diff --git a/.gitignore b/.gitignore index 0a980a0b0c1..2d7ce6410e8 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ Release/ *.suo *.vcproj *.vcxproj +!custom_actions.vcxproj *.vcxproj.user *.vcxproj.filters UpgradeLog*.XML diff --git a/.mailmap b/.mailmap index f5201458039..f3a15d1eca3 100644 --- a/.mailmap +++ b/.mailmap @@ -2,6 +2,8 @@ Aaron Heckmann Abe Fettig Alex Kocharin Alex Kocharin +Alexey Kupershtokh +Alexis Campailla Alexis Sellier Alexis Sellier Arlo Breault @@ -13,10 +15,12 @@ Bert Belder Bert Belder Bert Belder Brandon Benvie +Brandon Cheng Brian White Brian White Chew Choon Keat Christopher Lenz +Colin Ihrig Daniel Berger Daniel Chcouri <333222@gmail.com> Daniel Gröber @@ -25,6 +29,7 @@ Daniel Pihlström Dave Pacheco David Siegel Domenic Denicola +Doron Pagot Eduard Burtescu Einar Otto Stangvik Elliott Cable @@ -38,6 +43,7 @@ Friedemann Altrock Fuji Goro Gabriel de Perthuis Gil Pedersen +Guillaume Goussard Henry Chin Herbert Vojčík Igor Soarez @@ -46,6 +52,7 @@ Isaac Z. Schlueter Isaac Z. Schlueter Jake Verbaten Jered Schmidt +Jochen Eisinger Joe Shaw Johan Bergström Johan Dahlberg @@ -69,6 +76,7 @@ Micheil Smith Mikael Bourges-Sevenier Nebu Pookins Nicholas Kinsey +Nicholas Vavilov Onne Gorter Paul Querna Ray Morgan @@ -104,8 +112,10 @@ Trevor Burnham Tyler Larson Vincent Voyer Willi Eggeling +Yiyu He Yoshihiro KIKUCHI Yuichiro MASUI +Yunsong Guo Zachary Scott Zoran Tomicic @@ -120,3 +130,5 @@ Michael Starzinger Toon Verwaest Vyacheslav Egorov Yang Guo +Dan Carney +Sven Panne diff --git a/AUTHORS b/AUTHORS index 3dfbf5ae002..c9519e8c2f2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,582 +1,681 @@ -# Authors ordered by first contribution. - -Ryan Dahl -Urban Hafner -Joshaven Potter -Abe Fettig -Kevin van Zonneveld -Michael Carter -Jeff Smick -Jon Crosby -Felix Geisendörfer -Ray Morgan -Jérémy Lal -Isaac Z. Schlueter -Brandon Beacher -Tim Caswell -Connor Dunn -Johan Sørensen -Friedemann Altrock -Onne Gorter -Rhys Jones -Jan Lehnardt -Simon Willison -Chew Choon Keat -Jered Schmidt -Michaeljohn Clement -Karl Guertin -Xavier Shay -Christopher Lenz -TJ Holowaychuk -Johan Dahlberg -Simon Cornelius P. Umacob -Ryan McGrath -Rasmus Andersson -Micheil Smith -Jonas Pfenniger -David Sklar -Charles Lehner -Elliott Cable -Benjamin Thomas -San-Tai Hsu -Ben Williamson -Joseph Pecoraro -Erich Ocean -Alexis Sellier -Blaine Cook -Stanislav Opichal -Aaron Heckmann -Mikeal Rogers -Matt Brubeck -Michael Stillwell -Yuichiro MASUI -Mark Hansen -Zoran Tomicic -Jeremy Ashkenas -Scott González -James Duncan -Arlo Breault -Kris Kowal -Jacek Becela -Rob Ellis -Tim Smart -Herbert Vojčík -Krishna Rajendran -Nicholas Kinsey -Scott Taylor -Carson McDonald -Matt Ranney -James Herdman -Julian Lamb -Brian Hammond -Mathias Pettersson -Trevor Blackwell -Thomas Lee -Daniel Berger -Paulo Matias -Peter Griess -Jonathan Knezek -Jonathan Rentzsch -Ben Noordhuis -Elijah Insua -Andrew Johnston -Brian White -Aapo Laitinen -Sam Hughes -Orlando Vazquez -Raffaele Sena -Brian McKenna -Paul Querna -Ben Lowery -Peter Dekkers -David Siegel -Marshall Culpepper -Ruben Rodriguez -Dmitry Baranovskiy -Blake Mizerany -Jerome Etienne -Dmitriy Shalashov -Adam Wiggins -Rick Olson -Sergey Kryzhanovsky -Marco Rogers -Benjamin Fritsch -Jan Kassens -Robert Keizer -Sam Shull -Chandra Sekar S -Andrew Naylor -Benjamin Kramer -Danny Coates -Nick Stenning -Bert Belder -Trent Mick -Fedor Indutny -Illarionov Oleg -Aria Stewart -Johan Euphrosine -Russell Haering -Bradley Meck -Tobie Langel -Tony Metzidis -Mark Nottingham -Sam Stephenson -Jorge Chamorro Bieling -Evan Larkin -Sean Coates -Tom Hughes-Croucher -Joshua Peek -Nathan Rajlich -Peteris Krumins -AJ ONeal -Sami Samhuri -Nikhil Marathe -Vitali Lovich -Stéphan Kochen -Oleg Efimov -Guillaume Tuton -Tim Cooijmans -Dan Søndergaard -Silas Sewell -Wade Simmons -Daniel Gröber -Travis Swicegood -Oleg Slobodskoi -Jeremy Martin -Michael Wilber -Sean Braithwaite -Anders Conbere -Devin Torres -Theo Schlossnagle -Kai Chen -Daniel Chcouri <333222@gmail.com> -Mihai Călin Bazon -Ali Farhadi -Daniel Ennis -Carter Allen -Greg Hughes -David Trejo -Joe Walnes -Koichi Kobayashi -Konstantin Käfer -Richard Rodger -Andreas Reich -Tony Huang -Dean McNamee -Trevor Burnham -Zachary Scott -Arnout Kazemier -George Stagas -Ben Weaver -Scott McWhirter -Jakub Lekstan -Nick Campbell -Nebu Pookins -Tim Baumann -Robert Mustacchi -George Miroshnykov -Mark Cavage -Håvard Stranden -Marcel Laverdet -Alexandre Marangone -Ryan Petrello -Fuji Goro -Siddharth Mahendraker -Dave Pacheco -Mathias Buus -Henry Rawas -Yoshihiro KIKUCHI -Brett Kiefer -Mariano Iglesias -Jörn Horstmann -Joe Shaw -Niklas Fiekas -Adam Luikart -Artem Zaytsev -Alex Xu -Jeremy Selier -Igor Zinkovsky -Kip Gebhardt -Stefan Rusu -Shigeki Ohtsu -Wojciech Wnętrzak -Devon Govett -Steve Engledow -Pierre-Alexandre St-Jean -Reid Burke -Vicente Jimenez Aguilar -Tadashi SAWADA -Jeroen Janssen -Daniel Pihlström -Stefan Bühler -Alexander Uvarov -Aku Kotkavuo -Peter Bright -Logan Smyth -Christopher Wright -Glen Low -Thomas Shinnick -Mickaël Delahaye -Antranig Basman -Maciej Małecki -Evan Martin -Peter Lyons -Jann Horn -Abimanyu Raja -Niclas Hoyer -Karl Skomski -Michael Jackson -Ashok Mudukutore -Sean Cunningham -Vitor Balocco -Ben Leslie -Eric Lovett -Christian Tellnes -Colton Baker -Tyler Larson -Tomasz Janczuk -Ilya Dmitrichenko -Simen Brekken -Guglielmo Ferri <44gatti@gmail.com> -Thomas Parslow -Ryan Emery -Jordan Sissel -Matt Robenolt -Jacob H.C. Kragh -Benjamin Pasero -Scott Anderson -Yoji SHIDARA -Mathias Bynens -Łukasz Walukiewicz -Artur Adib -E. Azer Koçulu -Paddy Byers -Roman Shtylman -Kyle Robinson Young -Tim Oxley -Eduard Burtescu -Ingmar Runge -Russ Bradberry -Andreas Madsen -Adam Malcontenti-Wilson -Avi Flax -Pedro Teixeira -Johan Bergström -James Hartig -Shannen Saez -Seong-Rak Choi -Dave Irvine -Ju-yeong Park -Phil Sung -Damon Oehlman -Mikael Bourges-Sevenier -Emerson Macedo -Ryunosuke SATO -Michael Bernstein -Guillermo Rauch -Dan Williams -Brandon Benvie -Nicolas LaCasse -Dan VerWeire -Matthew Fitzsimmons -Philip Tellis -Christopher Jeffrey -Seth Fitzsimmons -Einar Otto Stangvik -Paul Vorbach -Luke Gallagher -Tomasz Buchert -Myles Byrne -T.C. Hollingsworth -Cam Pedersen -Roly Fentanes -Ted Young -Joshua Holbrook -Blake Miner -Vincent Ollivier -Jimb Esser -Sambasiva Suda -Sadique Ali -Dmitry Nizovtsev -Alex Kocharin -Ming Liu -Shea Levy -Nao Iizuka -Christian Ress -Rod Vagg -Matt Ezell -Charlie McConnell -Farid Neshat -Johannes Wüller -Erik Lundin -Bryan Cantrill -Yosef Dinerstein -Nathan Friedly -Aaron Jacobs -Mustansir Golawala -Atsuo Fukaya -Domenic Denicola -Joshua S. Weinstein -Dane Springmeyer -Erik Dubbelboer -Malte-Thorben Bruns -Michael Thomas -Garen Torikian -EungJun Yi -Vincent Voyer -Takahiro ANDO -Brian Schroeder -J. Lee Coltrane -Javier Hernández -James Koval -Kevin Gadd -Ray Solomon -Kevin Bowman -Erwin van der Koogh -Matt Gollob -Simon Sturmer -Joel Brandt -Marc Harter -Nuno Job -Ben Kelly -Felix Böhm -George Shank -Gabriel de Perthuis -Vladimir Beloborodov -Tim Macfarlane -Jonas Westerlund -Dominic Tarr -Justin Plock -Timothy J Fontaine -Toshihiro Nakamura -Ivan Torres -Philipp Hagemeister -Mike Morearty -Pavel Lang -Peter Rybin -Joe Andaverde -Eugen Dueck -Gil Pedersen -Tyler Neylon -Josh Erickson -Golo Roden -Ron Korving -Brandon Wilson -Ian Babrou -Bearice Ren -Ankur Oberoi -Atsuya Takagi -Pooya Karimian -Frédéric Germain -Robin Lee -Kazuyuki Yamada -Adam Blackburn -Willi Eggeling -Paul Serby -Andrew Paprocki -Ricky Ng-Adam -Aaditya Bhatia -Max Ogden -Igor Soarez -Olivier Lalonde -Francois Marier -Trevor Norris -Kai Sasaki Lewuathe -Nicolas Chambrier -Tim Bradshaw -Johannes Ewald -Chris Dent -Dan Milon -Brandon Philips -Frederico Silva -Jan Wynholds -Girish Ramakrishnan -Anthony Pesch -Stephen Gallagher -Sergey Kholodilov -Tim Kuijsten -Michael Axiak -Chad Rhyner -Ben Taber -Luke Arduini -Luke Bayes -Nirk Niggler -James Hight -Mike Harsch -Alexandr Emelin -James Campos -Dave Olszewski -Tim Price -Jake Verbaten -Jacob Gable -Rick Yakubowski -Dan Kohn -Andy Burke -Sugendran Ganess -Jim Schubert -Victor Costan -Arianit Uka -Andrei Sedoi -Eugene Girshov -Evan Oxfeld -Lars-Magnus Skog -Raymond Feng -Aaron Cannon -Xidorn Quan -Paolo Fragomeni -Scott Blomquist -Henry Chin -Julian Gruber -JeongHoon Byun -Iskren Ivov Chernev -Alexey Kupershtokh -Benjamin Ruston -Manav Rathi -Marcin Kostrzewa -Suwon Chae -David Braun -Mitar Milutinovic -Michael Hart -Jeff Barczewski -Andrew Hart -Rafael Garcia -Tobias Müllerleile -Stanislav Ochotnicky -Ryan Graham -Kelly Gerber -Ryan Doenges -Sean Silva -Miroslav Bajtoš -Olof Johansson -Sam Roberts -Kevin Locke -Daniel Moore -Robert Kowalski -Benoit Vallée -Ryuichi Okumura -Brandon Frohs -Nick Sullivan -Nathan Zadoks -Rafael Henrique Moreira -Daniel G. Taylor -Kiyoshi Nomo -Veres Lajos -Yuan Chuan -Krzysztof Chrapka -Linus Mårtensson -Peter Rust -Shuan Wang -Wyatt Preul -David Björklund -Dav Glass -Andrew Chilton -Antony Bailey -Forrest L Norvell -Evan Solomon -Eran Hammer -Daniel Chatfield -Eivind Uggedal -Edward Hutchins -Chris Wren -Duan Yao -Matthias Bartelmeß -James Halliday -Matthew Aynalem -Vsevolod Strukchinsky -Jay Beavers -Eric Schrock -Jeff Switzer -Glen Mailer -Jason Gerfen -Patrik Stutz -Zarko Stankovic -Maxim Bogushevich -Phillip Alexander -Thom Seddon -Nick Simmons -Jacob Groundwater -Jackson Tian -fengmk2 -Tim Wood -Linus Unnebäck -Nikolai Vavilov -Michael Ridgway -Yazhong Liu -Gabriel Falkenberg -Kai Groner -Steven Kabbes -Gabriel Farrell -Nicolas Kaiser -Ahamed Nafeez -Cam Swords -Paul Loyd -Benjamin Waters -Lev Gimelfarb -Peter Flannery -Tuğrul Topuz -Lorenz Leutgeb -Brandon Cheng -Alexis Campailla -Yang Tianyang -Tom Gallacher -Jo Liss -Jun Ma -Jacob Hoffman-Andrews -Keith M Wesolowski -Maxime Quandalle -Doron Pagot -Oguz Bastemur -Kenan Sulayman -Christian Schulz -Pedro Ballesteros -Anton Khlynovskiy -Nicolas Talle -Austin Moran -Mike Pennisi -Maxwell Krohn -Saúl Ibarra Corretgé -Greg Brail -Shuhei Kagawa -Yuriy Nemtsov -Josh Dague -Goh Yisheng (Andrew) -William Bert -James Pickard -Andrew Low -Nick Apperson -C. Scott Ananian -Yuki KAN -Evan Carroll -goussardg -Geir Hauge -Farrin Reid -Denys Zariaiev -Sean McArthur -Rasmus Christian Pedersen -Greg Sabia Tucker -Calvin Metcalf -cjihrig -Chris Barber -Nick Apperson -Oguz Bastemur -Maurice Butler -Chris Dickinson -Julien Gilli -Jakob Gillich -James Halliday -Kevin Simper -Jackson Tian -Tristan Berger -Mathias Schreck -Steven R. Loomis -Matthew Fitzsimmons -Swaagie -Emmanuel Odeke -Eric Mill -Brendan Ashworth -Alejandro Oviedo -pkcs -Saúl Ibarra Corretgé -silverwind -Steven R. Loomis -James M Snell +AJ ONeal +Aaditya Bhatia +Aapo Laitinen +Aaron Cannon +Aaron Heckmann +Aaron Jacobs +Abe Fettig +Abimanyu Raja +Adam Blackburn +Adam Lippai +Adam Luikart +Adam Malcontenti-Wilson +Adam Wiggins +Adrian Lang +Ahamed Nafeez +Aku Kotkavuo +Alejandro Oviedo +Alex Kocharin +Alex Xu +AlexKVal +Alexander Uvarov +Alexandr Emelin +Alexandre Marangone +Alexey Kupershtokh +Alexis Campailla +Alexis Sellier +Ali Farhadi +Amir Saboury +Anders Conbere +Andreas Madsen +Andreas Reich +Andrei Sedoi +Andrew Chilton +Andrew Hart +Andrew Johnston +Andrew Low +Andrew Naylor +Andrew Oppenlander +Andrew Paprocki +Andrew Teich +Andrius Bentkus +Andy Burke +Ankur Oberoi +Anthony Pesch +Anton Khlynovskiy +Antony Bailey +Antranig Basman +Aria Stewart +Arianit Uka +Arlo Breault +Arnout Kazemier +Artem Zaytsev +Artur Adib +Artur Cistov +Ashok Mudukutore +Atsuo Fukaya +Atsuya Takagi +Austin Moran +Avi Flax +Bearice Ren +Ben Burns +Ben Kelly +Ben Leslie +Ben Lowery +Ben Noordhuis +Ben Taber +Ben Weaver +Ben Williamson +Benjamin Fritsch +Benjamin Kramer +Benjamin Pasero +Benjamin Ruston +Benjamin Thomas +Benjamin Waters +Benoit Vallée +Bert Belder +Blaine Cook +Blake Miner +Blake Mizerany +Bradley Meck +Brandon Beacher +Brandon Benvie +Brandon Cheng +Brandon Frohs +Brandon Philips +Brandon Wilson +Brendan Ashworth +Brett Kiefer +Brian Hammond +Brian McKenna +Brian Schroeder +Brian White +Bruno Jouhier +Bryan Cantrill +C. Scott Ananian +CGavrila +Calvin Metcalf +Cam Pedersen +Cam Swords +Carlos Campderrós +Carson McDonald +Carter Allen +Chad Johnston +Chad Rhyner +Chandra Sekar S +Charles +Charles Lehner +Charlie McConnell +Cheng Zhao +Chew Choon Keat +Chris Barber +Chris Dent +Chris Dickinson +ChrisWren +Christian +Christian Ress +Christian Tellnes +Christopher Jeffrey +Christopher Lenz +Christopher Wright +Colin Ihrig +Colton Baker +Connor Dunn +Damon Oehlman +Dan Carney +Dan Dascalescu +Dan Kaplun +Dan Kohn +Dan Milon +Dan Søndergaard +Dan VerWeire +Dan Williams +Dane Springmeyer +Daniel Berger +Daniel Chatfield +Daniel Chcouri +Daniel Clifford +Daniel Ennis +Daniel G. Taylor +Daniel Gröber +Daniel Moore +Daniel Pihlström +Danny Coates +Dav Glass +Dave Irvine +Dave Olszewski +Dave Pacheco +David Björklund +David Braun +David Chan +David Siegel +David Sklar +David Trejo +Dean McNamee +Debjeet Biswas +Denys Zariaiev +Devin Torres +Devon Govett +Dmitri Melikyan +Dmitriy Shalashov +Dmitry Baranovskiy +Dmitry Nizovtsev +Domenic Denicola +Dominic Tarr +Doron Pagot +Duan Yao +E. Azer Koçulu +Ed Morley +Ed Umansky +Eduard Burtescu +Edward Hutchins +Einar Otto Stangvik +Eivind Uggedal +Eli Skeggs +Elijah Insua +Elliott Cable +Emerson Macedo +Emmanuel Odeke +Eran Hammer +Eric Lovett +Eric Mill +Eric Schrock +Erik Corry +Erik Dubbelboer +Erik Lundin +Erwin van der Koogh +Euan +Eugen Dueck +Eugene Girshov +EungJun Yi +Evan Carroll +Evan Larkin +Evan Lucas +Evan Martin +Evan Oxfeld +Evan Rutledge Borden +Evan Solomon +Ezequiel Rabinovich +Farid Neshat +Farrin Reid +Fedor Indutny +Felix Böhm +Felix Geisendörfer +Feross Aboukhadijeh +Florin-Cristian Gavrila +Forrest L Norvell +Francois Marier +Frank Cash +Fred K. Schott +Frederico Silva +Friedemann Altrock +Frédéric Germain +Fuji Goro +Gabriel Falkenberg +Gabriel Farrell +Gabriel Wicke +Gabriel de Perthuis +Garen Torikian +Geir Hauge +George Miroshnykov +George Shank +George Stagas +Gil Pedersen +Gireesh Punathil +Girish Ramakrishnan +Glen Low +Glen Mailer +Goh Yisheng (Andrew) +Golo Roden +Greg Brail +Greg Hughes +Greg Sabia Tucker +Guglielmo Ferri +Guilherme de Souza +Guillaume Goussard +Guillaume Tuton +Guillermo Rauch +Henry Chin +Henry Rawas +Herbert Vojčík +Herman Lee +Håvard Stranden +Ian Babrou +Igor Soarez +Igor Zinkovsky +Illarionov Oleg +Ilya Dmitrichenko +Ingmar Runge +Ionică Bizău +Isaac Burns +Isaac Z. Schlueter +Iskren Ivov Chernev +Ivan Torres +J. Lee Coltrane +Jacek Becela +Jackson Tian +Jacob Gable +Jacob Groundwater +Jacob H.C. Kragh +Jacob Hoffman-Andrews +Jake Verbaten +Jakob Gillich +Jakob Kummerow +Jakub Lekstan +James Campos +James Duncan +James Ferguson +James Halliday +James Hartig +James Herdman +James Hight +James Koval +James M Snell +James Pickard +Jan Kassens +Jan Krems +Jan Lehnardt +Jan Schär +Jan Wynholds +Jann Horn +Jason Gerfen +Javier Hernández +Jay Beavers +Jeff Barczewski +Jeff Smick +Jeff Switzer +JeongHoon Byun +Jered Schmidt +Jeremy Ashkenas +Jeremy Martin +Jeremy Selier +Jeroen Janssen +Jerome Etienne +Jesús Leganés Combarro "piranna +Jicheng Li +Jim Schubert +Jimb Esser +Jo Liss +Jochen Eisinger +Joe Andaverde +Joe Shaw +Joe Walnes +Joel Brandt +Johan Bergström +Johan Dahlberg +Johan Euphrosine +Johan Sørensen +Johannes Ewald +Johannes Wüller +John Albietz +Johnny Ray +Jon Crosby +Jonas Dohse +Jonas Pfenniger +Jonas Westerlund +Jonathan Johnson +Jonathan Knezek +Jonathan Reem +Jonathan Rentzsch +Jordan Sissel +Jorge Chamorro Bieling +Joseph Pecoraro +Josh Dague +Josh Erickson +Joshaven Potter +Joshua Holbrook +Joshua Peek +Joshua S. Weinstein +João Reis +Ju-yeong Park +Juanjo +Julian Gruber +Julian Lamb +Julien Fontanet +Julien Gilli +Jun Ma +Justin Plock +Jérémy Lal +Jörn Horstmann +Kai Chen +Kai Groner +Kai Sasaki Lewuathe +Kang-Hao Kenny +Karl Guertin +Karl Skomski +Kat Marchán +Kazuyuki Yamada +Keith M Wesolowski +Kelly Gerber +Kenan Sulayman +Kevin Bowman +Kevin Decker +Kevin Gadd +Kevin Locke +Kevin Millikin +Kevin Simper +Kevin van Zonneveld +Kip Gebhardt +Kiyoshi Nomo +Koichi Kobayashi +Konstantin Käfer +Kris Kowal +Krishna Rajendran +Krzysztof Chrapka +Kyle Robinson Young +Lalit Kapoor +Lars-Magnus Skog +Lasse R.H. Nielsen +Lev Gimelfarb +Linus Mårtensson +Linus Unnebäck +Logan Smyth +Lorenz Leutgeb +Lucio M. Tato +Luis Reis +Luke Arduini +Luke Bayes +Luke Gallagher +MK Safi +Maciej Małecki +Majid Arif Siddiqui +Malte-Thorben Bruns +Manav Rathi +Marc Harter +Marcel Laverdet +Marcin Kostrzewa +Marco Rogers +Mariano Iglesias +Mark Cavage +Mark Hansen +Mark Nottingham +Mark Stosberg +Marshall Culpepper +Mathias Buus +Mathias Bynens +Mathias Küsel +Mathias Pettersson +Mathias Schreck +Matt Brubeck +Matt Ezell +Matt Gollob +Matt Ranney +Matt Robenolt +Matthew Aynalem +Matthew Fitzsimmons +Matthias Bartelmeß +Maurice Butler +Max Ogden +Maxim Bogushevich +Maxime Quandalle +Maxwell Krohn +Michael Axiak +Michael Bernstein +Michael Carter +Michael Dawson +Michael Hart +Michael Jackson +Michael Kebe +Michael Ridgway +Michael Starzinger +Michael Stillwell +Michael Thomas +Michael Wilber +Michaeljohn Clement +Micheil Smith +Mickael van der Beek +Mickaël Delahaye +Mihai Călin Bazon +Mikael Bourges-Sevenier +Mike Harsch +Mike Morearty +Mike Pennisi +Mike Tunnicliffe +Mikeal Rogers +Ming Liu +Miroslav Bajtos +Miroslav Bajtoš +Mitar +Mustansir Golawala +Myles Byrne +Nao Iizuka +Nathan Friedly +Nathan Rajlich +Nathan Woltman +Nathan Zadoks +Nebu Pookins +Nicholas Kinsey +Nicholas Vavilov +Nick Apperson +Nick Campbell +Nick Desaulniers +Nick Muerdter +Nick Simmons +Nick Stenning +Nick Sullivan +Niclas Hoyer +Nicolas Chambrier +Nicolas Kaiser +Nicolas LaCasse +Nicolas Talle +Nikhil Marathe +Niklas Fiekas +Nirk Niggler +Nuno Job +Oguz Bastemur +Ole André Vadla Ravnås +Oleg Efimov +Oleg Slobodskoi +Olivier Lalonde +Olof Johansson +Onne Gorter +Orlando Vazquez +Paddy Byers +Paolo Fragomeni +Patrick Mooney +Patrik Stutz +Paul Loyd +Paul Querna +Paul Serby +Paul Vorbach +Paulo Matias +Paulo McNally +Pavel Lang +Pedro Ballesteros +Pedro Teixeira +Peter Bright +Peter Dekkers +Peter Griess +Peter Lyons +Peter Rust +Peter Rybin +Peteris Krumins +Phil Sung +Philip Tellis +Philipp Hagemeister +Phillip Alexander +Pierre-Alexandre St-Jean +Pooya Karimian +Rafael Garcia +Rafael Henrique Moreira +Raffaele Sena +Rasmus Andersson +Rasmus Christian Pedersen +Ray Morgan +Ray Solomon +Raymond Feng +Rebecca Turner +Refael Ackermann +Reid Burke +Rhys Jones +Richard Rodger +Rick Olson +Rick Yakubowski +Ricky Ng-Adam +Rob Ellis +Robert Keizer +Robert Kowalski +Robert Mustacchi +Robin Lee +Rod Vagg +Rohini Harendra +Roly Fentanes +Roman Klauke +Roman Shtylman +Ron Korving +Rory Bradford +Ruben Rodriguez +Russ Bradberry +Russell Haering +Ryan Cole +Ryan Dahl +Ryan Doenges +Ryan Emery +Ryan Graham +Ryan McGrath +Ryan Petrello +Ryuichi Okumura +Ryunosuke SATO +Sadique Ali +Sam Hughes +Sam Roberts +Sam Shull +Sam Stephenson +Sambasiva Suda +Sami Samhuri +San-Tai Hsu +Saúl Ibarra Corretgé +Scott Anderson +Scott Blomquist +Scott González +Scott McWhirter +Scott Taylor +Sean Braithwaite +Sean Coates +Sean Cunningham +Sean McArthur +Sean Silva +Seong-Rak Choi +Sergey Kholodilov +Sergey Kryzhanovsky +Seth Fitzsimmons +Shannen Saez +Shea Levy +Shigeki Ohtsu +Shuan Wang +Shuhei Kagawa +Siddharth Mahendraker +Silas Sewell +Simen Brekken +Simon Cornelius P. Umacob +Simon Sturmer +Simon Willison +Stanislav Ochotnicky +Stanislav Opichal +Stefan Bühler +Stefan Rusu +Stephen Gallagher +Steve Engledow +Steve Mao +Steve Sharp +Steven Kabbes +Steven Loomis +Steven R. Loomis +Steven Rockarts +Stiliyan Lazarov +Stéphan Kochen +Sugendran Ganess +Suwon Chae +Sven Panne +Swaagie +T.C. Hollingsworth +TJ Holowaychuk +Tadashi SAWADA +Takahiro ANDO +Taojie +Ted Young +Theo Schlossnagle +Thom Seddon +Thomas Lee +Thomas Parslow +Thomas Shinnick +Thorsten Lorenz +Tim Baumann +Tim Bradshaw +Tim Caswell +Tim Cooijmans +Tim Kuijsten +Tim Macfarlane +Tim Oxley +Tim Price +Tim Smart +Tim Wood +Timothy J Fontaine +Tobias Müllerleile +Tobie Langel +Tom Gallacher +Tom Hughes-Croucher +Tomasz Buchert +Tomasz Janczuk +Tony Huang +Tony Metzidis +Toon Verwaest +Toshihiro Nakamura +Travis Swicegood +Trent Mick +Trevor Burnham +Trevor Livingston +Trevor Norris +Tristan Berger +Tuğrul Topuz +Tyler Anton +Tyler Larson +Tyler Neylon +Urban Hafner +Veres Lajos +Vicente Jimenez Aguilar +Victor Costan +Victor Widell +Vincent Ollivier +Vincent Voyer +Vitali Lovich +Vitor Balocco +Vladimir Beloborodov +Vladimir Kurchatkin +Vsevolod Strukchinsky +Vyacheslav Egorov +Wade Simmons +Wang Xinyong +Willi Eggeling +William Bert +Wojciech Wnętrzak +Wyatt Preul +Xavi Magrinyà +Xavier Shay +Xidorn Quan +Yang Guo +Yazhong Liu +Yiyu He +Yoji SHIDARA +Yorkie +Yosef Dinerstein +Yoshihiro KIKUCHI +Yuan Chuan +Yuichiro MASUI +Yuki KAN +Yunsong Guo +Yuriy Nemtsov +Yury Semikhatsky +Zachary Scott +Zarko Stankovic +Zoran Tomicic +adamk +ayanamist +fengmk2 +h7lin +haoxin +pflannery +pkcs +silverwind +sudodoki +Łukasz Walukiewicz diff --git a/ChangeLog b/ChangeLog index 7bbacd0e9df..53e478dc5e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,284 @@ -2014.09.24, Version 0.11.14 (Unstable) +2015.07.09, Version 0.12.7 (Stable) + +* openssl: upgrade to 1.0.1p + +* npm: upgrade to 2.11.3 + +* V8: cherry-pick JitCodeEvent patch from upstream (Ben Noordhuis) + +* win,msi: create npm folder in AppData directory (Steven Rockarts) + + +2015.07.03, Version 0.12.6 (Stable), 0be9a77bb18ec15b4fb6a1fb0762f313b7351201 + +* V8: fix out-of-band write in utf8 decoder + + +2015.06.22, Version 0.12.5 (Stable), 61c6abf00898fe00eb7fcf2c23ba0b01cf12034c + +* openssl: upgrade to 1.0.1o (Addressing multiple CVEs) + +* npm: upgrade to 2.11.2 + +* uv: upgrade to 1.6.1 + +* V8: avoid deadlock when profiling is active (Dmitri Melikyan) + +* install: fix source path for openssl headers (Oguz Bastemur) + +* install: make sure opensslconf.h is overwritten (Oguz Bastemur) + +* timers: fix timeout when added in timer's callback (Julien Gilli) + +* windows: broadcast WM_SETTINGCHANGE after install (Mathias Küsel) + + +2015.05.22, Version 0.12.4 (Stable), 0a604e92e258c5ee2752d763e50721e35053f135 + +* npm: upgrade to 2.10.1 + +* V8: revert v8 Array.prototype.values() removal (cjihrig) + +* win: bring back xp/2k3 support (Bert Belder) + + +2015.05.13, Version 0.12.3 (Stable), 03431c7d7b4b4a3054ca8ae2cfa8009e3e84a2c7 + +* V8: update to 3.28.71.19 + +* uv: upgrade to 1.5.0 + +* npm: upgrade to 2.9.1 + +* V8: don't busy loop in v8 cpu profiler thread (Mike Tunnicliffe) + +* V8: fix issue with let bindings in for loops (adamk) + +* debugger: don't spawn child process in remote mode (Jackson Tian) + +* net: do not set V4MAPPED on FreeBSD (Julien Gilli) + +* repl: make 'Unexpected token' errors recoverable (Julien Gilli) + +* src: backport ignore ENOTCONN on shutdown race (Ben Noordhuis) + +* src: fix backport of SIGINT crash fix on FreeBSD (Julien Gilli) + + +2015.03.31, Version 0.12.2 (Stable), 523d445705027438b83b8d5958c9beeb1c8711d9 + +* uv: Upgrade to 1.4.2 + +* npm: Upgrade to 2.7.4 + +* V8: do not add extra newline in log file (Julien Gilli) + +* V8: Fix --max_old_space_size=4096 integer overflow (Andrei Sedoi) + +* asyncwrap: fix constructor condition for early ret (Trevor Norris) + +* buffer: align chunks on 8-byte boundary (Fedor Indutny) + +* buffer: fix pool offset adjustment (Trevor Norris) + +* build: fix use of strict aliasing (Trevor Norris) + +* console: allow Object.prototype fields as labels (Colin Ihrig) + +* fs: make F_OK/R_OK/W_OK/X_OK not writable (Jackson Tian) + +* fs: properly handle fd passed to truncate() (Bruno Jouhier) + +* http: fix assert on data/end after socket error (Fedor Indutny) + +* lib: fix max size check in Buffer constructor (Ben Noordhuis) + +* lib: fix stdio/ipc sync i/o regression (Ben Noordhuis) + +* module: replace NativeModule.require (Herbert Vojčík) + +* net: allow port 0 in connect() (cjihrig) + +* net: unref timer in parent sockets (Fedor Indutny) + +* path: refactor for performance and consistency (Nathan Woltman) + +* smalloc: extend user API (Trevor Norris) + +* src: fix for SIGINT crash on FreeBSD (Fedor Indutny) + +* src: fix builtin modules failing with --use-strict (Julien Gilli) + +* watchdog: fix timeout for early polling return (Saúl Ibarra Corretgé) + + +2015.03.23, Version 0.12.1 (Stable), 0034086b49f22cfde765a7e9f55db25f8eb310b6 + +* openssl: upgrade to 1.0.1m (Addressing multiple CVES) + + +2015.02.06, Version 0.12.0 (Stable), 2b18916ff054309a07408719b62e2b6a4f1e056a + +* npm: Upgrade to 2.5.1 + +* mdb_v8: update for v0.12 (Dave Pacheco) + + +2015.01.29, Version 0.11.16 (Unstable), 8e42e5a0731040075e14cec087eea86729f2dc53 + +* openssl: Upgrade to 1.0.1l + +* npm: Upgrade to 2.3.0 + +* url: revert support of `path` for url.format" (Julien Gilli) + +* assert: use util.inspect() to create error messages (cjihrig) + +* net: throw on invalid socket timeouts (cjihrig) + +* url: fix parsing of ssh urls (Evan Lucas) + + +2015.01.20, Version 0.11.15 (Unstable), 8a9f263a82089814e69f277f9fecd2888705101b + +* v8: Upgrade to 3.28.73 + +* uv: Upgrade to 1.0.2 + +* npm: Upgrade to v2.1.6 + +* uv: float patch to revert tty breakage (Trevor Norris) + +* v8: re-implement debugger-agent (Fedor Indutny) + +* v8: apply floating irhydra patch (Fedor Indutny) + +* v8: fix postmortem-metadata generator (Refael Ackermann) + +* debugger: fix unhandled error in setBreakpoint (Miroslav Bajtoš) + +* async-wrap: add event hooks (Trevor Norris) + +* async-wrap: expose async-wrap as binding (Trevor Norris) + +* buffer, doc: misc. fix and cleanup (Trevor Norris) + +* buffer: add generic functions for (u)int ops (Yazhong Liu) + +* buffer: fix and cleanup fill() (Trevor Norris) + +* buffer: mv floating point read/write checks to JS (Trevor Norris) + +* build, i18n: improve Intl build, add "--with-intl" (Steven R. Loomis) + +* build: add small-icu support for binary packages (Julien Gilli) + +* build: do not generate support for libuv's probes (Julien Gilli) + +* build: i18n: add icu config options (Steven R. Loomis) + +* build: i18n: support little-endian machines (Steven Loomis) + +* build: vcbuild fix "The input line is too long." (Alexis Campailla) + +* child_process: improve spawn() argument handling (cjihrig) + +* cluster: avoid race enabling debugger in worker (Timothy J Fontaine) + +* cluster: cluster.disconnect() should check status (Sam Roberts) + +* cluster: do not signal children in debug mode (Fedor Indutny) + +* cluster: don't assert if worker has no handles (Sam Roberts) + +* core: fix usage of uv_cwd (Saúl Ibarra Corretgé) + +* core: replace uv_fs_readdir with uv_fs_scandir (Saúl Ibarra Corretgé) + +* crypto: createDiffieHellman throw for bad args (Trevor Norris) + +* crypto: lower RSS usage for TLSCallbacks (Fedor Indutny) + +* crypto: store thread id as pointer-sized (Alexis Campailla) + +* dns: propagate domain for c-ares methods (Chris Dickinson) + +* fs: fix symlink error message (Vladimir Kurchatkin) + +* http: Improve _addHeaderLines method (Jackson Tian) + +* http: cleanup setHeader() (Trevor Norris) + +* http: rename flush to flushHeaders (Timothy J Fontaine) + +* lib,src: fix spawnSync ignoring its 'env' option (Juanjo) + +* modules: adding load linked modules feature (Thorsten Lorenz) + +* net: Make server.connections un-enumerable (Patrick Mooney) + +* net: add pauseOnConnect option to createServer() (cjihrig) + +* net: make connect() input validation synchronous (cjihrig) + +* node: avoid automatic microtask runs (Vladimir Kurchatkin) + +* node: fix throws before timer module is loaded (Trevor Norris) + +* openssl: fix keypress requirement in apps on win32 (Fedor Indutny) + +* path: added parse() and format() functions (Rory Bradford) + +* path: allow calling platform specific methods (Timothy J Fontaine) + +* path: don't lower-cases drive letters (Bert Belder) + +* path: refactor normalizeArray() (Nathan Woltman) + +* process: pid can be a string in process.kill() (Sam Roberts) + +* readline: fix performance issue when large line (Jicheng Li) + +* readline: should not require an output stream. (Julien Gilli) + +* smalloc: check if obj has external data (Vladimir Kurchatkin) + +* smalloc: don't allow to dispose typed arrays (Vladimir Kurchatkin) + +* smalloc: fix bad assert for zero length data (Trevor Norris) + +* smalloc: fix copyOnto optimization (Vladimir Kurchatkin) + +* src: all wrap's now use actual FunctionTemplate (Trevor Norris) + +* src: fix VC++ warning C4244 (Rasmus Christian Pedersen) + +* src: remove Async Listener (Trevor Norris) + +* stream: switch _writableState.buffer to queue (Chris Dickinson) + +* streams: make setDefaultEncoding() throw (Brian White) + +* streams: set default encoding for writable streams (Johnny Ray) + +* tls: remove tls.createSecurePair code deprecation (Jackson Tian) + +* tls_wrap: ignore ZERO_RETURN after close_notify (Fedor Indutny) + +* url: change hostname regex to negate invalid chars (Jonathan Johnson) + +* url: fixed encoding for slash switching emulation. (Evan Rutledge Borden) + +* url: improve parsing speed (CGavrila) + +* url: make query() consistent (Gabriel Wicke) + +* url: support `path` for url.format (Yazhong Liu) + +* util: add es6 Symbol support for `util.inspect` (gyson) + + +2014.09.24, Version 0.11.14 (Unstable), 902090af5375e497dded310575f19de5328a9bbc * uv: Upgrade to v1.0.0-rc1 @@ -787,7 +1067,58 @@ * console: `console.dir()` bypasses inspect() methods (Nathan Rajlich) -2014.12.22, Version 0.10.35 (Stable) +2015.07.09, Version 0.10.40 (Maintenance), 0439a28d519fb6efe228074b0588a59452fc1677 + +* openssl: upgrade to 1.0.1p + +* V8: back-port JitCodeEvent patch from upstream (Ben Noordhuis) + +* win,msi: create npm folder in AppData directory (Steven Rockarts) + + +2015.06.18, Version 0.10.39 (Maintenance), 615a35ccd2cb5cba80901862aefe51a940995f44 + +* openssl: upgrade to 1.0.1o (Addressing multiple CVEs) + +* install: fix source path for openssl headers (Oguz Bastemur) + +* install: make sure opensslconf.h is overwritten (Oguz Bastemur) + +* timers: fix timeout when added in timer's callback (Julien Gilli) + +* windows: broadcast WM_SETTINGCHANGE after install (Mathias Küsel) + + +2015.03.23, Version 0.10.38 (Maintenance), 0b5731a63cc40c4fe9275c79158fe0a5dd4d1609 + +* openssl: upgrade to 1.0.1m (Addressing multiple CVEs) + + +2015.03.11, Version 0.10.37 (Maintenance), 7d6b5b1d5ba726331f9ccaaae59af7cd53eee82e + +* uv: update to 0.10.36 (CVE-2015-0278) + +* domains: fix stack clearing after error handled (Jonas Dohse) + +* buffer: reword Buffer.concat error message (Chris Dickinson) + +* console: allow Object.prototype fields as labels (Julien Gilli) + +* V8: log version in profiler log file (Ben Noordhuis) + +* http: fix performance regression for GET requests (Florin-Cristian Gavrila) + + +2015.01.26, Version 0.10.36 (Stable), 09b482886bdd3d863c3d4e7d71264eac0daaf9e1 + +* openssl: update to 1.0.1l + +* v8: Fix debugger and strict mode regression (Julien Gilli) + +* v8: don't busy loop in cpu profiler thread (Ben Noordhuis) + + +2014.12.22, Version 0.10.35 (Stable), a363f61ca839e817eb6853c5dc5af8c3b9b9226b * tls: re-add 1024-bit SSL certs removed by f9456a2 (Chris Dickinson) @@ -2471,7 +2802,7 @@ - Support for parallel use of the cache folder - Retry on registry timeouts or network failures (Trent Mick) - Reduce 'engines' failures to a warning - - Use new zsh completion if aviailable (Jeremy Cantrell) + - Use new zsh completion if available (Jeremy Cantrell) * Fix #3577 Un-break require('sys') diff --git a/LICENSE b/LICENSE index b793e8c94fa..5d37e1cf94f 100644 --- a/LICENSE +++ b/LICENSE @@ -781,3 +781,388 @@ maintained libraries. The externally maintained libraries used by Node are: END OF TERMS AND CONDITIONS """ + +- ICU's license follows: + From http://source.icu-project.org/repos/icu/icu/trunk/license.html + """ + ICU License - ICU 1.8.1 and later + + COPYRIGHT AND PERMISSION NOTICE + + Copyright (c) 1995-2014 International Business Machines Corporation and others + + 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, and/or sell copies of the + Software, and to permit persons to whom the Software is furnished + to do so, provided that the above copyright notice(s) and this + permission notice appear in all copies of the Software and that + both the above copyright notice(s) and this permission notice + appear in supporting documentation. + + 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 OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE + COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR + ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + + Except as contained in this notice, the name of a copyright holder + shall not be used in advertising or otherwise to promote the sale, + use or other dealings in this Software without prior written + authorization of the copyright holder. + + All trademarks and registered trademarks mentioned herein are the + property of their respective owners. + + Third-Party Software Licenses + + This section contains third-party software notices and/or + additional terms for licensed third-party software components + included within ICU libraries. + + 1. Unicode Data Files and Software + COPYRIGHT AND PERMISSION NOTICE + + Copyright © 1991-2014 Unicode, Inc. All rights reserved. + Distributed under the Terms of Use in + http://www.unicode.org/copyright.html. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of the Unicode data files and any associated documentation + (the "Data Files") or Unicode software and any associated documentation + (the "Software") to deal in the Data Files or Software + without restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, and/or sell copies of + the Data Files or Software, and to permit persons to whom the Data Files + or Software are furnished to do so, provided that + (a) this copyright and permission notice appear with all copies + of the Data Files or Software, + (b) this copyright and permission notice appear in associated + documentation, and + (c) there is clear notice in each modified Data File or in the Software + as well as in the documentation associated with the Data File(s) or + Software that the data or software has been modified. + + THE DATA FILES AND SOFTWARE ARE 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 OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS + NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL + DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THE DATA FILES OR SOFTWARE. + + Except as contained in this notice, the name of a copyright holder + shall not be used in advertising or otherwise to promote the sale, + use or other dealings in these Data Files or Software without prior + written authorization of the copyright holder. + + 2. Chinese/Japanese Word Break Dictionary Data (cjdict.txt) + # The Google Chrome software developed by Google is licensed + # under the BSD license. Other software included in this distribution + # is provided under other licenses, as set forth below. + # + # The BSD License + # http://opensource.org/licenses/bsd-license.php + # Copyright (C) 2006-2008, Google Inc. + # + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or + # without modification, are permitted provided that the following + # conditions are met: + # + # Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + # Redistributions in binary form must reproduce the above + # copyright notice, this list of conditions and the following + # disclaimer in the documentation and/or other materials provided with + # the distribution. + # Neither the name of Google Inc. nor the names of its + # contributors may be used to endorse or promote products derived from + # this software without specific prior written permission. + # + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + # + # + # The word list in cjdict.txt are generated by combining three + word lists listed + # below with further processing for compound word breaking. The + frequency is generated + # with an iterative training against Google web corpora. + # + # * Libtabe (Chinese) + # - https://sourceforge.net/project/?group_id=1519 + # - Its license terms and conditions are shown below. + # + # * IPADIC (Japanese) + # - http://chasen.aist-nara.ac.jp/chasen/distribution.html + # - Its license terms and conditions are shown below. + # + # ---------COPYING.libtabe ---- BEGIN-------------------- + # + # /* + # * Copyrighy (c) 1999 TaBE Project. + # * Copyright (c) 1999 Pai-Hsiang Hsiao. + # * All rights reserved. + # * + # * Redistribution and use in source and binary forms, with or without + # * modification, are permitted provided that the following conditions + # * are met: + # * + # * . Redistributions of source code must retain the above copyright + # * notice, this list of conditions and the following disclaimer. + # * . Redistributions in binary form must reproduce the above copyright + # * notice, this list of conditions and the following disclaimer in + # * the documentation and/or other materials provided with the + # * distribution. + # * . Neither the name of the TaBE Project nor the names of its + # * contributors may be used to endorse or promote products derived + # * from this software without specific prior written permission. + # * + # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # * OF THE POSSIBILITY OF SUCH DAMAGE. + # */ + # + # /* + # * Copyright (c) 1999 Computer Systems and Communication Lab, + # * Institute of Information Science, Academia Sinica. + # * All rights reserved. + # * + # * Redistribution and use in source and binary forms, with or without + # * modification, are permitted provided that the following conditions + # * are met: + # * + # * . Redistributions of source code must retain the above copyright + # * notice, this list of conditions and the following disclaimer. + # * . Redistributions in binary form must reproduce the above copyright + # * notice, this list of conditions and the following disclaimer in + # * the documentation and/or other materials provided with the + # * distribution. + # * . Neither the name of the Computer Systems and Communication Lab + # * nor the names of its contributors may be used to endorse or + # * promote products derived from this software without specific + # * prior written permission. + # * + # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # * OF THE POSSIBILITY OF SUCH DAMAGE. + # */ + # + # Copyright 1996 Chih-Hao Tsai @ Beckman Institute, University of Illinois + # c-tsai4@uiuc.edu http://casper.beckman.uiuc.edu/~c-tsai4 + # + # ---------------COPYING.libtabe-----END------------------------------------ + # + # + # ---------------COPYING.ipadic-----BEGIN------------------------------------ + # + # Copyright 2000, 2001, 2002, 2003 Nara Institute of Science + # and Technology. All Rights Reserved. + # + # Use, reproduction, and distribution of this software is permitted. + # Any copy of this software, whether in its original form or modified, + # must include both the above copyright notice and the following + # paragraphs. + # + # Nara Institute of Science and Technology (NAIST), + # the copyright holders, disclaims all warranties with regard to this + # software, including all implied warranties of merchantability and + # fitness, in no event shall NAIST be liable for + # any special, indirect or consequential damages or any damages + # whatsoever resulting from loss of use, data or profits, whether in an + # action of contract, negligence or other tortuous action, arising out + # of or in connection with the use or performance of this software. + # + # A large portion of the dictionary entries + # originate from ICOT Free Software. The following conditions for ICOT + # Free Software applies to the current dictionary as well. + # + # Each User may also freely distribute the Program, whether in its + # original form or modified, to any third party or parties, PROVIDED + # that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear + # on, or be attached to, the Program, which is distributed substantially + # in the same form as set out herein and that such intended + # distribution, if actually made, will neither violate or otherwise + # contravene any of the laws and regulations of the countries having + # jurisdiction over the User or the intended distribution itself. + # + # NO WARRANTY + # + # The program was produced on an experimental basis in the course of the + # research and development conducted during the project and is provided + # to users as so produced on an experimental basis. Accordingly, the + # program is provided without any warranty whatsoever, whether express, + # implied, statutory or otherwise. The term "warranty" used herein + # includes, but is not limited to, any warranty of the quality, + # performance, merchantability and fitness for a particular purpose of + # the program and the nonexistence of any infringement or violation of + # any right of any third party. + # + # Each user of the program will agree and understand, and be deemed to + # have agreed and understood, that there is no warranty whatsoever for + # the program and, accordingly, the entire risk arising from or + # otherwise connected with the program is assumed by the user. + # + # Therefore, neither ICOT, the copyright holder, or any other + # organization that participated in or was otherwise related to the + # development of the program and their respective officials, directors, + # officers and other employees shall be held liable for any and all + # damages, including, without limitation, general, special, incidental + # and consequential damages, arising out of or otherwise in connection + # with the use or inability to use the program or any product, material + # or result produced or otherwise obtained by using the program, + # regardless of whether they have been advised of, or otherwise had + # knowledge of, the possibility of such damages at any time during the + # project or thereafter. Each user will be deemed to have agreed to the + # foregoing by his or her commencement of use of the program. The term + # "use" as used herein includes, but is not limited to, the use, + # modification, copying and distribution of the program and the + # production of secondary products from the program. + # + # In the case where the program, whether in its original form or + # modified, was distributed or delivered to or received by a user from + # any person, organization or entity other than ICOT, unless it makes or + # grants independently of ICOT any specific warranty to the user in + # writing, such person, organization or entity, will also be exempted + # from and not be held liable to the user for any such damages as noted + # above as far as the program is concerned. + # + # ---------------COPYING.ipadic-----END------------------------------------ + +3. Lao Word Break Dictionary Data (laodict.txt) + # Copyright (c) 2013 International Business Machines Corporation + # and others. All Rights Reserved. + # + # Project: http://code.google.com/p/lao-dictionary/ + # Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt + # License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt + # (copied below) + # + # This file is derived from the above dictionary, with slight modifications. + # -------------------------------------------------------------------------------- + # Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell. + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without modification, + # are permitted provided that the following conditions are met: + # + # Redistributions of source code must retain the above copyright notice, this + # list of conditions and the following disclaimer. Redistributions in binary + # form must reproduce the above copyright notice, this list of conditions and + # the following disclaimer in the documentation and/or other materials + # provided with the distribution. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + # -------------------------------------------------------------------------------- + + 4. Burmese Word Break Dictionary Data (burmesedict.txt) + # Copyright (c) 2014 International Business Machines Corporation + # and others. All Rights Reserved. + # + # This list is part of a project hosted at: + # github.com/kanyawtech/myanmar-karen-word-lists + # + # -------------------------------------------------------------------------------- + # Copyright (c) 2013, LeRoy Benjamin Sharon + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without modification, + # are permitted provided that the following conditions are met: + # + # Redistributions of source code must retain the above copyright notice, this + # list of conditions and the following disclaimer. + # + # Redistributions in binary form must reproduce the above copyright notice, this + # list of conditions and the following disclaimer in the documentation and/or + # other materials provided with the distribution. + # + # Neither the name Myanmar Karen Word Lists, nor the names of its + # contributors may be used to endorse or promote products derived from + # this software without specific prior written permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + # -------------------------------------------------------------------------------- + + 5. Time Zone Database + ICU uses the public domain data and code derived from Time Zone + Database for its time zone support. The ownership of the TZ + database is explained in BCP 175: Procedure for Maintaining the + Time Zone Database section 7. + + 7. Database Ownership + + The TZ database itself is not an IETF Contribution or an IETF + document. Rather it is a pre-existing and regularly updated work + that is in the public domain, and is intended to remain in the public + domain. Therefore, BCPs 78 [RFC5378] and 79 [RFC3979] do not apply + to the TZ Database or contributions that individuals make to it. + Should any claims be made and substantiated against the TZ Database, + the organization that is providing the IANA Considerations defined in + this RFC, under the memorandum of understanding with the IETF, + currently ICANN, may act in accordance with all competent court + orders. No ownership claims will be made by ICANN or the IETF Trust + on the database or the code. Any person making a contribution to the + database or code waives all rights to future claims in that + contribution or in the TZ Database. + """ diff --git a/Makefile b/Makefile index 6c148eb2cda..b3685e1479d 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ NINJA ?= ninja DESTDIR ?= SIGN ?= PREFIX ?= /usr/local +FLAKY_TESTS ?= run NODE ?= ./node @@ -127,6 +128,9 @@ test-all-http1: test-build test-all-valgrind: test-build $(PYTHON) tools/test.py --mode=debug,release --valgrind +test-ci: + $(PYTHON) tools/test.py -p tap --logfile test.tap --mode=release --arch=$(DESTCPU) --flaky-tests=$(FLAKY_TESTS) simple message internet + test-release: test-build $(PYTHON) tools/test.py --mode=release @@ -154,12 +158,13 @@ test-npm: node cd deps/npm ; npm_config_cache="$(shell pwd)/npm-cache" \ npm_config_prefix="$(shell pwd)/npm-prefix" \ npm_config_tmp="$(shell pwd)/npm-tmp" \ - ../../node cli.js install + PATH="../../:${PATH}" node cli.js install cd deps/npm ; npm_config_cache="$(shell pwd)/npm-cache" \ npm_config_prefix="$(shell pwd)/npm-prefix" \ npm_config_tmp="$(shell pwd)/npm-tmp" \ - ../../node cli.js run-script test-all && \ - ../../node cli.js prune --prod && \ + PATH="../../:${PATH}" node cli.js run-script test-legacy && \ + PATH="../../:${PATH}" node cli.js run-script test && \ + PATH="../../:${PATH}" node cli.js prune --prod && \ cd ../.. && \ rm -rf npm-cache npm-tmp npm-prefix @@ -239,6 +244,11 @@ docopen: out/doc/api/all.html docclean: -rm -rf out/doc +run-ci: + $(PYTHON) ./configure --without-snapshot $(CONFIG_FLAGS) + $(MAKE) + $(MAKE) test-ci + RAWVER=$(shell $(PYTHON) tools/getnodeversion.py) VERSION=v$(RAWVER) NODE_DOC_VERSION=$(VERSION) @@ -425,8 +435,6 @@ jslint: PYTHONPATH=tools/closure_linter/ $(PYTHON) tools/closure_linter/closure_linter/gjslint.py --unix_mode --strict --nojsdoc -r lib/ -r src/ --exclude_files lib/punycode.js CPPLINT_EXCLUDE ?= -CPPLINT_EXCLUDE += src/node_dtrace.cc -CPPLINT_EXCLUDE += src/node_dtrace.cc CPPLINT_EXCLUDE += src/node_root_certs.h CPPLINT_EXCLUDE += src/node_win32_perfctr_provider.cc CPPLINT_EXCLUDE += src/queue.h @@ -440,4 +448,9 @@ cpplint: lint: jslint cpplint -.PHONY: lint cpplint jslint bench clean docopen docclean doc dist distclean check uninstall install install-includes install-bin all staticlib dynamiclib test test-all test-addons build-addons website-upload pkg blog blogclean tar binary release-only bench-http-simple bench-idle bench-all bench bench-misc bench-array bench-buffer bench-net bench-http bench-fs bench-tls +.PHONY: lint cpplint jslint bench clean docopen docclean doc dist distclean \ + check uninstall install install-includes install-bin all staticlib \ + dynamiclib test test-all test-addons build-addons website-upload pkg \ + blog blogclean tar binary release-only bench-http-simple bench-idle \ + bench-all bench bench-misc bench-array bench-buffer bench-net \ + bench-http bench-fs bench-tls run-ci diff --git a/README-pre-convergence.md b/README-pre-convergence.md new file mode 100644 index 00000000000..61f3e519220 --- /dev/null +++ b/README-pre-convergence.md @@ -0,0 +1,200 @@ +Evented I/O for V8 javascript. +=== + +### To build: + +Prerequisites (Unix only): + + * GCC 4.2 or newer + * G++ 4.2 or newer + * Python 2.6 or 2.7 + * GNU Make 3.81 or newer + * libexecinfo (FreeBSD and OpenBSD only) + +Unix/Macintosh: + +```sh +./configure +make +make install +``` + +If your python binary is in a non-standard location or has a +non-standard name, run the following instead: + +```sh +export PYTHON=/path/to/python +$PYTHON ./configure +make +make install +``` + +Prerequisites (Windows only): + + * Python 2.6 or 2.7 + * Visual Studio 2010 or 2012 + +Windows: + +```sh +vcbuild nosign +``` + +You can download pre-built binaries for various operating systems from +[http://nodejs.org/download/](http://nodejs.org/download/). The Windows +and OS X installers will prompt you for the location in which to install. +The tarballs are self-contained; you can extract them to a local directory +with: + +```sh +tar xzf /path/to/node---.tar.gz +``` + +Or system-wide with: + +```sh +cd /usr/local && tar --strip-components 1 -xzf \ + /path/to/node---.tar.gz +``` + +### To run the tests: + +Unix/Macintosh: + +```sh +make test +``` + +Windows: + +```sh +vcbuild test +``` + +### To build the documentation: + +```sh +make doc +``` + +### To read the documentation: + +```sh +man doc/node.1 +``` + +### `Intl` (ECMA-402) support: + +[Intl](https://github.com/joyent/node/wiki/Intl) support is not +enabled by default. + +#### "small" (English only) support + +This option will build with "small" (English only) support, but +the full `Intl` (ECMA-402) APIs. With `--download=all` it will +download the ICU library as needed. + +Unix/Macintosh: + +```sh +./configure --with-intl=small-icu --download=all +``` + +Windows: + +```sh +vcbuild small-icu download-all +``` + +The `small-icu` mode builds +with English-only data. You can add full data at runtime. + +*Note:* more docs are on +[the wiki](https://github.com/joyent/node/wiki/Intl). + +#### Build with full ICU support (all locales supported by ICU): + +With the `--download=all`, this may download ICU if you don't +have an ICU in `deps/icu`. + +Unix/Macintosh: + +```sh +./configure --with-intl=full-icu --download=all +``` + +Windows: + +```sh +vcbuild full-icu download-all +``` + +#### Build with no Intl support `:-(` + +The `Intl` object will not be available. +This is the default at present, so this option is not normally needed. + +Unix/Macintosh: + +```sh +./configure --with-intl=none +``` + +Windows: + +```sh +vcbuild intl-none +``` + +#### Use existing installed ICU (Unix/Macintosh only): + +```sh +pkg-config --modversion icu-i18n && ./configure --with-intl=system-icu +``` + +#### Build with a specific ICU: + +You can find other ICU releases at +[the ICU homepage](http://icu-project.org/download). +Download the file named something like `icu4c-**##.#**-src.tgz` (or +`.zip`). + +Unix/Macintosh: from an already-unpacked ICU + +```sh +./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu +``` + +Unix/Macintosh: from a local ICU tarball + +```sh +./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu.tgz +``` + +Unix/Macintosh: from a tarball URL + +```sh +./configure --with-intl=full-icu --with-icu-source=http://url/to/icu.tgz +``` + +Windows: first unpack latest ICU to `deps/icu` + [icu4c-**##.#**-src.tgz](http://icu-project.org/download) (or `.zip`) + as `deps/icu` (You'll have: `deps/icu/source/...`) + +```sh +vcbuild full-icu +``` + +Resources for Newcomers +--- + - [The Wiki](https://github.com/joyent/node/wiki) + - [nodejs.org](http://nodejs.org/) + - [how to install node.js and npm (node package manager)](http://www.joyent.com/blog/installing-node-and-npm/) + - [list of modules](https://github.com/joyent/node/wiki/modules) + - [searching the npm registry](http://npmjs.org/) + - [list of companies and projects using node](https://github.com/joyent/node/wiki/Projects,-Applications,-and-Companies-Using-Node) + - [node.js mailing list](http://groups.google.com/group/nodejs) + - [irc chatroom, #node.js on freenode.net](http://webchat.freenode.net?channels=node.js&uio=d4) + - [community](https://github.com/joyent/node/wiki/Community) + - [contributing](https://github.com/joyent/node/wiki/Contributing) + - [big list of all the helpful wiki pages](https://github.com/joyent/node/wiki/_pages) diff --git a/README.md b/README.md index acaf24b372c..b88e4bd767c 100644 --- a/README.md +++ b/README.md @@ -1,200 +1,8 @@ -Evented I/O for V8 javascript. -=== -### To build: +This repository is an archive of Node.js before the move to [nodejs/node](https://github.com/nodejs/node). -Prerequisites (Unix only): +It still contains issues and pull requests that are relevant to Node versions v0.10 and v0.12, and that were opened before the move to [nodejs/node](https://github.com/nodejs/node). +New issues and pull requests, for all branches, should be opened at [nodejs/node](https://github.com/nodejs/node). +New issues and pull requests opened here will automatically be rejected. - * GCC 4.2 or newer - * G++ 4.2 or newer - * Python 2.6 or 2.7 - * GNU Make 3.81 or newer - * libexecinfo (FreeBSD and OpenBSD only) - -Unix/Macintosh: - -```sh -./configure -make -make install -``` - -If your python binary is in a non-standard location or has a -non-standard name, run the following instead: - -```sh -export PYTHON=/path/to/python -$PYTHON ./configure -make -make install -``` - -Prerequisites (Windows only): - - * Python 2.6 or 2.7 - * Visual Studio 2010 or 2012 - -Windows: - -```sh -vcbuild nosign -``` - -You can download pre-built binaries for various operating systems from -[http://nodejs.org/download/](http://nodejs.org/download/). The Windows -and OS X installers will prompt you for the location in which to install. -The tarballs are self-contained; you can extract them to a local directory -with: - -```sh -tar xzf /path/to/node---.tar.gz -``` - -Or system-wide with: - -```sh -cd /usr/local && tar --strip-components 1 -xzf \ - /path/to/node---.tar.gz -``` - -### To run the tests: - -Unix/Macintosh: - -```sh -make test -``` - -Windows: - -```sh -vcbuild test -``` - -### To build the documentation: - -```sh -make doc -``` - -### To read the documentation: - -```sh -man doc/node.1 -``` - -### `Intl` (ECMA-402) support: - -[Intl](https://github.com/joyent/node/wiki/Intl) support is not -enabled by default. - -#### "small" (English only) support - -This option will build with "small" (English only) support, but -the full `Intl` (ECMA-402) APIs. With `--download=all` it will -download the ICU library as needed. - -Unix/Macintosh: - -```sh -./configure --with-intl=small-icu --download=all -``` - -Windows: - -```sh -vcbuild small-icu download-all -``` - -The `small-icu` mode builds -with English-only data. You can add full data at runtime. - -*Note:* more docs are on -[the wiki](https://github.com/joyent/node/wiki/Intl). - -#### Build with full ICU support (all locales supported by ICU): - -With the `--download=all`, this may download ICU if you don't -have an ICU in `deps/icu`. - -Unix/Macintosh: - -```sh -./configure --with-intl=full-icu --download=all -``` - -Windows: - -```sh -vcbuild full-icu download-all -``` - -#### Build with no Intl support `:-(` - -The `Intl` object will not be available. -This is the default at present, so this option is not normally needed. - -Unix/Macintosh: - -```sh -./configure --with-intl=none -``` - -Windows: - -```sh -vcbuild intl-none -``` - -#### Use existing installed ICU (Unix/Macintosh only): - -```sh -pkg-config --modversion icu-i18n && ./configure --with-intl=system-icu -``` - -#### Build with a specific ICU: - -You can find other ICU releases at -[the ICU homepage](http://icu-project.org/download). -Download the file named something like `icu4c-**##.#**-src.tgz` (or -`.zip`). - -Unix/Macintosh: from an already-unpacked ICU - -```sh -./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu -``` - -Unix/Macintosh: from a local ICU tarball - -```sh -./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu.tgz -``` - -Unix/Macintosh: from a tarball URL - -```sh -./configure --with-intl=full-icu --with-icu-source=http://url/to/icu.tgz -``` - -Windows: first unpack latest ICU to `deps/icu` - [icu4c-**##.#**-src.tgz](http://icu-project.org/download) (or `.zip`) - as `deps/icu` (You'll have: `deps/icu/source/...`) - -```sh -vcbuild full-icu -``` - -Resources for Newcomers ---- - - [The Wiki](https://github.com/joyent/node/wiki) - - [nodejs.org](http://nodejs.org/) - - [how to install node.js and npm (node package manager)](http://www.joyent.com/blog/installing-node-and-npm/) - - [list of modules](https://github.com/joyent/node/wiki/modules) - - [searching the npm registry](http://npmjs.org/) - - [list of companies and projects using node](https://github.com/joyent/node/wiki/Projects,-Applications,-and-Companies-Using-Node) - - [node.js mailing list](http://groups.google.com/group/nodejs) - - irc chatroom, [#node.js on freenode.net](http://webchat.freenode.net?channels=node.js&uio=d4) - - [community](https://github.com/joyent/node/wiki/Community) - - [contributing](https://github.com/joyent/node/wiki/Contributing) - - [big list of all the helpful wiki pages](https://github.com/joyent/node/wiki/_pages) +The pre-convergence version of the README is available [here](https://github.com/nodejs/node-v0.x-archive/blob/master/README-pre-convergence.md). \ No newline at end of file diff --git a/common.gypi b/common.gypi index 8886b743927..83e1ee4405f 100644 --- a/common.gypi +++ b/common.gypi @@ -135,8 +135,21 @@ }, 'VCLinkerTool': { 'conditions': [ + ['target_arch=="ia32"', { + 'TargetMachine' : 1, # /MACHINE:X86 + 'target_conditions': [ + ['_type=="executable"', { + 'AdditionalOptions': [ '/SubSystem:Console,"5.01"' ], + }], + ], + }], ['target_arch=="x64"', { - 'TargetMachine' : 17 # /MACHINE:X64 + 'TargetMachine' : 17, # /MACHINE:AMD64 + 'target_conditions': [ + ['_type=="executable"', { + 'AdditionalOptions': [ '/SubSystem:Console,"5.02"' ], + }], + ], }], ], 'GenerateDebugInformation': 'true', @@ -144,11 +157,6 @@ 'DataExecutionPrevention': 2, # enable DEP 'AllowIsolation': 'true', 'SuppressStartupBanner': 'true', - 'target_conditions': [ - ['_type=="executable"', { - 'SubSystem': 1, # console executable - }], - ], }, }, 'msvs_disabled_warnings': [4351, 4355, 4800], diff --git a/configure b/configure index 66cb312ddb8..5751a32a9c3 100755 --- a/configure +++ b/configure @@ -282,6 +282,11 @@ parser.add_option('--without-etw', dest='without_etw', help='build without ETW') +parser.add_option('--without-mdb', + action='store_true', + dest='without_mdb', + help='build without mdb') + parser.add_option('--without-npm', action='store_true', dest='without_npm', @@ -554,7 +559,7 @@ def configure_node(o): # if we're on illumos based systems wrap the helper library into the # executable if flavor == 'solaris': - o['variables']['node_use_mdb'] = 'true' + o['variables']['node_use_mdb'] = b(not options.without_mdb) else: o['variables']['node_use_mdb'] = 'false' diff --git a/deps/debugger-agent/debugger-agent.gyp b/deps/debugger-agent/debugger-agent.gyp index e98206849ab..3d012ac0d59 100644 --- a/deps/debugger-agent/debugger-agent.gyp +++ b/deps/debugger-agent/debugger-agent.gyp @@ -17,6 +17,14 @@ "include", ], }, + 'conditions': [ + [ 'gcc_version<=44', { + # GCC versions <= 4.4 do not handle the aliasing in the queue + # implementation, so disable aliasing on these platforms + # to avoid subtle bugs + 'cflags': [ '-fno-strict-aliasing' ], + }], + ], "sources": [ "src/agent.cc", ], diff --git a/deps/debugger-agent/lib/_debugger_agent.js b/deps/debugger-agent/lib/_debugger_agent.js index 680c5e95c49..d0e6dff257a 100644 --- a/deps/debugger-agent/lib/_debugger_agent.js +++ b/deps/debugger-agent/lib/_debugger_agent.js @@ -1,3 +1,5 @@ +'use strict'; + var assert = require('assert'); var net = require('net'); var util = require('util'); diff --git a/deps/mdb_v8/mdb_v8.c b/deps/mdb_v8/mdb_v8.c index 5653431b8c3..552c70c7186 100644 --- a/deps/mdb_v8/mdb_v8.c +++ b/deps/mdb_v8/mdb_v8.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -145,10 +146,11 @@ static intptr_t V8_DICT_SHIFT; static intptr_t V8_DICT_PREFIX_SIZE; static intptr_t V8_DICT_ENTRY_SIZE; static intptr_t V8_DICT_START_INDEX; +static intptr_t V8_FIELDINDEX_MASK; +static intptr_t V8_FIELDINDEX_SHIFT; static intptr_t V8_PROP_IDX_CONTENT; static intptr_t V8_PROP_IDX_FIRST; static intptr_t V8_PROP_TYPE_FIELD; -static intptr_t V8_PROP_FIRST_PHANTOM; static intptr_t V8_PROP_TYPE_MASK; static intptr_t V8_PROP_DESC_KEY; static intptr_t V8_PROP_DESC_DETAILS; @@ -158,6 +160,7 @@ static intptr_t V8_TRANSITIONS_IDX_DESC; static intptr_t V8_TYPE_JSOBJECT = -1; static intptr_t V8_TYPE_JSARRAY = -1; +static intptr_t V8_TYPE_JSFUNCTION = -1; static intptr_t V8_TYPE_FIXEDARRAY = -1; static intptr_t V8_ELEMENTS_KIND_SHIFT; @@ -211,10 +214,12 @@ static ssize_t V8_OFF_SLICEDSTRING_PARENT; static ssize_t V8_OFF_SLICEDSTRING_OFFSET; static ssize_t V8_OFF_STRING_LENGTH; -#define NODE_OFF_EXTSTR_DATA 0x4 /* see node_string.h */ +/* see node_string.h */ +#define NODE_OFF_EXTSTR_DATA sizeof (uintptr_t) #define V8_CONSTANT_OPTIONAL 1 #define V8_CONSTANT_HASFALLBACK 2 +#define V8_CONSTANT_REMOVED 4 #define V8_CONSTANT_MAJORSHIFT 3 #define V8_CONSTANT_MAJORMASK ((1 << 4) - 1) @@ -230,6 +235,10 @@ static ssize_t V8_OFF_STRING_LENGTH; (V8_CONSTANT_OPTIONAL | V8_CONSTANT_HASFALLBACK | \ ((maj) << V8_CONSTANT_MAJORSHIFT) | ((min) << V8_CONSTANT_MINORSHIFT)) +#define V8_CONSTANT_REMOVED_SINCE(maj, min) \ + (V8_CONSTANT_REMOVED | \ + ((maj) << V8_CONSTANT_MAJORSHIFT) | ((min) << V8_CONSTANT_MINORSHIFT)) + /* * Table of constants used directly by this file. */ @@ -259,8 +268,10 @@ static v8_constant_t v8_constants[] = { { &V8_SlicedStringTag, "v8dbg_SlicedStringTag", V8_CONSTANT_FALLBACK(0, 0), 0x3 }, { &V8_ExternalStringTag, "v8dbg_ExternalStringTag" }, - { &V8_FailureTag, "v8dbg_FailureTag" }, - { &V8_FailureTagMask, "v8dbg_FailureTagMask" }, + { &V8_FailureTag, "v8dbg_FailureTag", + V8_CONSTANT_REMOVED_SINCE(3, 28) }, + { &V8_FailureTagMask, "v8dbg_FailureTagMask", + V8_CONSTANT_REMOVED_SINCE(3, 28) }, { &V8_HeapObjectTag, "v8dbg_HeapObjectTag" }, { &V8_HeapObjectTagMask, "v8dbg_HeapObjectTagMask" }, { &V8_SmiTag, "v8dbg_SmiTag" }, @@ -274,7 +285,7 @@ static v8_constant_t v8_constants[] = { #endif { &V8_PointerSizeLog2, "v8dbg_PointerSizeLog2" }, - { &V8_DICT_SHIFT, "v8dbg_dict_shift", + { &V8_DICT_SHIFT, "v8dbg_bit_field3_dictionary_map_shift", V8_CONSTANT_FALLBACK(3, 13), 24 }, { &V8_DICT_PREFIX_SIZE, "v8dbg_dict_prefix_size", V8_CONSTANT_FALLBACK(3, 11), 2 }, @@ -282,11 +293,14 @@ static v8_constant_t v8_constants[] = { V8_CONSTANT_FALLBACK(3, 11), 3 }, { &V8_DICT_START_INDEX, "v8dbg_dict_start_index", V8_CONSTANT_FALLBACK(3, 11), 3 }, + { &V8_FIELDINDEX_MASK, "v8dbg_fieldindex_mask", + V8_CONSTANT_FALLBACK(3, 26), 0x3ff00000 }, + { &V8_FIELDINDEX_SHIFT, "v8dbg_fieldindex_shift", + V8_CONSTANT_FALLBACK(3, 26), 20 }, { &V8_ISSHARED_SHIFT, "v8dbg_isshared_shift", V8_CONSTANT_FALLBACK(3, 11), 0 }, { &V8_PROP_IDX_FIRST, "v8dbg_prop_idx_first" }, - { &V8_PROP_TYPE_FIELD, "v8dbg_prop_type_field" }, - { &V8_PROP_FIRST_PHANTOM, "v8dbg_prop_type_first_phantom" }, + { &V8_PROP_TYPE_FIELD, "v8dbg_prop_type_field" }, { &V8_PROP_TYPE_MASK, "v8dbg_prop_type_mask" }, { &V8_PROP_IDX_CONTENT, "v8dbg_prop_idx_content", V8_CONSTANT_OPTIONAL }, @@ -427,6 +441,66 @@ static void conf_class_compute_offsets(v8_class_t *); static int read_typebyte(uint8_t *, uintptr_t); static int heap_offset(const char *, const char *, ssize_t *); +static int jsfunc_name(uintptr_t, char **, size_t *); + +/* + * When iterating properties, it's useful to keep track of what kinds of + * properties were found. This is useful for developers to identify objects of + * different kinds in order to debug them. + */ +typedef enum { + JPI_NONE = 0, + + /* + * Indicates how properties are stored in this object. There can be + * both numeric properties and some of the other kinds. + */ + JPI_NUMERIC = 0x01, /* numeric-named properties in "elements" */ + JPI_DICT = 0x02, /* dictionary properties */ + JPI_INOBJECT = 0x04, /* properties stored inside object */ + JPI_PROPS = 0x08, /* "properties" array */ + + /* error-like cases */ + JPI_SKIPPED = 0x10, /* some properties were skipped */ + JPI_BADLAYOUT = 0x20, /* we didn't recognize the layout at all */ + + /* fallback cases */ + JPI_HASTRANSITIONS = 0x100, /* found a transitions array */ + JPI_HASCONTENT = 0x200, /* found a separate content array */ +} jspropinfo_t; + +typedef struct jsobj_print { + char **jsop_bufp; + size_t *jsop_lenp; + int jsop_indent; + uint64_t jsop_depth; + boolean_t jsop_printaddr; + uintptr_t jsop_baseaddr; + int jsop_nprops; + const char *jsop_member; + boolean_t jsop_found; + boolean_t jsop_descended; + jspropinfo_t jsop_propinfo; +} jsobj_print_t; + +static int jsobj_print_number(uintptr_t, jsobj_print_t *); +static int jsobj_print_oddball(uintptr_t, jsobj_print_t *); +static int jsobj_print_jsobject(uintptr_t, jsobj_print_t *); +static int jsobj_print_jsarray(uintptr_t, jsobj_print_t *); +static int jsobj_print_jsfunction(uintptr_t, jsobj_print_t *); +static int jsobj_print_jsdate(uintptr_t, jsobj_print_t *); + +/* + * Returns 1 if the V8 version v8_major.v8.minor is strictly older than + * the V8 version represented by "flags". + * Returns 0 otherwise. + */ +static int +v8_version_older(uintptr_t v8_major, uintptr_t v8_minor, uint32_t flags) { + return v8_major < V8_CONSTANT_MAJOR(flags) || + (v8_major == V8_CONSTANT_MAJOR(flags) && + v8_minor < V8_CONSTANT_MINOR(flags)); +} /* * Invoked when this dmod is initially loaded to load the set of classes, enums, @@ -474,7 +548,9 @@ autoconfigure(v8_cfg_t *cfgp) continue; } - if (!(cnp->v8c_flags & V8_CONSTANT_OPTIONAL)) { + if (!(cnp->v8c_flags & V8_CONSTANT_OPTIONAL) && + (!(cnp->v8c_flags & V8_CONSTANT_REMOVED) || + v8_version_older(v8_major, v8_minor, cnp->v8c_flags))) { mdb_warn("failed to read \"%s\"", cnp->v8c_symbol); failed++; continue; @@ -505,6 +581,9 @@ autoconfigure(v8_cfg_t *cfgp) if (strcmp(ep->v8e_name, "JSArray") == 0) V8_TYPE_JSARRAY = ep->v8e_value; + if (strcmp(ep->v8e_name, "JSFunction") == 0) + V8_TYPE_JSFUNCTION = ep->v8e_value; + if (strcmp(ep->v8e_name, "FixedArray") == 0) V8_TYPE_FIXEDARRAY = ep->v8e_value; } @@ -519,6 +598,11 @@ autoconfigure(v8_cfg_t *cfgp) failed++; } + if (V8_TYPE_JSFUNCTION == -1) { + mdb_warn("couldn't find JSFunction type\n"); + failed++; + } + if (V8_TYPE_FIXEDARRAY == -1) { mdb_warn("couldn't find FixedArray type\n"); failed++; @@ -960,11 +1044,8 @@ v8_warn(const char *format, ...) } } -/* - * Returns in "offp" the offset of field "field" in C++ class "klass". - */ -static int -heap_offset(const char *klass, const char *field, ssize_t *offp) +static v8_field_t * +conf_field_lookup(const char *klass, const char *field) { v8_class_t *clp; v8_field_t *flp; @@ -975,15 +1056,28 @@ heap_offset(const char *klass, const char *field, ssize_t *offp) } if (clp == NULL) - return (-1); + return (NULL); for (flp = clp->v8c_fields; flp != NULL; flp = flp->v8f_next) { if (strcmp(field, flp->v8f_name) == 0) break; } - if (flp == NULL) - return (-1); + return (flp); +} + +/* + * Returns in "offp" the offset of field "field" in C++ class "klass". + */ +static int +heap_offset(const char *klass, const char *field, ssize_t *offp) +{ + v8_field_t *flp; + + flp = conf_field_lookup(klass, field); + + if (flp == NULL) + return (-1); *offp = V8_OFF_HEAP(flp->v8f_offset); return (0); @@ -1090,6 +1184,46 @@ read_heap_byte(uint8_t *valp, uintptr_t addr, ssize_t off) return (0); } +/* + * This is truly horrific. Inside the V8 Script class are a number of + * small-integer fields like the function_token_position (an offset into the + * script's text where the "function" token appears). For 32-bit processes, V8 + * stores these as a sequence of SMI fields, which we know how to interpret well + * enough. For 64-bit processes, "to avoid wasting space", they use a different + * trick: each 8-byte word contains two integer fields. The low word is + * represented like an SMI: shifted left by one. They don't bother shifting the + * high word, since its low bit will never be looked at (since it's not + * word-aligned). + * + * This function is used for cases where we would use read_heap_smi(), except + * that this is one of those fields that might be encoded or might not be, + * depending on whether the address is word-aligned. + */ +static int +read_heap_maybesmi(uintptr_t *valp, uintptr_t addr, ssize_t off) +{ +#ifdef _LP64 + uint32_t readval; + + if (mdb_vread(&readval, sizeof (readval), addr + off) == -1) { + *valp = -1; + v8_warn("failed to read offset %d from %p", off, addr); + return (-1); + } + + /* + * If this was the low half-word, it needs to be shifted right. + */ + if ((addr + off) % sizeof (uintptr_t) == 0) + readval >>= 1; + + *valp = (uintptr_t)readval; + return (0); +#else + return (read_heap_smi(valp, addr, off)); +#endif +} + /* * Given a heap object, returns in *valp the byte describing the type of the * object. This is shorthand for first retrieving the Map at the start of the @@ -1178,8 +1312,7 @@ read_heap_dict(uintptr_t addr, if (V8_IS_SMI(dict[i])) { intptr_t val = V8_SMI_VALUE(dict[i]); - - (void) snprintf(buf, sizeof (buf), "%ld", val); + (void) snprintf(buf, sizeof (buf), "%" PRIdPTR, val); } else { if (jsobj_is_hole(dict[i])) { /* @@ -1213,6 +1346,62 @@ read_heap_dict(uintptr_t addr, return (rval); } +/* + * Given an object, returns in "buf" the name of the constructor function. With + * "verbose", prints the pointer to the JSFunction object. Given anything else, + * returns an error (and warns the user why). + */ +static int +obj_jsconstructor(uintptr_t addr, char **bufp, size_t *lenp, boolean_t verbose) +{ + uint8_t type; + uintptr_t map, consfunc, funcinfop; + const char *constype; + + if (!V8_IS_HEAPOBJECT(addr) || + read_typebyte(&type, addr) != 0 || + (type != V8_TYPE_JSOBJECT && type != V8_TYPE_JSARRAY)) { + mdb_warn("%p is not a JSObject\n", addr); + return (-1); + } + + if (mdb_vread(&map, sizeof (map), addr + V8_OFF_HEAPOBJECT_MAP) == -1 || + mdb_vread(&consfunc, sizeof (consfunc), + map + V8_OFF_MAP_CONSTRUCTOR) == -1) { + mdb_warn("unable to read object map\n"); + return (-1); + } + + if (read_typebyte(&type, consfunc) != 0) + return (-1); + + constype = enum_lookup_str(v8_types, type, ""); + if (strcmp(constype, "Oddball") == 0) { + jsobj_print_t jsop; + bzero(&jsop, sizeof (jsop)); + jsop.jsop_bufp = bufp; + jsop.jsop_lenp = lenp; + return (jsobj_print_oddball(consfunc, &jsop)); + } + + if (strcmp(constype, "JSFunction") != 0) { + mdb_warn("constructor: expected JSFunction, found %s\n", + constype); + return (-1); + } + + if (read_heap_ptr(&funcinfop, consfunc, V8_OFF_JSFUNCTION_SHARED) != 0) + return (-1); + + if (jsfunc_name(funcinfop, bufp, lenp) != 0) + return (-1); + + if (verbose) + bsnprintf(bufp, lenp, " (JSFunction: %p)", consfunc); + + return (0); +} + /* * Returns in "buf" a description of the type of "addr" suitable for printing. */ @@ -1220,7 +1409,7 @@ static int obj_jstype(uintptr_t addr, char **bufp, size_t *lenp, uint8_t *typep) { uint8_t typebyte; - uintptr_t strptr; + uintptr_t strptr, map, consfunc, funcinfop; const char *typename; if (V8_IS_FAILURE(addr)) { @@ -1256,9 +1445,74 @@ obj_jstype(uintptr_t addr, char **bufp, size_t *lenp, uint8_t *typep) } } + if (strcmp(typename, "JSObject") == 0 && + mdb_vread(&map, sizeof (map), addr + V8_OFF_HEAPOBJECT_MAP) != -1 && + mdb_vread(&consfunc, sizeof (consfunc), + map + V8_OFF_MAP_CONSTRUCTOR) != -1 && + read_typebyte(&typebyte, consfunc) == 0 && + strcmp(enum_lookup_str(v8_types, typebyte, ""), + "JSFunction") == 0 && + mdb_vread(&funcinfop, sizeof (funcinfop), + consfunc + V8_OFF_JSFUNCTION_SHARED) != -1) { + (void) bsnprintf(bufp, lenp, ": "); + (void) jsfunc_name(funcinfop, bufp, lenp); + } + return (0); } +/* + * V8 allows implementers (like Node) to store pointer-sized values into + * internal fields within V8 heap objects. Implementors access these values by + * 0-based index (e.g., SetInternalField(0, value)). These values are stored as + * an array directly after the last actual C++ field in the C++ object. + * + * Node uses internal fields to refer to handles. For example, a socket's C++ + * HandleWrap object is typically stored as internal field 0 in the JavaScript + * Socket object. Similarly, the native-heap-allocated chunk of memory + * associated with a Node Buffer is referenced by field 0 in the External array + * pointed-to by the Node Buffer JSObject. + */ +static int +obj_v8internal(uintptr_t addr, uint_t idx, uintptr_t *valp) +{ + char *bufp; + size_t len; + ssize_t off; + uint8_t type; + + v8_class_t *clp; + char buf[256]; + + bufp = buf; + len = sizeof (buf); + if (obj_jstype(addr, &bufp, &len, &type) != 0) + return (DCMD_ERR); + + if (type == 0) { + mdb_warn("%p: unsupported type\n", addr); + return (DCMD_ERR); + } + + for (clp = v8_classes; clp != NULL; clp = clp->v8c_next) { + if (strcmp(buf, clp->v8c_name) == 0) + break; + } + + if (clp == NULL) { + mdb_warn("%p: didn't find expected class\n", addr); + return (DCMD_ERR); + } + + off = clp->v8c_end + (idx * sizeof (uintptr_t)) - 1; + if (read_heap_ptr(valp, addr, off) != 0) { + mdb_warn("%p: failed to read from %p\n", addr, addr + off); + return (DCMD_ERR); + } + + return (DCMD_OK); +} + /* * Print out the fields of the given object that come from the given class. */ @@ -1453,11 +1707,6 @@ jsstr_print_seq(uintptr_t addr, uint_t flags, char **bufp, size_t *lenp, char *buf; uint16_t chrval; - if ((blen = MIN(*lenp, 256 * 1024)) == 0) - return (0); - - buf = alloca(blen); - if (read_heap_smi(&nstrchrs, addr, V8_OFF_STRING_LENGTH) != 0) { (void) bsnprintf(bufp, lenp, ""); @@ -1467,17 +1716,22 @@ jsstr_print_seq(uintptr_t addr, uint_t flags, char **bufp, size_t *lenp, if (slicelen != -1) nstrchrs = slicelen; + blen = ((flags & JSSTR_ISASCII) != 0) ? *lenp : 2 * (*lenp); + if ((blen = MIN(blen, 256 * 1024)) == 0) + return (0); + if ((flags & JSSTR_ISASCII) != 0) { nstrbytes = nstrchrs; nreadoffset = sliceoffset; + nreadbytes = nstrbytes + sizeof ("\"\"") <= *lenp ? + nstrbytes : *lenp - sizeof ("\"\"[...]"); } else { nstrbytes = 2 * nstrchrs; nreadoffset = 2 * sliceoffset; + nreadbytes = nstrchrs + sizeof ("\"\"") <= *lenp ? + nstrbytes : 2 * (*lenp - sizeof ("\"\"[...]")); } - nreadbytes = nstrbytes + sizeof ("\"\"") <= blen ? nstrbytes : - blen - sizeof ("\"\"[...]"); - if (nreadbytes < 0) { /* * We don't even have the room to store the ellipsis; zero @@ -1488,10 +1742,13 @@ jsstr_print_seq(uintptr_t addr, uint_t flags, char **bufp, size_t *lenp, return (0); } - if (verbose) + if (verbose) { mdb_printf("length: %d chars (%d bytes), " "will read %d bytes from offset %d\n", nstrchrs, nstrbytes, nreadbytes, nreadoffset); + mdb_printf("given buffer size: %d, internal buffer: %d\n", + *lenp, blen); + } if (nstrbytes == 0) { (void) bsnprintf(bufp, lenp, "%s%s", @@ -1499,6 +1756,7 @@ jsstr_print_seq(uintptr_t addr, uint_t flags, char **bufp, size_t *lenp, return (0); } + buf = alloca(blen); buf[0] = '\0'; if ((flags & JSSTR_ISASCII) != 0) { @@ -1739,9 +1997,126 @@ jsobj_is_hole(uintptr_t addr) return (jsobj_is_oddball(addr, "hole")); } +/* + * Iterate the properties of a JavaScript object "addr". + * + * Every heap object refers to a Map that describes how that heap object is laid + * out. The Map includes information like the constructor function used to + * create the object, how many bytes each object uses, and how many properties + * are stored inside the object. (A single Map object can be shared by many + * objects of the same general type, which is why this information is encoded by + * reference rather than contained in each object.) + * + * V8 knows about lots of different kinds of properties: + * + * o properties with numeric names (e.g., array elements) + * o dictionary properties + * o "fast" properties stored inside each object, much like a C struct + * o properties stored in the separate "properties" array + * o getters, setters, and other magic (not supported by this module) + * + * While property lookup in JavaScript involves traversing an object's prototype + * chain, this module only iterates the properties local to the object itself. + * + * + * Numeric properties + * + * Properties having numeric indexes are stored in the "elements" array attached + * to each object. Objects with numeric properties can also have other + * properties. + * + * + * Dictionary properties + * + * An object with dictionary properties is identified by one of the bits in + * "bitfield3" in the object's Map. For details on slow properties, see + * read_heap_dict(). + * + * + * Other properties + * + * The Map object refers to an array of "instance descriptors". This array has + * a few metadata entries at the front, followed by groups of three entries for + * each property. In Node v0.10 and later, it looks roughly like this: + * + * +--------------+ +----------------------+ + * | JSObject | +--> | Map | + * +--------------| | +----------------------+ + * | map | ---+ | ... | + * | ... | | instance_descriptors | --+ + * in-object | [prop 0 val] | | ... | | + * properties | [prop 1 val] | +----------------------+ | + * (not for all | ... | | + * objects) | [prop N val] | | + * +--------------+ | + * +------------------------------------------------+ + * | + * +----> +------------------------------+ + * | FixedArray | + * +------------------------------+ + * | ... | + * | prop 0 "key" descriptor | + * | prop 0 "details" descriptor | + * | prop 0 "value" descriptor | + * | prop 1 "key" descriptor | + * | prop 1 "details" descriptor | + * | prop 1 "value" descriptor | + * | ... | + * | prop N "key" descriptor | + * | prop N "details" descriptor | + * | prop N "value" descriptor | + * +------------------------------+ + * + * In versions of Node prior to 0.10, there's an extra level of indirection. + * The Map refers to a "transitions" array, which has an entry that points to + * the instance descriptors. In both cases, the descriptors look roughly the + * same. + * + * Each property is described by three pointer-sized entries: + * + * o key: a string denoting the name of the property + * o details: a bitfield describing attributes of this property + * o value: an integer describing where this property's value is stored + * + * "key" is straightforward: it's just the name of the property as the + * JavaScript programmer knows it. + * + * In versions prior to Node 0.12, "value" is an integer. If "value" is less + * than the number of properties stored inside the object (which is also + * recorded in the Map), then it denotes which of the in-object property value + * slots (shown above inside the JSObject object) stores the value for this + * property. If "value" is greater than the number of properties stored inside + * the object, then it denotes which index into the separate "properties" array + * (a separate field in the JSObject, not shown above) contains the value for + * this property. + * + * In Node 0.12, for properties that are stored inside the object, the offset is + * obtained not using "value", but using a bitfield from the "details" part of + * the descriptor. + * + * Terminology notes: it's important to keep straight the different senses of + * "object" and "property" here. We use "JavaScript objects" to refer to the + * things that JavaScript programmers would call objects, including instances of + * Object and Array and subclasses of those. These are a subset of V8 heap + * objects, since V8 uses its heap to manage lots of other objects that + * JavaScript programmers don't think about. This function iterates JavaScript + * properties of these JavaScript objects, not internal properties of heap + * objects in general. + * + * Relatedly, while JavaScript programmers frequently interchange the notions of + * property names, property values, and property configurations (e.g., getters + * and setters, read-only or not, hidden or not), these are all distinct in the + * implementation of the VM, and "property" typically refers to the whole + * configuration, which may include a way to get the property name and value. + * + * The canonical source of the information used here is the implementation of + * property lookup in the V8 source code, currently in Object::GetProperty. + */ + static int jsobj_properties(uintptr_t addr, - int (*func)(const char *, uintptr_t, void *), void *arg) + int (*func)(const char *, uintptr_t, void *), void *arg, + jspropinfo_t *propinfop) { uintptr_t ptr, map, elements; uintptr_t *props = NULL, *descs = NULL, *content = NULL, *trans, *elts; @@ -1751,10 +2126,12 @@ jsobj_properties(uintptr_t addr, int rval = -1; size_t ps = sizeof (uintptr_t); ssize_t off; + jspropinfo_t propinfo = JPI_NONE; /* - * Objects have either "fast" properties represented with a FixedArray - * or slow properties represented with a Dictionary. + * First, check if the JSObject's "properties" field is a FixedArray. + * If not, then this is something we don't know how to deal with, and + * we'll just pass the caller a NULL value. */ if (mdb_vread(&ptr, ps, addr + V8_OFF_JSOBJECT_PROPERTIES) == -1) return (-1); @@ -1763,30 +2140,26 @@ jsobj_properties(uintptr_t addr, return (-1); if (type != V8_TYPE_FIXEDARRAY) { - /* - * If our properties aren't a fixed array, we'll emit a member - * that contains the type name, but with a NULL value. - */ char buf[256]; - (void) mdb_snprintf(buf, sizeof (buf), "<%s>", enum_lookup_str(v8_types, type, "unknown")); - + if (propinfop != NULL) + *propinfop = JPI_BADLAYOUT; return (func(buf, NULL, arg)); } /* - * To iterate the properties, we need to examine the instance - * descriptors of the associated Map object. Depending on the version - * of V8, this might be found directly from the map -- or indirectly - * via the transitions array. + * As described above, we need the Map to figure out how to iterate the + * properties for this object. */ if (mdb_vread(&map, ps, addr + V8_OFF_HEAPOBJECT_MAP) == -1) goto err; /* * Check to see if our elements member is an array and non-zero; if - * so, it contains numerically-named properties. + * so, it contains numerically-named properties. Whether or not there + * are any numerically-named properties, there may be other kinds of + * properties. */ if (V8_ELEMENTS_KIND_SHIFT != -1 && read_heap_ptr(&elements, addr, V8_OFF_JSOBJECT_ELEMENTS) == 0 && @@ -1802,6 +2175,7 @@ jsobj_properties(uintptr_t addr, kind = bit_field2 >> V8_ELEMENTS_KIND_SHIFT; kind &= (1 << V8_ELEMENTS_KIND_BITCOUNT) - 1; + propinfo |= JPI_NUMERIC; if (kind == V8_ELEMENTS_FAST_ELEMENTS || kind == V8_ELEMENTS_FAST_HOLEY_ELEMENTS) { @@ -1812,7 +2186,7 @@ jsobj_properties(uintptr_t addr, jsobj_is_hole(elts[ii])) continue; - snprintf(name, sizeof (name), "%d", ii); + snprintf(name, sizeof (name), "%" PRIdPTR, ii); if (func(name, elts[ii], arg) != 0) { mdb_free(elts, sz); @@ -1820,6 +2194,7 @@ jsobj_properties(uintptr_t addr, } } } else if (kind == V8_ELEMENTS_DICTIONARY_ELEMENTS) { + propinfo |= JPI_DICT; if (read_heap_dict(elements, func, arg) != 0) { mdb_free(elts, sz); goto err; @@ -1830,14 +2205,49 @@ jsobj_properties(uintptr_t addr, } if (V8_DICT_SHIFT != -1) { + v8_field_t *flp; uintptr_t bit_field3; - if (mdb_vread(&bit_field3, sizeof (bit_field3), - map + V8_OFF_MAP_BIT_FIELD3) == -1) - goto err; + /* + * If dictionary properties are supported (the V8_DICT_SHIFT + * offset is not -1), then bitfield 3 tells us if the properties + * for this object are stored in "properties" field of the + * object using a Dictionary representation. + * + * Versions of V8 prior to Node 0.12 treated bit_field3 as an + * SMI, so it was pointer-sized, and it has to be converted from + * an SMI before using it. In 0.12, it's treated as a raw + * uint32_t, meaning it's always int-sized and it should not be + * converted. We can tell which case we're in because the debug + * constant (v8dbg_class_map__bit_field3__TYPE) tells us whether + * the TYPE is "SMI" or "int". + */ - if (V8_SMI_VALUE(bit_field3) & (1 << V8_DICT_SHIFT)) + flp = conf_field_lookup("Map", "bit_field3"); + if (flp == NULL || flp->v8f_isbyte) { + /* + * v8f_isbyte indicates the type is "int", so we're in + * the int-sized not-a-SMI world. + */ + unsigned int bf3_value; + if (mdb_vread(&bf3_value, sizeof (bf3_value), + map + V8_OFF_MAP_BIT_FIELD3) == -1) + goto err; + bit_field3 = (uintptr_t)bf3_value; + } else { + /* The metadata indicates this is an SMI. */ + if (mdb_vread(&bit_field3, sizeof (bit_field3), + map + V8_OFF_MAP_BIT_FIELD3) == -1) + goto err; + bit_field3 = V8_SMI_VALUE(bit_field3); + } + + if (bit_field3 & (1 << V8_DICT_SHIFT)) { + propinfo |= JPI_DICT; + if (propinfop != NULL) + *propinfop = propinfo; return (read_heap_dict(ptr, func, arg)); + } } else if (V8_OFF_MAP_INSTANCE_DESCRIPTORS != -1) { uintptr_t bit_field3; @@ -1857,6 +2267,9 @@ jsobj_properties(uintptr_t addr, * dictionary -- an assumption that is assuredly in * error in some cases. */ + propinfo |= JPI_DICT; + if (propinfop != NULL) + *propinfop = propinfo; return (read_heap_dict(ptr, func, arg)); } } @@ -1864,7 +2277,12 @@ jsobj_properties(uintptr_t addr, if (read_heap_array(ptr, &props, &nprops, UM_SLEEP) != 0) goto err; - if ((off = V8_OFF_MAP_INSTANCE_DESCRIPTORS) == -1) { + /* + * Check if we're looking at an older version of V8, where the instance + * descriptors are stored not directly in the Map, but in the + * "transitions" array that's stored in the Map. + */ + if (V8_OFF_MAP_INSTANCE_DESCRIPTORS == -1) { if (V8_OFF_MAP_TRANSITIONS == -1 || V8_TRANSITIONS_IDX_DESC == -1 || V8_PROP_IDX_CONTENT != -1) { @@ -1874,47 +2292,71 @@ jsobj_properties(uintptr_t addr, goto err; } + propinfo |= JPI_HASTRANSITIONS; off = V8_OFF_MAP_TRANSITIONS; - } - - if (mdb_vread(&ptr, ps, map + off) == -1) - goto err; + if (mdb_vread(&ptr, ps, map + off) == -1) + goto err; - if (V8_OFF_MAP_INSTANCE_DESCRIPTORS == -1) { if (read_heap_array(ptr, &trans, &ntrans, UM_SLEEP) != 0) goto err; ptr = trans[V8_TRANSITIONS_IDX_DESC]; mdb_free(trans, ntrans * sizeof (uintptr_t)); + } else { + off = V8_OFF_MAP_INSTANCE_DESCRIPTORS; + if (mdb_vread(&ptr, ps, map + off) == -1) + goto err; } + /* + * Either way, at this point "ptr" should refer to the descriptors + * array. + */ if (read_heap_array(ptr, &descs, &ndescs, UM_SLEEP) != 0) goto err; + /* + * For cases where property values are stored directly inside the object + * ("fast properties"), we need to know the whole size of the object and + * the number of properties in the object in order to calculate the + * correct offset for each property. + */ if (read_size(&size, addr) != 0) size = 0; - - if (mdb_vread(&ninprops, 1, map + V8_OFF_MAP_INOBJECT_PROPERTIES) == -1) - goto err; - - if (V8_PROP_IDX_CONTENT != -1 && V8_PROP_IDX_CONTENT < ndescs && - read_heap_array(descs[V8_PROP_IDX_CONTENT], &content, - &ncontent, UM_SLEEP) != 0) + if (mdb_vread(&ninprops, ps, + map + V8_OFF_MAP_INOBJECT_PROPERTIES) == -1) goto err; if (V8_PROP_IDX_CONTENT == -1) { /* - * On node v0.8 and later, the content is not stored in an - * orthogonal FixedArray, but rather with the descriptors. + * On node v0.8 and later, the content is not stored in a + * separate FixedArray, but rather with the descriptors. The + * number of actual properties is the length of the array minus + * the first (non-property) elements divided by the number of + * elements per property. */ content = descs; ncontent = ndescs; rndescs = ndescs > V8_PROP_IDX_FIRST ? (ndescs - V8_PROP_IDX_FIRST) / V8_PROP_DESC_SIZE : 0; } else { + /* + * On older versions, the content is stored in a separate array, + * and there's one entry per property (rather than three). + */ + if (V8_PROP_IDX_CONTENT < ndescs && + read_heap_array(descs[V8_PROP_IDX_CONTENT], &content, + &ncontent, UM_SLEEP) != 0) + goto err; + rndescs = ndescs - V8_PROP_IDX_FIRST; + propinfo |= JPI_HASCONTENT; } + /* + * At this point, we've read all the pieces we need to process the list + * of instance descriptors. + */ for (ii = 0; ii < rndescs; ii++) { uintptr_t keyidx, validx, detidx, baseidx; char buf[1024]; @@ -1938,48 +2380,91 @@ jsobj_properties(uintptr_t addr, detidx = baseidx + V8_PROP_DESC_DETAILS; } + /* + * Ignore cases where our understanding doesn't appear to match + * what's here. + */ if (detidx >= ncontent) { + propinfo |= JPI_SKIPPED; v8_warn("property descriptor %d: detidx (%d) " "out of bounds for content array (length %d)\n", ii, detidx, ncontent); continue; } + /* + * We only process fields. There are other entries here + * (notably: transitions) that we don't care about (and these + * are not errors). + */ if (!V8_DESC_ISFIELD(content[detidx])) continue; if (keyidx >= ndescs) { + propinfo |= JPI_SKIPPED; v8_warn("property descriptor %d: keyidx (%d) " "out of bounds for descriptor array (length %d)\n", ii, keyidx, ndescs); continue; } - if (jsstr_print(descs[keyidx], JSSTR_NUDE, &c, &len) != 0) + if (jsstr_print(descs[keyidx], JSSTR_NUDE, &c, &len) != 0) { + propinfo |= JPI_SKIPPED; continue; + } val = (intptr_t)content[validx]; - if (!V8_IS_SMI(val)) { + propinfo |= JPI_SKIPPED; v8_warn("object %p: property descriptor %d: value " - "index value is not an SMI: %p\n", addr, ii, val); + "index is not an SMI: %p\n", addr, ii, val); continue; } + /* + * The "value" part of each property descriptor tells us whether + * the property value is stored directly in the object or in the + * related "props" array. See JSObject::RawFastPropertyAt() in + * the V8 source. + */ val = V8_SMI_VALUE(val) - ninprops; - if (val < 0) { - /* property is stored directly in the object */ - if (mdb_vread(&ptr, sizeof (ptr), addr + V8_OFF_HEAP( - size + val * sizeof (uintptr_t))) == -1) { + uintptr_t propaddr; + + /* + * The property is stored directly inside the object. + * In Node 0.10, "val - ninprops" is the (negative) + * index of the property counted from the end of the + * object. In that context, -1 refers to the last + * word in the object; -2 refers to the second-last + * word, and so on. + * + * In Node 0.12, we get the 0-based index from the + * first property inside the object by reading certain + * bits from the property descriptor details word. + * These constants are literal here because they're + * literal in the V8 source itself. + */ + if (v8_major > 3 || (v8_major == 3 && v8_minor >= 26)) { + val = V8_PROP_FIELDINDEX(content[detidx]); + propaddr = addr + V8_OFF_HEAP( + size - (ninprops - val) * ps); + } else { + propaddr = addr + V8_OFF_HEAP(size + val * ps); + } + + if (mdb_vread(&ptr, sizeof (ptr), propaddr) == -1) { + propinfo |= JPI_SKIPPED; v8_warn("object %p: failed to read in-object " - "property at %p\n", addr, addr + - V8_OFF_HEAP(size + val * - sizeof (uintptr_t))); + "property at %p", addr, propaddr); continue; } + + propinfo |= JPI_INOBJECT; } else { - /* property should be in "props" array */ + /* + * The property is in the separate "props" array. + */ if (val >= nprops) { /* * This can happen when properties are deleted. @@ -1989,12 +2474,14 @@ jsobj_properties(uintptr_t addr, if (val < rndescs) continue; + propinfo |= JPI_SKIPPED; v8_warn("object %p: property descriptor %d: " "value index value (%d) out of bounds " "(%d)\n", addr, ii, val, nprops); goto err; } + propinfo |= JPI_PROPS; ptr = props[val]; } @@ -2003,6 +2490,9 @@ jsobj_properties(uintptr_t addr, } rval = 0; + if (propinfop != NULL) + *propinfop = propinfo; + err: if (props != NULL) mdb_free(props, nprops * sizeof (uintptr_t)); @@ -2036,9 +2526,14 @@ jsfunc_lineno(uintptr_t lendsp, uintptr_t tokpos, * The token position is an SMI, but it comes in as its raw * value so we can more easily compare it to values in the line * endings table. If we're just printing the position directly, - * we must convert it here. + * we must convert it here, unless we're checking against the + * "-1" sentinel. */ - mdb_snprintf(buf, buflen, "position %d", V8_SMI_VALUE(tokpos)); + if (tokpos == V8_VALUE_SMI(-1)) + mdb_snprintf(buf, buflen, "unknown position"); + else + mdb_snprintf(buf, buflen, "position %d", + V8_SMI_VALUE(tokpos)); if (lineno != NULL) *lineno = 0; @@ -2164,7 +2659,7 @@ jsfunc_lines(uintptr_t scriptp, if (startline == -1 || endline == -1) { mdb_warn("for script %p, could not determine startline/endline" - " (start %ld, end %ld, nlines %d)", + " (start %ld, end %ld, nlines %d)\n", scriptp, start, end, nlines); mdb_free(buf, bufsz); return; @@ -2253,25 +2748,6 @@ jsfunc_name(uintptr_t funcinfop, char **bufp, size_t *lenp) /* * JavaScript-level object printing */ -typedef struct jsobj_print { - char **jsop_bufp; - size_t *jsop_lenp; - int jsop_indent; - uint64_t jsop_depth; - boolean_t jsop_printaddr; - uintptr_t jsop_baseaddr; - int jsop_nprops; - const char *jsop_member; - boolean_t jsop_found; - boolean_t jsop_descended; -} jsobj_print_t; - -static int jsobj_print_number(uintptr_t, jsobj_print_t *); -static int jsobj_print_oddball(uintptr_t, jsobj_print_t *); -static int jsobj_print_jsobject(uintptr_t, jsobj_print_t *); -static int jsobj_print_jsarray(uintptr_t, jsobj_print_t *); -static int jsobj_print_jsfunction(uintptr_t, jsobj_print_t *); -static int jsobj_print_jsdate(uintptr_t, jsobj_print_t *); static int jsobj_print(uintptr_t addr, jsobj_print_t *jsop) @@ -2374,7 +2850,7 @@ jsobj_print_prop(const char *desc, uintptr_t val, void *arg) char **bufp = jsop->jsop_bufp; size_t *lenp = jsop->jsop_lenp; - (void) bsnprintf(bufp, lenp, "%s\n%*s%s: ", jsop->jsop_nprops == 0 ? + (void) bsnprintf(bufp, lenp, "%s\n%*s\"%s\": ", jsop->jsop_nprops == 0 ? "{" : "", jsop->jsop_indent + 4, "", desc); descend = *jsop; @@ -2435,7 +2911,8 @@ jsobj_print_jsobject(uintptr_t addr, jsobj_print_t *jsop) size_t *lenp = jsop->jsop_lenp; if (jsop->jsop_member != NULL) - return (jsobj_properties(addr, jsobj_print_prop_member, jsop)); + return (jsobj_properties(addr, jsobj_print_prop_member, + jsop, &jsop->jsop_propinfo)); if (jsop->jsop_depth == 0) { (void) bsnprintf(bufp, lenp, "[...]"); @@ -2444,7 +2921,8 @@ jsobj_print_jsobject(uintptr_t addr, jsobj_print_t *jsop) jsop->jsop_nprops = 0; - if (jsobj_properties(addr, jsobj_print_prop, jsop) != 0) + if (jsobj_properties(addr, jsobj_print_prop, jsop, + &jsop->jsop_propinfo) != 0) return (-1); if (jsop->jsop_nprops > 0) { @@ -2757,7 +3235,7 @@ dcmd_v8function(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) } if (read_heap_ptr(&funcinfop, addr, V8_OFF_JSFUNCTION_SHARED) != 0 || - read_heap_ptr(&tokpos, funcinfop, + read_heap_maybesmi(&tokpos, funcinfop, V8_OFF_SHAREDFUNCTIONINFO_FUNCTION_TOKEN_POSITION) != 0 || read_heap_ptr(&scriptp, funcinfop, V8_OFF_SHAREDFUNCTIONINFO_SCRIPT) != 0 || @@ -2765,6 +3243,13 @@ dcmd_v8function(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) read_heap_ptr(&lendsp, scriptp, V8_OFF_SCRIPT_LINE_ENDS) != 0) goto err; + /* + * The token position is normally a SMI, so read_heap_maybesmi() will + * interpret the value for us. However, this code uses its SMI-encoded + * value, so convert it back here. + */ + tokpos = V8_VALUE_SMI(tokpos); + bufp = buf; len = sizeof (buf); if (jsfunc_name(funcinfop, &bufp, &len) != 0) @@ -2797,6 +3282,28 @@ dcmd_v8function(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) return (DCMD_ERR); } +/* + * Access an internal field of a V8 object. + */ +/* ARGSUSED */ +static int +dcmd_v8internal(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) +{ + uintptr_t idx; + uintptr_t fieldaddr; + + if (mdb_getopts(argc, argv, NULL) != argc - 1 || + argv[argc - 1].a_type != MDB_TYPE_STRING) + return (DCMD_USAGE); + + idx = mdb_strtoull(argv[argc - 1].a_un.a_str); + if (obj_v8internal(addr, idx, &fieldaddr) != 0) + return (DCMD_ERR); + + mdb_printf("%p\n", fieldaddr); + return (DCMD_OK); +} + /* ARGSUSED */ static int dcmd_v8frametypes(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) @@ -2918,11 +3425,39 @@ load_current_context(uintptr_t *fpp, uintptr_t *raddrp) return (0); } +typedef struct jsframe { + boolean_t jsf_showall; /* show hidden frames and pointers */ + boolean_t jsf_verbose; /* show arguments and JS code */ + char *jsf_func; /* filter frames for named function */ + char *jsf_prop; /* filter arguments */ + uintptr_t jsf_nlines; /* lines of context (for verbose) */ + uint_t jsf_nskipped; /* skipped frames */ +} jsframe_t; + +static void +jsframe_skip(jsframe_t *jsf) +{ + jsf->jsf_nskipped++; +} + +static void +jsframe_print_skipped(jsframe_t *jsf) +{ + if (jsf->jsf_nskipped == 1) + mdb_printf(" (1 internal frame elided)\n"); + else if (jsf->jsf_nskipped > 1) + mdb_printf(" (%d internal frames elided)\n", + jsf->jsf_nskipped); + jsf->jsf_nskipped = 0; +} + static int -do_jsframe_special(uintptr_t fptr, uintptr_t raddr, char *prop) +do_jsframe_special(uintptr_t fptr, uintptr_t raddr, jsframe_t *jsf) { + uint_t count; uintptr_t ftype; const char *ftypename; + char *prop = jsf->jsf_prop; /* * First see if this looks like a native frame rather than a JavaScript @@ -2930,11 +3465,21 @@ do_jsframe_special(uintptr_t fptr, uintptr_t raddr, char *prop) * symbolically. If that works, we assume this was NOT a V8 frame, * since those are never in the symbol table. */ - if (mdb_snprintf(NULL, 0, "%A", raddr) > 1) { + count = mdb_snprintf(NULL, 0, "%A", raddr); + if (count > 1) { if (prop != NULL) return (0); - mdb_printf("%p %a\n", fptr, raddr); + jsframe_print_skipped(jsf); + if (jsf->jsf_showall) { + mdb_printf("%p %a\n", fptr, raddr); + } else if (count <= 65) { + mdb_printf("native: %a\n", raddr); + } else { + char buf[65]; + mdb_snprintf(buf, sizeof (buf), "%a", raddr); + mdb_printf("native: %s...\n", buf); + } return (0); } @@ -2949,7 +3494,12 @@ do_jsframe_special(uintptr_t fptr, uintptr_t raddr, char *prop) if (prop != NULL) return (0); - mdb_printf("%p %a <%s>\n", fptr, raddr, ftypename); + if (jsf->jsf_showall) { + jsframe_print_skipped(jsf); + mdb_printf("%p %a <%s>\n", fptr, raddr, ftypename); + } else { + jsframe_skip(jsf); + } return (0); } @@ -2964,10 +3514,12 @@ do_jsframe_special(uintptr_t fptr, uintptr_t raddr, char *prop) ftypename = enum_lookup_str(v8_frametypes, V8_SMI_VALUE(ftype), NULL); - if (ftypename != NULL) + if (jsf->jsf_showall && ftypename != NULL) { + jsframe_print_skipped(jsf); mdb_printf("%p %a <%s>\n", fptr, raddr, ftypename); - else - mdb_printf("%p %a\n", fptr, raddr); + } else { + jsframe_skip(jsf); + } return (0); } @@ -2976,9 +3528,14 @@ do_jsframe_special(uintptr_t fptr, uintptr_t raddr, char *prop) } static int -do_jsframe(uintptr_t fptr, uintptr_t raddr, boolean_t verbose, - char *func, char *prop, uintptr_t nlines) +do_jsframe(uintptr_t fptr, uintptr_t raddr, jsframe_t *jsf) { + boolean_t showall = jsf->jsf_showall; + boolean_t verbose = jsf->jsf_verbose; + const char *func = jsf->jsf_func; + const char *prop = jsf->jsf_prop; + uintptr_t nlines = jsf->jsf_nlines; + uintptr_t funcp, funcinfop, tokpos, endpos, scriptp, lendsp, ptrp; uintptr_t ii, nargs; const char *typename; @@ -2991,7 +3548,7 @@ do_jsframe(uintptr_t fptr, uintptr_t raddr, boolean_t verbose, /* * Check for non-JavaScript frames first. */ - if (func == NULL && do_jsframe_special(fptr, raddr, prop) == 0) + if (func == NULL && do_jsframe_special(fptr, raddr, jsf) == 0) return (DCMD_OK); /* @@ -3014,7 +3571,12 @@ do_jsframe(uintptr_t fptr, uintptr_t raddr, boolean_t verbose, if (func != NULL || prop != NULL) return (DCMD_OK); - mdb_printf("%p %a\n", fptr, raddr); + if (showall) { + jsframe_print_skipped(jsf); + mdb_printf("%p %a\n", fptr, raddr); + } else { + jsframe_skip(jsf); + } return (DCMD_OK); } @@ -3022,7 +3584,13 @@ do_jsframe(uintptr_t fptr, uintptr_t raddr, boolean_t verbose, if (func != NULL || prop != NULL) return (DCMD_OK); - mdb_printf("%p %a internal (Code: %p)\n", fptr, raddr, funcp); + if (showall) { + jsframe_print_skipped(jsf); + mdb_printf("%p %a internal (Code: %p)\n", + fptr, raddr, funcp); + } else { + jsframe_skip(jsf); + } return (DCMD_OK); } @@ -3030,8 +3598,13 @@ do_jsframe(uintptr_t fptr, uintptr_t raddr, boolean_t verbose, if (func != NULL || prop != NULL) return (DCMD_OK); - mdb_printf("%p %a unknown (%s: %p)", fptr, raddr, typename, - funcp); + if (showall) { + jsframe_print_skipped(jsf); + mdb_printf("%p %a unknown (%s: %p)", + fptr, raddr, typename, funcp); + } else { + jsframe_skip(jsf); + } return (DCMD_OK); } @@ -3046,19 +3619,33 @@ do_jsframe(uintptr_t fptr, uintptr_t raddr, boolean_t verbose, if (func != NULL && strcmp(buf, func) != 0) return (DCMD_OK); - if (prop == NULL) - mdb_printf("%p %a %s (%p)\n", fptr, raddr, buf, funcp); + if (prop == NULL) { + jsframe_print_skipped(jsf); + if (showall) + mdb_printf("%p %a ", fptr, raddr); + else + mdb_printf("js: "); + mdb_printf("%s", buf); + if (showall) + mdb_printf(" (JSFunction: %p)\n", funcp); + else + mdb_printf("\n"); + } if (!verbose && prop == NULL) return (DCMD_OK); + if (verbose) + jsframe_print_skipped(jsf); + /* * Although the token position is technically an SMI, we're going to * byte-compare it to other SMI values so we don't want decode it here. */ - if (read_heap_ptr(&tokpos, funcinfop, + if (read_heap_maybesmi(&tokpos, funcinfop, V8_OFF_SHAREDFUNCTIONINFO_FUNCTION_TOKEN_POSITION) != 0) return (DCMD_ERR); + tokpos = V8_VALUE_SMI(tokpos); if (read_heap_ptr(&scriptp, funcinfop, V8_OFF_SHAREDFUNCTIONINFO_SCRIPT) != 0) @@ -3077,25 +3664,54 @@ do_jsframe(uintptr_t fptr, uintptr_t raddr, boolean_t verbose, } if (prop == NULL) { - (void) mdb_inc_indent(4); + (void) mdb_inc_indent(10); mdb_printf("file: %s\n", buf); } if (read_heap_ptr(&lendsp, scriptp, V8_OFF_SCRIPT_LINE_ENDS) != 0) return (DCMD_ERR); - if (read_heap_smi(&nargs, funcinfop, + (void) jsfunc_lineno(lendsp, tokpos, buf, sizeof (buf), &lineno); + + if (prop != NULL && strcmp(prop, "posn") == 0) { + mdb_printf("%s\n", buf); + return (DCMD_OK); + } + + if (prop == NULL) + mdb_printf("posn: %s\n", buf); + + if (read_heap_maybesmi(&nargs, funcinfop, V8_OFF_SHAREDFUNCTIONINFO_LENGTH) == 0) { - for (ii = 0; ii < nargs; ii++) { - uintptr_t argptr; - char arg[10]; + uintptr_t argptr; + char arg[10]; + + if (mdb_vread(&argptr, sizeof (argptr), + fptr + V8_OFF_FP_ARGS + nargs * sizeof (uintptr_t)) != -1 && + argptr != NULL) { + (void) snprintf(arg, sizeof (arg), "this"); + if (prop != NULL && strcmp(arg, prop) == 0) { + mdb_printf("%p\n", argptr); + return (DCMD_OK); + } + + if (prop == NULL) { + bufp = buf; + len = sizeof (buf); + (void) obj_jstype(argptr, &bufp, &len, NULL); + mdb_printf("this: %p (%s)\n", argptr, buf); + } + } + + for (ii = 0; ii < nargs; ii++) { if (mdb_vread(&argptr, sizeof (argptr), fptr + V8_OFF_FP_ARGS + (nargs - ii - 1) * sizeof (uintptr_t)) == -1) continue; - (void) snprintf(arg, sizeof (arg), "arg%d", ii + 1); + (void) snprintf(arg, sizeof (arg), "arg%" PRIuPTR, + ii + 1); if (prop != NULL) { if (strcmp(arg, prop) != 0) @@ -3113,28 +3729,20 @@ do_jsframe(uintptr_t fptr, uintptr_t raddr, boolean_t verbose, } } - (void) jsfunc_lineno(lendsp, tokpos, buf, sizeof (buf), &lineno); if (prop != NULL) { - if (strcmp(prop, "posn") == 0) { - mdb_printf("%s\n", buf); - return (DCMD_OK); - } - mdb_warn("unknown frame property '%s'\n", prop); return (DCMD_ERR); } - mdb_printf("posn: %s", buf); - - if (nlines != 0 && read_heap_smi(&endpos, funcinfop, + if (nlines != 0 && read_heap_maybesmi(&endpos, funcinfop, V8_OFF_SHAREDFUNCTIONINFO_END_POSITION) == 0) { jsfunc_lines(scriptp, V8_SMI_VALUE(tokpos), endpos, nlines, "%5d "); + mdb_printf("\n"); } - mdb_printf("\n"); - (void) mdb_dec_indent(4); + (void) mdb_dec_indent(10); return (DCMD_OK); } @@ -3152,6 +3760,7 @@ typedef struct findjsobjects_instance { typedef struct findjsobjects_obj { findjsobjects_prop_t *fjso_props; findjsobjects_prop_t *fjso_last; + jspropinfo_t fjso_propinfo; size_t fjso_nprops; findjsobjects_instance_t fjso_instances; int fjso_ninstances; @@ -3161,6 +3770,17 @@ typedef struct findjsobjects_obj { char fjso_constructor[80]; } findjsobjects_obj_t; +typedef struct findjsobjects_func { + findjsobjects_instance_t fjsf_instances; + int fjsf_ninstances; + avl_node_t fjsf_node; + struct findjsobjects_func *fjsf_next; + uintptr_t fjsf_shared; + char fjsf_funcname[40]; + char fjsf_scriptname[80]; + char fjsf_location[20]; +} findjsobjects_func_t; + typedef struct findjsobjects_stats { int fjss_heapobjs; int fjss_cached; @@ -3169,6 +3789,9 @@ typedef struct findjsobjects_stats { int fjss_objects; int fjss_arrays; int fjss_uniques; + int fjss_funcs; + int fjss_funcs_skipped; + int fjss_funcs_unique; } findjsobjects_stats_t; typedef struct findjsobjects_reference { @@ -3197,10 +3820,12 @@ typedef struct findjsobjects_state { boolean_t fjs_referred; avl_tree_t fjs_tree; avl_tree_t fjs_referents; + avl_tree_t fjs_funcinfo; findjsobjects_referent_t *fjs_head; findjsobjects_referent_t *fjs_tail; findjsobjects_obj_t *fjs_current; findjsobjects_obj_t *fjs_objects; + findjsobjects_func_t *fjs_funcs; findjsobjects_stats_t fjs_stats; } findjsobjects_state_t; @@ -3264,6 +3889,14 @@ findjsobjects_cmp(findjsobjects_obj_t *lhs, findjsobjects_obj_t *rhs) return (rv < 0 ? -1 : rv > 0 ? 1 : 0); } +int +findjsobjects_cmp_funcinfo(findjsobjects_func_t *lhs, + findjsobjects_func_t *rhs) +{ + int diff = lhs->fjsf_shared - rhs->fjsf_shared; + return (diff < 0 ? -1 : diff > 0 ? 1 : 0); +} + int findjsobjects_cmp_referents(findjsobjects_referent_t *lhs, findjsobjects_referent_t *rhs) @@ -3366,6 +3999,71 @@ findjsobjects_constructor(findjsobjects_obj_t *obj) v8_silent--; } +static void +findjsobjects_jsfunc(findjsobjects_state_t *fjs, uintptr_t addr) +{ + findjsobjects_func_t *func, *ofunc; + findjsobjects_instance_t *inst; + uintptr_t funcinfo, script, name; + avl_index_t where; + int err; + char *bufp; + size_t len; + + /* + * This may be somewhat expensive to do for all JSFunctions, but in most + * core files, there aren't that many. We could defer some of this work + * until the user tries to print the function ::jsfunctions, but this + * step is useful to do early to filter out garbage data. + */ + + v8_silent++; + if (read_heap_ptr(&funcinfo, addr, V8_OFF_JSFUNCTION_SHARED) != 0 || + read_heap_ptr(&script, funcinfo, + V8_OFF_SHAREDFUNCTIONINFO_SCRIPT) != 0 || + read_heap_ptr(&name, script, V8_OFF_SCRIPT_NAME) != 0) { + fjs->fjs_stats.fjss_funcs_skipped++; + v8_silent--; + return; + } + + func = mdb_zalloc(sizeof (findjsobjects_func_t), UM_SLEEP); + func->fjsf_ninstances = 1; + func->fjsf_instances.fjsi_addr = addr; + func->fjsf_shared = funcinfo; + + bufp = func->fjsf_funcname; + len = sizeof (func->fjsf_funcname); + err = jsfunc_name(funcinfo, &bufp, &len); + + bufp = func->fjsf_scriptname; + len = sizeof (func->fjsf_scriptname); + err |= jsstr_print(name, JSSTR_NUDE, &bufp, &len); + + v8_silent--; + if (err != 0) { + fjs->fjs_stats.fjss_funcs_skipped++; + mdb_free(func, sizeof (findjsobjects_func_t)); + return; + } + + fjs->fjs_stats.fjss_funcs++; + ofunc = avl_find(&fjs->fjs_funcinfo, func, &where); + if (ofunc == NULL) { + avl_add(&fjs->fjs_funcinfo, func); + func->fjsf_next = fjs->fjs_funcs; + fjs->fjs_funcs = func; + fjs->fjs_stats.fjss_funcs_unique++; + } else { + inst = mdb_alloc(sizeof (findjsobjects_instance_t), UM_SLEEP); + inst->fjsi_addr = addr; + inst->fjsi_next = ofunc->fjsf_instances.fjsi_next; + ofunc->fjsf_instances.fjsi_next = inst; + ofunc->fjsf_ninstances++; + mdb_free(func, sizeof (findjsobjects_func_t)); + } +} + int findjsobjects_range(findjsobjects_state_t *fjs, uintptr_t addr, uintptr_t size) { @@ -3373,6 +4071,7 @@ findjsobjects_range(findjsobjects_state_t *fjs, uintptr_t addr, uintptr_t size) findjsobjects_stats_t *stats = &fjs->fjs_stats; uint8_t type; int jsobject = V8_TYPE_JSOBJECT, jsarray = V8_TYPE_JSARRAY; + int jsfunction = V8_TYPE_JSFUNCTION; caddr_t range = mdb_alloc(size, UM_SLEEP); uintptr_t base = addr, mapaddr; @@ -3411,6 +4110,11 @@ findjsobjects_range(findjsobjects_state_t *fjs, uintptr_t addr, uintptr_t size) continue; } + if (type == jsfunction) { + findjsobjects_jsfunc(fjs, addr); + continue; + } + if (type != jsobject && type != jsarray) continue; @@ -3420,7 +4124,8 @@ findjsobjects_range(findjsobjects_state_t *fjs, uintptr_t addr, uintptr_t size) if (type == jsobject) { if (jsobj_properties(addr, - findjsobjects_prop, fjs) != 0) { + findjsobjects_prop, fjs, + &fjs->fjs_current->fjso_propinfo) != 0) { findjsobjects_free(fjs->fjs_current); fjs->fjs_current = NULL; continue; @@ -3622,7 +4327,7 @@ findjsobjects_references(findjsobjects_state_t *fjs) fjs->fjs_addr = inst->fjsi_addr; (void) jsobj_properties(inst->fjsi_addr, - findjsobjects_references_prop, fjs); + findjsobjects_references_prop, fjs, NULL); } } @@ -3713,6 +4418,26 @@ findjsobjects_match_constructor(findjsobjects_obj_t *obj, mdb_printf("%p\n", obj->fjso_instances.fjsi_addr); } +static void +findjsobjects_match_kind(findjsobjects_obj_t *obj, const char *propkind) +{ + jspropinfo_t p = obj->fjso_propinfo; + + if (((p & JPI_NUMERIC) != 0 && strstr(propkind, "numeric") != NULL) || + ((p & JPI_DICT) != 0 && strstr(propkind, "dict") != NULL) || + ((p & JPI_INOBJECT) != 0 && strstr(propkind, "inobject") != NULL) || + ((p & JPI_PROPS) != 0 && strstr(propkind, "props") != NULL) || + ((p & JPI_HASTRANSITIONS) != 0 && + strstr(propkind, "transitions") != NULL) || + ((p & JPI_HASCONTENT) != 0 && + strstr(propkind, "content") != NULL) || + ((p & JPI_SKIPPED) != 0 && strstr(propkind, "skipped") != NULL) || + ((p & JPI_BADLAYOUT) != 0 && + strstr(propkind, "badlayout") != NULL)) { + mdb_printf("%p\n", obj->fjso_instances.fjsi_addr); + } +} + static int findjsobjects_match(findjsobjects_state_t *fjs, uintptr_t addr, uint_t flags, void (*func)(findjsobjects_obj_t *, const char *), @@ -3820,84 +4545,71 @@ dcmd_findjsobjects_help(void) " -v Provide verbose statistics\n"); } +static findjsobjects_state_t findjsobjects_state; + static int -dcmd_findjsobjects(uintptr_t addr, - uint_t flags, int argc, const mdb_arg_t *argv) +findjsobjects_run(findjsobjects_state_t *fjs) { - static findjsobjects_state_t fjs; - static findjsobjects_stats_t *stats = &fjs.fjs_stats; - findjsobjects_obj_t *obj; struct ps_prochandle *Pr; - boolean_t references = B_FALSE, listlike = B_FALSE; - const char *propname = NULL; - const char *constructor = NULL; - - fjs.fjs_verbose = B_FALSE; - fjs.fjs_brk = B_FALSE; - fjs.fjs_marking = B_FALSE; - fjs.fjs_allobjs = B_FALSE; - - if (mdb_getopts(argc, argv, - 'a', MDB_OPT_SETBITS, B_TRUE, &fjs.fjs_allobjs, - 'b', MDB_OPT_SETBITS, B_TRUE, &fjs.fjs_brk, - 'c', MDB_OPT_STR, &constructor, - 'l', MDB_OPT_SETBITS, B_TRUE, &listlike, - 'm', MDB_OPT_SETBITS, B_TRUE, &fjs.fjs_marking, - 'p', MDB_OPT_STR, &propname, - 'r', MDB_OPT_SETBITS, B_TRUE, &references, - 'v', MDB_OPT_SETBITS, B_TRUE, &fjs.fjs_verbose, - NULL) != argc) - return (DCMD_USAGE); + findjsobjects_obj_t *obj; + findjsobjects_stats_t *stats = &fjs->fjs_stats; - if (!fjs.fjs_initialized) { - avl_create(&fjs.fjs_tree, + if (!fjs->fjs_initialized) { + avl_create(&fjs->fjs_tree, (int(*)(const void *, const void *))findjsobjects_cmp, sizeof (findjsobjects_obj_t), offsetof(findjsobjects_obj_t, fjso_node)); - avl_create(&fjs.fjs_referents, + avl_create(&fjs->fjs_referents, (int(*)(const void *, const void *)) findjsobjects_cmp_referents, sizeof (findjsobjects_referent_t), offsetof(findjsobjects_referent_t, fjsr_node)); - fjs.fjs_initialized = B_TRUE; + avl_create(&fjs->fjs_funcinfo, + (int(*)(const void *, const void*)) + findjsobjects_cmp_funcinfo, + sizeof (findjsobjects_func_t), + offsetof(findjsobjects_func_t, fjsf_node)); + + fjs->fjs_initialized = B_TRUE; } - if (avl_is_empty(&fjs.fjs_tree)) { + if (avl_is_empty(&fjs->fjs_tree)) { findjsobjects_obj_t **sorted; int nobjs, i; hrtime_t start = gethrtime(); if (mdb_get_xdata("pshandle", &Pr, sizeof (Pr)) == -1) { mdb_warn("couldn't read pshandle xdata"); - return (DCMD_ERR); + return (-1); } v8_silent++; if (Pmapping_iter(Pr, - (proc_map_f *)findjsobjects_mapping, &fjs) != 0) { + (proc_map_f *)findjsobjects_mapping, fjs) != 0) { v8_silent--; - return (DCMD_ERR); + return (-1); } - if ((nobjs = avl_numnodes(&fjs.fjs_tree)) != 0) { + if ((nobjs = avl_numnodes(&fjs->fjs_tree)) != 0) { /* * We have the objects -- now sort them. */ sorted = mdb_alloc(nobjs * sizeof (void *), UM_SLEEP | UM_GC); - for (obj = fjs.fjs_objects, i = 0; obj != NULL; + for (obj = fjs->fjs_objects, i = 0; obj != NULL; obj = obj->fjso_next, i++) { sorted[i] = obj; } - qsort(sorted, avl_numnodes(&fjs.fjs_tree), + qsort(sorted, avl_numnodes(&fjs->fjs_tree), sizeof (void *), findjsobjects_cmp_ninstances); - for (i = 1, fjs.fjs_objects = sorted[0]; i < nobjs; i++) + for (i = 1, fjs->fjs_objects = sorted[0]; + i < nobjs; i++) sorted[i - 1]->fjso_next = sorted[i]; sorted[nobjs - 1]->fjso_next = NULL; @@ -3905,7 +4617,7 @@ dcmd_findjsobjects(uintptr_t addr, v8_silent--; - if (fjs.fjs_verbose) { + if (fjs->fjs_verbose) { const char *f = "findjsobjects: %30s => %d\n"; int elapsed = (int)((gethrtime() - start) / NANOSEC); @@ -3917,12 +4629,54 @@ dcmd_findjsobjects(uintptr_t addr, mdb_printf(f, "processed objects", stats->fjss_objects); mdb_printf(f, "processed arrays", stats->fjss_arrays); mdb_printf(f, "unique objects", stats->fjss_uniques); + mdb_printf(f, "functions found", stats->fjss_funcs); + mdb_printf(f, "unique functions", + stats->fjss_funcs_unique); + mdb_printf(f, "functions skipped", + stats->fjss_funcs_skipped); } } + return (0); +} + +static int +dcmd_findjsobjects(uintptr_t addr, + uint_t flags, int argc, const mdb_arg_t *argv) +{ + findjsobjects_state_t *fjs = &findjsobjects_state; + findjsobjects_obj_t *obj; + boolean_t references = B_FALSE, listlike = B_FALSE; + const char *propname = NULL; + const char *constructor = NULL; + const char *propkind = NULL; + + fjs->fjs_verbose = B_FALSE; + fjs->fjs_brk = B_FALSE; + fjs->fjs_marking = B_FALSE; + fjs->fjs_allobjs = B_FALSE; + + if (mdb_getopts(argc, argv, + 'a', MDB_OPT_SETBITS, B_TRUE, &fjs->fjs_allobjs, + 'b', MDB_OPT_SETBITS, B_TRUE, &fjs->fjs_brk, + 'c', MDB_OPT_STR, &constructor, + 'k', MDB_OPT_STR, &propkind, + 'l', MDB_OPT_SETBITS, B_TRUE, &listlike, + 'm', MDB_OPT_SETBITS, B_TRUE, &fjs->fjs_marking, + 'p', MDB_OPT_STR, &propname, + 'r', MDB_OPT_SETBITS, B_TRUE, &references, + 'v', MDB_OPT_SETBITS, B_TRUE, &fjs->fjs_verbose, + NULL) != argc) + return (DCMD_USAGE); + + if (findjsobjects_run(fjs) != 0) + return (DCMD_ERR); + if (listlike && !(flags & DCMD_ADDRSPEC)) { - if (propname != NULL || constructor != NULL) { - char opt = propname != NULL ? 'p' : 'c'; + if (propname != NULL || constructor != NULL || + propkind != NULL) { + char opt = propname != NULL ? 'p' : + propkind != NULL ? 'k' :'c'; mdb_warn("cannot specify -l with -%c; instead, pipe " "output of ::findjsobjects -%c to " @@ -3930,38 +4684,50 @@ dcmd_findjsobjects(uintptr_t addr, return (DCMD_ERR); } - return (findjsobjects_match(&fjs, addr, flags, + return (findjsobjects_match(fjs, addr, flags, findjsobjects_match_all, NULL)); } if (propname != NULL) { - if (constructor != NULL) { + if (constructor != NULL || propkind != NULL) { mdb_warn("cannot specify both a property name " - "and a constructor\n"); + "and a %s\n", constructor != NULL ? + "constructor" : "property kind"); return (DCMD_ERR); } - return (findjsobjects_match(&fjs, addr, flags, + return (findjsobjects_match(fjs, addr, flags, findjsobjects_match_propname, propname)); } if (constructor != NULL) { - return (findjsobjects_match(&fjs, addr, flags, + if (propkind != NULL) { + mdb_warn("cannot specify both a constructor name " + "and a property kind\n"); + return (DCMD_ERR); + } + + return (findjsobjects_match(fjs, addr, flags, findjsobjects_match_constructor, constructor)); } + if (propkind != NULL) { + return (findjsobjects_match(fjs, addr, flags, + findjsobjects_match_kind, propkind)); + } + if (references && !(flags & DCMD_ADDRSPEC) && - avl_is_empty(&fjs.fjs_referents)) { + avl_is_empty(&fjs->fjs_referents)) { mdb_warn("must specify or mark an object to find references\n"); return (DCMD_ERR); } - if (fjs.fjs_marking && !(flags & DCMD_ADDRSPEC)) { + if (fjs->fjs_marking && !(flags & DCMD_ADDRSPEC)) { mdb_warn("must specify an object to mark\n"); return (DCMD_ERR); } - if (references && fjs.fjs_marking) { + if (references && fjs->fjs_marking) { mdb_warn("can't both mark an object and find its references\n"); return (DCMD_ERR); } @@ -3975,14 +4741,14 @@ dcmd_findjsobjects(uintptr_t addr, * specified/marked objects (-r). (Note that the absence of * any of these options implies -l.) */ - inst = findjsobjects_instance(&fjs, addr, &head); + inst = findjsobjects_instance(fjs, addr, &head); if (inst == NULL) { mdb_warn("%p is not a valid object\n", addr); return (DCMD_ERR); } - if (!references && !fjs.fjs_marking) { + if (!references && !fjs->fjs_marking) { for (inst = head; inst != NULL; inst = inst->fjsi_next) mdb_printf("%p\n", inst->fjsi_addr); @@ -3990,24 +4756,24 @@ dcmd_findjsobjects(uintptr_t addr, } if (!listlike) { - findjsobjects_referent(&fjs, inst->fjsi_addr); + findjsobjects_referent(fjs, inst->fjsi_addr); } else { for (inst = head; inst != NULL; inst = inst->fjsi_next) - findjsobjects_referent(&fjs, inst->fjsi_addr); + findjsobjects_referent(fjs, inst->fjsi_addr); } } if (references) - findjsobjects_references(&fjs); + findjsobjects_references(fjs); - if (references || fjs.fjs_marking) + if (references || fjs->fjs_marking) return (DCMD_OK); mdb_printf("%?s %8s %8s %s\n", "OBJECT", "#OBJECTS", "#PROPS", "CONSTRUCTOR: PROPS"); - for (obj = fjs.fjs_objects; obj != NULL; obj = obj->fjso_next) { - if (obj->fjso_malformed && !fjs.fjs_allobjs) + for (obj = fjs->fjs_objects; obj != NULL; obj = obj->fjso_next) { + if (obj->fjso_malformed && !fjs->fjs_allobjs) continue; findjsobjects_print(obj); @@ -4016,21 +4782,90 @@ dcmd_findjsobjects(uintptr_t addr, return (DCMD_OK); } +/* + * Given a Node Buffer object, print out details about it. With "-a", just + * print the address. + */ +/* ARGSUSED */ +static int +dcmd_nodebuffer(uintptr_t addr, uint_t flags, int argc, + const mdb_arg_t *argv) +{ + boolean_t opt_f = B_FALSE; + char buf[80]; + char *bufp = buf; + size_t len = sizeof (buf); + uintptr_t elts, rawbuf; + + /* + * The undocumented "-f" option allows users to override constructor + * checks. + */ + if (mdb_getopts(argc, argv, + 'f', MDB_OPT_SETBITS, B_TRUE, &opt_f, NULL) != argc) + return (DCMD_USAGE); + + if (!opt_f) { + if (obj_jsconstructor(addr, &bufp, &len, B_FALSE) != 0) + return (DCMD_ERR); + + if (strcmp(buf, "Buffer") != 0) { + mdb_warn("%p does not appear to be a buffer\n", addr); + return (DCMD_ERR); + } + } + + if (read_heap_ptr(&elts, addr, V8_OFF_JSOBJECT_ELEMENTS) != 0) + return (DCMD_ERR); + + if (obj_v8internal(elts, 0, &rawbuf) != 0) + return (DCMD_ERR); + + mdb_printf("%p\n", rawbuf); + return (DCMD_OK); +} + +/* ARGSUSED */ +static int +dcmd_jsconstructor(uintptr_t addr, uint_t flags, int argc, + const mdb_arg_t *argv) +{ + boolean_t opt_v = B_FALSE; + char buf[80]; + char *bufp; + size_t len = sizeof (buf); + + if (mdb_getopts(argc, argv, 'v', MDB_OPT_SETBITS, B_TRUE, &opt_v, + NULL) != argc) + return (DCMD_USAGE); + + bufp = buf; + if (obj_jsconstructor(addr, &bufp, &len, opt_v)) + return (DCMD_ERR); + + mdb_printf("%s\n", buf); + return (DCMD_OK); +} + /* ARGSUSED */ static int dcmd_jsframe(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) { uintptr_t fptr, raddr; - boolean_t opt_v = B_FALSE, opt_i = B_FALSE; - char *opt_f = NULL, *opt_p = NULL; - uintptr_t opt_n = 5; + boolean_t opt_i = B_FALSE; + jsframe_t jsf; + int rv; + + bzero(&jsf, sizeof (jsf)); + jsf.jsf_nlines = 5; if (mdb_getopts(argc, argv, - 'v', MDB_OPT_SETBITS, B_TRUE, &opt_v, + 'a', MDB_OPT_SETBITS, B_TRUE, &jsf.jsf_showall, + 'v', MDB_OPT_SETBITS, B_TRUE, &jsf.jsf_verbose, 'i', MDB_OPT_SETBITS, B_TRUE, &opt_i, - 'f', MDB_OPT_STR, &opt_f, - 'n', MDB_OPT_UINTPTR, &opt_n, - 'p', MDB_OPT_STR, &opt_p, NULL) != argc) + 'f', MDB_OPT_STR, &jsf.jsf_func, + 'n', MDB_OPT_UINTPTR, &jsf.jsf_nlines, + 'p', MDB_OPT_STR, &jsf.jsf_prop, NULL) != argc) return (DCMD_USAGE); /* @@ -4040,8 +4875,12 @@ dcmd_jsframe(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) * actually stored with the next frame. For debugging, this can be * overridden with the "-i" option (for "immediate"). */ - if (opt_i) - return (do_jsframe(addr, 0, opt_v, opt_f, opt_p, opt_n)); + if (opt_i) { + rv = do_jsframe(addr, 0, &jsf); + if (rv == 0) + jsframe_print_skipped(&jsf); + return (rv); + } if (mdb_vread(&raddr, sizeof (raddr), addr + sizeof (uintptr_t)) == -1) { @@ -4058,7 +4897,43 @@ dcmd_jsframe(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) if (fptr == NULL) return (DCMD_OK); - return (do_jsframe(fptr, raddr, opt_v, opt_f, opt_p, opt_n)); + rv = do_jsframe(fptr, raddr, &jsf); + if (rv == 0) + jsframe_print_skipped(&jsf); + return (rv); +} + +static void +jsobj_print_propinfo(jspropinfo_t propinfo) +{ + if (propinfo == JPI_NONE) + return; + + mdb_printf("property kind: "); + if ((propinfo & JPI_NUMERIC) != 0) + mdb_printf("numeric-named "); + if ((propinfo & JPI_DICT) != 0) + mdb_printf("dictionary "); + if ((propinfo & JPI_INOBJECT) != 0) + mdb_printf("in-object "); + if ((propinfo & JPI_PROPS) != 0) + mdb_printf("\"properties\" array "); + mdb_printf("\n"); + + if ((propinfo & (JPI_HASTRANSITIONS | JPI_HASCONTENT)) != 0) { + mdb_printf("fallbacks: "); + if ((propinfo & JPI_HASTRANSITIONS) != 0) + mdb_printf("transitions "); + if ((propinfo & JPI_HASCONTENT) != 0) + mdb_printf("content "); + mdb_printf("\n"); + } + + if ((propinfo & JPI_SKIPPED) != 0) + mdb_printf( + "some properties skipped due to unexpected layout\n"); + if ((propinfo & JPI_BADLAYOUT) != 0) + mdb_printf("object has unexpected layout\n"); } /* ARGSUSED */ @@ -4069,6 +4944,7 @@ dcmd_jsprint(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) size_t bufsz = 262144, len = bufsz; jsobj_print_t jsop; boolean_t opt_b = B_FALSE; + boolean_t opt_v = B_FALSE; int rv, i; bzero(&jsop, sizeof (jsop)); @@ -4078,7 +4954,8 @@ dcmd_jsprint(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) i = mdb_getopts(argc, argv, 'a', MDB_OPT_SETBITS, B_TRUE, &jsop.jsop_printaddr, 'b', MDB_OPT_SETBITS, B_TRUE, &opt_b, - 'd', MDB_OPT_UINT64, &jsop.jsop_depth, NULL); + 'd', MDB_OPT_UINT64, &jsop.jsop_depth, + 'v', MDB_OPT_SETBITS, B_TRUE, &opt_v, NULL); if (opt_b) jsop.jsop_baseaddr = addr; @@ -4136,9 +5013,209 @@ dcmd_jsprint(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) mdb_printf("\n"); + if (opt_v) + jsobj_print_propinfo(jsop.jsop_propinfo); + return (DCMD_OK); } +/* ARGSUSED */ +static int +dcmd_jssource(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) +{ + const char *typename; + uintptr_t nlines = 5; + uintptr_t funcinfop, scriptp, funcnamep; + uintptr_t tokpos, endpos; + uint8_t type; + char buf[256]; + char *bufp = buf; + size_t len = sizeof (buf); + + if (mdb_getopts(argc, argv, 'n', MDB_OPT_UINTPTR, &nlines, + NULL) != argc) + return (DCMD_USAGE); + + if (!V8_IS_HEAPOBJECT(addr) || read_typebyte(&type, addr) != 0) { + mdb_warn("%p is not a heap object\n", addr); + return (DCMD_ERR); + } + + typename = enum_lookup_str(v8_types, type, ""); + if (strcmp(typename, "JSFunction") != 0) { + mdb_warn("%p is not a JSFunction\n", addr); + return (DCMD_ERR); + } + + if (read_heap_ptr(&funcinfop, addr, V8_OFF_JSFUNCTION_SHARED) != 0 || + read_heap_ptr(&scriptp, funcinfop, + V8_OFF_SHAREDFUNCTIONINFO_SCRIPT) != 0 || + read_heap_ptr(&funcnamep, scriptp, V8_OFF_SCRIPT_NAME) != 0) { + mdb_warn("%p: failed to find script for function\n", addr); + return (DCMD_ERR); + } + + if (read_heap_maybesmi(&tokpos, funcinfop, + V8_OFF_SHAREDFUNCTIONINFO_FUNCTION_TOKEN_POSITION) != 0 || + read_heap_maybesmi(&endpos, funcinfop, + V8_OFF_SHAREDFUNCTIONINFO_END_POSITION) != 0) { + mdb_warn("%p: failed to find function's boundaries\n", addr); + } + + if (jsstr_print(funcnamep, JSSTR_NUDE, &bufp, &len) == 0) + mdb_printf("file: %s\n", buf); + + if (tokpos != endpos) + jsfunc_lines(scriptp, tokpos, endpos, nlines, "%5d "); + mdb_printf("\n"); + return (DCMD_OK); +} + +/* ARGSUSED */ +static int +dcmd_jsfunctions(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) +{ + findjsobjects_state_t *fjs = &findjsobjects_state; + findjsobjects_func_t *func; + uintptr_t funcinfo; + boolean_t showrange = B_FALSE; + const char *name = NULL, *filename = NULL; + uintptr_t instr = 0; + + if (mdb_getopts(argc, argv, + 'x', MDB_OPT_UINTPTR, &instr, + 'X', MDB_OPT_SETBITS, B_TRUE, &showrange, + 'n', MDB_OPT_STR, &name, + 's', MDB_OPT_STR, &filename, + NULL) != argc) + return (DCMD_USAGE); + + if (findjsobjects_run(fjs) != 0) + return (DCMD_ERR); + + if (!showrange) + mdb_printf("%?s %8s %-40s %s\n", "FUNC", "#FUNCS", "NAME", + "FROM"); + else + mdb_printf("%?s %8s %?s %?s %-40s %s\n", "FUNC", "#FUNCS", + "START", "END", "NAME", "FROM"); + + for (func = fjs->fjs_funcs; func != NULL; func = func->fjsf_next) { + uintptr_t code, ilen; + + funcinfo = func->fjsf_shared; + + if (func->fjsf_location[0] == '\0') { + uintptr_t tokpos, script, lends; + ptrdiff_t tokposoff = + V8_OFF_SHAREDFUNCTIONINFO_FUNCTION_TOKEN_POSITION; + + /* + * We don't want to actually decode the token position + * as an SMI here, so we re-encode it when we pass it to + * jsfunc_lineno() below. + */ + if (read_heap_maybesmi(&tokpos, funcinfo, + tokposoff) != 0 || + read_heap_ptr(&script, funcinfo, + V8_OFF_SHAREDFUNCTIONINFO_SCRIPT) != 0 || + read_heap_ptr(&lends, script, + V8_OFF_SCRIPT_LINE_ENDS) != 0 || + jsfunc_lineno(lends, V8_VALUE_SMI(tokpos), + func->fjsf_location, + sizeof (func->fjsf_location), NULL) != 0) { + func->fjsf_location[0] = '\0'; + } + } + + if (name != NULL && strstr(func->fjsf_funcname, name) == NULL) + continue; + + if (filename != NULL && + strstr(func->fjsf_scriptname, filename) == NULL) + continue; + + code = 0; + ilen = 0; + if ((showrange || instr != 0) && + (read_heap_ptr(&code, funcinfo, + V8_OFF_SHAREDFUNCTIONINFO_CODE) != 0 || + read_heap_ptr(&ilen, code, + V8_OFF_CODE_INSTRUCTION_SIZE) != 0)) { + code = 0; + ilen = 0; + } + + if ((instr != 0 && ilen != 0) && + (instr < code + V8_OFF_CODE_INSTRUCTION_START || + instr >= code + V8_OFF_CODE_INSTRUCTION_START + ilen)) + continue; + + if (!showrange) { + mdb_printf("%?p %8d %-40s %s %s\n", + func->fjsf_instances.fjsi_addr, + func->fjsf_ninstances, func->fjsf_funcname, + func->fjsf_scriptname, func->fjsf_location); + } else { + uintptr_t code, ilen; + + if (read_heap_ptr(&code, funcinfo, + V8_OFF_SHAREDFUNCTIONINFO_CODE) != 0 || + read_heap_ptr(&ilen, code, + V8_OFF_CODE_INSTRUCTION_SIZE) != 0) { + mdb_printf("%?p %8d %?s %?s %-40s %s %s\n", + func->fjsf_instances.fjsi_addr, + func->fjsf_ninstances, "?", "?", + func->fjsf_funcname, func->fjsf_scriptname, + func->fjsf_location); + } else { + mdb_printf("%?p %8d %?p %?p %-40s %s %s\n", + func->fjsf_instances.fjsi_addr, + func->fjsf_ninstances, + code + V8_OFF_CODE_INSTRUCTION_START, + code + V8_OFF_CODE_INSTRUCTION_START + ilen, + func->fjsf_funcname, func->fjsf_scriptname, + func->fjsf_location); + } + } + } + + return (DCMD_OK); +} + +static void +dcmd_jsfunctions_help(void) +{ + mdb_printf("%s\n\n", +"Lists JavaScript functions, optionally filtered by a substring of the\n" +"function name or script filename or by the instruction address. This uses\n" +"the cache created by ::findjsobjects. If ::findjsobjects has not already\n" +"been run, this command runs it automatically without printing the output.\n" +"This can take anywhere from a second to several minutes, depending on the\n" +"size of the core dump.\n" +"\n" +"It's important to keep in mind that each time you create a function in\n" +"JavaScript (even from a function definition that has already been used),\n" +"the VM must create a new object to represent it. For example, if your\n" +"program has a function A that returns a closure B, the VM will create new\n" +"instances of the closure function (B) each time the surrounding function (A)\n" +"is called. To show this, the output of this command consists of one line \n" +"per function definition that appears in the JavaScript source, and the\n" +"\"#FUNCS\" column shows how many different functions were created by VM from\n" +"this definition."); + + mdb_dec_indent(2); + mdb_printf("%OPTIONS%\n"); + mdb_inc_indent(2); + + mdb_printf("%s\n", +" -f file List functions that were defined in a file whose name contains\n" +" this substring.\n" +" -n func List functions whose name contains this substring\n" +" -x instr List functions whose compiled instructions include this address\n" +" -X Show where the function's instructions are stored in memory\n"); +} + /* ARGSUSED */ static int dcmd_v8field(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) @@ -4231,15 +5308,18 @@ dcmd_v8array(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) static int dcmd_jsstack(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) { - uintptr_t raddr, opt_n = 5; - boolean_t opt_v = B_FALSE; - char *opt_f = NULL, *opt_p = NULL; + uintptr_t raddr; + jsframe_t jsf; + + bzero(&jsf, sizeof (jsf)); + jsf.jsf_nlines = 5; if (mdb_getopts(argc, argv, - 'v', MDB_OPT_SETBITS, B_TRUE, &opt_v, - 'f', MDB_OPT_STR, &opt_f, - 'n', MDB_OPT_UINTPTR, &opt_n, - 'p', MDB_OPT_STR, &opt_p, + 'a', MDB_OPT_SETBITS, B_TRUE, &jsf.jsf_showall, + 'v', MDB_OPT_SETBITS, B_TRUE, &jsf.jsf_verbose, + 'f', MDB_OPT_STR, &jsf.jsf_func, + 'n', MDB_OPT_UINTPTR, &jsf.jsf_nlines, + 'p', MDB_OPT_STR, &jsf.jsf_prop, NULL) != argc) return (DCMD_USAGE); @@ -4250,13 +5330,14 @@ dcmd_jsstack(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) */ if (!(flags & DCMD_ADDRSPEC)) { if (load_current_context(&addr, &raddr) != 0 || - do_jsframe(addr, raddr, opt_v, opt_f, opt_p, opt_n) != 0) + do_jsframe(addr, raddr, &jsf) != 0) return (DCMD_ERR); } if (mdb_pwalk_dcmd("jsframe", "jsframe", argc, argv, addr) == -1) return (DCMD_ERR); + jsframe_print_skipped(&jsf); return (DCMD_OK); } @@ -4432,7 +5513,7 @@ walk_jsprop_init(mdb_walk_state_t *wsp) jspw = mdb_zalloc(sizeof (jsprop_walk_data_t), UM_SLEEP | UM_GC); - if (jsobj_properties(addr, walk_jsprop_nprops, jspw) == -1) { + if (jsobj_properties(addr, walk_jsprop_nprops, jspw, NULL) == -1) { mdb_warn("couldn't iterate over properties for %p\n", addr); return (WALK_ERR); } @@ -4440,7 +5521,7 @@ walk_jsprop_init(mdb_walk_state_t *wsp) jspw->jspw_props = mdb_zalloc(jspw->jspw_nprops * sizeof (uintptr_t), UM_SLEEP | UM_GC); - if (jsobj_properties(addr, walk_jsprop_props, jspw) == -1) { + if (jsobj_properties(addr, walk_jsprop_props, jspw, NULL) == -1) { mdb_warn("couldn't iterate over properties for %p\n", addr); return (WALK_ERR); } @@ -4472,17 +5553,32 @@ walk_jsprop_step(mdb_walk_state_t *wsp) */ static const mdb_dcmd_t v8_mdb_dcmds[] = { + /* + * Commands to inspect Node-level state + */ + { "nodebuffer", ":[-a]", + "print details about the given Node Buffer", dcmd_nodebuffer }, + /* * Commands to inspect JavaScript-level state */ - { "jsframe", ":[-iv] [-f function] [-p property] [-n numlines]", + { "jsconstructor", ":[-v]", + "print the constructor for a JavaScript object", + dcmd_jsconstructor }, + { "jsframe", ":[-aiv] [-f function] [-p property] [-n numlines]", "summarize a JavaScript stack frame", dcmd_jsframe }, { "jsprint", ":[-ab] [-d depth] [member]", "print a JavaScript object", dcmd_jsprint }, - { "jsstack", "[-v] [-f function] [-p property] [-n numlines]", + { "jssource", ":[-n numlines]", + "print the source code for a JavaScript function", + dcmd_jssource }, + { "jsstack", "[-av] [-f function] [-p property] [-n numlines]", "print a JavaScript stacktrace", dcmd_jsstack }, { "findjsobjects", "?[-vb] [-r | -c cons | -p prop]", "find JavaScript " "objects", dcmd_findjsobjects, dcmd_findjsobjects_help }, + { "jsfunctions", "[-X] [-s file_filter] [-n name_filter] " + "[-x instr_filter]", "list JavaScript functions", + dcmd_jsfunctions, dcmd_jsfunctions_help }, /* * Commands to inspect V8-level state @@ -4497,6 +5593,8 @@ static const mdb_dcmd_t v8_mdb_dcmds[] = { "manually add a field to a given class", dcmd_v8field }, { "v8function", ":[-d]", "print JSFunction object details", dcmd_v8function }, + { "v8internal", ":[fieldidx]", "print v8 object internal fields", + dcmd_v8internal }, { "v8load", "version", "load canned config for a specific V8 version", dcmd_v8load, dcmd_v8load_help }, { "v8frametypes", NULL, "list known V8 frame types", @@ -4531,19 +5629,24 @@ configure(void) char *success; v8_cfg_t *cfgp = NULL; GElf_Sym sym; + int major, minor, build, patch; - if (mdb_readsym(&v8_major, sizeof (v8_major), + if (mdb_readsym(&major, sizeof (major), "_ZN2v88internal7Version6major_E") == -1 || - mdb_readsym(&v8_minor, sizeof (v8_minor), + mdb_readsym(&minor, sizeof (minor), "_ZN2v88internal7Version6minor_E") == -1 || - mdb_readsym(&v8_build, sizeof (v8_build), + mdb_readsym(&build, sizeof (build), "_ZN2v88internal7Version6build_E") == -1 || - mdb_readsym(&v8_patch, sizeof (v8_patch), + mdb_readsym(&patch, sizeof (patch), "_ZN2v88internal7Version6patch_E") == -1) { mdb_warn("failed to determine V8 version"); return; } + v8_major = major; + v8_minor = minor; + v8_build = build; + v8_patch = patch; mdb_printf("V8 version: %d.%d.%d.%d\n", v8_major, v8_minor, v8_build, v8_patch); diff --git a/deps/mdb_v8/mdb_v8.gyp b/deps/mdb_v8/mdb_v8.gyp index e7bb6599252..89430f25afb 100644 --- a/deps/mdb_v8/mdb_v8.gyp +++ b/deps/mdb_v8/mdb_v8.gyp @@ -4,7 +4,7 @@ 'target_name': 'mdb_v8', 'product_prefix': '', 'type': 'loadable_module', - 'cflags': [ '-fPIC' ], + 'cflags': [ '-fPIC', '-Wno-missing-field-initializers', '-Wno-sign-compare' ], 'sources': [ 'mdb_v8.c', 'mdb_v8_cfg.c', diff --git a/deps/mdb_v8/v8dbg.h b/deps/mdb_v8/v8dbg.h index a66329eacb7..c6517c9fbee 100644 --- a/deps/mdb_v8/v8dbg.h +++ b/deps/mdb_v8/v8dbg.h @@ -39,7 +39,10 @@ * Determine whether a given pointer refers to a SMI, Failure, or HeapObject. */ #define V8_IS_SMI(ptr) (((ptr) & V8_SmiTagMask) == V8_SmiTag) -#define V8_IS_FAILURE(ptr) (((ptr) & V8_FailureTagMask) == V8_FailureTag) +#define V8_IS_FAILURE(ptr) (V8_FailureTagMask != -1 && \ + V8_FailureTagMask != -1 && \ + ((ptr) & V8_FailureTagMask) == V8_FailureTag) + #define V8_IS_HEAPOBJECT(ptr) \ (((ptr) & V8_HeapObjectTagMask) == V8_HeapObjectTag) @@ -48,6 +51,8 @@ * using the upper 31 bits. */ #define V8_SMI_VALUE(smi) ((smi) >> (V8_SmiValueShift + V8_SmiShiftSize)) +#define V8_VALUE_SMI(value) \ + ((value) << (V8_SmiValueShift + V8_SmiShiftSize)) /* * Determine the encoding and representation of a V8 string. @@ -77,4 +82,7 @@ #define V8_DESC_ISFIELD(x) \ ((V8_SMI_VALUE(x) & V8_PROP_TYPE_MASK) == V8_PROP_TYPE_FIELD) +#define V8_PROP_FIELDINDEX(value) \ + ((V8_SMI_VALUE(value) & V8_FIELDINDEX_MASK) >> V8_FIELDINDEX_SHIFT) + #endif /* _V8DBG_H */ diff --git a/deps/npm/.eslintrc b/deps/npm/.eslintrc deleted file mode 100644 index ba331504210..00000000000 --- a/deps/npm/.eslintrc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "env" : { - "node" : true - }, - "rules" : { - "semi": [2, "never"], - "strict": 0, - "quotes": [1, "double", "avoid-escape"], - "no-use-before-define": 0, - "curly": 0, - "no-underscore-dangle": 0, - "no-lonely-if": 1, - "no-unused-vars": [2, {"vars" : "all", "args" : "after-used"}], - "no-mixed-requires": 0, - "space-infix-ops": 0 - } -} diff --git a/deps/npm/.mailmap b/deps/npm/.mailmap new file mode 100644 index 00000000000..84886514da4 --- /dev/null +++ b/deps/npm/.mailmap @@ -0,0 +1,53 @@ +Alex K. Wolfe +Andrew Bradley +Andrew Lunny +Arlo Breault +Benjamin Coe +Benjamin Coe +Brian White +Cedric Nelson +Charlie Robbins +Dalmais Maxence +Danila Gerasimov +David Beitey +Domenic Denicola +Einar Otto Stangvik +Erik Wienhold +Evan Lucas +Evan Lucas +Faiq Raza +Forbes Lindesay +Forrest L Norvell +Gabriel Barros +Geoff Flarity +Isaac Z. Schlueter +Isaac Z. Schlueter isaacs +Jake Verbaten +James Sanders +Jason Smith +Jonas Weber +Julien Meddah +Kris Windham +Lin Clark +Luke Arduini +Maciej Małecki +Max Goodman +Maxim Bogushevich +Maximilian Antoni +Michael Hayes +Nicolas Morel +Olivier Melcher +Ra'Shaun Stovall +Rebecca Turner +Rebecca Turner +Ryan Emery +Sam Mikes +Takaya Kobayashi +Timo Weiß +Tony +Trent Mick +Visnu Pitiyanuvath +Will Elwood +Wout Mertens +Yeonghoon Park +Zeke Sikelianos diff --git a/deps/npm/.travis.yml b/deps/npm/.travis.yml index 2734148642f..e971a85534c 100644 --- a/deps/npm/.travis.yml +++ b/deps/npm/.travis.yml @@ -1,11 +1,15 @@ language: node_js node_js: - - "0.11" + - iojs + - "0.12" - "0.10" + - "0.8" env: - DEPLOY_VERSION=testing before_install: - "npm config set spin false" - - "npm install -g npm@^2" + - "npm install -g npm/npm" - "sudo mkdir -p /var/run/couchdb" -script: "npm run-script tap" +script: "npm run-script test-all" +notifications: + slack: npm-inc:kRqQjto7YbINqHPb1X6nS3g8 diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS index 3c0c0b0ba89..92dee7cfc1e 100644 --- a/deps/npm/AUTHORS +++ b/deps/npm/AUTHORS @@ -4,8 +4,6 @@ Steve Steiner Mikeal Rogers Aaron Blohowiak Martyn Smith -Mathias Pettersson -Brian Hammond Charlie Robbins Francisco Treacy Cliffano Subagio @@ -16,7 +14,6 @@ James Sanders Reid Burke Arlo Breault Timo Derstappen -Bradley Meck Bart Teeuwisse Ben Noordhuis Tor Valamo @@ -25,36 +22,42 @@ Olivier Melcher Tomaž Muraus Evan Meagher Orlando Vazquez +Kai Chen George Miroshnykov Geoff Flarity +Max Goodman Pete Kruckenberg Laurie Harper Chris Wong -Max Goodman Scott Bronson Federico Romero Visnu Pitiyanuvath Irakli Gozalishvili Mark Cahill -Zearin +Tony Iain Sproat Trent Mick Felix Geisendörfer -Conny Brunnkvist +Jameson Little +Conny Brunnkvist Will Elwood +Dean Landolt Oleg Efimov Martin Cooper -Jameson Little -cspotcode -Maciej Małecki +Jann Horn +Andrew Bradley +Maciej Małecki Stephen Sugden +Michael Budde +Jason Smith Gautham Pai David Trejo Paul Vorbach George Ornbo Tim Oxley Tyler Green -atomizer +Dave Pacheco +Danila Gerasimov Rod Vagg Christian Howe Andrew Lunny @@ -63,7 +66,7 @@ Adam Blackburn Kris Windham Jens Grunert Joost-Wim Boekesteijn -Dalmais Maxence +Dalmais Maxence Marcus Ekwall Aaron Stacy Phillip Howell @@ -71,88 +74,217 @@ Domenic Denicola James Halliday Jeremy Cantrell Ribettes -Einar Otto Stangvik Don Park +Einar Otto Stangvik Kei Son Nicolas Morel Mark Dube Nathan Rajlich Maxim Bogushevich -Justin Beckwith Meaglin Ben Evans Nathan Zadoks -Brian White +Brian White Jed Schmidt Ian Livingstone Patrick Pfeiffer Paul Miller -seebees +Ryan Emery Carl Lange Jan Lehnardt -Alexey Kreschuk -Di Wu -Florian Margaine -Forbes Lindesay -Ian Babrou -Jaakko Manninen -Johan Nordberg +Stuart P. Bentley Johan Sköld -Larz Conwell +Stuart Knightley +Niggler +Paolo Fragomeni +Jaakko Manninen Luke Arduini +Larz Conwell Marcel Klehr -Mathias Bynens -Matt Lunn -Matt McClure -Nirk Niggler -Paolo Fragomeni -Jake Verbaten (Raynos) Robert Kowalski -Schabse Laks -Stuart Knightley -Stuart P. Bentley +Forbes Lindesay Vaz Allen +Jake Verbaten +Schabse Laks +Florian Margaine +Johan Nordberg +Ian Babrou +Di Wu +Mathias Bynens +Matt McClure +Matt Lunn +Alexey Kreschuk elisee -Evan You -Wil Moore III -Dylan Greene -zeke -Andrew Horton -Denis Gladkikh -Daniel Santiago -Alex Kocharin -Evan Lucas -Steve Mason -Quinn Slack -Sébastien Santoro -CamilleM -Tom Huang -Sergey Belov -Younghoon Park -Yazhong Liu -Mikola Lysenko -Rafael de Oleza -Yeonghoon Park -Franck Cuny +Robert Gieseke +François Frisch +Trevor Burnham Alan Shaw -Alex Rodionov -Alexej Yaroshevich +TJ Holowaychuk +Nicholas Kinsey +Paulo Cesar Elan Shanker -François Frisch -Gabriel Falkenberg +Jon Spencer Jason Diamond +Maximilian Antoni +Thom Blake Jess Martin -Jon Spencer -Matt Colyer -Matt McClure -Maximilian Antoni -Nicholas Kinsey -Paulo Cesar -Quim Calpe -Robert Gieseke Spain Train -TJ Holowaychuk -Thom Blake -Trevor Burnham +Alex Rodionov +Matt Colyer +Evan You bitspill +Gabriel Falkenberg +Alexej Yaroshevich +Quim Calpe +Steve Mason +Wil Moore III +Sergey Belov +Tom Huang +CamilleM +Sébastien Santoro +Evan Lucas +Quinn Slack +Alex Kocharin +Daniel Santiago +Denis Gladkikh +Andrew Horton +Zeke Sikelianos +Dylan Greene +Franck Cuny +Yeonghoon Park +Rafael de Oleza +Mikola Lysenko +Yazhong Liu Neil Gentleman +Kris Kowal +Alex Gorbatchev +Shawn Wildermuth +Wesley de Souza +yoyoyogi +J. Tangelder +Jean Lauliac +Andrey Kislyuk +Thorsten Lorenz +Julian Gruber +Benjamin Coe +Alex Ford +Matt Hickford +Sean McGivern +C J Silverio +Robin Tweedie +Miroslav Bajtoš +David Glasser +Gianluca Casati +Forrest L Norvell +Karsten Tinnefeld +Bryan Burgers +David Beitey +Evan You +Zach Pomerantz +Chris Williams +sudodoki +Mick Thompson +Felix Rabe +Michael Hayes +Chris Dickinson +Bradley Meck +GeJ +Andrew Terris +Michael Nisi +fengmk2 +Adam Meadows +Chulki Lee +不四 +dead_horse +Kenan Yildirim +Laurie Voss +Rebecca Turner +Hunter Loftis +Peter Richardson +Jussi Kalliokoski +Filip Weiss +Timo Weiß +Christopher Hiller +Jérémy Lal +Anders Janmyr +Chris Meyers +Ludwig Magnusson +Wout Mertens +Nick Santos +Terin Stock +Faiq Raza +Thomas Torp +Sam Mikes +Mat Tyndall +Tauren Mills +Ron Martinez +Kazuhito Hokamura +Tristan Davies +David Volm +Lin Clark +Ben Page +Jeff Jo +martinvd +Mark J. Titorenko +Oddur Sigurdsson +Eric Mill +Gabriel Barros +KevinSheedy +Aleksey Smolenchuk +Ed Morley +Blaine Bublitz +Andrey Fedorov +Daijiro Wachi +Luc Thevenard +Aria Stewart +Charlie Rudolph +Vladimir Rutsky +Isaac Murchie +Marcin Wosinek +David Marr +Bryan English +Anthony Zotti +Karl Horky +Jordan Harband +Guðlaugur Stefán Egilsson +Helge Skogly Holm +Peter A. Shevtsov +Alain Kalker +Bryant Williams +Jonas Weber +Tim Whidden +Andreas +Karolis Narkevicius +Adrian Lynch +Richard Littauer +Oli Evans +Matt Brennan +Jeff Barczewski +Danny Fritz +Takaya Kobayashi +Ra'Shaun Stovall +Julien Meddah +Michiel Sikma +Jakob Krigovsky +Charmander <~@charmander.me> +Erik Wienhold +James Butler +Kevin Kragenbrink +Arnaud Rinquin +Mike MacCana +Antti Mattila +laiso +Matt Zorn +Kyle Mitchell +Jeremiah Senkpiel +Michael Klein +Simen Bekkhus +Victor +thefourtheye +Clay Carpenter +bangbang93 +Nick Malaguti +Cedric Nelson +Kat Marchán +Andrew +Eduardo Pinho diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md index e67cd290927..a2b62ecf174 100644 --- a/deps/npm/CHANGELOG.md +++ b/deps/npm/CHANGELOG.md @@ -1,3 +1,2026 @@ +### v2.11.3 (2015-06-11): + +This was a very quiet week. This release was done by +[@iarna](https://github.com/iarna), while the rest of the team hangs out at +NodeConf Adventure! + +#### TESTS IN 0.8 FAIL LESS + +* [`5b3b3c2`](https://github.com/npm/npm/commit/5b3b3c2) + [#8491](//github.com/npm/npm/pull/8491) + Updates a test to use only 0.8 compatible features + ([@watilde](https://github.com/watilde)) + +#### THE TREADMILL OF UPDATES NEVER CEASES + +* [`9f439da`](https://github.com/npm/npm/commit/9f439da) + `spdx@0.4.1`: License range updates + (@kemitchell)[https://github.com/kemitchell] +* [`2dd055b`](https://github.com/npm/npm/commit/2dd055b) + `normalize-package-data@2.2.1`: Fixes a crashing bug when the package.json + `scripts` property is not an object. + (@iarna)[https://github.com/iarna] +* [`e02e85d`](https://github.com/npm/npm/commit/e02e85d) + `osenv@0.1.2`: Switches to using the `os-tmpdir` module instead of + `os.tmpdir()` for greate consistency in behavior between node versions. + (@iarna)[https://github.com/iarna] +* [`a6f0265`](https://github.com/npm/npm/commit/a6f0265) + `ini@1.3.4` (@isaacs)[https://github.com/isaacs] +* [`7395977`](https://github.com/npm/npm/commit/7395977) + `rimraf@2.4.0` (@isaacs)[https://github.com/isaacs] + +### v2.11.2 (2015-06-04): + +Another small release this week, brought to you by the latest addition to the +CLI team, [@zkat](https://github.com/zkat) (Hi, all!) + +Mostly small documentation tweaks and version updates. Oh! And `npm outdated` +is actually sorted now. Rejoice! + +It's gonna be a while before we get another palindromic version number. Enjoy it +while it lasts. :3 + +#### QUALITY OF LIFE HAS NEVER BEEN BETTER + +* [`31aada4`](https://github.com/npm/npm/commit/31aada4ccc369c0903ff7f233f464955d12c6fe2) + [#8401](https://github.com/npm/npm/issues/8401) `npm outdated` output is just + that much nicer to consume now, due to sorting by name. + ([@watilde](https://github.com/watilde)) +* [`458a919`](https://github.com/npm/npm/commit/458a91925d8b20c5e672ba71a86745aad654abaf) + [#8469](https://github.com/npm/npm/pull/8469) Explicitly set `cwd` for + `preversion`, `version`, and `postversion` scripts. This makes the scripts + findable relative to the root dir. + ([@alexkwolfe](https://github.com/alexkwolfe)) +* [`55d6d71`](https://github.com/npm/npm/commit/55d6d71562e979e745c9db88861cc39f99b9f3ec) + Ensure package name and version are included in display during `npm version` + lifecycle execution. Gets rid of those little `undefined`s in the console. + ([@othiym23](https://github.com/othiym23)) + +#### WORDS HAVE NEVER BEEN QUITE THIS READABLE + +* [`3901e49`](https://github.com/npm/npm/commit/3901e4974c800e7f9fba4a5b2ff88da1126d5ef8) + [#8462](https://github.com/npm/npm/pull/8462) English apparently requires + correspondence between indefinite articles and attached nouns. + ([@Enet4](https://github.com/Enet4)) +* [`5a744e4`](https://github.com/npm/npm/commit/5a744e4b143ef7b2f50c80a1d96fdae4204d452b) + [#8421](https://github.com/npm/npm/pull/8421) The effect of `npm prune`'s + `--production` flag and how to use it have been documented a bit better. + ([@foiseworth](https://github.com/foiseworth)) +* [`eada625`](https://github.com/npm/npm/commit/eada625993485f0a2c5324b06f02bfa0a95ce4bc) + We've updated our `.mailmap` and `AUTHORS` files to make sure credit is given + where credit is due. ([@othiym23](https://github.com/othiym23)) + +#### VERSION NUMBERS HAVE NEVER BEEN BIGGER + +* [`c929fd1`](https://github.com/npm/npm/commit/c929fd1d0604b5878ed05706447e078d3e41f5b3) + `readable-stream@1.1.13`: Manually deduped `v1.1.13` (streams3) to make + deduping more reliable on `npm@<3`. ([@othiym23](https://github.com/othiym23)) +* [`a9b4b78`](https://github.com/npm/npm/commit/a9b4b78dcc85571fd1cdd737903f7f37a5e6a755) + `request@2.57.0`: Replace dependency on IncomingMessage's `.client` with + `.socket` as the former was deprecated in io.js 2.2.0. + ([@othiym23](https://github.com/othiym23)) +* [`4b5e557`](https://github.com/npm/npm/commit/4b5e557a23cdefd521ad154111e3d4dcc81f1cdb) + `abbrev@1.0.7`: Better testing, with coverage. + ([@othiym23](https://github.com/othiym23)) +* [`561affe`](https://github.com/npm/npm/commit/561affee21df9bbea5a47298f2452f533be8f359) + `semver@4.3.6`: .npmignore added for less cruft, and better testing, with coverage. + ([@othiym23](https://github.com/othiym23)) +* [`60aef3c`](https://github.com/npm/npm/commit/60aef3cf5d84d757752db3eb8ede2cb385469e7b) + `graceful-fs@3.0.8`: io.js fixes. + ([@zkat](https://github.com/zkat)) +* [`f8bd453`](https://github.com/npm/npm/commit/f8bd453b1a1c46ba7666cb166595e8a011eae443) + `config-chain@1.1.9`: Added MIT license to package.json + ([@zkat](https://github.com/zkat)) + +### v2.11.1 (2015-05-28): + +This release brought to you from poolside at the Omni Amelia Island Resort and +JSConf 2015, which is why it's so tiny. + +#### CONFERENCE WIFI CAN'T STOP THESE BUG FIXES + +* [`cf109a6`](https://github.com/npm/npm/commit/cf109a682f38a059a994da953d5c1b4aaece5e2f) + [#8381](https://github.com/npm/npm/issues/8381) Documented a subtle gotcha + with `.npmrc`, which is that it needs to have its permissions set such that + only the owner can read or write the file. + ([@colakong](https://github.com/colakong)) +* [`180da67`](https://github.com/npm/npm/commit/180da67c9fa53103d625e2f031626c2453c7ebcd) + [#8365](https://github.com/npm/npm/issues/8365) Git 2.3 adds support for + `GIT_SSH_COMMAND`, which allows you to pass an explicit git command (with, + for example, a specific identity passed in on the command line). + ([@nmalaguti](https://github.com/nmalaguti)) + +#### MY (VIRGIN) PINA COLADA IS GETTING LOW, BETTER UPGRADE THESE DEPENDENCIES + +* [`b72de41`](https://github.com/npm/npm/commit/b72de41c5cc9f0c46d3fa8f062c75bd273641474) + `node-gyp@2.0.0`: Use a newer version of `gyp`, and generally improve support + for Visual Studios and Windows. + ([@TooTallNate](https://github.com/TooTallNate)) +* [`8edbe21`](https://github.com/npm/npm/commit/8edbe210af41e8f248f5bb92c72de92f54fda3b1) + `node-gyp@2.0.1`: Don't crash when Python's version doesn't parse as valid + semver. ([@TooTallNate](https://github.com/TooTallNate)) +* [`ba0e0a8`](https://github.com/npm/npm/commit/ba0e0a845a4f29717aba566b416a27d1a22f5d08) + `glob@5.0.10`: Add coverage to tests. ([@isaacs](https://github.com/isaacs)) +* [`7333701`](https://github.com/npm/npm/commit/7333701b5d4f01673f37d64992c63c4e15864d6d) + `request@2.56.0`: Bug fixes and dependency upgrades. + ([@simov](https://github.com/simov)) + +### v2.11.0 (2015-05-21): + +For the first time in a very long time, we've added new events to the life +cycle used by `npm run-script`. Since running `npm version (major|minor|patch)` +is typically the last thing many developers do before publishing their updated +packages, it makes sense to add life cycle hooks to run tests or otherwise +preflight the package before doing a full publish. Thanks, as always, to the +indefatigable [@watilde](https://github.com/watilde) for yet another great +usability improvement for npm! + +#### FEATURELETS + +* [`b07f7c7`](https://github.com/npm/npm/commit/b07f7c7c1e5021730b3c320f1b3a46e70f8a21ff) + [#7906](https://github.com/npm/npm/issues/7906) + Add new [`scripts`](https://github.com/npm/npm/blob/master/doc/misc/npm-scripts.md) to + allow you to run scripts before and after + the [`npm version`](https://github.com/npm/npm/blob/master/doc/cli/npm-version.md) + command has run. This makes it easy to, for instance, require that your + test suite passes before bumping the version by just adding `"preversion": + "npm test"` to the scripts section of your `package.json`. + ([@watilde](https://github.com/watilde)) +* [`8a46136`](https://github.com/npm/npm/commit/8a46136f42e416cbadb533bcf89d73d681ed421d) + [#8185](https://github.com/npm/npm/issues/8185) + When we get a "not found" error from the registry, we'll now check to see + if the package name you specified is invalid and if so, give you a better + error message. ([@thefourtheye](https://github.com/thefourtheye)) + +#### BUG FIXES + +* [`9bcf573`](https://github.com/npm/npm/commit/9bcf5730bd0316f210dafea898afe9103849cea9) + [#8324](https://github.com/npm/npm/pull/8324) On Windows, when you've configured a + custom `node-gyp`, run it with node itself instead of using the default open action (which + is almost never what you want). ([@bangbang93](https://github.com/bangbang93)) +* [`1da9b04`](https://github.com/npm/npm/commit/1da9b0411d3416c7fca17d08cbbcfca7ae86e92d) + [#7195](https://github.com/npm/npm/issues/7195) + [#7260](https://github.com/npm/npm/issues/7260) `npm-registry-client@6.4.0`: + (Re-)allow publication of existing mixed-case packages (part 1). + ([@smikes](https://github.com/smikes)) +* [`e926783`](https://github.com/npm/npm/commit/e9267830ab261c751f12723e84d2458ae9238646) + [#7195](https://github.com/npm/npm/issues/7195) + [#7260](https://github.com/npm/npm/issues/7260) + `normalize-package-data@2.2.0`: (Re-)allow publication of existing mixed-case + packages (part 2). ([@smikes](https://github.com/smikes)) + +#### DOCUMENTATION IMPROVEMENTS + +* [`f62ee05`](https://github.com/npm/npm/commit/f62ee05333b141539a8e851c620dd2e82ff06860) + [#8314](https://github.com/npm/npm/issues/8314) Update the README to warn + folks away from using the CLI's internal API. For the love of glob, just use a + child process to run the CLI! ([@claycarpenter](https://github.com/claycarpenter)) +* [`1093921`](https://github.com/npm/npm/commit/1093921c04db41ab46db24a170a634a4b2acd8d9) + [#8279](https://github.com/npm/npm/pull/8279) + Update the documentation to note that, yes, you can publish scoped packages to the + public registry now! ([@mantoni](https://github.com/mantoni)) +* [`f87cde5`](https://github.com/npm/npm/commit/f87cde5234a760d3e515ffdaacaed6f5b71dbf44) + [#8292](https://github.com/npm/npm/pull/8292) + Fix typo in an example and grammar in the description in + the [shrinkwrap documentation](https://github.com/npm/npm/blob/master/doc/cli/npm-shrinkwrap.md). + ([@vshih](https://github.com/vshih)) +* [`d3526ce`](https://github.com/npm/npm/commit/d3526ceb09a0c29fdb7d4124536ae09057d033e7) + Improve the formatting in + the [shrinkwrap documentation](https://github.com/npm/npm/blob/master/doc/cli/npm-shrinkwrap.md). + ([@othiym23](https://github.com/othiym23)) +* [`19fe6d2`](https://github.com/npm/npm/commit/19fe6d20883e28956ff916fe4dae42d73ee6195b) + [#8311](https://github.com/npm/npm/pull/8311) + Update [README.md](https://github.com/npm/npm#readme) to use syntax highlighting in + its code samples and bits of shell scripts. ([@SimenB](https://github.com/SimenB)) + +#### DEPENDENCY UPDATES! ALWAYS AND FOREVER! + +* [`fc52160`](https://github.com/npm/npm/commit/fc52160d0223226fffe4166f42fdfd3b899b3c1e) + [#4700](https://github.com/npm/npm/issues/4700) [#5044](https://github.com/npm/npm/issues/5044) + `init-package-json@1.6.0`: Make entering an invalid version while running `npm init` give + you an immediate error and prompt you to correct it. ([@watilde](https://github.com/watilde)) +* [`738853e`](https://github.com/npm/npm/commit/738853eb1f55636476a2a410c2c04732eec9d51e) + [#7763](https://github.com/npm/npm/issues/7763) `fs-write-stream-atomic@1.0.3`: Fix a bug + where errors would not propagate, making error messages unhelpful. + ([@iarna](https://github.com/iarna)) +* [`6d74a2d`](https://github.com/npm/npm/commit/6d74a2d2ac7f92750cf6a2cfafae1af23b569098) + `npm-package-arg@4.0.1`: Fix tests on windows ([@Bacra](https://github.com)) and with + more recent `hosted-git-info`. ([@iarna](https://github.com/iarna)) +* [`50f7178`](https://github.com/npm/npm/commit/50f717852fbf713ef6cbc4e0a9ab42657decbbbd) + `hosted-git-info@2.1.4`: Correct spelling in its documentation. + ([@iarna](https://github.com/iarna)) +* [`d7956ca`](https://github.com/npm/npm/commit/d7956ca17c057d5383ff0d3fc5cf6ac2940b034d) + `glob@5.0.7`: Fix a bug where unusual error conditions could make + further use of the module fail. ([@isaacs](https://github.com/isaacs)) +* [`44f7d74`](https://github.com/npm/npm/commit/44f7d74c5d3181d37da7ea7949c86b344153f8d9) + `tap@1.1.0`: Update to the most recent tap to get a whole host of bug + fixes and integration with [coveralls](https://coveralls.io/). + ([@isaacs](https://github.com/isaacs)) +* [`c21e8a8`](https://github.com/npm/npm/commit/c21e8a8d94bcf0ad79dc583ddc53f8366d4813b3) + `nock@2.2.0` ([@othiym23](https://github.com/othiym23)) + +#### LICENSE FILES FOR THE LICENSE GOD + +* Add missing ISC license file to package ([@kasicka](https://github.com/kasicka)): + * [`aa9908c`](https://github.com/npm/npm/commit/aa9908c20017729673b9d410b77f9a16b7aae8a4) `realize-package-specifier@3.0.1` + * [`23a3b1a`](https://github.com/npm/npm/commit/23a3b1a726b9176c70ce0ccf3cd9d25c54429bdf) `fs-vacuum@1.2.6` + * [`8e04bba`](https://github.com/npm/npm/commit/8e04bba830d4353d84751d21803cd127c96153a7) `dezalgo@1.0.2` + * [`50f7178`](https://github.com/npm/npm/commit/50f717852fbf713ef6cbc4e0a9ab42657decbbbd) `hosted-git-info@2.1.4` + * [`6a54917`](https://github.com/npm/npm/commit/6a54917fbd4df995495a95d4b548defd44b77c93) `write-file-atomic@1.1.2` + * [`971f92c`](https://github.com/npm/npm/commit/971f92c4a4e5514217d1e4db45d1ccf71a60ff19) `async-some@1.0.2` + * [`67b50b7`](https://github.com/npm/npm/commit/67b50b7667a42bb3340a660eb2e617e1a554d2d4) `normalize-git-url@1.0.1` + +#### SPDX LICENSE UPDATES + +* Switch license to + [BSD-2-Clause](http://spdx.org/licenses/BSD-2-Clause.html#licenseText) from + plain "BSD" ([@isaacs](https://github.com/isaacs)): + * [`efdb733`](https://github.com/npm/npm/commit/efdb73332eeedcad4c609796929070b62abb37ab) `npm-user-validate@0.1.2` + * [`e926783`](https://github.com/npm/npm/commit/e9267830ab261c751f12723e84d2458ae9238646) `normalize-package-data@2.2.0` +* Switch license to [ISC](http://spdx.org/licenses/ISC.html#licenseText) from + [BSD](http://spdx.org/licenses/BSD-2-Clause.html#licenseText) + ([@isaacs](https://github.com/isaacs)): + * [`c300956`](https://github.com/npm/npm/commit/c3009565a964f0ead4ac4ab234b1a458e2365f17) `block-stream@0.0.8` + * [`1de1253`](https://github.com/npm/npm/commit/1de125355765fecd31e682ed0ff9d2edbeac0bb0) `lockfile@1.0.1` + * [`0d5698a`](https://github.com/npm/npm/commit/0d5698ab132e376c7aec93ae357c274932116220) `osenv@0.1.1` + * [`2e84921`](https://github.com/npm/npm/commit/2e84921474e1ffb18de9fce4616e73171fa8046d) `abbrev@1.0.6` + * [`872fac9`](https://github.com/npm/npm/commit/872fac9d10c11607e4d0348c08a683b84e64d30b) `chmodr@0.1.1` + * [`01eb7f6`](https://github.com/npm/npm/commit/01eb7f60acba584346ad8aae846657899f3b6887) `chownr@0.0.2` + * [`294336f`](https://github.com/npm/npm/commit/294336f0f31c7b9fe31a50075ed750db6db134d1) `read@1.0.6` + * [`ebdf6a1`](https://github.com/npm/npm/commit/ebdf6a14d17962cdb7128402c53b452f91d44ca7) `graceful-fs@3.0.7` +* Switch license to [ISC](http://spdx.org/licenses/ISC.html#licenseText) from + [MIT](http://spdx.org/licenses/MIT.html#licenseText) + ([@isaacs](https://github.com/isaacs)): + * [`e5d237f`](https://github.com/npm/npm/commit/e5d237fc0f436dd2a89437ebf8a9632a2e35ccbe) `nopt@3.0.2` + * [`79fef14`](https://github.com/npm/npm/commit/79fef1421b78f044980f0d1bf0e97039b6992710) `rimraf@2.3.4` + * [`22527da`](https://github.com/npm/npm/commit/22527da4816e7c2746cdc0317c5fb4a85152d554) `minimatch@2.0.8` + * [`882ac87`](https://github.com/npm/npm/commit/882ac87a6c4123ca985d7ad4394ea5085e5b0ef5) `lru-cache@2.6.4` + * [`9d9d015`](https://github.com/npm/npm/commit/9d9d015a2e972f68664dda54fbb204db28b21ede) `npmlog@1.2.1` + +### v2.10.1 (2015-05-14): + +#### BUG FIXES & DOCUMENTATION TWEAKS + +* [`dc77520`](https://github.com/npm/npm/commit/dc7752013ffce13a3d3f13e518a0052c22fc1158) + When getting back a 404 from a request to a private registry that uses a + registry path that extends past the root + (`http://registry.enterprise.co/path/to/registry`), display the name of the + nonexistent package, rather than the first element in the registry API path. + Sorry, Artifactory users! ([@hayes](https://github.com/hayes)) +* [`f70dea9`](https://github.com/npm/npm/commit/f70dea9b4766f6eaa55012c3e8087e9cb04fd4ce) + Make clearer that `--registry` can be used on a per-publish basis to push a + package to a non-default registry. ([@mischkl](https://github.com/mischkl)) +* [`a3e26f5`](https://github.com/npm/npm/commit/a3e26f5b4465991a941a325468ab7725670d2a94) + Did you know that GitHub shortcuts can have commit-ishes included + (`org/repo#branch`)? They can! ([@iarna](https://github.com/iarna)) +* [`0e2c091`](https://github.com/npm/npm/commit/0e2c091a539b61fdc60423b6bbaaf30c24e4b1b8) + Some errors from `readPackage` were being swallowed, potentially leading to + invalid package trees on disk. ([@smikes](https://github.com/smikes)) + +#### DEPENDENCY UPDATES! STILL! MORE! AGAIN! + +* [`0b901ad`](https://github.com/npm/npm/commit/0b901ad0811d84dda6ca0755a9adc8d47825edd0) + `lru-cache@2.6.3`: Removed some cruft from the published package. + ([@isaacs](https://github.com/isaacs)) +* [`d713e0b`](https://github.com/npm/npm/commit/d713e0b14930c563e3fdb6ac6323bae2a8924652) + `mkdirp@0.5.1`: Made compliant with `standard`, dropped support for Node 0.6, + added (Travis) support for Node 0.12 and io.js. + ([@isaacs](https://github.com/isaacs)) +* [`a2d6578`](https://github.com/npm/npm/commit/a2d6578b6554c5c9d48fe2006751759f4da57520) + `glob@1.0.3`: Updated to use `tap@1`. ([@isaacs](https://github.com/isaacs)) +* [`64cd1a5`](https://github.com/npm/npm/commit/64cd1a570aaa5f24ccba190948ec9456297c97f5) + `fstream@ 1.0.6`: Made compliant with [`standard`](http://npm.im/standard) + (done by [@othiym23](https://github.com/othiym23), and then debugged and + fixed by [@iarna](https://github.com/iarna)), and license changed to ISC. + ([@othiym23](https://github.com/othiym23) / + [@iarna](https://github.com/iarna)) +* [`b527a7c`](https://github.com/npm/npm/commit/b527a7c2ba3c4002f443dd2c536ff4ff41a38b86) + `which@1.1.1`: Callers can pass in their own `PATH` instead of relying on + `process.env`. ([@isaacs](https://github.com/isaacs)) + +### v2.10.0 (2015-05-8): + +#### THE IMPLICATIONS ARE MORE PROFOUND THAN THEY APPEAR + +If you've done much development in The Enterprise®™, you know that keeping +track of software licenses is far more important than one might expect / hope / +fear. Tracking licenses is a hassle, and while many (if not most) of us have +(reluctantly) gotten around to setting a license to use by default with all our +new projects (even if it's just WTFPL), that's about as far as most of us think +about it. In big enterprise shops, ensuring that projects don't inadvertently +use software with unacceptably encumbered licenses is serious business, and +developers spend a surprising (and appalling) amount of time ensuring that +licensing is covered by writing automated checkers and other license auditing +tools. + +The Linux Foundation has been working on a machine-parseable syntax for license +expressions in the form of [SPDX](https://spdx.org/), an appropriately +enterprisey acronym. IP attorney and JavaScript culture hero [Kyle +Mitchell](http://kemitchell.com/) has put a considerable amount of effort into +bringing SPDX to JavaScript and Node. He's written +[`spdx.js`](https://github.com/kemitchell/spdx.js), a JavaScript SPDX +expression parser, and has integrated it into npm in a few different ways. + +For you as a user of npm, this means: + +* npm now has proper support for dual licensing in `package.json`, due to + SPDX's compound expression syntax. Run `npm help package.json` for details. +* npm will warn you if the `package.json` for your project is either missing a + `"license"` field, or if the value of that field isn't a valid SPDX + expression (pro tip: `"BSD"` becomes `"BSD-2-Clause"` in SPDX (unless you + really want one of its variants); `"MIT"` and `"ISC"` are fine as-is; the + [full list](https://github.com/shinnn/spdx-license-ids/blob/master/spdx-license-ids.json) + is its own package). +* `npm init` now demands that you use a valid SPDX expression when using it + interactively (pro tip: I mostly use `npm init -y`, having previously run + `npm config set init.license=MIT` / `npm config set init.author.email=foo` / + `npm config set init.author.name=me`). +* The documentation for `package.json` has been updated to tell you how to use + the `"license"` field properly with SPDX. + +In general, this shouldn't be a big deal for anybody other than people trying +to run their own automated license validators, but in the long run, if +everybody switches to this format, many people's lives will be made much +simpler. I think this is an important improvement for npm and am very thankful +to Kyle for taking the lead on this. Also, even if you think all of this is +completely stupid, just [choose a license](http://en.wikipedia.org/wiki/License-free_software) +anyway. Future you will thank past you someday, unless you are +[djb](http://cr.yp.to/), in which case you are djb, and more power to you. + +* [`8669f7d`](https://github.com/npm/npm/commit/8669f7d88c472ccdd60e140106ac43cca636a648) + [#8179](https://github.com/npm/npm/issues/8179) Document how to use SPDX in + `license` stanzas in `package.json`, including how to migrate from old busted + license declaration arrays to fancy new compound-license clauses. + ([@kemitchell](https://github.com/kemitchell)) +* [`98ad98c`](https://github.com/npm/npm/commit/98ad98cb11f3d3ba29a488ef1ab050b066d9c7f6) + [#8197](https://github.com/npm/npm/issues/8197) `init-package-json@1.5.0` + Ensure that packages bootstrapped with `npm init` use an SPDX-compliant + license expression. ([@kemitchell](https://github.com/kemitchell)) +* [`2ad3905`](https://github.com/npm/npm/commit/2ad3905e9139b0be2b22accf707b814469de813e) + [#8197](https://github.com/npm/npm/issues/8197) + `normalize-package-data@2.1.0`: Warn when a package is missing a license + declaration, or using a license expression that isn't valid SPDX. + ([@kemitchell](https://github.com/kemitchell)) +* [`127bb73`](https://github.com/npm/npm/commit/127bb73ccccc59a1267851c702d8ebd3f3a97e81) + [#8197](https://github.com/npm/npm/issues/8197) `tar@2.1.1`: Switch from + `BSD` to `ISC` for license, where the latter is valid SPDX. + ([@othiym23](https://github.com/othiym23)) +* [`e9a933a`](https://github.com/npm/npm/commit/e9a933a9148180d9d799f99f4154f5110ff2cace) + [#8197](https://github.com/npm/npm/issues/8197) `once@1.3.2`: Switch from + `BSD` to `ISC` for license, where the latter is valid SPDX. + ([@othiym23](https://github.com/othiym23)) +* [`412401f`](https://github.com/npm/npm/commit/412401fb6a19b18f3e02d97a24d4dafed650c186) + [#8197](https://github.com/npm/npm/issues/8197) `semver@4.3.4`: Switch from + `BSD` to `ISC` for license, where the latter is valid SPDX. + ([@othiym23](https://github.com/othiym23)) + +As a corollary to the previous changes, I've put some work into making `npm +install` spew out fewer pointless warnings about missing values in transitive +dependencies. From now on, npm will only warn you about missing READMEs, +license fields, and the like for top-level projects (including packages you +directly install into your application, but we may relax that eventually). + +Practically _nobody_ liked having those warnings displayed for child +dependencies, for the simple reason that there was very little that anybody +could _do_ about those warnings, unless they happened to be the maintainers of +those dependencies themselves. Since many, many projects don't have +SPDX-compliant licenses, the number of warnings reached a level where they ran +the risk of turning into a block of visual noise that developers (read: me, and +probably you) would ignore forever. + +So I fixed it. If you still want to see the messages about child dependencies, +they're still there, but have been pushed down a logging level to `info`. You +can display them by running `npm install -d` or `npm install --loglevel=info`. + +* [`eb18245`](https://github.com/npm/npm/commit/eb18245f55fb4cd62a36867744bcd1b7be0a33e2) + Only warn on normalization errors for top-level dependencies. Transitive + dependency validation warnings are logged at `info` level. + ([@othiym23](https://github.com/othiym23)) + +#### BUG FIXES + +* [`e40e809`](https://github.com/npm/npm/commit/e40e8095d2bc9fa4eb8f01aa22067e0068fa8a54) + `tap@1.0.1`: TAP: The Next Generation. Fix up many tests to they work + properly with the new major version of `node-tap`. Look at all the colors! + ([@isaacs](https://github.com/isaacs)) +* [`f9314e9`](https://github.com/npm/npm/commit/f9314e97d26532c0ef2b03e98f3ed300b7cd5026) + `nock@1.9.0`: Minor tweaks and bug fixes. ([@pgte](https://github.com/pgte)) +* [`45c2b1a`](https://github.com/npm/npm/commit/45c2b1aaa051733fa352074994ae6e569fd51e8b) + [#8187](https://github.com/npm/npm/issues/8187) `npm ls` wasn't properly + recognizing dependencies installed from GitHub repositories as git + dependencies, and so wasn't displaying them as such. + ([@zornme](https://github.com/zornme)) +* [`1ab57c3`](https://github.com/npm/npm/commit/1ab57c38116c0403965c92bf60121f0f251433e4) + In some cases, `npm help` was using something that looked like a regular + expression where a glob pattern should be used, and vice versa. + ([@isaacs](https://github.com/isaacs)) + +### v2.9.1 (2015-04-30): + +#### WOW! MORE GIT FIXES! YOU LOVE THOSE! + +The first item below is actually a pretty big deal, as it fixes (with a +one-word change and a much, much longer test case (thanks again, +[@iarna](https://github.com/iarna))) a regression that's been around for months +now. If you're depending on multiple branches of a single git dependency in a +single project, you probably want to check out `npm@2.9.1` and verify that +things (again?) work correctly in your project. + +* [`178a6ad`](https://github.com/npm/npm/commit/178a6ad540215820d16217465a5f220d8c95a313) + [#7202](https://github.com/npm/npm/issues/7202) When caching git + dependencies, do so by the whole URL, including the branch name, so that if a + single application depends on multiple branches from the same repository (in + practice, multiple version tags), every install is of the correct version, + instead of reusing whichever branch the caching process happened to check out + first. ([@iarna](https://github.com/iarna)) +* [`63b79cc`](https://github.com/npm/npm/commit/63b79ccde092a9cb3b1f34abe43e1d2ba69c0dbf) + [#8084](https://github.com/npm/npm/issues/8084) Ensure that Bitbucket, + GitHub, and Gitlab dependencies are installed the same way as non-hosted git + dependencies, fixing `npm install --link`. + ([@laiso](https://github.com/laiso)) + +#### DOCUMENTATION FIXES AND TWEAKS + +These changes may seem simple and small (except Lin's fix to the package name +restrictions, which was more an egregious oversight on our part), but cleaner +documentation makes npm significantly more pleasant to use. I really appreciate +all the typo fixes, clarifications, and formatting tweaks people send us, and +am delighted that we get so many of these pull requests. Thanks, everybody! + +* [`ca478dc`](https://github.com/npm/npm/commit/ca478dcaa29b8f07cd6fe515a3c4518166819291) + [#8137](https://github.com/npm/npm/issues/8137) Somehow, we had failed to + clearly document the full restrictions on package names. + [@linclark](https://github.com/linclark) has now fixed that, although we will + take with us to our graves the reasons why the maximum package name length is 214 + characters (well, OK, it was that that was the longest name in the registry + when we decided to put a cap on the name length). + ([@linclark](https://github.com/linclark)) +* [`b574076`](https://github.com/npm/npm/commit/b5740767c320c1eff3576a8d63952534a0fbb936) + [#8079](https://github.com/npm/npm/issues/8079) Make the `npm shrinkwrap` + documentation use code formatting for examples consistently. It would be + great to do this for more commands HINT HINT. + ([@RichardLitt](https://github.com/RichardLitt)) +* [`1ff636e`](https://github.com/npm/npm/commit/1ff636e2db3852a53e38c866fed7eafdacd307fc) + [#8105](https://github.com/npm/npm/issues/8105) Document that the global + `npmrc` goes in `$PREFIX/etc/npmrc`, instead of `$PREFIX/npmrc`. + ([@anttti](https://github.com/anttti)) +* [`c3f2f7c`](https://github.com/npm/npm/commit/c3f2f7c299342e1c1eccc55a976a63c607f51621) + [#8127](https://github.com/npm/npm/issues/8127) Document how to use `npm run + build` directly (hint: it's different from `npm build`!). + ([@mikemaccana](https://github.com/mikemaccana)) +* [`873e467`](https://github.com/npm/npm/commit/873e46757e1986761b15353f94580a071adcb383) + [#8069](https://github.com/npm/npm/issues/8069) Take the old, dead npm + mailing list address out of `package.json`. It seems that people don't have + much trouble figuring out how to report errors to npm. + ([@robertkowalski](https://github.com/robertkowalski)) + +#### ENROBUSTIFICATIONMENT + +* [`5abfc9c`](https://github.com/npm/npm/commit/5abfc9c9017da714e47a3aece750836b4f9af6a9) + [#7973](https://github.com/npm/npm/issues/7973) `npm run-script` completion + will only suggest run scripts, instead of including dependencies. If for some + reason you still wanted it to suggest dependencies, let us know. + ([@mantoni](https://github.com/mantoni)) +* [`4b564f0`](https://github.com/npm/npm/commit/4b564f0ce979dc74c09604f4d46fd25a2ee63804) + [#8081](https://github.com/npm/npm/issues/8081) Use `osenv` to parse the + environment's `PATH` in a platform-neutral way. + ([@watilde](https://github.com/watilde)) +* [`a4b6238`](https://github.com/npm/npm/commit/a4b62387b41848818973eeed056fd5c6570274f3) + [#8094](https://github.com/npm/npm/issues/8094) When we refactored the + configuration code to split out checking for IPv4 local addresses, we + inadvertently completely broke it by failing to return the values. In + addition, just the call to `os.getInterfaces()` could throw on systems where + querying the network configuration requires elevated privileges (e.g. Amazon + Lambda). Add the return, and trap errors so they don't cause npm to explode. + Thanks to [@mhart](https://github.com/mhart) for bringing this to our + attention! ([@othiym23](https://github.com/othiym23)) + +#### DEPENDENCY UPDATES WAIT FOR NO SOPHONT + +* [`000cd8b`](https://github.com/npm/npm/commit/000cd8b52104942ac3404f0ad0651d82f573da37) + `rimraf@2.3.3`: More informative assertions on argument validation failure. + ([@isaacs](https://github.com/isaacs)) +* [`530a2e3`](https://github.com/npm/npm/commit/530a2e369128270f3e098f0e9be061533003b0eb) + `lru-cache@2.6.2`: Revert to old key access-time behavior, as it was correct + all along. ([@isaacs](https://github.com/isaacs)) +* [`d88958c`](https://github.com/npm/npm/commit/d88958ca02ce81b027b9919aec539d0145875a59) + `minimatch@2.0.7`: Feature detection and test improvements. + ([@isaacs](https://github.com/isaacs)) +* [`3fa39e4`](https://github.com/npm/npm/commit/3fa39e4d492609d5d045033896dcd99f7b875329) + `nock@1.7.1` ([@pgte](https://github.com/pgte)) + +### v2.9.0 (2015-04-23): + +This week was kind of a breather to concentrate on fixing up the tests on the +`multi-stage` branch, and not mess with git issues for a little while. +Unfortunately, There are now enough severe git issues that we'll probably have +to spend another couple weeks tackling them. In the meantime, enjoy these two +small features. They're just enough to qualify for a semver-minor bump: + +#### NANOFEATURES + +* [`2799322`](https://github.com/npm/npm/commit/279932298ce5b589c5eea9439ac40b88b99c6a4a) + [#7426](https://github.com/npm/npm/issues/7426) Include local modules in `npm + outdated` and `npm update`. ([@ArnaudRinquin](https://github.com/ArnaudRinquin)) +* [`2114862`](https://github.com/npm/npm/commit/21148620fa03a582f4ec436bb16bd472664f2737) + [#8014](https://github.com/npm/npm/issues/8014) The prefix used before the + version on version tags is now configurable via `tag-version-prefix`. Be + careful with this one and read the docs before using it. + ([@kkragenbrink](https://github.com/kkragenbrink)) + +#### OTHER MINOR TWEAKS + +* [`18ce0ec`](https://github.com/npm/npm/commit/18ce0ecd2d94ad3af01e997f1396515892dd363c) + [#3032](https://github.com/npm/npm/issues/3032) `npm unpublish` will now use + the registry set in `package.json`, just like `npm publish`. This only + applies, for now, when unpublishing the entire package, as unpublishing a + single version requires the name be included on the command line and + therefore doesn't read from `package.json`. ([@watilde](https://github.com/watilde)) +* [`9ad2100`](https://github.com/npm/npm/commit/9ad210042242e51d52b2a8b633d8e59248f5faa4) + [#8008](https://github.com/npm/npm/issues/8008) Once again, when considering + what to install on `npm install`, include `devDependencies`. + ([@smikes](https://github.com/smikes)) +* [`5466260`](https://github.com/npm/npm/commit/546626059909dca1906454e820ca4e315c1795bd) + [#8003](https://github.com/npm/npm/issues/8003) Clarify the documentation + around scopes to make it easier to understand how they support private + packages. ([@smikes](https://github.com/smikes)) + +#### DEPENDENCIES WILL NOT STOP UNTIL YOU ARE VERY SLEEPY + +* [`faf65a7`](https://github.com/npm/npm/commit/faf65a7bbb2fad13216f64ed8f1243bafe743f97) + `init-package-json@1.4.2`: If there are multiple validation errors and + warnings, ensure they all get displayed (includes a rad new way of testing + `init-package-json` contributed by + [@michaelnisi](https://github.com/michaelnisi)). + ([@MisumiRize](https://github.com/MisumiRize)) +* [`7f10f38`](https://github.com/npm/npm/commit/7f10f38d29a8423d7cde8103fa7b64ac728da1e0) + `editor@1.0.0`: `1.0.0` is literally more than `0.1.0` (no change aside from + version number). ([@substack](https://github.com/substack)) +* [`4979af3`](https://github.com/npm/npm/commit/4979af3fcae5a3962383b7fdad3162381e62eefe) + [#6805](https://github.com/npm/npm/issues/6805) `npm-registry-client@6.3.3`: + Decode scoped package names sent by the registry so they look nicer. + ([@mmalecki](https://github.com/mmalecki)) + +### v2.8.4 (2015-04-16): + +This is the fourth release of npm this week, so it's mostly just landing a few +small outstanding PRs on dependencies and some tiny documentation tweaks. +`npm@2.8.3` is where the real action is. + +* [`ee2bd77`](https://github.com/npm/npm/commit/ee2bd77f3c64d38735d1d31028224a5c40422a9b) + [#7983](https://github.com/npm/npm/issues/7983) `tar@2.1.0`: Better error + reporting in corrupted tar files, and add support for the `fromBase` flag + (rescued from the dustbin of history by + [@deanmarano](https://github.com/deanmarano)). + ([@othiym23](https://github.com/othiym23)) +* [`d8eee6c`](https://github.com/npm/npm/commit/d8eee6cf9d2ff7aca68dfaed2de76824a3e0d9af) + `init-package-json@1.4.1`: Add support for a default author, and only add + scope to a package name once. ([@othiym23](https://github.com/othiym23)) +* [`4fc5d98`](https://github.com/npm/npm/commit/4fc5d98b785f601c60d4dc0a2c8674f0cccf6262) + `lru-cache@2.6.1`: Small tweaks to cache value aging and entry counting that + are irrelevant to npm. ([@isaacs](https://github.com/isaacs)) +* [`1fe5840`](https://github.com/npm/npm/commit/1fe584089f5bef133de5518aa26eaf6064be2bf7) + [#7946](https://github.com/npm/npm/issues/7946) Make `npm init` text + friendlier. ([@sandfox](https://github.com/sandfox)) + +### v2.8.3 (2015-04-15): + +#### TWO SMALL GIT TWEAKS + +This is the last of a set of releases intended to ensure npm's git support is +robust enough that we can stop working on it for a while. These fixes are +small, but prevent a common crasher and clear up one of the more confusing +error messages coming out of npm when working with repositories hosted on git. + +* [`387f889`](https://github.com/npm/npm/commit/387f889c0e8fb617d9cc9a42ed0a3ec49424ab5d) + [#7961](https://github.com/npm/npm/issues/7961) Ensure that hosted git SSH + URLs always have a valid protocol when stored in `resolved` fields in + `npm-shrinkwrap.json`. ([@othiym23](https://github.com/othiym23)) +* [`394c2f5`](https://github.com/npm/npm/commit/394c2f5a1227232c0baf42fbba1402aafe0d6ffb) + Switch the order in which hosted Git providers are checked to `git:`, + `git+https:`, then `git+ssh:` (from `git:`, `git+ssh:`, then `git+https:`) in + an effort to go from most to least likely to succeed, to make for less + confusing error message. ([@othiym23](https://github.com/othiym23)) + +### v2.8.2 (2015-04-14): + +#### PEACE IN OUR TIME + +npm has been having an issue with CouchDB's web server since the release +of io.js and Node.js 0.12.0 that has consumed a huge amount of my time +to little visible effect. Sam Mikes picked up the thread from me, and +after a [_lot_ of effort](https://github.com/npm/npm/issues/7699#issuecomment-93091111) +figured out that ultimately there are probably a couple problems with +the new HTTP Agent keep-alive handling in new versions of Node. In +addition, `npm-registry-client` was gratuitously sending a body along +with a GET request which was triggering the bugs. Sam removed about 10 bytes from +one file in `npm-registry-client`, and this problem, which has been bugging us for months, +completely went away. + +In conclusion, Sam Mikes is great, and anybody using a private registry +hosted on CouchDB should thank him for his hard work. Also, thanks to +the community at large for pitching in on this bug, which has been +around for months now. + +* [`431c3bf`](https://github.com/npm/npm/commit/431c3bf6cdec50f9f0c735f478cb2f3f337d3313) + [#7699](https://github.com/npm/npm/issues/7699) `npm-registry-client@6.3.2`: + Don't send body with HTTP GET requests when logging in. + ([@smikes](https://github.com/smikes)) + +### v2.8.1 (2015-04-12): + +#### CORRECTION: NPM'S GIT INTEGRATION IS DOING OKAY + +A [helpful bug report](https://github.com/npm/npm/issues/7872#issuecomment-91809553) +led to another round of changes to +[`hosted-git-info`](https://github.com/npm/hosted-git-info/commit/827163c74531b69985d1ede7abced4861e7b0cd4), +some additional test-writing, and a bunch of hands-on testing against actual +private repositories. While the complexity of npm's git dependency handling is +nearly fractal (because npm is very complex, and git is even more complex), +it's feeling way more solid than it has for a while. We think this is a +substantial improvement over what we had before, so give `npm@2.8.1` a shot if +you have particularly complex git use cases and +[let us know](https://github.com/npm/npm/issues/new) how it goes. + +(NOTE: These changes mostly affect cloning and saving references to packages +hosted in git repositories, and don't address some known issues with things +like lifecycle scripts not being run on npm dependencies. Work continues on +other issues that affect parity between git and npm registry packages.) + +* [`66377c6`](https://github.com/npm/npm/commit/66377c6ece2cf4d53d9a618b7d9824e1452bc293) + [#7872](https://github.com/npm/npm/issues/7872) `hosted-git-info@2.1.2`: Pass + through credentials embedded in SSH and HTTPs git URLs. + ([@othiym23](https://github.com/othiym23)) +* [`15efe12`](https://github.com/npm/npm/commit/15efe124753257728a0ddc64074fa5a4b9c2eb30) + [#7872](https://github.com/npm/npm/issues/7872) Use the new version of + `hosted-git-info` to pass along credentials embedded in git URLs. Test it. + Test it a lot. ([@othiym23](https://github.com/othiym23)) + +#### SCOPED DEPENDENCIES AND PEER DEPENDENCIES: NOT QUITE REESE'S + +Big thanks to [@ewie](https://github.com/ewie) for identifying an issue with +how npm was handling `peerDependencies` that were implicitly installed from the +`package.json` files of scoped dependencies. This +[will be a moot point](https://github.com/npm/npm/issues/6565#issuecomment-74971689) +with the release of `npm@3`, but until then, it's important that +`peerDependency` auto-installation work as expected. + +* [`b027319`](https://github.com/npm/npm/commit/b0273190c71eba14395ddfdd1d9f7ba625297523) + [#7920](https://github.com/npm/npm/issues/7920) Scoped packages with + `peerDependencies` were installing the `peerDependencies` into the wrong + directory. ([@ewie](https://github.com/ewie)) +* [`649e31a`](https://github.com/npm/npm/commit/649e31ae4fd02568bae5dc6b4ea783431ce3d63e) + [#7920](https://github.com/npm/npm/issues/7920) Test `peerDependency` + installs involving scoped packages using `npm-package-arg` instead of simple + path tests, for consistency. ([@othiym23](https://github.com/othiym23)) + +#### MAKING IT EASIER TO WRITE NPM TESTS, VERSION 0.0.1 + +[@iarna](https://github.com/iarna) and I +([@othiym23](https://github.com/othiym23)) have been discussing a +[candidate plan](https://github.com/npm/npm/wiki/rewriting-npm's-tests:-a-plan-maybe) +for improving npm's test suite, with the goal of making it easier for new +contributors to get involved with npm by reducing the learning curve +necessary to be able to write good tests for proposed changes. This is the +first substantial piece of that effort. Here's what the commit message for +[`ed7e249`](https://github.com/npm/npm/commit/ed7e249d50444312cd266942ce3b89e1ca049bdf) +had to say about this work: + +> It's too difficult for npm contributors to figure out what the conventional +> style is for tests. Part of the problem is that the documentation in +> CONTRIBUTING.md is inadequate, but another important factor is that the tests +> themselves are written in a variety of styles. One of the most notable +> examples of this is the fact that many tests use fixture directories to store +> precooked test scenarios and package.json files. +> +> This had some negative consequences: +> +> * tests weren't idempotent +> * subtle dependencies between tests existed +> * new tests get written in this deprecated style because it's not +> obvious that the style is out of favor +> * it's hard to figure out why a lot of those directories existed, +> because they served a variety of purposes, so it was difficult to +> tell when it was safe to remove them +> +> All in all, the fixture directories were a major source of technical debt, and +> cleaning them up, while time-consuming, makes the whole test suite much more +> approachable, and makes it more likely that new tests written by outside +> contributors will follow a conventional style. To support that, all of the +> tests touched by this changed were cleaned up to pass the `standard` style +> checker. + +And here's a little extra context from a comment I left on [#7929](https://github.com/npm/npm/issues/7929): + +> One of the other things that encouraged me was looking at this +> [presentation on technical debt](http://www.slideshare.net/nnja/pycon-2015-technical-debt-the-monster-in-your-closet) +> from Pycon 2015, especially slide 53, which I interpreted in terms of +> difficulty getting new contributors to submit patches to an OSS project like +> npm. npm has a long ways to go, but I feel good about this change. + +* [`ed7e249`](https://github.com/npm/npm/commit/ed7e249d50444312cd266942ce3b89e1ca049bdf) + [#7929](https://github.com/npm/npm/issues/7929) Eliminate fixture directories + from `test/tap`, leaving each test self-contained. + ([@othiym23](https://github.com/othiym23)) +* [`4928d30`](https://github.com/npm/npm/commit/4928d30140821c63e03fffed73f8d88ebdc43710) + [#7929](https://github.com/npm/npm/issues/7929) Move fixture files from + `test/tap/*` to `test/fixtures`. ([@othiym23](https://github.com/othiym23)) +* [`e925deb`](https://github.com/npm/npm/commit/e925debca91092a814c1a00933babc3a8cf975be) + [#7929](https://github.com/npm/npm/issues/7929) Tweak the run scripts to stop + slaughtering the CPU on doc rebuild. + ([@othiym23](https://github.com/othiym23)) +* [`65bf7cf`](https://github.com/npm/npm/commit/65bf7cffaf91c426b676c47529eee796f8b8b75c) + [#7923](https://github.com/npm/npm/issues/7923) Use an alias of scripts and + run-scripts in `npm run test-all` ([@watilde](https://github.com/watilde)) +* [`756a3fb`](https://github.com/npm/npm/commit/756a3fbb852a2469afe706635ed88d22c37743e5) + [#7923](https://github.com/npm/npm/issues/7923) Sync timeout time of `npm + run-script test-all` to be the same as `test` and `tap` scripts. + ([@watilde](https://github.com/watilde)) +* [`8299b5f`](https://github.com/npm/npm/commit/8299b5fb6373354a7fbaab6f333863758812ae90) + Set a timeout for tap tests for `npm run-script test-all`. + ([@othiym23](https://github.com/othiym23)) + +#### THE EVER-BEATING DRUM OF DEPENDENCY UPDATES + +* [`d90d0b9`](https://github.com/npm/npm/commit/d90d0b992acbf62fd5d68debf9d1dbd6cfa20804) + [#7924](https://github.com/npm/npm/issues/7924) Remove `child-process-close`, + as it was included for Node 0.6 compatibility, and npm no longer supports + 0.6. ([@robertkowalski](https://github.com/robertkowalski)) +* [`16427c1`](https://github.com/npm/npm/commit/16427c1f3ea3d71ee753c62eb4c2663c7b32b84f) + `lru-cache@2.5.2`: More accurate updating of expiry times when `maxAge` is + set. ([@isaacs](https://github.com/isaacs)) +* [`03cce83`](https://github.com/npm/npm/commit/03cce83b64344a9e0fe036dce214f4d68cfcc9e7) + `nock@1.6.0`: Mocked network error handling. + ([@pgte](https://github.com/pgte)) +* [`f93b1f0`](https://github.com/npm/npm/commit/f93b1f0b7eb5d1b8a7967e837bbd756db1091d00) + `glob@5.0.5`: Use `path-is-absolute` polyfill, allowing newer Node.js and + io.js versions to use `path.isAbsolute()`. + ([@sindresorhus](https://github.com/sindresorhus)) +* [`a70d694`](https://github.com/npm/npm/commit/a70d69495a6e96997e64855d9e749d943ee6d64f) + `request@2.55.0`: Bug fixes and simplification. + ([@simov](https://github.com/simov)) +* [`2aecc6f`](https://github.com/npm/npm/commit/2aecc6f4083526feeb14615b4e5484edc66175b5) + `columnify@1.5.1`: Switch to using babel from 6to5. + ([@timoxley](https://github.com/timoxley)) + +### v2.8.0 (2015-04-09): + +#### WE WILL NEVER BE DONE FIXING NPM'S GIT SUPPORT + +If you look at [the last release's release +notes](https://github.com/npm/npm/blob/master/CHANGELOG.md#git-mean-git-tuff-git-all-the-way-away-from-my-stuff), +you will note that they confidently assert that it's perfectly OK to force all +GitHub URLs through the same `git:` -> `git+ssh:` fallback flow for cloning. It +turns out that many users depend on `git+https:` URLs in their build +environments because they use GitHub auth tokens instead of SSH keys. Also, in +some cases you just want to be able to explicitly say how a given dependency +should be cloned from GitHub. + +Because of the way we resolved the inconsistency in GitHub shorthand handling +[before](https://github.com/npm/npm/blob/master/CHANGELOG.md#bug-fixes-1), this +turned out to be difficult to work around. So instead of hacking around it, we +completely redid how git is handled within npm and its attendant packages. +Again. This time, we changed things so that `normalize-package-data` and +`read-package-json` leave more of the git logic to npm itself, which makes +handling shorthand syntax consistently much easier, and also allows users to +resume using explicit, fully-qualified git URLs without npm messing with them. + +Here's a summary of what's changed: + +* Instead of converting the GitHub shorthand syntax to a `git+ssh:`, `git:`, or + `git+https:` URL and saving that, save the shorthand itself to + `package.json`. +* If presented with shortcuts, try cloning via the git protocol, SSH, and HTTPS + (in that order). +* No longer prompt for credentials -- it didn't work right with the spinner, + and wasn't guaranteed to work anyway. We may experiment with doing this a + better way in the future. Users can override this by setting `GIT_ASKPASS` in + their environment if they want to experiment with interactive cloning, but + should also set `--no-spin` on the npm command line (or run `npm config set + spin=false`). +* **EXPERIMENTAL FEATURE**: Add support for `github:`, `gist:`, `bitbucket:`, + and `gitlab:` shorthand prefixes. GitHub shortcuts will continue to be + normalized to `org/repo` instead of being saved as `github:org/repo`, but + `gitlab:`, `gist:`, and `bitbucket:` prefixes will be used on the command + line and from `package.json`. BE CAREFUL WITH THIS. `package.json` files + published with the new shorthand syntax can _only_ be read by `npm@2.8.0` and + later, and this feature is mostly meant for playing around with it. If you + want to save git dependencies in a form that older versions of npm can read, + use `--save-exact`, which will save the git URL and resolved commit hash of + the head of the branch in a manner similar to the way that `--save-exact` + pins versions for registry dependencies. This is documented (so check `npm + help install` for details), but we're not going to make a lot of noise about + it until it has a chance to bake in a little more. + +It is [@othiym23](https://github.com/othiym23)'s sincere hope that this will +resolve all of the inconsistencies users were seeing with GitHub and git-hosted +packages, but given the level of change here, that may just be a fond wish. +Extra testing of this change is requested. + +* [`6b0f588`](https://github.com/npm/npm/commit/6b0f58877f37df9904490ffbaaad33862bd36dce) + [#7867](https://github.com/npm/npm/issues/7867) Use git shorthand and git + URLs as presented by user. Support new `hosted-git-info` shortcut syntax. + Save shorthand in `package.json`. Try cloning via `git:`, `git+ssh:`, and + `git+https:`, in that order, when supported by the underlying hosting + provider. ([@othiym23](https://github.com/othiym23)) +* [`75d4267`](https://github.com/npm/npm/commit/75d426787869d54ca7400408f562f971b34649ef) + [#7867](https://github.com/npm/npm/issues/7867) Document new GitHub, GitHub + gist, Bitbucket, and GitLab shorthand syntax. + ([@othiym23](https://github.com/othiym23)) +* [`7d92c75`](https://github.com/npm/npm/commit/7d92c7592998d90ec883fa989ca74f04ec1b93de) + [#7867](https://github.com/npm/npm/issues/7867) When `--save-exact` is used + with git shorthand or URLs, save the fully-resolved URL, with branch name + resolved to the exact hash for the commit checked out. + ([@othiym23](https://github.com/othiym23)) +* [`9220e59`](https://github.com/npm/npm/commit/9220e59f8def8c82c6d331a39ba29ad4c44e3a9b) + [#7867](https://github.com/npm/npm/issues/7867) Ensure that non-prefixed and + non-normalized GitHub shortcuts are saved to `package.json`. + ([@othiym23](https://github.com/othiym23)) +* [`dd398e9`](https://github.com/npm/npm/commit/dd398e98a8eba27eeba84378200da3d078fdf980) + [#7867](https://github.com/npm/npm/issues/7867) `hosted-git-info@2.1.1`: + Ensure that `gist:` shorthand survives being round-tripped through + `package.json`. ([@othiym23](https://github.com/othiym23)) +* [`33d1420`](https://github.com/npm/npm/commit/33d1420bf2f629332fceb2ac7e174e63ac48f96a) + [#7867](https://github.com/npm/npm/issues/7867) `hosted-git-info@2.1.0`: Add + support for auth embedded directly in git URLs. + ([@othiym23](https://github.com/othiym23)) +* [`23a1d5a`](https://github.com/npm/npm/commit/23a1d5a540e8db27f5cd0245de7c3694e2bddad1) + [#7867](https://github.com/npm/npm/issues/7867) `hosted-git-info@2.0.2`: Make + it possible to determine in which form a hosted git URL was passed. + ([@iarna](https://github.com/iarna)) +* [`eaf75ac`](https://github.com/npm/npm/commit/eaf75acb718611ad5cfb360084ec86938d9c66c5) + [#7867](https://github.com/npm/npm/issues/7867) + `normalize-package-data@2.0.0`: Normalize GitHub specifiers so they pass + through shortcut syntax and preserve explicit URLs. + ([@iarna](https://github.com/iarna)) +* [`95e0535`](https://github.com/npm/npm/commit/95e0535e365e0aca49c634dd2061a0369b0475f1) + [#7867](https://github.com/npm/npm/issues/7867) `npm-package-arg@4.0.0`: Add + git URL and shortcut to hosted git spec and use `hosted-git-info@2.0.2`. + ([@iarna](https://github.com/iarna)) +* [`a808926`](https://github.com/npm/npm/commit/a8089268d5f3d57f42dbaba02ff6437da5121191) + [#7867](https://github.com/npm/npm/issues/7867) + `realize-package-specifier@3.0.0`: Use `npm-package-arg@4.0.0` and test + shortcut specifier behavior. ([@iarna](https://github.com/iarna)) +* [`6dd1e03`](https://github.com/npm/npm/commit/6dd1e039bddf8cf5383343f91d84bc5d78acd083) + [#7867](https://github.com/npm/npm/issues/7867) `init-package-json@1.4.0`: + Allow dependency on `read-package-json@2.0.0`. + ([@iarna](https://github.com/iarna)) +* [`63254bb`](https://github.com/npm/npm/commit/63254bb6358f66752aca6aa1a275271b3ae03f7c) + [#7867](https://github.com/npm/npm/issues/7867) `read-installed@4.0.0`: Use + `read-package-json@2.0.0`. ([@iarna](https://github.com/iarna)) +* [`254b887`](https://github.com/npm/npm/commit/254b8871f5a173bb464cc5b0ace460c7878b8097) + [#7867](https://github.com/npm/npm/issues/7867) `read-package-json@2.0.0`: + Use `normalize-package-data@2.0.0`. ([@iarna](https://github.com/iarna)) +* [`0b9f8be`](https://github.com/npm/npm/commit/0b9f8be62fe5252abe54d49e36a696f4816c2eca) + [#7867](https://github.com/npm/npm/issues/7867) `npm-registry-client@6.3.0`: + Mark compatibility with `normalize-package-data@2.0.0` and + `npm-package-arg@4.0.0`. ([@iarna](https://github.com/iarna)) +* [`f40ecaa`](https://github.com/npm/npm/commit/f40ecaad68f77abc50eb6f5b224e31dec3d250fc) + [#7867](https://github.com/npm/npm/issues/7867) Extract a common method to + use when cloning git repos for testing. + ([@othiym23](https://github.com/othiym23)) + +#### TEST FIXES FOR NODE 0.8 + +npm continues to [get closer](https://github.com/npm/npm/issues/7842) to being +completely green on Travis for Node 0.8. + +* [`26d36e9`](https://github.com/npm/npm/commit/26d36e9cf0eca69fe1863d2ea536c28555b9e8de) + [#7842](https://github.com/npm/npm/issues/7842) When spawning child + processes, map exit code 127 to ENOENT so Node 0.8 handles child process + failures the same as later versions. + ([@SonicHedgehog](https://github.com/SonicHedgehog)) +* [`54cd895`](https://github.com/npm/npm/commit/54cd8956ea783f96749e46597d8c2cb9397c5d5f) + [#7842](https://github.com/npm/npm/issues/7842) Node 0.8 requires -e with -p + when evaluating snippets; fix test. + ([@SonicHedgehog](https://github.com/SonicHedgehog)) + +#### SMALL FIX AND DOC TWEAK + +* [`20e9003`](https://github.com/npm/npm/commit/20e90031b847e9f7c7168f3dad8b1e526f9a2586) + `tar@2.0.1`: Fix regression where relative symbolic links within an + extraction root that pointed within an extraction root would get normalized + to absolute symbolic links. ([@isaacs](https://github.com/isaacs)) +* [`2ef8898`](https://github.com/npm/npm/commit/2ef88989c41bee1578570bb2172c90ede129dbd1) + [#7879](https://github.com/npm/npm/issues/7879) Better document that `npm + publish --tag=foo` will not set `latest` to that version. + ([@linclark](https://github.com/linclark)) + +### v2.7.6 (2015-04-02): + +#### GIT MEAN, GIT TUFF, GIT ALL THE WAY AWAY FROM MY STUFF + +Part of the reason that we're reluctant to take patches to how npm deals with +git dependencies is that every time we touch the git support, something breaks. +The last few releases are a case in point. `npm@2.7.4` completely broke +installing private modules from GitHub, and `npm@2.7.5` fixed them at the cost +of logging a misleading error message that caused many people to believe that +their dependencies hadn't been successfully installed when they actually had +been. + +This all started from a desire to ensure that GitHub shortcut syntax is being +handled correctly. The correct behavior is for npm to try to clone all +dependencies on GitHub (whether they're specified with the GitHub +`organization/repository` shortcut syntax or not) via the plain `git:` protocol +first, and to fall back to using `git+ssh:` if `git:` doesn't work. Previously, +sometimes npm would use `git:` and `git+ssh:` in some cases (most notably when +using GitHub shortcut syntax on the command line), and use `git+https:` in +others (when the GitHub shortcut syntax was present in `package.json`). This +led to subtle and hard-to-understand inconsistencies, and we're glad that as of +`npm@2.7.6`, we've finally gotten things to where they were before we started, +only slightly more consistent overall. + +We are now going to go back to our policy of being extremely reluctant to touch +the code that handles Git dependencies. + +* [`b747593`](https://github.com/npm/npm/commit/b7475936f473f029e6a027ba1b16277523747d0b) + [#7630](https://github.com/npm/npm/issues/7630) Don't automatically log all + git failures as errors. `maybeGithub` needs to be able to fail without + logging to support its fallback logic. + ([@othiym23](https://github.com/othiym23)) +* [`cd67a0d`](https://github.com/npm/npm/commit/cd67a0db07891d20871822696c26692c8a84866a) + [#7829](https://github.com/npm/npm/issues/7829) When fetching a git remote + URL, handle failures gracefully (without assuming standard output exists). + ([@othiym23](https://github.com/othiym23)) +* [`637c7d1`](https://github.com/npm/npm/commit/637c7d1411fe07f409cf91f2e65fd70685cb253c) + [#7829](https://github.com/npm/npm/issues/7829) When fetching a git remote + URL, handle failures gracefully (without assuming standard _error_ exists). + ([@othiym23](https://github.com/othiym23)) + +#### OTHER SIGNIFICANT FIXES + +* [`78005eb`](https://github.com/npm/npm/commit/78005ebb6f4103c20f077669c3929b7ea46a4c0d) + [#7743](https://github.com/npm/npm/issues/7743) Always quote arguments passed + to `npm run-script`. This allows build systems and the like to safely escape + glob patterns passed as arguments to `run-scripts` with `npm run-script + + + +
+ +

npm-access

Set access level on published packages

+

SYNOPSIS

+
npm access public [<package>]
+npm access restricted [<package>]
+
+npm access add <read-only|read-write> <entity> [<package>]
+npm access rm <entity> [<package>]
+
+npm access ls [<package>]
+npm access edit [<package>]
+

DESCRIPTION

+

Used to set access controls on private packages.

+

For all of the subcommands, npm access will perform actions on the packages +in the current working directory if no package name is passed to the +subcommand.

+
    +
  • public / restricted: +Set a package to be either publicly accessible or restricted.

    +
  • +
  • add / rm: +Add or remove the ability of users and teams to have read-only or read-write +access to a package.

    +
  • +
  • ls: +Show all of the access privileges for a package. Will only show permissions +for packages to which you have at least read access.

    +
  • +
  • edit: +Set the access privileges for a package at once using $EDITOR.

    +
  • +
+

DETAILS

+

npm access always operates directly on the current registry, configurable +from the command line using --registry=<registry url>.

+

Unscoped packages are always public.

+

Scoped packages default to restricted, but you can either publish them as +public using npm publish --access=public, or set their access as public using +npm access public after the initial publish.

+

You must have privileges to set the access of a package:

+
    +
  • You are an owner of an unscoped or scoped package.
  • +
  • You are a member of the team that owns a scope.
  • +
  • You have been given read-write privileges for a package, either as a member +of a team or directly as an owner.
  • +
+

If your account is not paid, then attempts to publish scoped packages will fail +with an HTTP 402 status code (logically enough), unless you use +--access=public.

+

SEE ALSO

+ + +
+ + + + + + + + + + + + diff --git a/deps/npm/html/doc/cli/npm-adduser.html b/deps/npm/html/doc/cli/npm-adduser.html index 84f0ac389ef..5eda2bf5ce6 100644 --- a/deps/npm/html/doc/cli/npm-adduser.html +++ b/deps/npm/html/doc/cli/npm-adduser.html @@ -17,11 +17,12 @@

SYNOPSIS

save the credentials to the .npmrc file. If no registry is specified, the default registry will be used (see npm-config(7)).

The username, password, and email are read in from prompts.

-

You may use this command to change your email address, but not username -or password.

-

To reset your password, go to https://www.npmjs.org/forgot

+

To reset your password, go to https://www.npmjs.com/forgot

+

To change your email address, go to https://www.npmjs.com/email-edit

You may use this command multiple times with the same user account to -authorize on a new machine.

+authorize on a new machine. When authenticating on a new machine, +the username, password and email address must all match with +your existing record.

npm login is an alias to adduser and behaves exactly the same way.

CONFIGURATION

registry

@@ -44,7 +45,7 @@

always-auth

npm adduser --registry=http://private-registry.example.com --always-auth
 

This will ensure that all requests to that registry (including for tarballs) include an authorization header. See always-auth in npm-config(7) for more -details on always-auth. Registry-specific configuaration of always-auth takes +details on always-auth. Registry-specific configuration of always-auth takes precedence over any global configuration.

SEE ALSO

    @@ -67,5 +68,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-bin.html b/deps/npm/html/doc/cli/npm-bin.html index 7f6e3a5c0dd..000641e2e5e 100644 --- a/deps/npm/html/doc/cli/npm-bin.html +++ b/deps/npm/html/doc/cli/npm-bin.html @@ -35,5 +35,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-bugs.html b/deps/npm/html/doc/cli/npm-bugs.html index 7758efa7264..62539c0ddce 100644 --- a/deps/npm/html/doc/cli/npm-bugs.html +++ b/deps/npm/html/doc/cli/npm-bugs.html @@ -54,5 +54,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-build.html b/deps/npm/html/doc/cli/npm-build.html index ca62cb24651..b6b1b9c3bb9 100644 --- a/deps/npm/html/doc/cli/npm-build.html +++ b/deps/npm/html/doc/cli/npm-build.html @@ -18,8 +18,10 @@

    SYNOPSIS

DESCRIPTION

This is the plumbing command called by npm link and npm install.

-

It should generally not be called directly.

-

SEE ALSO

+

It should generally be called during installation, but if you need to run it +directly, run:

+
npm run-script build
+

SEE ALSO

  • npm-install(1)
  • npm-link(1)
  • @@ -38,5 +40,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-bundle.html b/deps/npm/html/doc/cli/npm-bundle.html index 9b833d0b6dd..f9b1deea9a9 100644 --- a/deps/npm/html/doc/cli/npm-bundle.html +++ b/deps/npm/html/doc/cli/npm-bundle.html @@ -31,5 +31,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-cache.html b/deps/npm/html/doc/cli/npm-cache.html index 53835b35db3..4f174bbc440 100644 --- a/deps/npm/html/doc/cli/npm-cache.html +++ b/deps/npm/html/doc/cli/npm-cache.html @@ -81,5 +81,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-completion.html b/deps/npm/html/doc/cli/npm-completion.html index 5a678ba352f..2632938af4e 100644 --- a/deps/npm/html/doc/cli/npm-completion.html +++ b/deps/npm/html/doc/cli/npm-completion.html @@ -42,5 +42,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-config.html b/deps/npm/html/doc/cli/npm-config.html index d97845e708a..376bbd48067 100644 --- a/deps/npm/html/doc/cli/npm-config.html +++ b/deps/npm/html/doc/cli/npm-config.html @@ -66,5 +66,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-dedupe.html b/deps/npm/html/doc/cli/npm-dedupe.html index bf6c9974ea4..b93f3fcb75a 100644 --- a/deps/npm/html/doc/cli/npm-dedupe.html +++ b/deps/npm/html/doc/cli/npm-dedupe.html @@ -63,5 +63,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-deprecate.html b/deps/npm/html/doc/cli/npm-deprecate.html index 8182c6ecf1b..d916b791c93 100644 --- a/deps/npm/html/doc/cli/npm-deprecate.html +++ b/deps/npm/html/doc/cli/npm-deprecate.html @@ -38,5 +38,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-dist-tag.html b/deps/npm/html/doc/cli/npm-dist-tag.html new file mode 100644 index 00000000000..1fdf4b97a6f --- /dev/null +++ b/deps/npm/html/doc/cli/npm-dist-tag.html @@ -0,0 +1,81 @@ + + + npm-dist-tag + + + + + + +
    + +

    npm-dist-tag

    Modify package distribution tags

    +

    SYNOPSIS

    +
    npm dist-tag add <pkg>@<version> [<tag>]
    +npm dist-tag rm <pkg> <tag>
    +npm dist-tag ls [<pkg>]
    +

    DESCRIPTION

    +

    Add, remove, and enumerate distribution tags on a package:

    +
      +
    • add: +Tags the specified version of the package with the specified tag, or the +--tag config if not specified.

      +
    • +
    • rm: +Clear a tag that is no longer in use from the package.

      +
    • +
    • ls: +Show all of the dist-tags for a package, defaulting to the package in +the current prefix.

      +
    • +
    +

    A tag can be used when installing packages as a reference to a version instead +of using a specific version number:

    +
    npm install <name>@<tag>
    +

    When installing dependencies, a preferred tagged version may be specified:

    +
    npm install --tag <tag>
    +

    This also applies to npm dedupe.

    +

    Publishing a package sets the "latest" tag to the published version unless the +--tag option is used. For example, npm publish --tag=beta.

    +

    PURPOSE

    +

    Tags can be used to provide an alias instead of version numbers. For +example, npm currently uses the tag "next" to identify the upcoming +version, and the tag "latest" to identify the current version.

    +

    A project might choose to have multiple streams of development, e.g., +"stable", "canary".

    +

    CAVEATS

    +

    This command used to be known as npm tag, which only created new tags, and so +had a different syntax.

    +

    Tags must share a namespace with version numbers, because they are specified in +the same slot: npm install <pkg>@<version> vs npm install <pkg>@<tag>.

    +

    Tags that can be interpreted as valid semver ranges will be rejected. For +example, v1.4 cannot be used as a tag, because it is interpreted by semver as +>=1.4.0 <1.5.0. See https://github.com/npm/npm/issues/6082.

    +

    The simplest way to avoid semver problems with tags is to use tags that do not +begin with a number or the letter v.

    +

    SEE ALSO

    + + +
    + + + + + + + + + + + + diff --git a/deps/npm/html/doc/cli/npm-docs.html b/deps/npm/html/doc/cli/npm-docs.html index e9f2c9e732e..8dfd9f0a615 100644 --- a/deps/npm/html/doc/cli/npm-docs.html +++ b/deps/npm/html/doc/cli/npm-docs.html @@ -56,5 +56,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-edit.html b/deps/npm/html/doc/cli/npm-edit.html index 24a70fe7fc1..44581b1e827 100644 --- a/deps/npm/html/doc/cli/npm-edit.html +++ b/deps/npm/html/doc/cli/npm-edit.html @@ -49,5 +49,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-explore.html b/deps/npm/html/doc/cli/npm-explore.html index eeb49064486..d6b2c363fdd 100644 --- a/deps/npm/html/doc/cli/npm-explore.html +++ b/deps/npm/html/doc/cli/npm-explore.html @@ -49,5 +49,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-help-search.html b/deps/npm/html/doc/cli/npm-help-search.html index 2cf7506f03f..a39aad66566 100644 --- a/deps/npm/html/doc/cli/npm-help-search.html +++ b/deps/npm/html/doc/cli/npm-help-search.html @@ -46,5 +46,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-help.html b/deps/npm/html/doc/cli/npm-help.html index 12c6c0e8fd2..a9ac805bbff 100644 --- a/deps/npm/html/doc/cli/npm-help.html +++ b/deps/npm/html/doc/cli/npm-help.html @@ -52,5 +52,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-init.html b/deps/npm/html/doc/cli/npm-init.html index e7640ea46c6..5791edd4acc 100644 --- a/deps/npm/html/doc/cli/npm-init.html +++ b/deps/npm/html/doc/cli/npm-init.html @@ -22,11 +22,19 @@

    SYNOPSIS

    without a really good reason to do so.

    If you invoke it with -f, --force, -y, or --yes, it will use only defaults and not prompt you for any options.

    +

    CONFIGURATION

    +

    scope

    +
      +
    • Default: none
    • +
    • Type: String
    • +
    +

    The scope under which the new module should be created.

    SEE ALSO

    @@ -40,5 +48,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-install.html b/deps/npm/html/doc/cli/npm-install.html index 3759f011559..35162c5018e 100644 --- a/deps/npm/html/doc/cli/npm-install.html +++ b/deps/npm/html/doc/cli/npm-install.html @@ -44,9 +44,10 @@

    SYNOPSIS

    In global mode (ie, with -g or --global appended to the command), it installs the current package context (ie, the current working directory) as a global package.

    -

    By default, npm install will install all modules listed as - dependencies. With the --production flag, - npm will not install modules listed in devDependencies.

    +

    By default, npm install will install all modules listed as dependencies. + With the --production flag (or when the NODE_ENV environment variable + is set to production), npm will not install modules listed in + devDependencies.

  • npm install <folder>:

    Install a package that is sitting in a folder on the filesystem.

    @@ -130,18 +131,10 @@

    SYNOPSIS

        npm install sax@">=0.1.0 <0.2.0"
         npm install @myorg/privatepackage@">=0.1.0 <0.2.0"
     
  • -
  • npm install <githubname>/<githubrepo>:

    -

    Install the package at https://github.com/githubname/githubrepo" by - attempting to clone it usinggit`.

    -

    Example:

    -
        npm install mygithubuser/myproject
    -

    To reference a package in a git repo that is not on GitHub, see git - remote urls below.

    -
  • npm install <git remote url>:

    Install a package by cloning a git remote url. The format of the git url is:

    -
        <protocol>://[<user>@]<hostname><separator><path>[#<commit-ish>]
    +
        <protocol>://[<user>[:<password>]@]<hostname>[:<port>][:/]<path>[#<commit-ish>]
     

    <protocol> is one of git, git+ssh, git+http, or git+https. If no <commit-ish> is specified, then master is used.

    @@ -150,6 +143,38 @@

    SYNOPSIS

    git+https://isaacs@github.com/npm/npm.git git://github.com/npm/npm.git#v1.0.27
  • +
  • npm install <githubname>/<githubrepo>[#<commit-ish>]:

    +
  • +
  • npm install github:<githubname>/<githubrepo>[#<commit-ish>]:

    +

    Install the package at https://github.com/githubname/githubrepo by + attempting to clone it using git.

    +

    If you don't specify a commit-ish then master will be used.

    +

    Examples:

    +
        npm install mygithubuser/myproject
    +    npm install github:mygithubuser/myproject
    +
  • +
  • npm install gist:[<githubname>/]<gistID>[#<commit-ish>]:

    +

    Install the package at https://gist.github.com/gistID by attempting to + clone it using git. The GitHub username associated with the gist is + optional and will not be saved in package.json if --save is used.

    +

    If you don't specify a commit-ish then master will be used.

    +

    Example:

    +
        npm install gist:101a11beef
    +
  • +
  • npm install bitbucket:<bitbucketname>/<bitbucketrepo>[#<commit-ish>]:

    +

    Install the package at https://bitbucket.org/bitbucketname/bitbucketrepo + by attempting to clone it using git.

    +

    If you don't specify a commit-ish then master will be used.

    +

    Example:

    +
        npm install bitbucket:mybitbucketuser/myproject
    +
  • +
  • npm install gitlab:<gitlabname>/<gitlabrepo>[#<commit-ish>]:

    +

    Install the package at https://gitlab.com/gitlabname/gitlabrepo + by attempting to clone it using git.

    +

    If you don't specify a commit-ish then master will be used.

    +

    Example:

    +
        npm install gitlab:mygitlabuser/myproject
    +

You may combine multiple arguments, and even multiple types of arguments. For example:

@@ -239,5 +264,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-link.html b/deps/npm/html/doc/cli/npm-link.html index 8d085892df2..fa2d33cc3a8 100644 --- a/deps/npm/html/doc/cli/npm-link.html +++ b/deps/npm/html/doc/cli/npm-link.html @@ -24,7 +24,7 @@

SYNOPSIS

Note that package-name is taken from package.json, not from directory name.

The package name can be optionally prefixed with a scope. See npm-scope(7). -The scope must by preceded by an @-symbol and followed by a slash.

+The scope must be preceded by an @-symbol and followed by a slash.

When creating tarballs for npm publish, the linked packages are "snapshotted" to their current state by resolving the symbolic links.

This is handy for installing your own stuff, so that you can work on it and @@ -35,14 +35,15 @@

SYNOPSIS

cd ~/projects/node-bloggy # go into some other package directory. npm link redis # link-install the package

Now, any changes to ~/projects/node-redis will be reflected in -~/projects/node-bloggy/node_modules/redis/

+~/projects/node-bloggy/node_modules/node-redis/. Note that the link should +be to the package name, not the directory name for that package.

You may also shortcut the two steps in one. For example, to do the above use-case in a shorter way:

cd ~/projects/node-bloggy  # go into the dir of your main project
 npm link ../node-redis     # link the dir of your dependency
 

The second line is the equivalent of doing:

(cd ../node-redis; npm link)
-npm link redis
+npm link node-redis
 

That is, it first creates a global link, and then links the global installation target into your project's node_modules folder.

If your linked package is scoped (see npm-scope(7)) your link command must @@ -71,5 +72,5 @@

SYNOPSIS

       - + diff --git a/deps/npm/html/doc/cli/npm-logout.html b/deps/npm/html/doc/cli/npm-logout.html new file mode 100644 index 00000000000..add0967b268 --- /dev/null +++ b/deps/npm/html/doc/cli/npm-logout.html @@ -0,0 +1,59 @@ + + + npm-logout + + + + + + +
+ +

npm-logout

Log out of the registry

+

SYNOPSIS

+
npm logout [--registry=url] [--scope=@orgname]
+

DESCRIPTION

+

When logged into a registry that supports token-based authentication, tell the +server to end this token's session. This will invalidate the token everywhere +you're using it, not just for the current environment.

+

When logged into a legacy registry that uses username and password authentication, this will +clear the credentials in your user configuration. In this case, it will only affect +the current environment.

+

If --scope is provided, this will find the credentials for the registry +connected to that scope, if set.

+

CONFIGURATION

+

registry

+

Default: http://registry.npmjs.org/

+

The base URL of the npm package registry. If scope is also specified, +it takes precedence.

+

scope

+

Default: none

+

If specified, the user and login credentials given will be associated +with the specified scope. See npm-scope(7). You can use both at the same time, +e.g.

+
npm adduser --registry=http://myregistry.example.com --scope=@myco
+

This will set a registry for the given scope and login or create a user for +that registry at the same time.

+

SEE ALSO

+ + +
+ + + + + + + + + + + + diff --git a/deps/npm/html/doc/cli/npm-ls.html b/deps/npm/html/doc/cli/npm-ls.html index 30419bdb0d6..90a2aa75033 100644 --- a/deps/npm/html/doc/cli/npm-ls.html +++ b/deps/npm/html/doc/cli/npm-ls.html @@ -22,7 +22,7 @@

SYNOPSIS

limit the results to only the paths to the packages named. Note that nested packages will also show the paths to the specified packages. For example, running npm ls promzard in npm's source tree will show:

-
npm@2.1.6 /path/to/npm
+
npm@2.11.3 /path/to/npm
 └─┬ init-package-json@0.0.4
   └── promzard@0.1.5
 

It will print out extraneous, missing, and invalid packages.

@@ -61,6 +61,18 @@

depth

  • Type: Int
  • Max display depth of the dependency tree.

    +

    prod / production

    +
      +
    • Type: Boolean
    • +
    • Default: false
    • +
    +

    Display only the dependency tree for packages in dependencies.

    +

    dev

    +
      +
    • Type: Boolean
    • +
    • Default: false
    • +
    +

    Display only the dependency tree for packages in devDependencies.

    SEE ALSO

    • npm-config(1)
    • @@ -85,5 +97,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-outdated.html b/deps/npm/html/doc/cli/npm-outdated.html index 07a0a933d76..e0ecfd26c2d 100644 --- a/deps/npm/html/doc/cli/npm-outdated.html +++ b/deps/npm/html/doc/cli/npm-outdated.html @@ -67,5 +67,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-owner.html b/deps/npm/html/doc/cli/npm-owner.html index 3600e087f15..9b83f7e6735 100644 --- a/deps/npm/html/doc/cli/npm-owner.html +++ b/deps/npm/html/doc/cli/npm-owner.html @@ -49,5 +49,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-pack.html b/deps/npm/html/doc/cli/npm-pack.html index 987ba3f792b..ccebbe323da 100644 --- a/deps/npm/html/doc/cli/npm-pack.html +++ b/deps/npm/html/doc/cli/npm-pack.html @@ -41,5 +41,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-prefix.html b/deps/npm/html/doc/cli/npm-prefix.html index 7b6a3c58a51..f9af61318d4 100644 --- a/deps/npm/html/doc/cli/npm-prefix.html +++ b/deps/npm/html/doc/cli/npm-prefix.html @@ -38,5 +38,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-prune.html b/deps/npm/html/doc/cli/npm-prune.html index dea291b4909..58125c41649 100644 --- a/deps/npm/html/doc/cli/npm-prune.html +++ b/deps/npm/html/doc/cli/npm-prune.html @@ -19,8 +19,10 @@

      SYNOPSIS

      removed.

      Extraneous packages are packages that are not listed on the parent package's dependencies list.

      -

      If the --production flag is specified, this command will remove the -packages specified in your devDependencies.

      +

      If the --production flag is specified or the NODE_ENV environment +variable is set to production, this command will remove the packages +specified in your devDependencies. Setting --production=false will +negate NODE_ENV being set to production.

      SEE ALSO

      • npm-rm(1)
      • @@ -39,5 +41,5 @@

        SEE ALSO

               - + diff --git a/deps/npm/html/doc/cli/npm-publish.html b/deps/npm/html/doc/cli/npm-publish.html index e1b46d21d0b..ba1bad9e26c 100644 --- a/deps/npm/html/doc/cli/npm-publish.html +++ b/deps/npm/html/doc/cli/npm-publish.html @@ -11,8 +11,8 @@

        npm-publish

        Publish a package

        SYNOPSIS

        -
        npm publish <tarball> [--tag <tag>]
        -npm publish <folder> [--tag <tag>]
        +
        npm publish <tarball> [--tag <tag>] [--access <public|restricted>]
        +npm publish <folder> [--tag <tag>] [--access <public|restricted>]
         

        DESCRIPTION

        Publishes a package to the registry so that it can be installed by name. See npm-developers(7) for details on what's included in the published package, as @@ -33,6 +33,12 @@

        SYNOPSIS

        <name>@<tag>
        will install this version. By default, npm publish updates and npm install installs the latest tag.

        +
      • [--access <public|restricted>] +Tells the registry whether this package should be published as public or +restricted. Only applies to scoped packages, which default to restricted. +If you don't have a paid account, you must publish with --access public +to publish scoped packages.

        +

      Fails if the package name and version combination already exists in the specified registry.

      @@ -42,6 +48,7 @@

      SYNOPSIS

      SEE ALSO

      • npm-registry(7)
      • +
      • npm-scope(7)
      • npm-adduser(1)
      • npm-owner(1)
      • npm-deprecate(1)
      • @@ -59,5 +66,5 @@

        SEE ALSO

               - + diff --git a/deps/npm/html/doc/cli/npm-rebuild.html b/deps/npm/html/doc/cli/npm-rebuild.html index 4da97a70518..38bc945329a 100644 --- a/deps/npm/html/doc/cli/npm-rebuild.html +++ b/deps/npm/html/doc/cli/npm-rebuild.html @@ -38,5 +38,5 @@

        SEE ALSO

               - + diff --git a/deps/npm/html/doc/cli/npm-repo.html b/deps/npm/html/doc/cli/npm-repo.html index 02335b4f4a1..63b850a61ed 100644 --- a/deps/npm/html/doc/cli/npm-repo.html +++ b/deps/npm/html/doc/cli/npm-repo.html @@ -42,5 +42,5 @@

        SEE ALSO

               - + diff --git a/deps/npm/html/doc/cli/npm-restart.html b/deps/npm/html/doc/cli/npm-restart.html index d7536f81fdf..faafb1d00e4 100644 --- a/deps/npm/html/doc/cli/npm-restart.html +++ b/deps/npm/html/doc/cli/npm-restart.html @@ -9,12 +9,29 @@
        -

        npm-restart

        Start a package

        +

        npm-restart

        Restart a package

        SYNOPSIS

        npm restart [-- <args>]
         

        DESCRIPTION

        -

        This runs a package's "restart" script, if one was provided. Otherwise it runs -package's "stop" script, if one was provided, and then the "start" script.

        +

        This restarts a package.

        +

        This runs a package's "stop", "restart", and "start" scripts, and associated +pre- and post- scripts, in the order given below:

        +
          +
        1. prerestart
        2. +
        3. prestop
        4. +
        5. stop
        6. +
        7. poststop
        8. +
        9. restart
        10. +
        11. prestart
        12. +
        13. start
        14. +
        15. poststart
        16. +
        17. postrestart
        18. +
        +

        NOTE

        +

        Note that the "restart" script is run in addition to the "stop" +and "start" scripts, not instead of them.

        +

        This is the behavior as of npm major version 2. A change in this +behavior will be accompanied by an increase in major version number

        SEE ALSO

        @@ -35,5 +53,5 @@

        SEE ALSO

               - + diff --git a/deps/npm/html/doc/cli/npm-rm.html b/deps/npm/html/doc/cli/npm-rm.html index 3b28aaad4d3..09ece656aa2 100644 --- a/deps/npm/html/doc/cli/npm-rm.html +++ b/deps/npm/html/doc/cli/npm-rm.html @@ -39,5 +39,5 @@

        SEE ALSO

               - + diff --git a/deps/npm/html/doc/cli/npm-root.html b/deps/npm/html/doc/cli/npm-root.html index f6b8b22dfcb..c3092e686fd 100644 --- a/deps/npm/html/doc/cli/npm-root.html +++ b/deps/npm/html/doc/cli/npm-root.html @@ -35,5 +35,5 @@

        SEE ALSO

               - + diff --git a/deps/npm/html/doc/cli/npm-run-script.html b/deps/npm/html/doc/cli/npm-run-script.html index 8ca2ea2a5ed..03f1aa201a2 100644 --- a/deps/npm/html/doc/cli/npm-run-script.html +++ b/deps/npm/html/doc/cli/npm-run-script.html @@ -14,12 +14,11 @@

        SYNOPSIS

        npm run-script [command] [-- <args>]
         npm run [command] [-- <args>]
         

        DESCRIPTION

        -

        This runs an arbitrary command from a package's "scripts" object. -If no package name is provided, it will search for a package.json -in the current folder and use its "scripts" object. If no "command" -is provided, it will list the available top level scripts.

        -

        It is used by the test, start, restart, and stop commands, but can be -called directly, as well.

        +

        This runs an arbitrary command from a package's "scripts" object. If no +"command" is provided, it will list the available scripts. run[-script] is +used by the test, start, restart, and stop commands, but can be called +directly, as well. When the scripts in the package are printed out, they're +separated into lifecycle (test, start, restart) and directly-run scripts.

        As of npm@2.0.0, you can use custom arguments when executing scripts. The special option -- is used by getopt to delimit the end of the options. npm will pass @@ -27,6 +26,16 @@

        SYNOPSIS

        npm run test -- --grep="pattern"
         

        The arguments will only be passed to the script specified after npm run and not to any pre or post script.

        +

        The env script is a special built-in command that can be used to list +environment variables that will be available to the script at runtime. If an +"env" command is defined in your package it will take precedence over the +built-in.

        +

        In addition to the shell's pre-existing PATH, npm run adds +node_modules/.bin to the PATH provided to scripts. Any binaries provided by +locally-installed dependencies can be used without the node_modules/.bin +prefix. For example, if there is a devDependency on tap in your package, +you should write "scripts": {"test": "tap test/\*.js"} instead of "scripts": +{"test": "node_modules/.bin/tap test/\*.js"} to run your tests.

        SEE ALSO

        • npm-scripts(7)
        • @@ -47,5 +56,5 @@

          SEE ALSO

                 - + diff --git a/deps/npm/html/doc/cli/npm-search.html b/deps/npm/html/doc/cli/npm-search.html index f5fe720baa1..fc065f99915 100644 --- a/deps/npm/html/doc/cli/npm-search.html +++ b/deps/npm/html/doc/cli/npm-search.html @@ -49,5 +49,5 @@

          SEE ALSO

                 - + diff --git a/deps/npm/html/doc/cli/npm-shrinkwrap.html b/deps/npm/html/doc/cli/npm-shrinkwrap.html index fbfaa6c3dc0..b6f8ddc6d04 100644 --- a/deps/npm/html/doc/cli/npm-shrinkwrap.html +++ b/deps/npm/html/doc/cli/npm-shrinkwrap.html @@ -15,17 +15,17 @@

          SYNOPSIS

    DESCRIPTION

    This command locks down the versions of a package's dependencies so that you can control exactly which versions of each dependency will be -used when your package is installed. The "package.json" file is still -required if you want to use "npm install".

    -

    By default, "npm install" recursively installs the target's -dependencies (as specified in package.json), choosing the latest +used when your package is installed. The package.json file is still +required if you want to use npm install.

    +

    By default, npm install recursively installs the target's +dependencies (as specified in package.json), choosing the latest available version that satisfies the dependency's semver pattern. In some situations, particularly when shipping software where each change is tightly managed, it's desirable to fully specify each version of each dependency recursively so that subsequent builds and deploys do not inadvertently pick up newer versions of a dependency that satisfy the semver pattern. Specifying specific semver patterns in each -dependency's package.json would facilitate this, but that's not always +dependency's package.json would facilitate this, but that's not always possible or desirable, as when another author owns the npm package. It's also possible to check dependencies directly into source control, but that may be undesirable for other reasons.

    @@ -47,15 +47,15 @@

    SYNOPSIS

    }

    and package C:

    {
    -  "name": "C,
    +  "name": "C",
       "version": "0.0.1"
     }
     

    If these are the only versions of A, B, and C available in the -registry, then a normal "npm install A" will install:

    +registry, then a normal npm install A will install:

    A@0.1.0
     `-- B@0.0.1
         `-- C@0.0.1
    -

    However, if B@0.0.2 is published, then a fresh "npm install A" will +

    However, if B@0.0.2 is published, then a fresh npm install A will install:

    A@0.1.0
     `-- B@0.0.2
    @@ -69,7 +69,7 @@ 

    SYNOPSIS

    when B hasn't changed at all.

    In this case, A's author can run

    npm shrinkwrap
    -

    This generates npm-shrinkwrap.json, which will look something like this:

    +

    This generates npm-shrinkwrap.json, which will look something like this:

    {
       "name": "A",
       "version": "0.1.0",
    @@ -78,58 +78,58 @@ 

    SYNOPSIS

    "version": "0.0.1", "dependencies": { "C": { - "version": "0.1.0" + "version": "0.0.1" } } } } }

    The shrinkwrap command has locked down the dependencies based on -what's currently installed in node_modules. When "npm install" -installs a package with a npm-shrinkwrap.json file in the package -root, the shrinkwrap file (rather than package.json files) completely +what's currently installed in node_modules. When npm install +installs a package with an npm-shrinkwrap.json in the package +root, the shrinkwrap file (rather than package.json files) completely drives the installation of that package and all of its dependencies (recursively). So now the author publishes A@0.1.0, and subsequent -installs of this package will use B@0.0.1 and C@0.1.0, regardless the -dependencies and versions listed in A's, B's, and C's package.json +installs of this package will use B@0.0.1 and C@0.0.1, regardless the +dependencies and versions listed in A's, B's, and C's package.json files.

    Using shrinkwrapped packages

    Using a shrinkwrapped package is no different than using any other -package: you can "npm install" it by hand, or add a dependency to your -package.json file and "npm install" it.

    +package: you can npm install it by hand, or add a dependency to your +package.json file and npm install it.

    Building shrinkwrapped packages

    To shrinkwrap an existing package:

      -
    1. Run "npm install" in the package root to install the current +
    2. Run npm install in the package root to install the current versions of all dependencies.
    3. Validate that the package works as expected with these versions.
    4. -
    5. Run "npm shrinkwrap", add npm-shrinkwrap.json to git, and publish +
    6. Run npm shrinkwrap, add npm-shrinkwrap.json to git, and publish your package.

    To add or update a dependency in a shrinkwrapped package:

      -
    1. Run "npm install" in the package root to install the current +
    2. Run npm install in the package root to install the current versions of all dependencies.
    3. -
    4. Add or update dependencies. "npm install" each new or updated -package individually and then update package.json. Note that they +
    5. Add or update dependencies. npm install each new or updated +package individually and then update package.json. Note that they must be explicitly named in order to be installed: running npm install with no arguments will merely reproduce the existing shrinkwrap.
    6. Validate that the package works as expected with the new dependencies.
    7. -
    8. Run "npm shrinkwrap", commit the new npm-shrinkwrap.json, and +
    9. Run npm shrinkwrap, commit the new npm-shrinkwrap.json, and publish your package.

    You can use npm-outdated(1) to view dependencies with newer versions available.

    Other Notes

    -

    A shrinkwrap file must be consistent with the package's package.json -file. "npm shrinkwrap" will fail if required dependencies are not +

    A shrinkwrap file must be consistent with the package's package.json +file. npm shrinkwrap will fail if required dependencies are not already installed, since that would result in a shrinkwrap that wouldn't actually work. Similarly, the command will fail if there are -extraneous packages (not referenced by package.json), since that would -indicate that package.json is not correct.

    -

    Since "npm shrinkwrap" is intended to lock down your dependencies for +extraneous packages (not referenced by package.json), since that would +indicate that package.json is not correct.

    +

    Since npm shrinkwrap is intended to lock down your dependencies for production use, devDependencies will not be included unless you explicitly set the --dev flag when you run npm shrinkwrap. If installed devDependencies are excluded, then npm will print a @@ -164,5 +164,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-star.html b/deps/npm/html/doc/cli/npm-star.html index d3bbde5b9d6..273ba24060f 100644 --- a/deps/npm/html/doc/cli/npm-star.html +++ b/deps/npm/html/doc/cli/npm-star.html @@ -36,5 +36,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-stars.html b/deps/npm/html/doc/cli/npm-stars.html index 7873880f415..1899557adf5 100644 --- a/deps/npm/html/doc/cli/npm-stars.html +++ b/deps/npm/html/doc/cli/npm-stars.html @@ -37,5 +37,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-start.html b/deps/npm/html/doc/cli/npm-start.html index 0a3134bc82e..eb36bd5b29f 100644 --- a/deps/npm/html/doc/cli/npm-start.html +++ b/deps/npm/html/doc/cli/npm-start.html @@ -34,5 +34,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-stop.html b/deps/npm/html/doc/cli/npm-stop.html index 01638ee4daf..c772f894616 100644 --- a/deps/npm/html/doc/cli/npm-stop.html +++ b/deps/npm/html/doc/cli/npm-stop.html @@ -34,5 +34,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-submodule.html b/deps/npm/html/doc/cli/npm-submodule.html index 4ac55a88525..30bde01b318 100644 --- a/deps/npm/html/doc/cli/npm-submodule.html +++ b/deps/npm/html/doc/cli/npm-submodule.html @@ -27,7 +27,7 @@

    SYNOPSIS

    dependencies into the submodule folder.

    SEE ALSO

    @@ -42,5 +42,4 @@

    SEE ALSO

           - - + diff --git a/deps/npm/html/doc/cli/npm-tag.html b/deps/npm/html/doc/cli/npm-tag.html index 946d5fa767c..414e84a0dd1 100644 --- a/deps/npm/html/doc/cli/npm-tag.html +++ b/deps/npm/html/doc/cli/npm-tag.html @@ -13,6 +13,7 @@

    npm-tag

    Tag a published version

    SYNOPSIS
    npm tag <name>@<version> [<tag>]
     

    DESCRIPTION

    +

    THIS COMMAND IS DEPRECATED. See npm-dist-tag(1) for details.

    Tags the specified version of the package with the specified tag, or the --tag config if not specified.

    A tag can be used when installing packages as a reference to a version instead @@ -22,6 +23,22 @@

    SYNOPSIS

    npm install --tag <tag>
     

    This also applies to npm dedupe.

    Publishing a package always sets the "latest" tag to the published version.

    +

    PURPOSE

    +

    Tags can be used to provide an alias instead of version numbers. For +example, npm currently uses the tag "next" to identify the upcoming +version, and the tag "latest" to identify the current version.

    +

    A project might choose to have multiple streams of development, e.g., +"stable", "canary".

    +

    CAVEATS

    +

    Tags must share a namespace with version numbers, because they are +specified in the same slot: npm install <pkg>@<version> vs npm +install <pkg>@<tag>.

    +

    Tags that can be interpreted as valid semver ranges will be +rejected. For example, v1.4 cannot be used as a tag, because it is +interpreted by semver as >=1.4.0 <1.5.0. See +https://github.com/npm/npm/issues/6082.

    +

    The simplest way to avoid semver problems with tags is to use tags +that do not begin with a number or the letter v.

    SEE ALSO

    @@ -44,5 +62,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-test.html b/deps/npm/html/doc/cli/npm-test.html index 6c5467de51f..1adc8897703 100644 --- a/deps/npm/html/doc/cli/npm-test.html +++ b/deps/npm/html/doc/cli/npm-test.html @@ -37,5 +37,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-uninstall.html b/deps/npm/html/doc/cli/npm-uninstall.html index 2a3c12c148d..aae5ca9b4d8 100644 --- a/deps/npm/html/doc/cli/npm-uninstall.html +++ b/deps/npm/html/doc/cli/npm-uninstall.html @@ -57,5 +57,5 @@

    SYNOPSIS

           - + diff --git a/deps/npm/html/doc/cli/npm-unpublish.html b/deps/npm/html/doc/cli/npm-unpublish.html index 59b278e23da..1f042fc55e3 100644 --- a/deps/npm/html/doc/cli/npm-unpublish.html +++ b/deps/npm/html/doc/cli/npm-unpublish.html @@ -47,5 +47,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/cli/npm-update.html b/deps/npm/html/doc/cli/npm-update.html index 5fa7846f534..ae6685d4495 100644 --- a/deps/npm/html/doc/cli/npm-update.html +++ b/deps/npm/html/doc/cli/npm-update.html @@ -14,16 +14,95 @@

    SYNOPSIS

    npm update [-g] [<name> [<name> ...]]
     

    DESCRIPTION

    This command will update all the packages listed to the latest version -(specified by the tag config).

    -

    It will also install missing packages.

    +(specified by the tag config), respecting semver.

    +

    It will also install missing packages. As with all commands that install +packages, the --dev flag will cause devDependencies to be processed +as well.

    If the -g flag is specified, this command will update globally installed packages.

    If no package name is specified, all packages in the specified location (global or local) will be updated.

    +

    As of npm@2.6.1, the npm update will only inspect top-level packages. +Prior versions of npm would also recursively inspect all dependencies. +To get the old behavior, use npm --depth 9999 update, but be warned that +simultaneous asynchronous update of all packages, including npm itself +and packages that npm depends on, often causes problems up to and including +the uninstallation of npm itself.

    +

    To restore a missing npm, use the command:

    +
    curl -L https://npmjs.com/install.sh | sh
    +

    EXAMPLES

    +

    IMPORTANT VERSION NOTE: these examples assume npm@2.6.1 or later. For +older versions of npm, you must specify --depth 0 to get the behavior +described below.

    +

    For the examples below, assume that the current package is app and it depends +on dependencies, dep1 (dep2, .. etc.). The published versions of dep1 are:

    +
    {
    +  dist-tags: { latest: "1.2.2" },
    +  versions: { "1.2.2",
    +              "1.2.1",
    +              "1.2.0",
    +              "1.1.2",
    +              "1.1.1",
    +              "1.0.0",
    +              "0.4.1",
    +              "0.4.0",
    +              "0.2.0"
    +  }
    +}
    +

    Caret Dependencies

    +

    If app's package.json contains:

    +
    dependencies: {
    +  dep1: "^1.1.1"
    +}
    +

    Then npm update will install dep1@1.2.2, because 1.2.2 is latest and +1.2.2 satisfies ^1.1.1.

    +

    Tilde Dependencies

    +

    However, if app's package.json contains:

    +
    dependencies: {
    +  dep1: "~1.1.1"
    +}
    +

    In this case, running npm update will install dep1@1.1.2. Even though the latest +tag points to 1.2.2, this version does not satisfy ~1.1.1, which is equivalent +to >=1.1.1 <1.2.0. So the highest-sorting version that satisfies ~1.1.1 is used, +which is 1.1.2.

    +

    Caret Dependencies below 1.0.0

    +

    Suppose app has a caret dependency on a version below 1.0.0, for example:

    +
    dependencies: {
    +  dep1: "^0.2.0"
    +}
    +

    npm update will install dep1@0.2.0, because there are no other +versions which satisfy ^0.2.0.

    +

    If the dependence were on ^0.4.0:

    +
    dependencies: {
    +  dep1: "^0.4.0"
    +}
    +

    Then npm update will install dep1@0.4.1, because that is the highest-sorting +version that satisfies ^0.4.0 (>= 0.4.0 <0.5.0)

    +

    Recording Updates with --save

    +

    When you want to update a package and save the new version as +the minimum required dependency in package.json, you can use +npm update --save. For example if package.json contains

    +
    dependencies: {
    +  dep1: "^1.1.1"
    +}
    +

    Then npm update --save will install dep1@1.2.2 (i.e., latest), +and package.json will be modified:

    +
    dependencies: {
    +  dep1: "^1.2.2"
    +}
    +

    Note that npm will only write an updated version to package.json +if it installs a new package.

    +

    Updating Globally-Installed Packages

    +

    npm update -g will apply the update action to each globally- installed +package that is outdated -- that is, has a version that is different from +latest.

    +

    NOTE: If a package has been upgraded to a version newer than latest, it will +be downgraded.

    SEE ALSO

    • npm-install(1)
    • npm-outdated(1)
    • +
    • npm-shrinkwrap(1)
    • npm-registry(7)
    • npm-folders(5)
    • npm-ls(1)
    • @@ -40,5 +119,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-version.html b/deps/npm/html/doc/cli/npm-version.html index 6477726f495..941df172003 100644 --- a/deps/npm/html/doc/cli/npm-version.html +++ b/deps/npm/html/doc/cli/npm-version.html @@ -14,13 +14,15 @@

      SYNOPSIS

      npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease]
       

      DESCRIPTION

      Run this in a package directory to bump the version and write the new -data back to the package.json file.

      +data back to package.json and, if present, npm-shrinkwrap.json.

      The newversion argument should be a valid semver string, or a valid second argument to semver.inc (one of "patch", "minor", "major", "prepatch", "preminor", "premajor", "prerelease"). In the second case, the existing version will be incremented by 1 in the specified field.

      -

      If run in a git repo, it will also create a version commit and tag, and -fail if the repo is not clean.

      +

      If run in a git repo, it will also create a version commit and tag, and fail if +the repo is not clean. This behavior is controlled by git-tag-version (see +below), and can be disabled on the command line by running npm +--no-git-tag-version version

      If supplied with --message (shorthand: -m) config option, npm will use it as a commit message when creating a version commit. If the message config contains %s then that will be replaced with the @@ -37,11 +39,27 @@

      SYNOPSIS

      2048-bit RSA key, ID 6C481CF6, created 2010-08-31 Enter passphrase: -

      SEE ALSO

      +

      If "preversion", "version", "postversion" in the "scripts" property of +the package.json, it will execute by running npm version. preversion +and version ware executed before bump the package version, postversion +was executed after bump the package version. For example to run npm version +after passed all test:

      +
      "scripts": { "preversion": "npm test" }
      +

      CONFIGURATION

      +

      git-tag-version

      +
        +
      • Default: true
      • +
      • Type: Boolean
      • +
      +

      Commit and tag the version change.

      +

      SEE ALSO

      @@ -55,5 +73,5 @@

      SYNOPSIS

             - + diff --git a/deps/npm/html/doc/cli/npm-view.html b/deps/npm/html/doc/cli/npm-view.html index 3b87ba0be20..e0f48b675e9 100644 --- a/deps/npm/html/doc/cli/npm-view.html +++ b/deps/npm/html/doc/cli/npm-view.html @@ -24,7 +24,7 @@

      SYNOPSIS

      For example, to show the dependencies of the ronn package at version 0.3.5, you could do the following:

      npm view ronn@0.3.5 dependencies
      -

      You can view child field by separating them with a period. +

      You can view child fields by separating them with a period. To view the git repository URL for the latest version of npm, you could do this:

      npm view npm repository.url
      @@ -82,5 +82,5 @@ 

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm-whoami.html b/deps/npm/html/doc/cli/npm-whoami.html index a2705c40c3a..9b451f148cc 100644 --- a/deps/npm/html/doc/cli/npm-whoami.html +++ b/deps/npm/html/doc/cli/npm-whoami.html @@ -33,5 +33,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/cli/npm.html b/deps/npm/html/doc/cli/npm.html index 3bd3849d2ad..83fe67d5759 100644 --- a/deps/npm/html/doc/cli/npm.html +++ b/deps/npm/html/doc/cli/npm.html @@ -9,11 +9,11 @@
      -

      npm

      node package manager

      +

      npm

      javascript package manager

      SYNOPSIS

      npm <command> [args]
       

      VERSION

      -

      2.1.6

      +

      2.11.3

      DESCRIPTION

      npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency @@ -110,7 +110,7 @@

      CONTRIBUTIONS

      the issues list or ask on the mailing list.

      BUGS

      When you find issues, please report them:

      @@ -118,7 +118,7 @@

      BUGS

    • web: http://github.com/npm/npm/issues
    • email: -npm-@googlegroups.com
    • +npm-@googlegroups.com

    Be sure to include all of the output from the npm command that didn't work as expected. The npm-debug.log file is also helpful to provide.

    @@ -128,7 +128,7 @@

    AUTHOR

    Isaac Z. Schlueter :: isaacs :: @izs :: -i@izs.me

    +i@izs.me

    SEE ALSO

    • npm-help(1)
    • @@ -154,5 +154,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/files/npm-folders.html b/deps/npm/html/doc/files/npm-folders.html index ec320399971..db8b092111a 100644 --- a/deps/npm/html/doc/files/npm-folders.html +++ b/deps/npm/html/doc/files/npm-folders.html @@ -184,5 +184,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/files/npm-global.html b/deps/npm/html/doc/files/npm-global.html index 90e5dcaf1dc..ddc76520145 100644 --- a/deps/npm/html/doc/files/npm-global.html +++ b/deps/npm/html/doc/files/npm-global.html @@ -184,5 +184,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/files/npm-json.html b/deps/npm/html/doc/files/npm-json.html index ade4fd07ec4..faf036a9816 100644 --- a/deps/npm/html/doc/files/npm-json.html +++ b/deps/npm/html/doc/files/npm-json.html @@ -21,18 +21,26 @@

      name

      them. The name and version together form an identifier that is assumed to be completely unique. Changes to the package should come along with changes to the version.

      -

      The name is what your thing is called. Some tips:

      +

      The name is what your thing is called.

      +

      Some rules:

        +
      • The name must be shorter than 214 characters. This includes the scope for +scoped packages.
      • +
      • The name can't start with a dot or an underscore.
      • +
      • New packages must not have uppercase letters in the name.
      • +
      • The name ends up being part of a URL, an argument on the command line, and a +folder name. Therefore, the name can't contain any non-URL-safe characters.
      • +
      +

      Some tips:

      +
        +
      • Don't use the same name as a core Node module.
      • Don't put "js" or "node" in the name. It's assumed that it's js, since you're writing a package.json file, and you can specify the engine using the "engines" field. (See below.)
      • -
      • The name ends up being part of a URL, an argument on the command line, and a -folder name. Any name with non-url-safe characters will be rejected. -Also, it can't start with a dot or an underscore.
      • The name will probably be passed as an argument to require(), so it should be something short, but also reasonably descriptive.
      • You may want to check the npm registry to see if there's something by that name -already, before you get too attached to it. http://registry.npmjs.org/
      • +already, before you get too attached to it. https://www.npmjs.com/

      A name can be optionally prefixed by a scope, e.g. @myorg/mypackage. See npm-scope(7) for more detail.

      @@ -63,7 +71,7 @@

      bugs

      issues should be reported. These are helpful for people who encounter issues with your package.

      It should look like this:

      -
      { "url" : "http://github.com/owner/project/issues"
      +
      { "url" : "https://github.com/owner/project/issues"
       , "email" : "project@hostname.com"
       }
       

      You can specify either one or both values. If you want to provide only a url, @@ -72,16 +80,44 @@

      bugs

      license

      You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you're placing on it.

      -

      The simplest way, assuming you're using a common license such as BSD-3-Clause -or MIT, is to just specify the standard SPDX ID of the license you're using, -like this:

      +

      If you're using a common license such as BSD-2-Clause or MIT, add a +current SPDX license identifier for the license you're using, like this:

      { "license" : "BSD-3-Clause" }
       

      You can check the full list of SPDX license IDs. Ideally you should pick one that is OSI approved.

      -

      It's also a good idea to include a LICENSE file at the top level in -your package.

      -

      people fields: author, contributors

      +

      If your package is licensed under multiple common licenses, use an SPDX license +expression syntax version 2.0 string, like this:

      +
      { "license" : "(ISC OR GPL-3.0)" }
      +

      If you are using a license that hasn't been assigned an SPDX identifier, or if +you are using a custom license, use the following valid SPDX expression:

      +
      { "license" : "LicenseRef-LICENSE" }
      +

      Then include a LICENSE file at the top level of the package.

      +

      Some old packages used license objects or a "licenses" property containing an +array of license objects:

      +
      // Not valid metadata
      +{ "license" :
      +  { "type" : "ISC"
      +  , "url" : "http://opensource.org/licenses/ISC"
      +  }
      +}
      +
      +// Not valid metadata
      +{ "licenses" :
      +  [
      +    { "type": "MIT"
      +    , "url": "http://www.opensource.org/licenses/mit-license.php"
      +    }
      +  , { "type": "Apache-2.0"
      +    , "url": "http://opensource.org/licenses/apache2.0.php"
      +    }
      +  ]
      +}
      +

      Those styles are now deprecated. Instead, use SPDX expressions, like this:

      +
      { "license": "ISC" }
      +
      +{ "license": "(MIT OR Apache-2.0)" }
      +

      people fields: author, contributors

      The "author" is one person. "contributors" is an array of people. A "person" is an object with a "name" field and optionally "url" and "email", like this:

      { "name" : "Barney Rubble"
      @@ -89,7 +125,7 @@ 

      people fields: author, contributors

      Or you can shorten that all into a single string, and npm will parse it for you:

      -
      "Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)
      +
      "Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)"
       

      Both email and url are optional either way.

      npm also sets a top-level "maintainers" field with your npm user info.

      files

      @@ -115,10 +151,10 @@

      bin

      command name to local file name. On install, npm will symlink that file into prefix/bin for global installs, or ./node_modules/.bin/ for local installs.

      -

      For example, npm has this:

      -
      { "bin" : { "npm" : "./cli.js" } }
      -

      So, when you install npm, it'll create a symlink from the cli.js script to -/usr/local/bin/npm.

      +

      For example, myapp could have this:

      +
      { "bin" : { "myapp" : "./cli.js" } }
      +

      So, when you install myapp, it'll create a symlink from the cli.js script to +/usr/local/bin/myapp.

      If you have a single executable, and its name should be the name of the package, then you can just supply it as a string. For example:

      { "name": "my-program"
      @@ -161,7 +197,7 @@ 

      bin

      directories

      The CommonJS Packages spec details a few ways that you can indicate the structure of your package using a directories -object. If you look at npm's package.json, +object. If you look at npm's package.json, you'll see that it has directories for doc, lib, and man.

      In the future, this information may be used in other creative ways.

      directories.lib

      @@ -181,22 +217,31 @@

      directories.example

      Put example scripts in here. Someday, it might be exposed in some clever way.

      repository

      Specify the place where your code lives. This is helpful for people who -want to contribute. If the git repo is on github, then the npm docs +want to contribute. If the git repo is on GitHub, then the npm docs command will be able to find you.

      Do it like this:

      "repository" :
         { "type" : "git"
      -  , "url" : "http://github.com/npm/npm.git"
      +  , "url" : "https://github.com/npm/npm.git"
         }
       
       "repository" :
         { "type" : "svn"
      -  , "url" : "http://v8.googlecode.com/svn/trunk/"
      +  , "url" : "https://v8.googlecode.com/svn/trunk/"
         }
       

      The URL should be a publicly available (perhaps read-only) url that can be handed directly to a VCS program without any modification. It should not be a url to an html project page that you put in your browser. It's for computers.

      -

      scripts

      +

      For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same +shortcut syntax you use for npm install:

      +
      "repository": "npm/npm"
      +
      +"repository": "gist:11081aaa281"
      +
      +"repository": "bitbucket:example/repo"
      +
      +"repository": "gitlab:another/repo"
      +

      scripts

      The "scripts" property is a dictionary containing script commands that are run at various times in the lifecycle of your package. The key is the lifecycle event, and the value is the command to run at that point.

      @@ -269,12 +314,15 @@

      Git URLs as Dependencies

      The commit-ish can be any tag, sha, or branch which can be supplied as an argument to git checkout. The default is master.

      GitHub URLs

      -

      As of version 1.1.65, you can refer to GitHub urls as just "foo": "user/foo-project". For example:

      +

      As of version 1.1.65, you can refer to GitHub urls as just "foo": +"user/foo-project". Just as with git URLs, a commit-ish suffix can be +included. For example:

      {
         "name": "foo",
         "version": "0.0.0",
         "dependencies": {
      -    "express": "visionmedia/express"
      +    "express": "visionmedia/express",
      +    "mocha": "visionmedia/mocha#4727d357ea"
         }
       }
       

      Local Paths

      @@ -326,25 +374,30 @@

      devDependencies

      themselves. In dev mode (ie, locally running npm install), it'll run this script as well, so that you can test it easily.

      peerDependencies

      -

      In some cases, you want to express the compatibility of your package with an +

      In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a require of this host. -This is usually refered to as a plugin. Notably, your module may be exposing +This is usually referred to as a plugin. Notably, your module may be exposing a specific interface, expected and specified by the host documentation.

      For example:

      {
         "name": "tea-latte",
      -  "version": "1.3.5"
      +  "version": "1.3.5",
         "peerDependencies": {
           "tea": "2.x"
         }
       }
       

      This ensures your package tea-latte can be installed along with the second -major version of the host package tea only. The host package is automatically -installed if needed. npm install tea-latte could possibly yield the following -dependency graph:

      +major version of the host package tea only. npm install tea-latte could +possibly yield the following dependency graph:

      ├── tea-latte@1.3.5
       └── tea@2.2.0
      -

      Trying to install another plugin with a conflicting requirement will cause an +

      NOTE: npm versions 1 and 2 will automatically install peerDependencies if +they are not explicitly depended upon higher in the dependency tree. In the +next major version of npm (npm@3), this will no longer be the case. You will +receive a warning that the peerDependency is not installed instead. The +behavior in npms 1 & 2 was frequently confusing and could easily put you into +dependency hell, a situation that npm is designed to avoid as much as possible.

      +

      Trying to install another plugin with a conflicting requirement will cause an error. For this reason, make sure your plugin requirement is as broad as possible, and not to lock it down to specific patch versions.

      Assuming the host complies with semver, only changes in @@ -393,6 +446,7 @@

      engines

      Note that, unless the user has set the engine-strict config flag, this field is advisory only.

      engineStrict

      +

      NOTE: This feature is deprecated and will be removed in npm 3.0.0.

      If you are sure that your module will definitely not run properly on versions of Node/npm other than those specified in the engines object, then you can set "engineStrict": true in your package.json file. @@ -400,8 +454,7 @@

      engineStrict

      Please do not do this unless you are really very very sure. If your engines object is something overly restrictive, you can quite easily and inadvertently lock yourself into obscurity and prevent your users from -updating to new versions of Node. Consider this choice carefully. If -people abuse it, it will be removed in a future version of npm.

      +updating to new versions of Node. Consider this choice carefully.

      os

      You can specify which operating systems your module will run on:

      @@ -485,5 +538,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/files/npmrc.html b/deps/npm/html/doc/files/npmrc.html index 9f379006f09..38f5c86e3e9 100644 --- a/deps/npm/html/doc/files/npmrc.html +++ b/deps/npm/html/doc/files/npmrc.html @@ -21,7 +21,7 @@

      FILES

      • per-project config file (/path/to/my/project/.npmrc)
      • per-user config file (~/.npmrc)
      • -
      • global config file ($PREFIX/npmrc)
      • +
      • global config file ($PREFIX/etc/npmrc)
      • npm builtin config file (/path/to/npm/npmrc)

      All npm config files are an ini-formatted list of key = value @@ -31,6 +31,14 @@

      FILES

      Each of these files is loaded, and config options are resolved in priority order. For example, a setting in the userconfig file would override the setting in the globalconfig file.

      +

      Array values are specified by adding "[]" after the key name. For +example:

      +
      key[] = "first value"
      +key[] = "second value"
      +

      NOTE: Because local (per-project or per-user) .npmrc files can contain +sensitive credentials, they must be readable and writable only by your user +account (i.e. must have a mode of 0600), otherwise they will be ignored by +npm!

      Per-project config file

      When working locally in a project, a .npmrc file in the root of the project (ie, a sibling of node_modules and package.json) will set @@ -73,5 +81,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/files/package.json.html b/deps/npm/html/doc/files/package.json.html index 183ad8ea5d6..66651bd4e50 100644 --- a/deps/npm/html/doc/files/package.json.html +++ b/deps/npm/html/doc/files/package.json.html @@ -21,18 +21,26 @@

      name

      them. The name and version together form an identifier that is assumed to be completely unique. Changes to the package should come along with changes to the version.

      -

      The name is what your thing is called. Some tips:

      +

      The name is what your thing is called.

      +

      Some rules:

        +
      • The name must be shorter than 214 characters. This includes the scope for +scoped packages.
      • +
      • The name can't start with a dot or an underscore.
      • +
      • New packages must not have uppercase letters in the name.
      • +
      • The name ends up being part of a URL, an argument on the command line, and a +folder name. Therefore, the name can't contain any non-URL-safe characters.
      • +
      +

      Some tips:

      +
        +
      • Don't use the same name as a core Node module.
      • Don't put "js" or "node" in the name. It's assumed that it's js, since you're writing a package.json file, and you can specify the engine using the "engines" field. (See below.)
      • -
      • The name ends up being part of a URL, an argument on the command line, and a -folder name. Any name with non-url-safe characters will be rejected. -Also, it can't start with a dot or an underscore.
      • The name will probably be passed as an argument to require(), so it should be something short, but also reasonably descriptive.
      • You may want to check the npm registry to see if there's something by that name -already, before you get too attached to it. http://registry.npmjs.org/
      • +already, before you get too attached to it. https://www.npmjs.com/

      A name can be optionally prefixed by a scope, e.g. @myorg/mypackage. See npm-scope(7) for more detail.

      @@ -63,7 +71,7 @@

      bugs

      issues should be reported. These are helpful for people who encounter issues with your package.

      It should look like this:

      -
      { "url" : "http://github.com/owner/project/issues"
      +
      { "url" : "https://github.com/owner/project/issues"
       , "email" : "project@hostname.com"
       }
       

      You can specify either one or both values. If you want to provide only a url, @@ -72,16 +80,44 @@

      bugs

      license

      You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you're placing on it.

      -

      The simplest way, assuming you're using a common license such as BSD-3-Clause -or MIT, is to just specify the standard SPDX ID of the license you're using, -like this:

      +

      If you're using a common license such as BSD-2-Clause or MIT, add a +current SPDX license identifier for the license you're using, like this:

      { "license" : "BSD-3-Clause" }
       

      You can check the full list of SPDX license IDs. Ideally you should pick one that is OSI approved.

      -

      It's also a good idea to include a LICENSE file at the top level in -your package.

      -

      people fields: author, contributors

      +

      If your package is licensed under multiple common licenses, use an SPDX license +expression syntax version 2.0 string, like this:

      +
      { "license" : "(ISC OR GPL-3.0)" }
      +

      If you are using a license that hasn't been assigned an SPDX identifier, or if +you are using a custom license, use the following valid SPDX expression:

      +
      { "license" : "LicenseRef-LICENSE" }
      +

      Then include a LICENSE file at the top level of the package.

      +

      Some old packages used license objects or a "licenses" property containing an +array of license objects:

      +
      // Not valid metadata
      +{ "license" :
      +  { "type" : "ISC"
      +  , "url" : "http://opensource.org/licenses/ISC"
      +  }
      +}
      +
      +// Not valid metadata
      +{ "licenses" :
      +  [
      +    { "type": "MIT"
      +    , "url": "http://www.opensource.org/licenses/mit-license.php"
      +    }
      +  , { "type": "Apache-2.0"
      +    , "url": "http://opensource.org/licenses/apache2.0.php"
      +    }
      +  ]
      +}
      +

      Those styles are now deprecated. Instead, use SPDX expressions, like this:

      +
      { "license": "ISC" }
      +
      +{ "license": "(MIT OR Apache-2.0)" }
      +

      people fields: author, contributors

      The "author" is one person. "contributors" is an array of people. A "person" is an object with a "name" field and optionally "url" and "email", like this:

      { "name" : "Barney Rubble"
      @@ -89,7 +125,7 @@ 

      people fields: author, contributors

      Or you can shorten that all into a single string, and npm will parse it for you:

      -
      "Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)
      +
      "Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)"
       

      Both email and url are optional either way.

      npm also sets a top-level "maintainers" field with your npm user info.

      files

      @@ -115,10 +151,10 @@

      bin

      command name to local file name. On install, npm will symlink that file into prefix/bin for global installs, or ./node_modules/.bin/ for local installs.

      -

      For example, npm has this:

      -
      { "bin" : { "npm" : "./cli.js" } }
      -

      So, when you install npm, it'll create a symlink from the cli.js script to -/usr/local/bin/npm.

      +

      For example, myapp could have this:

      +
      { "bin" : { "myapp" : "./cli.js" } }
      +

      So, when you install myapp, it'll create a symlink from the cli.js script to +/usr/local/bin/myapp.

      If you have a single executable, and its name should be the name of the package, then you can just supply it as a string. For example:

      { "name": "my-program"
      @@ -161,7 +197,7 @@ 

      bin

      directories

      The CommonJS Packages spec details a few ways that you can indicate the structure of your package using a directories -object. If you look at npm's package.json, +object. If you look at npm's package.json, you'll see that it has directories for doc, lib, and man.

      In the future, this information may be used in other creative ways.

      directories.lib

      @@ -181,22 +217,31 @@

      directories.example

      Put example scripts in here. Someday, it might be exposed in some clever way.

      repository

      Specify the place where your code lives. This is helpful for people who -want to contribute. If the git repo is on github, then the npm docs +want to contribute. If the git repo is on GitHub, then the npm docs command will be able to find you.

      Do it like this:

      "repository" :
         { "type" : "git"
      -  , "url" : "http://github.com/npm/npm.git"
      +  , "url" : "https://github.com/npm/npm.git"
         }
       
       "repository" :
         { "type" : "svn"
      -  , "url" : "http://v8.googlecode.com/svn/trunk/"
      +  , "url" : "https://v8.googlecode.com/svn/trunk/"
         }
       

      The URL should be a publicly available (perhaps read-only) url that can be handed directly to a VCS program without any modification. It should not be a url to an html project page that you put in your browser. It's for computers.

      -

      scripts

      +

      For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same +shortcut syntax you use for npm install:

      +
      "repository": "npm/npm"
      +
      +"repository": "gist:11081aaa281"
      +
      +"repository": "bitbucket:example/repo"
      +
      +"repository": "gitlab:another/repo"
      +

      scripts

      The "scripts" property is a dictionary containing script commands that are run at various times in the lifecycle of your package. The key is the lifecycle event, and the value is the command to run at that point.

      @@ -269,12 +314,15 @@

      Git URLs as Dependencies

      The commit-ish can be any tag, sha, or branch which can be supplied as an argument to git checkout. The default is master.

      GitHub URLs

      -

      As of version 1.1.65, you can refer to GitHub urls as just "foo": "user/foo-project". For example:

      +

      As of version 1.1.65, you can refer to GitHub urls as just "foo": +"user/foo-project". Just as with git URLs, a commit-ish suffix can be +included. For example:

      {
         "name": "foo",
         "version": "0.0.0",
         "dependencies": {
      -    "express": "visionmedia/express"
      +    "express": "visionmedia/express",
      +    "mocha": "visionmedia/mocha#4727d357ea"
         }
       }
       

      Local Paths

      @@ -326,25 +374,30 @@

      devDependencies

      themselves. In dev mode (ie, locally running npm install), it'll run this script as well, so that you can test it easily.

      peerDependencies

      -

      In some cases, you want to express the compatibility of your package with an +

      In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a require of this host. -This is usually refered to as a plugin. Notably, your module may be exposing +This is usually referred to as a plugin. Notably, your module may be exposing a specific interface, expected and specified by the host documentation.

      For example:

      {
         "name": "tea-latte",
      -  "version": "1.3.5"
      +  "version": "1.3.5",
         "peerDependencies": {
           "tea": "2.x"
         }
       }
       

      This ensures your package tea-latte can be installed along with the second -major version of the host package tea only. The host package is automatically -installed if needed. npm install tea-latte could possibly yield the following -dependency graph:

      +major version of the host package tea only. npm install tea-latte could +possibly yield the following dependency graph:

      ├── tea-latte@1.3.5
       └── tea@2.2.0
      -

      Trying to install another plugin with a conflicting requirement will cause an +

      NOTE: npm versions 1 and 2 will automatically install peerDependencies if +they are not explicitly depended upon higher in the dependency tree. In the +next major version of npm (npm@3), this will no longer be the case. You will +receive a warning that the peerDependency is not installed instead. The +behavior in npms 1 & 2 was frequently confusing and could easily put you into +dependency hell, a situation that npm is designed to avoid as much as possible.

      +

      Trying to install another plugin with a conflicting requirement will cause an error. For this reason, make sure your plugin requirement is as broad as possible, and not to lock it down to specific patch versions.

      Assuming the host complies with semver, only changes in @@ -393,6 +446,7 @@

      engines

      Note that, unless the user has set the engine-strict config flag, this field is advisory only.

      engineStrict

      +

      NOTE: This feature is deprecated and will be removed in npm 3.0.0.

      If you are sure that your module will definitely not run properly on versions of Node/npm other than those specified in the engines object, then you can set "engineStrict": true in your package.json file. @@ -400,8 +454,7 @@

      engineStrict

      Please do not do this unless you are really very very sure. If your engines object is something overly restrictive, you can quite easily and inadvertently lock yourself into obscurity and prevent your users from -updating to new versions of Node. Consider this choice carefully. If -people abuse it, it will be removed in a future version of npm.

      +updating to new versions of Node. Consider this choice carefully.

      os

      You can specify which operating systems your module will run on:

      @@ -485,5 +538,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/index.html b/deps/npm/html/doc/index.html index 6c68895e073..e45b852b5f9 100644 --- a/deps/npm/html/doc/index.html +++ b/deps/npm/html/doc/index.html @@ -11,11 +11,13 @@

      npm-index

      Index of all npm documentation

      README

      -

      node package manager

      +

      a JavaScript package manager

      Command Line Documentation

      Using npm on the command line

      npm(1)

      -

      node package manager

      +

      javascript package manager

      +

      npm-access(1)

      +

      Set access level on published packages

      npm-adduser(1)

      Add a registry user account

      npm-bin(1)

      @@ -36,6 +38,8 @@

      npm-deprecate(1)

      Deprecate a version of a package

      +

      npm-dist-tag(1)

      +

      Modify package distribution tags

      npm-docs(1)

      Docs for a package in a web browser maybe

      npm-edit(1)

      @@ -52,6 +56,8 @@

      npm-link(1)

      Symlink a package folder

      +

      npm-logout(1)

      +

      Log out of the registry

      npm-ls(1)

      List installed packages

      npm-outdated(1)

      @@ -71,7 +77,7 @@

      npm-repo(1)

      Open package repository page in the browser

      npm-restart(1)

      -

      Start a package

      +

      Restart a package

      npm-rm(1)

      Remove a package

      npm-root(1)

      @@ -109,7 +115,7 @@

      API Documentation

      Using npm in your Node programs

      npm(3)

      -

      node package manager

      +

      javascript package manager

      npm-bin(3)

      Display npm bin folder

      npm-bugs(3)

      @@ -157,7 +163,7 @@

      npm-repo(3)

      Open package repository page in the browser

      npm-restart(3)

      -

      Start a package

      +

      Restart a package

      npm-root(3)

      Display npm root

      npm-run-script(3)

      @@ -230,5 +236,5 @@

      semver(        - + diff --git a/deps/npm/html/doc/misc/npm-coding-style.html b/deps/npm/html/doc/misc/npm-coding-style.html index 30d3e07cfab..c336977c58d 100644 --- a/deps/npm/html/doc/misc/npm-coding-style.html +++ b/deps/npm/html/doc/misc/npm-coding-style.html @@ -16,14 +16,14 @@

      DESCRIPTION

      designed to reduce visual clutter and make bugs more apparent.

      If you want to contribute to npm (which is very encouraged), you should make your code conform to npm's style.

      -

      Note: this concerns npm's code not the specific packages at npmjs.org

      +

      Note: this concerns npm's code not the specific packages that you can download from the npm registry.

      Line Length

      Keep lines shorter than 80 characters. It's better for lines to be too short than to be too long. Break up long lists, objects, and other statements onto multiple lines.

      Indentation

      Two-spaces. Tabs are better, but they look like hell in web browsers -(and on github), and node uses 2 spaces, so that's that.

      +(and on GitHub), and node uses 2 spaces, so that's that.

      Configure your editor appropriately.

      Curly braces

      Curly braces belong on the same line as the thing that necessitates them.

      @@ -147,5 +147,5 @@

      SEE ALSO

             - + diff --git a/deps/npm/html/doc/misc/npm-config.html b/deps/npm/html/doc/misc/npm-config.html index 249d5934c9e..baa0762f1bb 100644 --- a/deps/npm/html/doc/misc/npm-config.html +++ b/deps/npm/html/doc/misc/npm-config.html @@ -11,7 +11,7 @@

      npm-config

      More than you probably want to know about npm configuration

      DESCRIPTION

      -

      npm gets its configuration values from 6 sources, in this priority:

      +

      npm gets its configuration values from the following sources, sorted by priority:

      Command Line Flags

      Putting --foo bar on the command line sets the foo configuration parameter to "bar". A -- argument tells the cli parser to stop @@ -53,7 +53,6 @@

      Shorthands and Other CLI Niceties

      -m: --message
    • -p, --porcelain: --parseable
    • -reg: --registry
    • -
    • -v: --version
    • -f: --force
    • -desc: --description
    • -S: --save
    • @@ -92,6 +91,15 @@

      Shorthands and Other CLI Niceties

      npm config set foo:port 80

      See package.json(5) for more information.

      Config Settings

      +

      access

      +
        +
      • Default: restricted
      • +
      • Type: Access
      • +
      +

      When publishing scoped packages, the access level defaults to restricted. If +you want your scoped package to be publicly viewable (and installable) set +--access=public. The only valid values for access are public and +restricted. Unscoped packages always have an access level of public.

      always-auth

      • Default: false
      • @@ -118,13 +126,18 @@

        browser

        ca

        • Default: The npm CA certificate
        • -
        • Type: String or null
        • +
        • Type: String, Array or null

        The Certificate Authority signing certificate that is trusted for SSL -connections to the registry.

        -

        Set to null to only allow "known" registrars, or to a specific CA cert +connections to the registry. Values should be in PEM format with newlines +replaced by the string "\n". For example:

        +
        ca="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
        +

        Set to null to only allow "known" registrars, or to a specific CA cert to trust only that specific signing authority.

        -

        See also the strict-ssl config.

        +

        Multiple CAs can be trusted by specifying an array of certificates:

        +
        ca[]="..."
        +ca[]="..."
        +

        See also the strict-ssl config.

        cafile

        • Default: null
        • @@ -193,8 +206,12 @@

          depth

        • Default: Infinity
        • Type: Number
        -

        The depth to go when recursing directories for npm ls and -npm cache ls.

        +

        The depth to go when recursing directories for npm ls, +npm cache ls, and npm outdated.

        +

        For npm outdated, a setting of Infinity will be treated as 0 +since that gives more useful information. To show the outdated status +of all packages and dependents, use a large integer value, +e.g., npm outdated --depth 9999

        description

        • Default: true
        • @@ -313,11 +330,22 @@

          heading

          The string that starts all the debugging log output.

          https-proxy

            -
          • Default: the HTTPS_PROXY or https_proxy or HTTP_PROXY or -http_proxy environment variables.
          • +
          • Default: null
          • Type: url
          -

          A proxy to use for outgoing https requests.

          +

          A proxy to use for outgoing https requests. If the HTTPS_PROXY or +https_proxy or HTTP_PROXY or http_proxy environment variables are set, +proxy settings will be honored by the underlying request library.

          +

          if-present

          +
            +
          • Default: false
          • +
          • Type: Boolean
          • +
          +

          If true, npm will not exit with an error code when run-script is invoked for +a script that isn't defined in the scripts section of package.json. This +option can be used when it's desirable to optionally run a script when it's +present and fail if the script fails. This is useful, for example, when running +scripts that may only apply for some builds in an otherwise generic CI setup.

          ignore-scripts

          • Default: false
          • @@ -359,7 +387,7 @@

            init-license

            The value npm init should use by default for the package license.

            init-version

              -
            • Default: "0.0.0"
            • +
            • Default: "1.0.0"
            • Type: semver

            The value that npm init should use by default for the package @@ -500,10 +528,12 @@

            proprietary-attribs

            this as true.

            proxy

              -
            • Default: HTTP_PROXY or http_proxy environment variable, or null
            • +
            • Default: null
            • Type: url
            -

            A proxy to use for outgoing http requests.

            +

            A proxy to use for outgoing http requests. If the HTTP_PROXY or +http_proxy environment variables are set, proxy settings will be +honored by the underlying request library.

            rebuild-bundle

            • Default: true
            • @@ -575,7 +605,7 @@

              save-prefix

            Configure how versions of packages installed to a package.json file via --save or --save-dev get prefixed.

            -

            For example if a package has version 1.2.3, by default it's version is +

            For example if a package has version 1.2.3, by default its version is set to ^1.2.3 which allows minor upgrades for that package, but after npm config set save-prefix='~' it would be set to ~1.2.3 which only allows patch upgrades.

            @@ -659,6 +689,17 @@

            tag

            it will install the specified tag.

            Also the tag that is added to the package@version specified by the npm tag command, if no explicit tag is given.

            +

            tag-version-prefix

            +
              +
            • Default: "v"
            • +
            • Type: String
            • +
            +

            If set, alters the prefix used when tagging a new version when performing a +version increment using npm-version. To remove the prefix altogether, set it +to the empty string: "".

            +

            Because other tools may rely on the convention that npm version tags look like +v1.0.0, only use this property if it is absolutely necessary. In +particular, use care when overriding this setting for public packages.

            tmp

            • Default: TMPDIR environment variable, or "/tmp"
            • @@ -703,7 +744,7 @@

              userconfig

              umask

              • Default: 022
              • -
              • Type: Octal numeric string
              • +
              • Type: Octal numeric string in range 0000..0777 (0..511)

              The "umask" value to use when setting the file creation mode on files and folders.

              @@ -741,7 +782,6 @@

              viewer

              SEE ALSO

              • npm-config(1)
              • -
              • npm-config(7)
              • npmrc(5)
              • npm-scripts(7)
              • npm-folders(5)
              • @@ -759,5 +799,5 @@

                SEE ALSO

                       - + diff --git a/deps/npm/html/doc/misc/npm-developers.html b/deps/npm/html/doc/misc/npm-developers.html index b4190a1a2b1..c3b26357b23 100644 --- a/deps/npm/html/doc/misc/npm-developers.html +++ b/deps/npm/html/doc/misc/npm-developers.html @@ -94,6 +94,14 @@

                Keeping files out of your pa ignore the stuff matched by the .gitignore file. If you want to include something that is excluded by your .gitignore file, you can create an empty .npmignore file to override it.

                +

                .npmignore files follow the same pattern rules +as .gitignore files:

                +
                  +
                • Blank lines or lines starting with # are ignored.
                • +
                • Standard glob patterns work.
                • +
                • You can end patterns with a forward slash / to specify a directory.
                • +
                • You can negate a pattern by starting it with an exclamation point !.
                • +

                By default, the following paths and files are ignored, so there's no need to add them to .npmignore explicitly:

                  @@ -181,5 +189,5 @@

                  SEE ALSO

                         - + diff --git a/deps/npm/html/doc/misc/npm-disputes.html b/deps/npm/html/doc/misc/npm-disputes.html index f59921e2e95..797d3e6bce9 100644 --- a/deps/npm/html/doc/misc/npm-disputes.html +++ b/deps/npm/html/doc/misc/npm-disputes.html @@ -13,7 +13,7 @@

                  npm-disputes

                  Handling Module

                  SYNOPSIS

                  1. Get the author email with npm owner ls <pkgname>
                  2. -
                  3. Email the author, CC support@npmjs.com
                  4. +
                  5. Email the author, CC support@npmjs.com
                  6. After a few weeks, if there's no resolution, we'll sort it out.

                  Don't squat on package names. Publish code or move out of the way.

                  @@ -51,12 +51,12 @@

                  DESCRIPTION

                  owner (Bob).
                • Joe emails Bob, explaining the situation as respectfully as possible, and what he would like to do with the module name. He -adds the npm support staff support@npmjs.com to the CC list of +adds the npm support staff support@npmjs.com to the CC list of the email. Mention in the email that Bob can run npm owner add joe foo to add Joe as an owner of the foo package.
                • After a reasonable amount of time, if Bob has not responded, or if Bob and Joe can't come to any sort of resolution, email support -support@npmjs.com and we'll sort it out. ("Reasonable" is +support@npmjs.com and we'll sort it out. ("Reasonable" is usually at least 4 weeks, but extra time is allowed around common holidays.)
                • @@ -112,5 +112,5 @@

                  SEE ALSO

                         - + diff --git a/deps/npm/html/doc/misc/npm-faq.html b/deps/npm/html/doc/misc/npm-faq.html index 08c8eafce24..01ef2c2d42f 100644 --- a/deps/npm/html/doc/misc/npm-faq.html +++ b/deps/npm/html/doc/misc/npm-faq.html @@ -11,7 +11,7 @@

                  npm-faq

                  Frequently Asked Questions

                  Where can I find these docs in HTML?

                  -

                  https://www.npmjs.org/doc/, or run:

                  +

                  https://docs.npmjs.com/, or run:

                  npm config set viewer browser
                   

                  to open these documents in your default web browser rather than man.

                  It didn't work.

                  @@ -62,7 +62,7 @@

                  Should I check my Usually, no. Allow npm to resolve dependencies for your packages.

                  For packages you deploy, such as websites and apps, you should use npm shrinkwrap to lock down your full dependency tree:

                  -

                  https://www.npmjs.org/doc/cli/npm-shrinkwrap.html

                  +

                  https://docs.npmjs.com/cli/shrinkwrap

                  If you are paranoid about depending on the npm ecosystem, you should run a private npm mirror or a private cache.

                  If you want 100% confidence in being able to reproduce the specific bytes @@ -108,7 +108,7 @@

                  How do I update npm?

                  installed already. (Consider, if there is ever a bug in the update command.)

                  In those cases, you can do this:

                  -
                  curl https://www.npmjs.org/install.sh | sh
                  +
                  curl https://www.npmjs.com/install.sh | sh
                   

                  What is a package?

                  A package is:

                  There is nothing special about the way Node treats scope folders, this is just specifying to require the module mypackage in the folder called @myorg.

                  Publishing scoped packages

                  -

                  Scoped packages can be published to any registry that supports them. -As of 2014-09-03, the public npm registry does not support scoped packages, -so attempting to publish a scoped package to the registry will fail unless -you have associated that scope with a different registry, see below.

                  +

                  Scoped packages can be published to any registry that supports them, including +the public npm registry.

                  +

                  (As of 2015-04-19, the public npm registry does support scoped packages)

                  +

                  If you wish, you may associate a scope with a registry; see below.

                  +

                  Publishing public scoped packages to the public npm registry

                  +

                  To publish a public scoped package, you must specify --access public with +the initial publication. This will publish the package and set access +to public as if you had run npm access public after publishing.

                  +

                  Publishing private scoped packages to the npm registry

                  +

                  To publish a private scoped package to the npm registry, you must have +an npm Private Modules +account.

                  +

                  You can then publish the module with npm publish or npm publish +--access restricted, and it will be present in the npm registry, with +restricted access. You can then change the access permissions, if +desired, with npm access or on the npmjs.com website.

                  Associating a scope with a registry

                  Scopes can be associated with a separate registry. This allows you to seamlessly use a mix of packages from the public npm registry and one or more @@ -65,6 +77,7 @@

                  SEE ALSO

                  @@ -78,5 +91,5 @@

                  SEE ALSO

                         - + diff --git a/deps/npm/html/doc/misc/npm-scripts.html b/deps/npm/html/doc/misc/npm-scripts.html index b2a3dbd383d..982c219fea6 100644 --- a/deps/npm/html/doc/misc/npm-scripts.html +++ b/deps/npm/html/doc/misc/npm-scripts.html @@ -27,10 +27,10 @@

                  DESCRIPTION

                  Run BEFORE the package is uninstalled.
                • postuninstall: Run AFTER the package is uninstalled.
                • -
                • preupdate: -Run BEFORE the package is updated with the update command.
                • -
                • update, postupdate: -Run AFTER the package is updated with the update command.
                • +
                • preversion, version: +Run BEFORE bump the package version.
                • +
                • postversion: +Run AFTER bump the package version.
                • pretest, test, posttest: Run by the npm test command.
                • prestop, stop, poststop: @@ -45,41 +45,23 @@

                  DESCRIPTION

                  run-script <pkg> <stage>
                  . Pre and post commands with matching names will be run for those as well (e.g. premyscript, myscript, postmyscript).

                  -

                  NOTE: INSTALL SCRIPTS ARE AN ANTIPATTERN

                  -

                  tl;dr Don't use install. Use a .gyp file for compilation, and -prepublish for anything else.

                  -

                  You should almost never have to explicitly set a preinstall or -install script. If you are doing this, please consider if there is -another option.

                  -

                  The only valid use of install or preinstall scripts is for -compilation which must be done on the target architecture. In early -versions of node, this was often done using the node-waf scripts, or -a standalone Makefile, and early versions of npm required that it be -explicitly set in package.json. This was not portable, and harder to -do properly.

                  -

                  In the current version of node, the standard way to do this is using a -.gyp file. If you have a file with a .gyp extension in the root -of your package, then npm will run the appropriate node-gyp commands -automatically at install time. This is the only officially supported -method for compiling binary addons, and does not require that you add -anything to your package.json file.

                  -

                  If you have to do other things before your package is used, in a way +

                  COMMON USES

                  +

                  If you need to perform operations on your package before it is used, in a way that is not dependent on the operating system or architecture of the -target system, then use a prepublish script instead. This includes +target system, use a prepublish script. This includes tasks such as:

                    -
                  • Compile CoffeeScript source code into JavaScript.
                  • -
                  • Create minified versions of JavaScript source code.
                  • +
                  • Compiling CoffeeScript source code into JavaScript.
                  • +
                  • Creating minified versions of JavaScript source code.
                  • Fetching remote resources that your package will use.
                  -

                  The advantage of doing these things at prepublish time instead of -preinstall or install time is that they can be done once, in a -single place, and thus greatly reduce complexity and variability. +

                  The advantage of doing these things at prepublish time is that they can be done once, in a +single place, thus reducing complexity and variability. Additionally, this means that:

                  • You can depend on coffee-script as a devDependency, and thus your users don't need to have it installed.
                  • -
                  • You don't need to include the minifiers in your package, reducing +
                  • You don't need to include minifiers in your package, reducing the size for your users.
                  • You don't need to rely on your users having curl or wget or other system tools on the target machines.
                  • @@ -200,6 +182,11 @@

                    BEST PRACTICES

                  • Don't prefix your script commands with "sudo". If root permissions are required for some reason, then it'll fail with that error, and the user will sudo the npm command in question.
                  • +
                  • Don't use install. Use a .gyp file for compilation, and prepublish +for anything else. You should almost never have to explicitly set a +preinstall or install script. If you are doing this, please consider if +there is another option. The only valid use of install or preinstall +scripts is for compilation which must be done on the target architecture.

                  SEE ALSO

                    @@ -220,5 +207,5 @@

                    SEE ALSO

                           - + diff --git a/deps/npm/html/doc/misc/removing-npm.html b/deps/npm/html/doc/misc/removing-npm.html index 3028625d1bf..37253651bb5 100644 --- a/deps/npm/html/doc/misc/removing-npm.html +++ b/deps/npm/html/doc/misc/removing-npm.html @@ -57,5 +57,5 @@

                    SEE ALSO

                           - + diff --git a/deps/npm/html/doc/misc/semver.html b/deps/npm/html/doc/misc/semver.html index eeea8fbc40f..bf227e4834a 100644 --- a/deps/npm/html/doc/misc/semver.html +++ b/deps/npm/html/doc/misc/semver.html @@ -22,12 +22,12 @@

                    Usage

                    As a command-line utility:

                    $ semver -h
                     
                    -Usage: semver <version> [<version> [...]] [-r <range> | -i <inc> | -d <dec>]
                    +Usage: semver <version> [<version> [...]] [-r <range> | -i <inc> | --preid <identifier> | -l | -rv]
                     Test if version(s) satisfy the supplied range(s), and sort them.
                     
                     Multiple versions or ranges may be supplied, unless increment
                    -or decrement options are specified.  In that case, only a single
                    -version may be used, and it is incremented by the specified level
                    +option is specified.  In that case, only a single version may
                    +be used, and it is incremented by the specified level
                     
                     Program exits successfully if any valid version satisfies
                     all supplied ranges, and prints all satisfying versions.
                    @@ -91,6 +91,20 @@ 

                    Prerelease Tags

                    the user is indicating that they are aware of the risk. However, it is still not appropriate to assume that they have opted into taking a similar risk on the next set of prerelease versions.

                    +

                    Prerelease Identifiers

                    +

                    The method .inc takes an additional identifier string argument that +will append the value of the string as a prerelease identifier:

                    +
                    > semver.inc('1.2.3', 'pre', 'beta')
                    +'1.2.4-beta.0'
                    +
                    +

                    command-line example:

                    +
                    $ semver 1.2.3 -i prerelease --preid beta
                    +1.2.4-beta.0
                    +
                    +

                    Which then can be used to increment further:

                    +
                    $ semver 1.2.4-beta.0 -i prerelease
                    +1.2.4-beta.1
                    +

                    Advanced Range Syntax

                    Advanced range syntax desugars to primitive comparators in deterministic ways.

                    @@ -145,7 +159,6 @@

                    Tilde Ranges ~1.2.3 ~1.21.2.4-beta.2 would not, because it is a prerelease of a different [major, minor, patch] tuple.

                  -

                  Note: this is the same as the ~> operator in rubygems.

                  Caret Ranges ^1.2.3 ^0.2.5 ^0.0.4

                  Allows changes that do not modify the left-most non-zero digit in the [major, minor, patch] tuple. In other words, this allows patch and @@ -206,6 +219,9 @@

                  Functions

                  increments it.
                +
              • major(v): Return the major version number.
              • +
              • minor(v): Return the minor version number.
              • +
              • patch(v): Return the patch version number.

              Comparison

                @@ -225,6 +241,9 @@

                Comparison

                v2 is greater. Sorts in ascending order if passed to Array.sort().
              • rcompare(v1, v2): The reverse of compare. Sorts an array of versions in descending order when passed to Array.sort().
              • +
              • diff(v1, v2): Returns difference between two versions by the release type +(major, premajor, minor, preminor, patch, prepatch, or prerelease), +or null if the versions are the same.

              Ranges

                @@ -263,5 +282,5 @@

                Ranges

                       - + diff --git a/deps/npm/html/index.html b/deps/npm/html/index.html index bf0a3f0b62a..06ca14ba4ac 100644 --- a/deps/npm/html/index.html +++ b/deps/npm/html/index.html @@ -52,7 +52,7 @@ } - npm - Node Package Manager + npm - JavaScript Package Manager

                npm

                diff --git a/deps/npm/html/partial/doc/README.html b/deps/npm/html/partial/doc/README.html index 13ff98d2c37..7db20d8965a 100644 --- a/deps/npm/html/partial/doc/README.html +++ b/deps/npm/html/partial/doc/README.html @@ -1,4 +1,4 @@ -

                npm

                node package manager

                +

                npm

                a JavaScript package manager

                Build Status

                SYNOPSIS

                This is just enough info to get you up and running.

                @@ -19,52 +19,42 @@

                Other Sorts of Unices

                paths, etc.) then read on.

                Fancy Install (Unix)

                There's a pretty robust install script at -https://www.npmjs.org/install.sh. You can download that and run it.

                +https://www.npmjs.com/install.sh. You can download that and run it.

                Here's an example using curl:

                -
                curl -L https://npmjs.org/install.sh | sh
                -

                Slightly Fancier

                +
                curl -L https://www.npmjs.com/install.sh | sh
                +
                +

                Slightly Fancier

                You can set any npm configuration params with that script:

                -
                npm_config_prefix=/some/path sh install.sh
                -

                Or, you can run it in uber-debuggery mode:

                -
                npm_debug=1 sh install.sh
                -

                Even Fancier

                +
                npm_config_prefix=/some/path sh install.sh
                +
                +

                Or, you can run it in uber-debuggery mode:

                +
                npm_debug=1 sh install.sh
                +
                +

                Even Fancier

                Get the code with git. Use make to build the docs and do other stuff. If you plan on hacking on npm, make link is your friend.

                If you've got the npm source code, you can also semi-permanently set arbitrary config keys using the ./configure --key=val ..., and then run npm commands by doing node cli.js <cmd> <args>. (This is helpful for testing, or running stuff without actually installing npm itself.)

                -

                Fancy Windows Install

                -

                You can download a zip file from https://npmjs.org/dist/, and unpack it -in the same folder where node.exe lives.

                +

                Windows Install or Upgrade

                +

                You can download a zip file from https://github.com/npm/npm/releases, and +unpack it in the node_modules\npm\ folder inside node's installation folder.

                +

                To upgrade to npm 2, follow the Windows upgrade instructions in +the npm Troubleshooting Guide:

                +

                https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows

                If that's not fancy enough for you, then you can fetch the code with git, and mess with it directly.

                Installing on Cygwin

                No.

                -

                Permissions when Using npm to Install Other Stuff

                -

                tl;dr

                -
                  -
                • Use sudo for greater safety. Or don't, if you prefer not to.
                • -
                • npm will downgrade permissions if it's root before running any build -scripts that package authors specified.
                • -
                -

                More details...

                -

                As of version 0.3, it is recommended to run npm as root. -This allows npm to change the user identifier to the nobody user prior -to running any package build or test commands.

                -

                If you are not the root user, or if you are on a platform that does not -support uid switching, then npm will not attempt to change the userid.

                -

                If you would like to ensure that npm always runs scripts as the -"nobody" user, and have it fail if it cannot downgrade permissions, then -set the following configuration param:

                -
                npm config set unsafe-perm false
                -

                This will prevent running in unsafe mode, even as non-root users.

                Uninstalling

                So sad to see you go.

                -
                sudo npm uninstall npm -g
                -

                Or, if that fails,

                -
                sudo make uninstall
                -

                More Severe Uninstalling

                +
                sudo npm uninstall npm -g
                +
                +

                Or, if that fails,

                +
                sudo make uninstall
                +
                +

                More Severe Uninstalling

                Usually, the above instructions are sufficient. That will remove npm, but leave behind anything you've installed.

                If you would like to remove all the packages that you have installed, @@ -72,25 +62,33 @@

                Uninstalling

                remove them.

                To remove cruft left behind by npm 0.x, you can use the included clean-old.sh script file. You can run it conveniently like this:

                -
                npm explore npm -g -- sh scripts/clean-old.sh
                -

                npm uses two configuration files, one for per-user configs, and another +

                npm explore npm -g -- sh scripts/clean-old.sh
                +
                +

                npm uses two configuration files, one for per-user configs, and another for global (every-user) configs. You can view them by doing:

                -
                npm config get userconfig   # defaults to ~/.npmrc
                +
                npm config get userconfig   # defaults to ~/.npmrc
                 npm config get globalconfig # defaults to /usr/local/etc/npmrc
                -

                Uninstalling npm does not remove configuration files by default. You +

                +

                Uninstalling npm does not remove configuration files by default. You must remove them yourself manually if you want them gone. Note that this means that future npm installs will not remember the settings that you have chosen.

                Using npm Programmatically

                -

                If you would like to use npm programmatically, you can do that. -It's not very well documented, but it is rather simple.

                -

                Most of the time, unless you actually want to do all the things that -npm does, you should try using one of npm's dependencies rather than -using npm itself, if possible.

                -

                Eventually, npm will be just a thin cli wrapper around the modules -that it depends on, but for now, there are some things that you must -use npm itself to do.

                -
                var npm = require("npm")
                +

                Although npm can be used programmatically, its API is meant for use by the CLI +only, and no guarantees are made regarding its fitness for any other purpose. +If you want to use npm to reliably perform some task, the safest thing to do is +to invoke the desired npm command with appropriate arguments.

                +

                The semantic version of npm refers to the CLI itself, rather than the +underlying API. The internal API is not guaranteed to remain stable even when +npm's version indicates no breaking changes have been made according to +semver.

                +

                If you still would like to use npm programmatically, it's possible. The API +isn't very well documented, but it is rather simple.

                +

                Eventually, npm will be just a thin CLI wrapper around the modules that it +depends on, but for now, there are some things that only the CLI can do. You +should try using one of npm's dependencies first, and only use the API if what +you're trying to do is only supported by npm itself.

                +
                var npm = require("npm")
                 npm.load(myConfigObject, function (er) {
                   if (er) return handlError(er)
                   npm.commands.install(["some", "args"], function (er, data) {
                @@ -99,7 +97,8 @@ 

                Using npm Programmatically

                }) npm.registry.log.on("log", function (message) { .... }) }) -

                The load function takes an object hash of the command-line configs. +

                +

                The load function takes an object hash of the command-line configs. The various npm.commands.<cmd> functions take an array of positional argument strings. The last argument to any npm.commands.<cmd> function is a callback. Some commands take other @@ -111,11 +110,11 @@

                Using npm Programmatically

                command line arguments using nopt. You may also want to check out npm help config to learn about all the options you can set there.

                More Docs

                -

                Check out the docs, -especially the faq.

                +

                Check out the docs, +especially the faq.

                You can use the npm help command to read any of them.

                If you're a developer, and you want to use npm to publish your program, -you should read this

                +you should read this

                "npm" and "The npm Registry" are owned by npm, Inc. All rights reserved. See the included LICENSE file for more details.

                @@ -124,13 +123,13 @@ npm, Inc. or the Node.js project.

                Data published to the npm registry is not part of npm itself, and is the sole property of the publisher. While every effort is made to -ensure accountability, there is absolutely no guarantee, warrantee, or +ensure accountability, there is absolutely no guarantee, warranty, or assertion expressed or implied as to the quality, fitness for a specific purpose, or lack of malice in any given npm package.

                If you have a complaint about a package in the public npm registry, -and cannot resolve it with the package +and cannot resolve it with the package owner, please email -support@npmjs.com and explain the situation.

                +support@npmjs.com and explain the situation.

                Any data published to The npm Registry (including user account information) may be removed or modified at the sole discretion of the npm server administrators.

                @@ -149,8 +148,6 @@

                BUGS

                Be sure to include all of the output from the npm command that didn't work as expected. The npm-debug.log file is also helpful to provide.

                diff --git a/deps/npm/html/partial/doc/api/npm-ls.html b/deps/npm/html/partial/doc/api/npm-ls.html index 508003ca158..850955b8361 100644 --- a/deps/npm/html/partial/doc/api/npm-ls.html +++ b/deps/npm/html/partial/doc/api/npm-ls.html @@ -38,6 +38,6 @@

                global

                List packages in the global install prefix instead of in the current project.

                Note, if parseable is set or long isn't set, then duplicates will be trimmed. -This means that if a submodule a same dependency as a parent module, then the +This means that if a submodule has the same dependency as a parent module, then the dependency will only be output once.

                diff --git a/deps/npm/html/partial/doc/api/npm-restart.html b/deps/npm/html/partial/doc/api/npm-restart.html index 35db404d785..f0de7504a5b 100644 --- a/deps/npm/html/partial/doc/api/npm-restart.html +++ b/deps/npm/html/partial/doc/api/npm-restart.html @@ -1,13 +1,29 @@ -

                npm-restart

                Start a package

                +

                npm-restart

                Restart a package

                SYNOPSIS

                npm.commands.restart(packages, callback)
                 

                DESCRIPTION

                -

                This runs a package's "restart" script, if one was provided. -Otherwise it runs package's "stop" script, if one was provided, and then -the "start" script.

                +

                This restarts a package (or multiple packages).

                +

                This runs a package's "stop", "restart", and "start" scripts, and associated +pre- and post- scripts, in the order given below:

                +
                  +
                1. prerestart
                2. +
                3. prestop
                4. +
                5. stop
                6. +
                7. poststop
                8. +
                9. restart
                10. +
                11. prestart
                12. +
                13. start
                14. +
                15. poststart
                16. +
                17. postrestart
                18. +

                If no version is specified, then it restarts the "active" version.

                -

                npm can run tests on multiple packages. Just specify multiple packages -in the packages parameter.

                +

                npm can restart multiple packages. Just specify multiple packages in +the packages parameter.

                +

                NOTE

                +

                Note that the "restart" script is run in addition to the "stop" +and "start" scripts, not instead of them.

                +

                This is the behavior as of npm major version 2. A change in this +behavior will be accompanied by an increase in major version number

                SEE ALSO

                • npm-start(3)
                • diff --git a/deps/npm/html/partial/doc/api/npm-start.html b/deps/npm/html/partial/doc/api/npm-start.html index 2eae8ba0f59..98bd41f6b24 100644 --- a/deps/npm/html/partial/doc/api/npm-start.html +++ b/deps/npm/html/partial/doc/api/npm-start.html @@ -3,6 +3,6 @@

                  SYNOPSIS

                  npm.commands.start(packages, callback)
                   

                  DESCRIPTION

                  This runs a package's "start" script, if one was provided.

                  -

                  npm can run tests on multiple packages. Just specify multiple packages -in the packages parameter.

                  +

                  npm can start multiple packages. Just specify multiple packages in the +packages parameter.

                  diff --git a/deps/npm/html/partial/doc/api/npm-submodule.html b/deps/npm/html/partial/doc/api/npm-submodule.html index 669841402f6..cc7dd822ada 100644 --- a/deps/npm/html/partial/doc/api/npm-submodule.html +++ b/deps/npm/html/partial/doc/api/npm-submodule.html @@ -19,4 +19,3 @@

                  SEE ALSO

                • npm help json
                • git help submodule
                - diff --git a/deps/npm/html/partial/doc/api/npm-tag.html b/deps/npm/html/partial/doc/api/npm-tag.html index f288fc15cfd..227c91b46ca 100644 --- a/deps/npm/html/partial/doc/api/npm-tag.html +++ b/deps/npm/html/partial/doc/api/npm-tag.html @@ -10,7 +10,7 @@

                SYNOPSIS

                is the package name and version is the version number (much like installing a specific version).

                The second element is the name of the tag to tag this version with. If this -parameter is missing or falsey (empty), the default froom the config will be +parameter is missing or falsey (empty), the default from the config will be used. For more information about how to set this config, check man 3 npm-config for programmatic usage or man npm-config for cli usage.

                diff --git a/deps/npm/html/partial/doc/api/npm-update.html b/deps/npm/html/partial/doc/api/npm-update.html index d05771159b8..5d48bc0d8ec 100644 --- a/deps/npm/html/partial/doc/api/npm-update.html +++ b/deps/npm/html/partial/doc/api/npm-update.html @@ -2,6 +2,12 @@

                npm-update

                Update a package

                SYNOPSIS

                npm.commands.update(packages, callback)
                 

                DESCRIPTION

                -

                Updates a package, upgrading it to the latest version. It also installs any missing packages.

                -

                The 'packages' argument is an array of packages to update. The 'callback' parameter will be called when done or when an error occurs.

                +

                Updates a package, upgrading it to the latest version. It also installs any +missing packages.

                +

                The packages argument is an array of packages to update. The callback +parameter will be called when done or when an error occurs.

                +

                SEE ALSO

                + diff --git a/deps/npm/html/partial/doc/api/npm.html b/deps/npm/html/partial/doc/api/npm.html index dbd481b380a..8e9de746a14 100644 --- a/deps/npm/html/partial/doc/api/npm.html +++ b/deps/npm/html/partial/doc/api/npm.html @@ -1,4 +1,4 @@ -

                npm

                node package manager

                +

                npm

                javascript package manager

                SYNOPSIS

                var npm = require("npm")
                 npm.load([configObject, ]function (er, npm) {
                @@ -12,7 +12,7 @@ 

                SYNOPSIS

                npm.commands.install(["package"], cb) })

                VERSION

                -

                2.1.6

                +

                2.11.3

                DESCRIPTION

                This is the API documentation for npm. To find documentation of the command line diff --git a/deps/npm/html/partial/doc/cli/npm-access.html b/deps/npm/html/partial/doc/cli/npm-access.html new file mode 100644 index 00000000000..9d84e6db958 --- /dev/null +++ b/deps/npm/html/partial/doc/cli/npm-access.html @@ -0,0 +1,55 @@ +

                npm-access

                Set access level on published packages

                +

                SYNOPSIS

                +
                npm access public [<package>]
                +npm access restricted [<package>]
                +
                +npm access add <read-only|read-write> <entity> [<package>]
                +npm access rm <entity> [<package>]
                +
                +npm access ls [<package>]
                +npm access edit [<package>]
                +

                DESCRIPTION

                +

                Used to set access controls on private packages.

                +

                For all of the subcommands, npm access will perform actions on the packages +in the current working directory if no package name is passed to the +subcommand.

                +
                  +
                • public / restricted: +Set a package to be either publicly accessible or restricted.

                  +
                • +
                • add / rm: +Add or remove the ability of users and teams to have read-only or read-write +access to a package.

                  +
                • +
                • ls: +Show all of the access privileges for a package. Will only show permissions +for packages to which you have at least read access.

                  +
                • +
                • edit: +Set the access privileges for a package at once using $EDITOR.

                  +
                • +
                +

                DETAILS

                +

                npm access always operates directly on the current registry, configurable +from the command line using --registry=<registry url>.

                +

                Unscoped packages are always public.

                +

                Scoped packages default to restricted, but you can either publish them as +public using npm publish --access=public, or set their access as public using +npm access public after the initial publish.

                +

                You must have privileges to set the access of a package:

                +
                  +
                • You are an owner of an unscoped or scoped package.
                • +
                • You are a member of the team that owns a scope.
                • +
                • You have been given read-write privileges for a package, either as a member +of a team or directly as an owner.
                • +
                +

                If your account is not paid, then attempts to publish scoped packages will fail +with an HTTP 402 status code (logically enough), unless you use +--access=public.

                +

                SEE ALSO

                + + diff --git a/deps/npm/html/partial/doc/cli/npm-adduser.html b/deps/npm/html/partial/doc/cli/npm-adduser.html index ac9fa0086ca..ce2c5dcce6f 100644 --- a/deps/npm/html/partial/doc/cli/npm-adduser.html +++ b/deps/npm/html/partial/doc/cli/npm-adduser.html @@ -6,11 +6,12 @@

                SYNOPSIS

                save the credentials to the .npmrc file. If no registry is specified, the default registry will be used (see npm-config(7)).

                The username, password, and email are read in from prompts.

                -

                You may use this command to change your email address, but not username -or password.

                -

                To reset your password, go to https://www.npmjs.org/forgot

                +

                To reset your password, go to https://www.npmjs.com/forgot

                +

                To change your email address, go to https://www.npmjs.com/email-edit

                You may use this command multiple times with the same user account to -authorize on a new machine.

                +authorize on a new machine. When authenticating on a new machine, +the username, password and email address must all match with +your existing record.

                npm login is an alias to adduser and behaves exactly the same way.

                CONFIGURATION

                registry

                @@ -33,7 +34,7 @@

                always-auth

                npm adduser --registry=http://private-registry.example.com --always-auth
                 

                This will ensure that all requests to that registry (including for tarballs) include an authorization header. See always-auth in npm-config(7) for more -details on always-auth. Registry-specific configuaration of always-auth takes +details on always-auth. Registry-specific configuration of always-auth takes precedence over any global configuration.

                SEE ALSO

                  diff --git a/deps/npm/html/partial/doc/cli/npm-build.html b/deps/npm/html/partial/doc/cli/npm-build.html index 51f2e32960e..11ba89b11f8 100644 --- a/deps/npm/html/partial/doc/cli/npm-build.html +++ b/deps/npm/html/partial/doc/cli/npm-build.html @@ -7,8 +7,10 @@

                  SYNOPSIS

                DESCRIPTION

                This is the plumbing command called by npm link and npm install.

                -

                It should generally not be called directly.

                -

                SEE ALSO

                +

                It should generally be called during installation, but if you need to run it +directly, run:

                +
                npm run-script build
                +

                SEE ALSO

                • npm-install(1)
                • npm-link(1)
                • diff --git a/deps/npm/html/partial/doc/cli/npm-dist-tag.html b/deps/npm/html/partial/doc/cli/npm-dist-tag.html new file mode 100644 index 00000000000..e99e059aee4 --- /dev/null +++ b/deps/npm/html/partial/doc/cli/npm-dist-tag.html @@ -0,0 +1,57 @@ +

                  npm-dist-tag

                  Modify package distribution tags

                  +

                  SYNOPSIS

                  +
                  npm dist-tag add <pkg>@<version> [<tag>]
                  +npm dist-tag rm <pkg> <tag>
                  +npm dist-tag ls [<pkg>]
                  +

                  DESCRIPTION

                  +

                  Add, remove, and enumerate distribution tags on a package:

                  +
                    +
                  • add: +Tags the specified version of the package with the specified tag, or the +--tag config if not specified.

                    +
                  • +
                  • rm: +Clear a tag that is no longer in use from the package.

                    +
                  • +
                  • ls: +Show all of the dist-tags for a package, defaulting to the package in +the current prefix.

                    +
                  • +
                  +

                  A tag can be used when installing packages as a reference to a version instead +of using a specific version number:

                  +
                  npm install <name>@<tag>
                  +

                  When installing dependencies, a preferred tagged version may be specified:

                  +
                  npm install --tag <tag>
                  +

                  This also applies to npm dedupe.

                  +

                  Publishing a package sets the "latest" tag to the published version unless the +--tag option is used. For example, npm publish --tag=beta.

                  +

                  PURPOSE

                  +

                  Tags can be used to provide an alias instead of version numbers. For +example, npm currently uses the tag "next" to identify the upcoming +version, and the tag "latest" to identify the current version.

                  +

                  A project might choose to have multiple streams of development, e.g., +"stable", "canary".

                  +

                  CAVEATS

                  +

                  This command used to be known as npm tag, which only created new tags, and so +had a different syntax.

                  +

                  Tags must share a namespace with version numbers, because they are specified in +the same slot: npm install <pkg>@<version> vs npm install <pkg>@<tag>.

                  +

                  Tags that can be interpreted as valid semver ranges will be rejected. For +example, v1.4 cannot be used as a tag, because it is interpreted by semver as +>=1.4.0 <1.5.0. See https://github.com/npm/npm/issues/6082.

                  +

                  The simplest way to avoid semver problems with tags is to use tags that do not +begin with a number or the letter v.

                  +

                  SEE ALSO

                  + + diff --git a/deps/npm/html/partial/doc/cli/npm-init.html b/deps/npm/html/partial/doc/cli/npm-init.html index 4f41ea88e1e..ff363fab1a6 100644 --- a/deps/npm/html/partial/doc/cli/npm-init.html +++ b/deps/npm/html/partial/doc/cli/npm-init.html @@ -11,10 +11,18 @@

                  SYNOPSIS

                  without a really good reason to do so.

                  If you invoke it with -f, --force, -y, or --yes, it will use only defaults and not prompt you for any options.

                  +

                  CONFIGURATION

                  +

                  scope

                  +
                    +
                  • Default: none
                  • +
                  • Type: String
                  • +
                  +

                  The scope under which the new module should be created.

                  SEE ALSO

                  diff --git a/deps/npm/html/partial/doc/cli/npm-install.html b/deps/npm/html/partial/doc/cli/npm-install.html index bd1932ed58c..1f6aef82499 100644 --- a/deps/npm/html/partial/doc/cli/npm-install.html +++ b/deps/npm/html/partial/doc/cli/npm-install.html @@ -33,9 +33,10 @@

                  SYNOPSIS

                  In global mode (ie, with -g or --global appended to the command), it installs the current package context (ie, the current working directory) as a global package.

                  -

                  By default, npm install will install all modules listed as - dependencies. With the --production flag, - npm will not install modules listed in devDependencies.

                  +

                  By default, npm install will install all modules listed as dependencies. + With the --production flag (or when the NODE_ENV environment variable + is set to production), npm will not install modules listed in + devDependencies.

                • npm install <folder>:

                  Install a package that is sitting in a folder on the filesystem.

                  @@ -119,18 +120,10 @@

                  SYNOPSIS

                      npm install sax@">=0.1.0 <0.2.0"
                       npm install @myorg/privatepackage@">=0.1.0 <0.2.0"
                   
                • -
                • npm install <githubname>/<githubrepo>:

                  -

                  Install the package at https://github.com/githubname/githubrepo" by - attempting to clone it usinggit`.

                  -

                  Example:

                  -
                      npm install mygithubuser/myproject
                  -

                  To reference a package in a git repo that is not on GitHub, see git - remote urls below.

                  -
                • npm install <git remote url>:

                  Install a package by cloning a git remote url. The format of the git url is:

                  -
                      <protocol>://[<user>@]<hostname><separator><path>[#<commit-ish>]
                  +
                      <protocol>://[<user>[:<password>]@]<hostname>[:<port>][:/]<path>[#<commit-ish>]
                   

                  <protocol> is one of git, git+ssh, git+http, or git+https. If no <commit-ish> is specified, then master is used.

                  @@ -139,6 +132,38 @@

                  SYNOPSIS

                  git+https://isaacs@github.com/npm/npm.git git://github.com/npm/npm.git#v1.0.27
                • +
                • npm install <githubname>/<githubrepo>[#<commit-ish>]:

                  +
                • +
                • npm install github:<githubname>/<githubrepo>[#<commit-ish>]:

                  +

                  Install the package at https://github.com/githubname/githubrepo by + attempting to clone it using git.

                  +

                  If you don't specify a commit-ish then master will be used.

                  +

                  Examples:

                  +
                      npm install mygithubuser/myproject
                  +    npm install github:mygithubuser/myproject
                  +
                • +
                • npm install gist:[<githubname>/]<gistID>[#<commit-ish>]:

                  +

                  Install the package at https://gist.github.com/gistID by attempting to + clone it using git. The GitHub username associated with the gist is + optional and will not be saved in package.json if --save is used.

                  +

                  If you don't specify a commit-ish then master will be used.

                  +

                  Example:

                  +
                      npm install gist:101a11beef
                  +
                • +
                • npm install bitbucket:<bitbucketname>/<bitbucketrepo>[#<commit-ish>]:

                  +

                  Install the package at https://bitbucket.org/bitbucketname/bitbucketrepo + by attempting to clone it using git.

                  +

                  If you don't specify a commit-ish then master will be used.

                  +

                  Example:

                  +
                      npm install bitbucket:mybitbucketuser/myproject
                  +
                • +
                • npm install gitlab:<gitlabname>/<gitlabrepo>[#<commit-ish>]:

                  +

                  Install the package at https://gitlab.com/gitlabname/gitlabrepo + by attempting to clone it using git.

                  +

                  If you don't specify a commit-ish then master will be used.

                  +

                  Example:

                  +
                      npm install gitlab:mygitlabuser/myproject
                  +

                You may combine multiple arguments, and even multiple types of arguments. For example:

                diff --git a/deps/npm/html/partial/doc/cli/npm-link.html b/deps/npm/html/partial/doc/cli/npm-link.html index 3c832399ddb..d25a64005b1 100644 --- a/deps/npm/html/partial/doc/cli/npm-link.html +++ b/deps/npm/html/partial/doc/cli/npm-link.html @@ -13,7 +13,7 @@

                SYNOPSIS

                Note that package-name is taken from package.json, not from directory name.

                The package name can be optionally prefixed with a scope. See npm-scope(7). -The scope must by preceded by an @-symbol and followed by a slash.

                +The scope must be preceded by an @-symbol and followed by a slash.

                When creating tarballs for npm publish, the linked packages are "snapshotted" to their current state by resolving the symbolic links.

                This is handy for installing your own stuff, so that you can work on it and @@ -24,14 +24,15 @@

                SYNOPSIS

                cd ~/projects/node-bloggy # go into some other package directory. npm link redis # link-install the package

                Now, any changes to ~/projects/node-redis will be reflected in -~/projects/node-bloggy/node_modules/redis/

                +~/projects/node-bloggy/node_modules/node-redis/. Note that the link should +be to the package name, not the directory name for that package.

                You may also shortcut the two steps in one. For example, to do the above use-case in a shorter way:

                cd ~/projects/node-bloggy  # go into the dir of your main project
                 npm link ../node-redis     # link the dir of your dependency
                 

                The second line is the equivalent of doing:

                (cd ../node-redis; npm link)
                -npm link redis
                +npm link node-redis
                 

                That is, it first creates a global link, and then links the global installation target into your project's node_modules folder.

                If your linked package is scoped (see npm-scope(7)) your link command must diff --git a/deps/npm/html/partial/doc/cli/npm-logout.html b/deps/npm/html/partial/doc/cli/npm-logout.html new file mode 100644 index 00000000000..63c28a3d7ca --- /dev/null +++ b/deps/npm/html/partial/doc/cli/npm-logout.html @@ -0,0 +1,35 @@ +

                npm-logout

                Log out of the registry

                +

                SYNOPSIS

                +
                npm logout [--registry=url] [--scope=@orgname]
                +

                DESCRIPTION

                +

                When logged into a registry that supports token-based authentication, tell the +server to end this token's session. This will invalidate the token everywhere +you're using it, not just for the current environment.

                +

                When logged into a legacy registry that uses username and password authentication, this will +clear the credentials in your user configuration. In this case, it will only affect +the current environment.

                +

                If --scope is provided, this will find the credentials for the registry +connected to that scope, if set.

                +

                CONFIGURATION

                +

                registry

                +

                Default: http://registry.npmjs.org/

                +

                The base URL of the npm package registry. If scope is also specified, +it takes precedence.

                +

                scope

                +

                Default: none

                +

                If specified, the user and login credentials given will be associated +with the specified scope. See npm-scope(7). You can use both at the same time, +e.g.

                +
                npm adduser --registry=http://myregistry.example.com --scope=@myco
                +

                This will set a registry for the given scope and login or create a user for +that registry at the same time.

                +

                SEE ALSO

                + + diff --git a/deps/npm/html/partial/doc/cli/npm-ls.html b/deps/npm/html/partial/doc/cli/npm-ls.html index 199b6002b89..f240024f22f 100644 --- a/deps/npm/html/partial/doc/cli/npm-ls.html +++ b/deps/npm/html/partial/doc/cli/npm-ls.html @@ -11,7 +11,7 @@

                SYNOPSIS

                limit the results to only the paths to the packages named. Note that nested packages will also show the paths to the specified packages. For example, running npm ls promzard in npm's source tree will show:

                -
                npm@2.1.6 /path/to/npm
                +
                npm@2.11.3 /path/to/npm
                 └─┬ init-package-json@0.0.4
                   └── promzard@0.1.5
                 

                It will print out extraneous, missing, and invalid packages.

                @@ -50,6 +50,18 @@

                depth

              • Type: Int

              Max display depth of the dependency tree.

              +

              prod / production

              +
                +
              • Type: Boolean
              • +
              • Default: false
              • +
              +

              Display only the dependency tree for packages in dependencies.

              +

              dev

              +
                +
              • Type: Boolean
              • +
              • Default: false
              • +
              +

              Display only the dependency tree for packages in devDependencies.

              SEE ALSO

              • npm-config(1)
              • diff --git a/deps/npm/html/partial/doc/cli/npm-prune.html b/deps/npm/html/partial/doc/cli/npm-prune.html index 43dd8730d69..8bb16677da1 100644 --- a/deps/npm/html/partial/doc/cli/npm-prune.html +++ b/deps/npm/html/partial/doc/cli/npm-prune.html @@ -8,8 +8,10 @@

                SYNOPSIS

                removed.

                Extraneous packages are packages that are not listed on the parent package's dependencies list.

                -

                If the --production flag is specified, this command will remove the -packages specified in your devDependencies.

                +

                If the --production flag is specified or the NODE_ENV environment +variable is set to production, this command will remove the packages +specified in your devDependencies. Setting --production=false will +negate NODE_ENV being set to production.

                SEE ALSO

                • npm-rm(1)
                • diff --git a/deps/npm/html/partial/doc/cli/npm-publish.html b/deps/npm/html/partial/doc/cli/npm-publish.html index 8df73e3d211..8d9321292a4 100644 --- a/deps/npm/html/partial/doc/cli/npm-publish.html +++ b/deps/npm/html/partial/doc/cli/npm-publish.html @@ -1,7 +1,7 @@

                  npm-publish

                  Publish a package

                  SYNOPSIS

                  -
                  npm publish <tarball> [--tag <tag>]
                  -npm publish <folder> [--tag <tag>]
                  +
                  npm publish <tarball> [--tag <tag>] [--access <public|restricted>]
                  +npm publish <folder> [--tag <tag>] [--access <public|restricted>]
                   

                  DESCRIPTION

                  Publishes a package to the registry so that it can be installed by name. See npm-developers(7) for details on what's included in the published package, as @@ -22,6 +22,12 @@

                  SYNOPSIS

                  <name>@<tag>
                  will install this version. By default, npm publish updates and npm install installs the latest tag.

                  +
                • [--access <public|restricted>] +Tells the registry whether this package should be published as public or +restricted. Only applies to scoped packages, which default to restricted. +If you don't have a paid account, you must publish with --access public +to publish scoped packages.

                  +

                Fails if the package name and version combination already exists in the specified registry.

                @@ -31,6 +37,7 @@

                SYNOPSIS

                SEE ALSO

                • npm-registry(7)
                • +
                • npm-scope(7)
                • npm-adduser(1)
                • npm-owner(1)
                • npm-deprecate(1)
                • diff --git a/deps/npm/html/partial/doc/cli/npm-restart.html b/deps/npm/html/partial/doc/cli/npm-restart.html index 267e570eca8..2186473373c 100644 --- a/deps/npm/html/partial/doc/cli/npm-restart.html +++ b/deps/npm/html/partial/doc/cli/npm-restart.html @@ -1,9 +1,26 @@ -

                  npm-restart

                  Start a package

                  +

                  npm-restart

                  Restart a package

                  SYNOPSIS

                  npm restart [-- <args>]
                   

                  DESCRIPTION

                  -

                  This runs a package's "restart" script, if one was provided. Otherwise it runs -package's "stop" script, if one was provided, and then the "start" script.

                  +

                  This restarts a package.

                  +

                  This runs a package's "stop", "restart", and "start" scripts, and associated +pre- and post- scripts, in the order given below:

                  +
                    +
                  1. prerestart
                  2. +
                  3. prestop
                  4. +
                  5. stop
                  6. +
                  7. poststop
                  8. +
                  9. restart
                  10. +
                  11. prestart
                  12. +
                  13. start
                  14. +
                  15. poststart
                  16. +
                  17. postrestart
                  18. +
                  +

                  NOTE

                  +

                  Note that the "restart" script is run in addition to the "stop" +and "start" scripts, not instead of them.

                  +

                  This is the behavior as of npm major version 2. A change in this +behavior will be accompanied by an increase in major version number

                  SEE ALSO

                  diff --git a/deps/npm/html/partial/doc/cli/npm-run-script.html b/deps/npm/html/partial/doc/cli/npm-run-script.html index b9a7cefce9f..4d3b6722f01 100644 --- a/deps/npm/html/partial/doc/cli/npm-run-script.html +++ b/deps/npm/html/partial/doc/cli/npm-run-script.html @@ -3,12 +3,11 @@

                  SYNOPSIS

                  npm run-script [command] [-- <args>]
                   npm run [command] [-- <args>]
                   

                  DESCRIPTION

                  -

                  This runs an arbitrary command from a package's "scripts" object. -If no package name is provided, it will search for a package.json -in the current folder and use its "scripts" object. If no "command" -is provided, it will list the available top level scripts.

                  -

                  It is used by the test, start, restart, and stop commands, but can be -called directly, as well.

                  +

                  This runs an arbitrary command from a package's "scripts" object. If no +"command" is provided, it will list the available scripts. run[-script] is +used by the test, start, restart, and stop commands, but can be called +directly, as well. When the scripts in the package are printed out, they're +separated into lifecycle (test, start, restart) and directly-run scripts.

                  As of npm@2.0.0, you can use custom arguments when executing scripts. The special option -- is used by getopt to delimit the end of the options. npm will pass @@ -16,6 +15,16 @@

                  SYNOPSIS

                  npm run test -- --grep="pattern"
                   

                  The arguments will only be passed to the script specified after npm run and not to any pre or post script.

                  +

                  The env script is a special built-in command that can be used to list +environment variables that will be available to the script at runtime. If an +"env" command is defined in your package it will take precedence over the +built-in.

                  +

                  In addition to the shell's pre-existing PATH, npm run adds +node_modules/.bin to the PATH provided to scripts. Any binaries provided by +locally-installed dependencies can be used without the node_modules/.bin +prefix. For example, if there is a devDependency on tap in your package, +you should write "scripts": {"test": "tap test/\*.js"} instead of "scripts": +{"test": "node_modules/.bin/tap test/\*.js"} to run your tests.

                  SEE ALSO

                  • npm-scripts(7)
                  • diff --git a/deps/npm/html/partial/doc/cli/npm-shrinkwrap.html b/deps/npm/html/partial/doc/cli/npm-shrinkwrap.html index 45b646c0300..8ac97fc3eed 100644 --- a/deps/npm/html/partial/doc/cli/npm-shrinkwrap.html +++ b/deps/npm/html/partial/doc/cli/npm-shrinkwrap.html @@ -4,17 +4,17 @@

                    SYNOPSIS

                    DESCRIPTION

                    This command locks down the versions of a package's dependencies so that you can control exactly which versions of each dependency will be -used when your package is installed. The "package.json" file is still -required if you want to use "npm install".

                    -

                    By default, "npm install" recursively installs the target's -dependencies (as specified in package.json), choosing the latest +used when your package is installed. The package.json file is still +required if you want to use npm install.

                    +

                    By default, npm install recursively installs the target's +dependencies (as specified in package.json), choosing the latest available version that satisfies the dependency's semver pattern. In some situations, particularly when shipping software where each change is tightly managed, it's desirable to fully specify each version of each dependency recursively so that subsequent builds and deploys do not inadvertently pick up newer versions of a dependency that satisfy the semver pattern. Specifying specific semver patterns in each -dependency's package.json would facilitate this, but that's not always +dependency's package.json would facilitate this, but that's not always possible or desirable, as when another author owns the npm package. It's also possible to check dependencies directly into source control, but that may be undesirable for other reasons.

                    @@ -36,15 +36,15 @@

                    SYNOPSIS

                    }

                    and package C:

                    {
                    -  "name": "C,
                    +  "name": "C",
                       "version": "0.0.1"
                     }
                     

                    If these are the only versions of A, B, and C available in the -registry, then a normal "npm install A" will install:

                    +registry, then a normal npm install A will install:

                    A@0.1.0
                     `-- B@0.0.1
                         `-- C@0.0.1
                    -

                    However, if B@0.0.2 is published, then a fresh "npm install A" will +

                    However, if B@0.0.2 is published, then a fresh npm install A will install:

                    A@0.1.0
                     `-- B@0.0.2
                    @@ -58,7 +58,7 @@ 

                    SYNOPSIS

                    when B hasn't changed at all.

                    In this case, A's author can run

                    npm shrinkwrap
                    -

                    This generates npm-shrinkwrap.json, which will look something like this:

                    +

                    This generates npm-shrinkwrap.json, which will look something like this:

                    {
                       "name": "A",
                       "version": "0.1.0",
                    @@ -67,58 +67,58 @@ 

                    SYNOPSIS

                    "version": "0.0.1", "dependencies": { "C": { - "version": "0.1.0" + "version": "0.0.1" } } } } }

                    The shrinkwrap command has locked down the dependencies based on -what's currently installed in node_modules. When "npm install" -installs a package with a npm-shrinkwrap.json file in the package -root, the shrinkwrap file (rather than package.json files) completely +what's currently installed in node_modules. When npm install +installs a package with an npm-shrinkwrap.json in the package +root, the shrinkwrap file (rather than package.json files) completely drives the installation of that package and all of its dependencies (recursively). So now the author publishes A@0.1.0, and subsequent -installs of this package will use B@0.0.1 and C@0.1.0, regardless the -dependencies and versions listed in A's, B's, and C's package.json +installs of this package will use B@0.0.1 and C@0.0.1, regardless the +dependencies and versions listed in A's, B's, and C's package.json files.

                    Using shrinkwrapped packages

                    Using a shrinkwrapped package is no different than using any other -package: you can "npm install" it by hand, or add a dependency to your -package.json file and "npm install" it.

                    +package: you can npm install it by hand, or add a dependency to your +package.json file and npm install it.

                    Building shrinkwrapped packages

                    To shrinkwrap an existing package:

                      -
                    1. Run "npm install" in the package root to install the current +
                    2. Run npm install in the package root to install the current versions of all dependencies.
                    3. Validate that the package works as expected with these versions.
                    4. -
                    5. Run "npm shrinkwrap", add npm-shrinkwrap.json to git, and publish +
                    6. Run npm shrinkwrap, add npm-shrinkwrap.json to git, and publish your package.

                    To add or update a dependency in a shrinkwrapped package:

                      -
                    1. Run "npm install" in the package root to install the current +
                    2. Run npm install in the package root to install the current versions of all dependencies.
                    3. -
                    4. Add or update dependencies. "npm install" each new or updated -package individually and then update package.json. Note that they +
                    5. Add or update dependencies. npm install each new or updated +package individually and then update package.json. Note that they must be explicitly named in order to be installed: running npm install with no arguments will merely reproduce the existing shrinkwrap.
                    6. Validate that the package works as expected with the new dependencies.
                    7. -
                    8. Run "npm shrinkwrap", commit the new npm-shrinkwrap.json, and +
                    9. Run npm shrinkwrap, commit the new npm-shrinkwrap.json, and publish your package.

                    You can use npm-outdated(1) to view dependencies with newer versions available.

                    Other Notes

                    -

                    A shrinkwrap file must be consistent with the package's package.json -file. "npm shrinkwrap" will fail if required dependencies are not +

                    A shrinkwrap file must be consistent with the package's package.json +file. npm shrinkwrap will fail if required dependencies are not already installed, since that would result in a shrinkwrap that wouldn't actually work. Similarly, the command will fail if there are -extraneous packages (not referenced by package.json), since that would -indicate that package.json is not correct.

                    -

                    Since "npm shrinkwrap" is intended to lock down your dependencies for +extraneous packages (not referenced by package.json), since that would +indicate that package.json is not correct.

                    +

                    Since npm shrinkwrap is intended to lock down your dependencies for production use, devDependencies will not be included unless you explicitly set the --dev flag when you run npm shrinkwrap. If installed devDependencies are excluded, then npm will print a diff --git a/deps/npm/html/partial/doc/cli/npm-submodule.html b/deps/npm/html/partial/doc/cli/npm-submodule.html index 1e259e1f2f6..dd7c7e8878e 100644 --- a/deps/npm/html/partial/doc/cli/npm-submodule.html +++ b/deps/npm/html/partial/doc/cli/npm-submodule.html @@ -19,4 +19,3 @@

                    SEE ALSO

                  • package.json(5)
                  • git help submodule
                  - diff --git a/deps/npm/html/partial/doc/cli/npm-tag.html b/deps/npm/html/partial/doc/cli/npm-tag.html index 61b1c76e65c..b12d5de7a4c 100644 --- a/deps/npm/html/partial/doc/cli/npm-tag.html +++ b/deps/npm/html/partial/doc/cli/npm-tag.html @@ -2,6 +2,7 @@

                  npm-tag

                  Tag a published version

                  SYNOPSIS
                  npm tag <name>@<version> [<tag>]
                   

                  DESCRIPTION

                  +

                  THIS COMMAND IS DEPRECATED. See npm-dist-tag(1) for details.

                  Tags the specified version of the package with the specified tag, or the --tag config if not specified.

                  A tag can be used when installing packages as a reference to a version instead @@ -11,6 +12,22 @@

                  SYNOPSIS

                  npm install --tag <tag>
                   

                  This also applies to npm dedupe.

                  Publishing a package always sets the "latest" tag to the published version.

                  +

                  PURPOSE

                  +

                  Tags can be used to provide an alias instead of version numbers. For +example, npm currently uses the tag "next" to identify the upcoming +version, and the tag "latest" to identify the current version.

                  +

                  A project might choose to have multiple streams of development, e.g., +"stable", "canary".

                  +

                  CAVEATS

                  +

                  Tags must share a namespace with version numbers, because they are +specified in the same slot: npm install <pkg>@<version> vs npm +install <pkg>@<tag>.

                  +

                  Tags that can be interpreted as valid semver ranges will be +rejected. For example, v1.4 cannot be used as a tag, because it is +interpreted by semver as >=1.4.0 <1.5.0. See +https://github.com/npm/npm/issues/6082.

                  +

                  The simplest way to avoid semver problems with tags is to use tags +that do not begin with a number or the letter v.

                  SEE ALSO

                  diff --git a/deps/npm/html/partial/doc/cli/npm-update.html b/deps/npm/html/partial/doc/cli/npm-update.html index 3923be7faf9..ecc6640f21d 100644 --- a/deps/npm/html/partial/doc/cli/npm-update.html +++ b/deps/npm/html/partial/doc/cli/npm-update.html @@ -3,16 +3,95 @@

                  SYNOPSIS

                  npm update [-g] [<name> [<name> ...]]
                   

                  DESCRIPTION

                  This command will update all the packages listed to the latest version -(specified by the tag config).

                  -

                  It will also install missing packages.

                  +(specified by the tag config), respecting semver.

                  +

                  It will also install missing packages. As with all commands that install +packages, the --dev flag will cause devDependencies to be processed +as well.

                  If the -g flag is specified, this command will update globally installed packages.

                  If no package name is specified, all packages in the specified location (global or local) will be updated.

                  +

                  As of npm@2.6.1, the npm update will only inspect top-level packages. +Prior versions of npm would also recursively inspect all dependencies. +To get the old behavior, use npm --depth 9999 update, but be warned that +simultaneous asynchronous update of all packages, including npm itself +and packages that npm depends on, often causes problems up to and including +the uninstallation of npm itself.

                  +

                  To restore a missing npm, use the command:

                  +
                  curl -L https://npmjs.com/install.sh | sh
                  +

                  EXAMPLES

                  +

                  IMPORTANT VERSION NOTE: these examples assume npm@2.6.1 or later. For +older versions of npm, you must specify --depth 0 to get the behavior +described below.

                  +

                  For the examples below, assume that the current package is app and it depends +on dependencies, dep1 (dep2, .. etc.). The published versions of dep1 are:

                  +
                  {
                  +  dist-tags: { latest: "1.2.2" },
                  +  versions: { "1.2.2",
                  +              "1.2.1",
                  +              "1.2.0",
                  +              "1.1.2",
                  +              "1.1.1",
                  +              "1.0.0",
                  +              "0.4.1",
                  +              "0.4.0",
                  +              "0.2.0"
                  +  }
                  +}
                  +

                  Caret Dependencies

                  +

                  If app's package.json contains:

                  +
                  dependencies: {
                  +  dep1: "^1.1.1"
                  +}
                  +

                  Then npm update will install dep1@1.2.2, because 1.2.2 is latest and +1.2.2 satisfies ^1.1.1.

                  +

                  Tilde Dependencies

                  +

                  However, if app's package.json contains:

                  +
                  dependencies: {
                  +  dep1: "~1.1.1"
                  +}
                  +

                  In this case, running npm update will install dep1@1.1.2. Even though the latest +tag points to 1.2.2, this version does not satisfy ~1.1.1, which is equivalent +to >=1.1.1 <1.2.0. So the highest-sorting version that satisfies ~1.1.1 is used, +which is 1.1.2.

                  +

                  Caret Dependencies below 1.0.0

                  +

                  Suppose app has a caret dependency on a version below 1.0.0, for example:

                  +
                  dependencies: {
                  +  dep1: "^0.2.0"
                  +}
                  +

                  npm update will install dep1@0.2.0, because there are no other +versions which satisfy ^0.2.0.

                  +

                  If the dependence were on ^0.4.0:

                  +
                  dependencies: {
                  +  dep1: "^0.4.0"
                  +}
                  +

                  Then npm update will install dep1@0.4.1, because that is the highest-sorting +version that satisfies ^0.4.0 (>= 0.4.0 <0.5.0)

                  +

                  Recording Updates with --save

                  +

                  When you want to update a package and save the new version as +the minimum required dependency in package.json, you can use +npm update --save. For example if package.json contains

                  +
                  dependencies: {
                  +  dep1: "^1.1.1"
                  +}
                  +

                  Then npm update --save will install dep1@1.2.2 (i.e., latest), +and package.json will be modified:

                  +
                  dependencies: {
                  +  dep1: "^1.2.2"
                  +}
                  +

                  Note that npm will only write an updated version to package.json +if it installs a new package.

                  +

                  Updating Globally-Installed Packages

                  +

                  npm update -g will apply the update action to each globally- installed +package that is outdated -- that is, has a version that is different from +latest.

                  +

                  NOTE: If a package has been upgraded to a version newer than latest, it will +be downgraded.

                  SEE ALSO

                  • npm-install(1)
                  • npm-outdated(1)
                  • +
                  • npm-shrinkwrap(1)
                  • npm-registry(7)
                  • npm-folders(5)
                  • npm-ls(1)
                  • diff --git a/deps/npm/html/partial/doc/cli/npm-version.html b/deps/npm/html/partial/doc/cli/npm-version.html index 5217f019635..515f19a6dea 100644 --- a/deps/npm/html/partial/doc/cli/npm-version.html +++ b/deps/npm/html/partial/doc/cli/npm-version.html @@ -3,13 +3,15 @@

                    SYNOPSIS

                    npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease]
                     

                    DESCRIPTION

                    Run this in a package directory to bump the version and write the new -data back to the package.json file.

                    +data back to package.json and, if present, npm-shrinkwrap.json.

                    The newversion argument should be a valid semver string, or a valid second argument to semver.inc (one of "patch", "minor", "major", "prepatch", "preminor", "premajor", "prerelease"). In the second case, the existing version will be incremented by 1 in the specified field.

                    -

                    If run in a git repo, it will also create a version commit and tag, and -fail if the repo is not clean.

                    +

                    If run in a git repo, it will also create a version commit and tag, and fail if +the repo is not clean. This behavior is controlled by git-tag-version (see +below), and can be disabled on the command line by running npm +--no-git-tag-version version

                    If supplied with --message (shorthand: -m) config option, npm will use it as a commit message when creating a version commit. If the message config contains %s then that will be replaced with the @@ -26,10 +28,26 @@

                    SYNOPSIS

                    2048-bit RSA key, ID 6C481CF6, created 2010-08-31 Enter passphrase: -

                    SEE ALSO

                    +

                    If "preversion", "version", "postversion" in the "scripts" property of +the package.json, it will execute by running npm version. preversion +and version ware executed before bump the package version, postversion +was executed after bump the package version. For example to run npm version +after passed all test:

                    +
                    "scripts": { "preversion": "npm test" }
                    +

                    CONFIGURATION

                    +

                    git-tag-version

                    +
                      +
                    • Default: true
                    • +
                    • Type: Boolean
                    • +
                    +

                    Commit and tag the version change.

                    +

                    SEE ALSO

                    diff --git a/deps/npm/html/partial/doc/cli/npm-view.html b/deps/npm/html/partial/doc/cli/npm-view.html index a5b38518fb1..dcd41693e7e 100644 --- a/deps/npm/html/partial/doc/cli/npm-view.html +++ b/deps/npm/html/partial/doc/cli/npm-view.html @@ -13,7 +13,7 @@

                    SYNOPSIS

                    For example, to show the dependencies of the ronn package at version 0.3.5, you could do the following:

                    npm view ronn@0.3.5 dependencies
                    -

                    You can view child field by separating them with a period. +

                    You can view child fields by separating them with a period. To view the git repository URL for the latest version of npm, you could do this:

                    npm view npm repository.url
                    diff --git a/deps/npm/html/partial/doc/cli/npm.html b/deps/npm/html/partial/doc/cli/npm.html
                    index 646fffcb378..b09a9846790 100644
                    --- a/deps/npm/html/partial/doc/cli/npm.html
                    +++ b/deps/npm/html/partial/doc/cli/npm.html
                    @@ -1,8 +1,8 @@
                    -

                    npm

                    node package manager

                    +

                    npm

                    javascript package manager

                    SYNOPSIS

                    npm <command> [args]
                     

                    VERSION

                    -

                    2.1.6

                    +

                    2.11.3

                    DESCRIPTION

                    npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency @@ -99,7 +99,7 @@

                    CONTRIBUTIONS

                    the issues list or ask on the mailing list.

                    BUGS

                    When you find issues, please report them:

                    @@ -107,7 +107,7 @@

                    BUGS

                  • web: http://github.com/npm/npm/issues
                  • email: -npm-@googlegroups.com
                  • +npm-@googlegroups.com

                  Be sure to include all of the output from the npm command that didn't work as expected. The npm-debug.log file is also helpful to provide.

                  @@ -117,7 +117,7 @@

                  AUTHOR

                  Isaac Z. Schlueter :: isaacs :: @izs :: -i@izs.me

                  +i@izs.me

                  SEE ALSO

                  • npm-help(1)
                  • diff --git a/deps/npm/html/partial/doc/files/npm-json.html b/deps/npm/html/partial/doc/files/npm-json.html index df3bea83742..752a10cbe5c 100644 --- a/deps/npm/html/partial/doc/files/npm-json.html +++ b/deps/npm/html/partial/doc/files/npm-json.html @@ -10,18 +10,26 @@

                    name

                    them. The name and version together form an identifier that is assumed to be completely unique. Changes to the package should come along with changes to the version.

                    -

                    The name is what your thing is called. Some tips:

                    +

                    The name is what your thing is called.

                    +

                    Some rules:

                      +
                    • The name must be shorter than 214 characters. This includes the scope for +scoped packages.
                    • +
                    • The name can't start with a dot or an underscore.
                    • +
                    • New packages must not have uppercase letters in the name.
                    • +
                    • The name ends up being part of a URL, an argument on the command line, and a +folder name. Therefore, the name can't contain any non-URL-safe characters.
                    • +
                    +

                    Some tips:

                    +
                      +
                    • Don't use the same name as a core Node module.
                    • Don't put "js" or "node" in the name. It's assumed that it's js, since you're writing a package.json file, and you can specify the engine using the "engines" field. (See below.)
                    • -
                    • The name ends up being part of a URL, an argument on the command line, and a -folder name. Any name with non-url-safe characters will be rejected. -Also, it can't start with a dot or an underscore.
                    • The name will probably be passed as an argument to require(), so it should be something short, but also reasonably descriptive.
                    • You may want to check the npm registry to see if there's something by that name -already, before you get too attached to it. http://registry.npmjs.org/
                    • +already, before you get too attached to it. https://www.npmjs.com/

                    A name can be optionally prefixed by a scope, e.g. @myorg/mypackage. See npm-scope(7) for more detail.

                    @@ -52,7 +60,7 @@

                    bugs

                    issues should be reported. These are helpful for people who encounter issues with your package.

                    It should look like this:

                    -
                    { "url" : "http://github.com/owner/project/issues"
                    +
                    { "url" : "https://github.com/owner/project/issues"
                     , "email" : "project@hostname.com"
                     }
                     

                    You can specify either one or both values. If you want to provide only a url, @@ -61,16 +69,44 @@

                    bugs

                    license

                    You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you're placing on it.

                    -

                    The simplest way, assuming you're using a common license such as BSD-3-Clause -or MIT, is to just specify the standard SPDX ID of the license you're using, -like this:

                    +

                    If you're using a common license such as BSD-2-Clause or MIT, add a +current SPDX license identifier for the license you're using, like this:

                    { "license" : "BSD-3-Clause" }
                     

                    You can check the full list of SPDX license IDs. Ideally you should pick one that is OSI approved.

                    -

                    It's also a good idea to include a LICENSE file at the top level in -your package.

                    -

                    people fields: author, contributors

                    +

                    If your package is licensed under multiple common licenses, use an SPDX license +expression syntax version 2.0 string, like this:

                    +
                    { "license" : "(ISC OR GPL-3.0)" }
                    +

                    If you are using a license that hasn't been assigned an SPDX identifier, or if +you are using a custom license, use the following valid SPDX expression:

                    +
                    { "license" : "LicenseRef-LICENSE" }
                    +

                    Then include a LICENSE file at the top level of the package.

                    +

                    Some old packages used license objects or a "licenses" property containing an +array of license objects:

                    +
                    // Not valid metadata
                    +{ "license" :
                    +  { "type" : "ISC"
                    +  , "url" : "http://opensource.org/licenses/ISC"
                    +  }
                    +}
                    +
                    +// Not valid metadata
                    +{ "licenses" :
                    +  [
                    +    { "type": "MIT"
                    +    , "url": "http://www.opensource.org/licenses/mit-license.php"
                    +    }
                    +  , { "type": "Apache-2.0"
                    +    , "url": "http://opensource.org/licenses/apache2.0.php"
                    +    }
                    +  ]
                    +}
                    +

                    Those styles are now deprecated. Instead, use SPDX expressions, like this:

                    +
                    { "license": "ISC" }
                    +
                    +{ "license": "(MIT OR Apache-2.0)" }
                    +

                    people fields: author, contributors

                    The "author" is one person. "contributors" is an array of people. A "person" is an object with a "name" field and optionally "url" and "email", like this:

                    { "name" : "Barney Rubble"
                    @@ -78,7 +114,7 @@ 

                    people fields: author, contributors

                    Or you can shorten that all into a single string, and npm will parse it for you:

                    -
                    "Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)
                    +
                    "Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)"
                     

                    Both email and url are optional either way.

                    npm also sets a top-level "maintainers" field with your npm user info.

                    files

                    @@ -104,10 +140,10 @@

                    bin

                    command name to local file name. On install, npm will symlink that file into prefix/bin for global installs, or ./node_modules/.bin/ for local installs.

                    -

                    For example, npm has this:

                    -
                    { "bin" : { "npm" : "./cli.js" } }
                    -

                    So, when you install npm, it'll create a symlink from the cli.js script to -/usr/local/bin/npm.

                    +

                    For example, myapp could have this:

                    +
                    { "bin" : { "myapp" : "./cli.js" } }
                    +

                    So, when you install myapp, it'll create a symlink from the cli.js script to +/usr/local/bin/myapp.

                    If you have a single executable, and its name should be the name of the package, then you can just supply it as a string. For example:

                    { "name": "my-program"
                    @@ -150,7 +186,7 @@ 

                    bin

                    directories

                    The CommonJS Packages spec details a few ways that you can indicate the structure of your package using a directories -object. If you look at npm's package.json, +object. If you look at npm's package.json, you'll see that it has directories for doc, lib, and man.

                    In the future, this information may be used in other creative ways.

                    directories.lib

                    @@ -170,22 +206,31 @@

                    directories.example

                    Put example scripts in here. Someday, it might be exposed in some clever way.

                    repository

                    Specify the place where your code lives. This is helpful for people who -want to contribute. If the git repo is on github, then the npm docs +want to contribute. If the git repo is on GitHub, then the npm docs command will be able to find you.

                    Do it like this:

                    "repository" :
                       { "type" : "git"
                    -  , "url" : "http://github.com/npm/npm.git"
                    +  , "url" : "https://github.com/npm/npm.git"
                       }
                     
                     "repository" :
                       { "type" : "svn"
                    -  , "url" : "http://v8.googlecode.com/svn/trunk/"
                    +  , "url" : "https://v8.googlecode.com/svn/trunk/"
                       }
                     

                    The URL should be a publicly available (perhaps read-only) url that can be handed directly to a VCS program without any modification. It should not be a url to an html project page that you put in your browser. It's for computers.

                    -

                    scripts

                    +

                    For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same +shortcut syntax you use for npm install:

                    +
                    "repository": "npm/npm"
                    +
                    +"repository": "gist:11081aaa281"
                    +
                    +"repository": "bitbucket:example/repo"
                    +
                    +"repository": "gitlab:another/repo"
                    +

                    scripts

                    The "scripts" property is a dictionary containing script commands that are run at various times in the lifecycle of your package. The key is the lifecycle event, and the value is the command to run at that point.

                    @@ -258,12 +303,15 @@

                    Git URLs as Dependencies

                    The commit-ish can be any tag, sha, or branch which can be supplied as an argument to git checkout. The default is master.

                    GitHub URLs

                    -

                    As of version 1.1.65, you can refer to GitHub urls as just "foo": "user/foo-project". For example:

                    +

                    As of version 1.1.65, you can refer to GitHub urls as just "foo": +"user/foo-project". Just as with git URLs, a commit-ish suffix can be +included. For example:

                    {
                       "name": "foo",
                       "version": "0.0.0",
                       "dependencies": {
                    -    "express": "visionmedia/express"
                    +    "express": "visionmedia/express",
                    +    "mocha": "visionmedia/mocha#4727d357ea"
                       }
                     }
                     

                    Local Paths

                    @@ -315,25 +363,30 @@

                    devDependencies

                    themselves. In dev mode (ie, locally running npm install), it'll run this script as well, so that you can test it easily.

                    peerDependencies

                    -

                    In some cases, you want to express the compatibility of your package with an +

                    In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a require of this host. -This is usually refered to as a plugin. Notably, your module may be exposing +This is usually referred to as a plugin. Notably, your module may be exposing a specific interface, expected and specified by the host documentation.

                    For example:

                    {
                       "name": "tea-latte",
                    -  "version": "1.3.5"
                    +  "version": "1.3.5",
                       "peerDependencies": {
                         "tea": "2.x"
                       }
                     }
                     

                    This ensures your package tea-latte can be installed along with the second -major version of the host package tea only. The host package is automatically -installed if needed. npm install tea-latte could possibly yield the following -dependency graph:

                    +major version of the host package tea only. npm install tea-latte could +possibly yield the following dependency graph:

                    ├── tea-latte@1.3.5
                     └── tea@2.2.0
                    -

                    Trying to install another plugin with a conflicting requirement will cause an +

                    NOTE: npm versions 1 and 2 will automatically install peerDependencies if +they are not explicitly depended upon higher in the dependency tree. In the +next major version of npm (npm@3), this will no longer be the case. You will +receive a warning that the peerDependency is not installed instead. The +behavior in npms 1 & 2 was frequently confusing and could easily put you into +dependency hell, a situation that npm is designed to avoid as much as possible.

                    +

                    Trying to install another plugin with a conflicting requirement will cause an error. For this reason, make sure your plugin requirement is as broad as possible, and not to lock it down to specific patch versions.

                    Assuming the host complies with semver, only changes in @@ -382,6 +435,7 @@

                    engines

                    Note that, unless the user has set the engine-strict config flag, this field is advisory only.

                    engineStrict

                    +

                    NOTE: This feature is deprecated and will be removed in npm 3.0.0.

                    If you are sure that your module will definitely not run properly on versions of Node/npm other than those specified in the engines object, then you can set "engineStrict": true in your package.json file. @@ -389,8 +443,7 @@

                    engineStrict

                    Please do not do this unless you are really very very sure. If your engines object is something overly restrictive, you can quite easily and inadvertently lock yourself into obscurity and prevent your users from -updating to new versions of Node. Consider this choice carefully. If -people abuse it, it will be removed in a future version of npm.

                    +updating to new versions of Node. Consider this choice carefully.

                    os

                    You can specify which operating systems your module will run on:

                    diff --git a/deps/npm/html/partial/doc/files/npmrc.html b/deps/npm/html/partial/doc/files/npmrc.html index ac386ca85e2..f4106bebf0f 100644 --- a/deps/npm/html/partial/doc/files/npmrc.html +++ b/deps/npm/html/partial/doc/files/npmrc.html @@ -10,7 +10,7 @@

                    FILES

                    • per-project config file (/path/to/my/project/.npmrc)
                    • per-user config file (~/.npmrc)
                    • -
                    • global config file ($PREFIX/npmrc)
                    • +
                    • global config file ($PREFIX/etc/npmrc)
                    • npm builtin config file (/path/to/npm/npmrc)

                    All npm config files are an ini-formatted list of key = value @@ -20,6 +20,14 @@

                    FILES

                    Each of these files is loaded, and config options are resolved in priority order. For example, a setting in the userconfig file would override the setting in the globalconfig file.

                    +

                    Array values are specified by adding "[]" after the key name. For +example:

                    +
                    key[] = "first value"
                    +key[] = "second value"
                    +

                    NOTE: Because local (per-project or per-user) .npmrc files can contain +sensitive credentials, they must be readable and writable only by your user +account (i.e. must have a mode of 0600), otherwise they will be ignored by +npm!

                    Per-project config file

                    When working locally in a project, a .npmrc file in the root of the project (ie, a sibling of node_modules and package.json) will set diff --git a/deps/npm/html/partial/doc/files/package.json.html b/deps/npm/html/partial/doc/files/package.json.html index df3bea83742..752a10cbe5c 100644 --- a/deps/npm/html/partial/doc/files/package.json.html +++ b/deps/npm/html/partial/doc/files/package.json.html @@ -10,18 +10,26 @@

                    name

                    them. The name and version together form an identifier that is assumed to be completely unique. Changes to the package should come along with changes to the version.

                    -

                    The name is what your thing is called. Some tips:

                    +

                    The name is what your thing is called.

                    +

                    Some rules:

                      +
                    • The name must be shorter than 214 characters. This includes the scope for +scoped packages.
                    • +
                    • The name can't start with a dot or an underscore.
                    • +
                    • New packages must not have uppercase letters in the name.
                    • +
                    • The name ends up being part of a URL, an argument on the command line, and a +folder name. Therefore, the name can't contain any non-URL-safe characters.
                    • +
                    +

                    Some tips:

                    +
                      +
                    • Don't use the same name as a core Node module.
                    • Don't put "js" or "node" in the name. It's assumed that it's js, since you're writing a package.json file, and you can specify the engine using the "engines" field. (See below.)
                    • -
                    • The name ends up being part of a URL, an argument on the command line, and a -folder name. Any name with non-url-safe characters will be rejected. -Also, it can't start with a dot or an underscore.
                    • The name will probably be passed as an argument to require(), so it should be something short, but also reasonably descriptive.
                    • You may want to check the npm registry to see if there's something by that name -already, before you get too attached to it. http://registry.npmjs.org/
                    • +already, before you get too attached to it. https://www.npmjs.com/

                    A name can be optionally prefixed by a scope, e.g. @myorg/mypackage. See npm-scope(7) for more detail.

                    @@ -52,7 +60,7 @@

                    bugs

                    issues should be reported. These are helpful for people who encounter issues with your package.

                    It should look like this:

                    -
                    { "url" : "http://github.com/owner/project/issues"
                    +
                    { "url" : "https://github.com/owner/project/issues"
                     , "email" : "project@hostname.com"
                     }
                     

                    You can specify either one or both values. If you want to provide only a url, @@ -61,16 +69,44 @@

                    bugs

                    license

                    You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you're placing on it.

                    -

                    The simplest way, assuming you're using a common license such as BSD-3-Clause -or MIT, is to just specify the standard SPDX ID of the license you're using, -like this:

                    +

                    If you're using a common license such as BSD-2-Clause or MIT, add a +current SPDX license identifier for the license you're using, like this:

                    { "license" : "BSD-3-Clause" }
                     

                    You can check the full list of SPDX license IDs. Ideally you should pick one that is OSI approved.

                    -

                    It's also a good idea to include a LICENSE file at the top level in -your package.

                    -

                    people fields: author, contributors

                    +

                    If your package is licensed under multiple common licenses, use an SPDX license +expression syntax version 2.0 string, like this:

                    +
                    { "license" : "(ISC OR GPL-3.0)" }
                    +

                    If you are using a license that hasn't been assigned an SPDX identifier, or if +you are using a custom license, use the following valid SPDX expression:

                    +
                    { "license" : "LicenseRef-LICENSE" }
                    +

                    Then include a LICENSE file at the top level of the package.

                    +

                    Some old packages used license objects or a "licenses" property containing an +array of license objects:

                    +
                    // Not valid metadata
                    +{ "license" :
                    +  { "type" : "ISC"
                    +  , "url" : "http://opensource.org/licenses/ISC"
                    +  }
                    +}
                    +
                    +// Not valid metadata
                    +{ "licenses" :
                    +  [
                    +    { "type": "MIT"
                    +    , "url": "http://www.opensource.org/licenses/mit-license.php"
                    +    }
                    +  , { "type": "Apache-2.0"
                    +    , "url": "http://opensource.org/licenses/apache2.0.php"
                    +    }
                    +  ]
                    +}
                    +

                    Those styles are now deprecated. Instead, use SPDX expressions, like this:

                    +
                    { "license": "ISC" }
                    +
                    +{ "license": "(MIT OR Apache-2.0)" }
                    +

                    people fields: author, contributors

                    The "author" is one person. "contributors" is an array of people. A "person" is an object with a "name" field and optionally "url" and "email", like this:

                    { "name" : "Barney Rubble"
                    @@ -78,7 +114,7 @@ 

                    people fields: author, contributors

                    Or you can shorten that all into a single string, and npm will parse it for you:

                    -
                    "Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)
                    +
                    "Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)"
                     

                    Both email and url are optional either way.

                    npm also sets a top-level "maintainers" field with your npm user info.

                    files

                    @@ -104,10 +140,10 @@

                    bin

                    command name to local file name. On install, npm will symlink that file into prefix/bin for global installs, or ./node_modules/.bin/ for local installs.

                    -

                    For example, npm has this:

                    -
                    { "bin" : { "npm" : "./cli.js" } }
                    -

                    So, when you install npm, it'll create a symlink from the cli.js script to -/usr/local/bin/npm.

                    +

                    For example, myapp could have this:

                    +
                    { "bin" : { "myapp" : "./cli.js" } }
                    +

                    So, when you install myapp, it'll create a symlink from the cli.js script to +/usr/local/bin/myapp.

                    If you have a single executable, and its name should be the name of the package, then you can just supply it as a string. For example:

                    { "name": "my-program"
                    @@ -150,7 +186,7 @@ 

                    bin

                    directories

                    The CommonJS Packages spec details a few ways that you can indicate the structure of your package using a directories -object. If you look at npm's package.json, +object. If you look at npm's package.json, you'll see that it has directories for doc, lib, and man.

                    In the future, this information may be used in other creative ways.

                    directories.lib

                    @@ -170,22 +206,31 @@

                    directories.example

                    Put example scripts in here. Someday, it might be exposed in some clever way.

                    repository

                    Specify the place where your code lives. This is helpful for people who -want to contribute. If the git repo is on github, then the npm docs +want to contribute. If the git repo is on GitHub, then the npm docs command will be able to find you.

                    Do it like this:

                    "repository" :
                       { "type" : "git"
                    -  , "url" : "http://github.com/npm/npm.git"
                    +  , "url" : "https://github.com/npm/npm.git"
                       }
                     
                     "repository" :
                       { "type" : "svn"
                    -  , "url" : "http://v8.googlecode.com/svn/trunk/"
                    +  , "url" : "https://v8.googlecode.com/svn/trunk/"
                       }
                     

                    The URL should be a publicly available (perhaps read-only) url that can be handed directly to a VCS program without any modification. It should not be a url to an html project page that you put in your browser. It's for computers.

                    -

                    scripts

                    +

                    For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same +shortcut syntax you use for npm install:

                    +
                    "repository": "npm/npm"
                    +
                    +"repository": "gist:11081aaa281"
                    +
                    +"repository": "bitbucket:example/repo"
                    +
                    +"repository": "gitlab:another/repo"
                    +

                    scripts

                    The "scripts" property is a dictionary containing script commands that are run at various times in the lifecycle of your package. The key is the lifecycle event, and the value is the command to run at that point.

                    @@ -258,12 +303,15 @@

                    Git URLs as Dependencies

                    The commit-ish can be any tag, sha, or branch which can be supplied as an argument to git checkout. The default is master.

                    GitHub URLs

                    -

                    As of version 1.1.65, you can refer to GitHub urls as just "foo": "user/foo-project". For example:

                    +

                    As of version 1.1.65, you can refer to GitHub urls as just "foo": +"user/foo-project". Just as with git URLs, a commit-ish suffix can be +included. For example:

                    {
                       "name": "foo",
                       "version": "0.0.0",
                       "dependencies": {
                    -    "express": "visionmedia/express"
                    +    "express": "visionmedia/express",
                    +    "mocha": "visionmedia/mocha#4727d357ea"
                       }
                     }
                     

                    Local Paths

                    @@ -315,25 +363,30 @@

                    devDependencies

                    themselves. In dev mode (ie, locally running npm install), it'll run this script as well, so that you can test it easily.

                    peerDependencies

                    -

                    In some cases, you want to express the compatibility of your package with an +

                    In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a require of this host. -This is usually refered to as a plugin. Notably, your module may be exposing +This is usually referred to as a plugin. Notably, your module may be exposing a specific interface, expected and specified by the host documentation.

                    For example:

                    {
                       "name": "tea-latte",
                    -  "version": "1.3.5"
                    +  "version": "1.3.5",
                       "peerDependencies": {
                         "tea": "2.x"
                       }
                     }
                     

                    This ensures your package tea-latte can be installed along with the second -major version of the host package tea only. The host package is automatically -installed if needed. npm install tea-latte could possibly yield the following -dependency graph:

                    +major version of the host package tea only. npm install tea-latte could +possibly yield the following dependency graph:

                    ├── tea-latte@1.3.5
                     └── tea@2.2.0
                    -

                    Trying to install another plugin with a conflicting requirement will cause an +

                    NOTE: npm versions 1 and 2 will automatically install peerDependencies if +they are not explicitly depended upon higher in the dependency tree. In the +next major version of npm (npm@3), this will no longer be the case. You will +receive a warning that the peerDependency is not installed instead. The +behavior in npms 1 & 2 was frequently confusing and could easily put you into +dependency hell, a situation that npm is designed to avoid as much as possible.

                    +

                    Trying to install another plugin with a conflicting requirement will cause an error. For this reason, make sure your plugin requirement is as broad as possible, and not to lock it down to specific patch versions.

                    Assuming the host complies with semver, only changes in @@ -382,6 +435,7 @@

                    engines

                    Note that, unless the user has set the engine-strict config flag, this field is advisory only.

                    engineStrict

                    +

                    NOTE: This feature is deprecated and will be removed in npm 3.0.0.

                    If you are sure that your module will definitely not run properly on versions of Node/npm other than those specified in the engines object, then you can set "engineStrict": true in your package.json file. @@ -389,8 +443,7 @@

                    engineStrict

                    Please do not do this unless you are really very very sure. If your engines object is something overly restrictive, you can quite easily and inadvertently lock yourself into obscurity and prevent your users from -updating to new versions of Node. Consider this choice carefully. If -people abuse it, it will be removed in a future version of npm.

                    +updating to new versions of Node. Consider this choice carefully.

                    os

                    You can specify which operating systems your module will run on:

                    diff --git a/deps/npm/html/partial/doc/index.html b/deps/npm/html/partial/doc/index.html index f6678d93715..2048487ee27 100644 --- a/deps/npm/html/partial/doc/index.html +++ b/deps/npm/html/partial/doc/index.html @@ -1,10 +1,12 @@

                    npm-index

                    Index of all npm documentation

                    README

                    -

                    node package manager

                    +

                    a JavaScript package manager

                    Command Line Documentation

                    Using npm on the command line

                    npm(1)

                    -

                    node package manager

                    +

                    javascript package manager

                    +

                    npm-access(1)

                    +

                    Set access level on published packages

                    npm-adduser(1)

                    Add a registry user account

                    npm-bin(1)

                    @@ -25,6 +27,8 @@

                    npm-dedupe(1)

                    Reduce duplication

                    npm-deprecate(1)

                    Deprecate a version of a package

                    +

                    npm-dist-tag(1)

                    +

                    Modify package distribution tags

                    npm-docs(1)

                    Docs for a package in a web browser maybe

                    npm-edit(1)

                    @@ -41,6 +45,8 @@

                    npm-install(1)

                    Install a package

                    Symlink a package folder

                    +

                    npm-logout(1)

                    +

                    Log out of the registry

                    npm-ls(1)

                    List installed packages

                    npm-outdated(1)

                    @@ -60,7 +66,7 @@

                    npm-rebuild(1)

                    npm-repo(1)

                    Open package repository page in the browser

                    npm-restart(1)

                    -

                    Start a package

                    +

                    Restart a package

                    npm-rm(1)

                    Remove a package

                    npm-root(1)

                    @@ -98,7 +104,7 @@

                    npm-whoami(1)

                    API Documentation

                    Using npm in your Node programs

                    npm(3)

                    -

                    node package manager

                    +

                    javascript package manager

                    npm-bin(3)

                    Display npm bin folder

                    npm-bugs(3)

                    @@ -146,7 +152,7 @@

                    npm-rebuild(3)

                    npm-repo(3)

                    Open package repository page in the browser

                    npm-restart(3)

                    -

                    Start a package

                    +

                    Restart a package

                    npm-root(3)

                    Display npm root

                    npm-run-script(3)

                    diff --git a/deps/npm/html/partial/doc/misc/npm-coding-style.html b/deps/npm/html/partial/doc/misc/npm-coding-style.html index 732b326c997..b50b95f27f7 100644 --- a/deps/npm/html/partial/doc/misc/npm-coding-style.html +++ b/deps/npm/html/partial/doc/misc/npm-coding-style.html @@ -5,14 +5,14 @@

                    DESCRIPTION

                    designed to reduce visual clutter and make bugs more apparent.

                    If you want to contribute to npm (which is very encouraged), you should make your code conform to npm's style.

                    -

                    Note: this concerns npm's code not the specific packages at npmjs.org

                    +

                    Note: this concerns npm's code not the specific packages that you can download from the npm registry.

                    Line Length

                    Keep lines shorter than 80 characters. It's better for lines to be too short than to be too long. Break up long lists, objects, and other statements onto multiple lines.

                    Indentation

                    Two-spaces. Tabs are better, but they look like hell in web browsers -(and on github), and node uses 2 spaces, so that's that.

                    +(and on GitHub), and node uses 2 spaces, so that's that.

                    Configure your editor appropriately.

                    Curly braces

                    Curly braces belong on the same line as the thing that necessitates them.

                    diff --git a/deps/npm/html/partial/doc/misc/npm-config.html b/deps/npm/html/partial/doc/misc/npm-config.html index 87409720b9f..2694cb8b2d6 100644 --- a/deps/npm/html/partial/doc/misc/npm-config.html +++ b/deps/npm/html/partial/doc/misc/npm-config.html @@ -1,6 +1,6 @@

                    npm-config

                    More than you probably want to know about npm configuration

                    DESCRIPTION

                    -

                    npm gets its configuration values from 6 sources, in this priority:

                    +

                    npm gets its configuration values from the following sources, sorted by priority:

                    Command Line Flags

                    Putting --foo bar on the command line sets the foo configuration parameter to "bar". A -- argument tells the cli parser to stop @@ -42,7 +42,6 @@

                    Shorthands and Other CLI Niceties

                    -m: --message
                  • -p, --porcelain: --parseable
                  • -reg: --registry
                  • -
                  • -v: --version
                  • -f: --force
                  • -desc: --description
                  • -S: --save
                  • @@ -81,6 +80,15 @@

                    Shorthands and Other CLI Niceties

                    npm config set foo:port 80

                    See package.json(5) for more information.

                    Config Settings

                    +

                    access

                    +
                      +
                    • Default: restricted
                    • +
                    • Type: Access
                    • +
                    +

                    When publishing scoped packages, the access level defaults to restricted. If +you want your scoped package to be publicly viewable (and installable) set +--access=public. The only valid values for access are public and +restricted. Unscoped packages always have an access level of public.

                    always-auth

                    • Default: false
                    • @@ -107,13 +115,18 @@

                      browser

                      ca

                      • Default: The npm CA certificate
                      • -
                      • Type: String or null
                      • +
                      • Type: String, Array or null

                      The Certificate Authority signing certificate that is trusted for SSL -connections to the registry.

                      -

                      Set to null to only allow "known" registrars, or to a specific CA cert +connections to the registry. Values should be in PEM format with newlines +replaced by the string "\n". For example:

                      +
                      ca="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
                      +

                      Set to null to only allow "known" registrars, or to a specific CA cert to trust only that specific signing authority.

                      -

                      See also the strict-ssl config.

                      +

                      Multiple CAs can be trusted by specifying an array of certificates:

                      +
                      ca[]="..."
                      +ca[]="..."
                      +

                      See also the strict-ssl config.

                      cafile

                      • Default: null
                      • @@ -182,8 +195,12 @@

                        depth

                      • Default: Infinity
                      • Type: Number
                      -

                      The depth to go when recursing directories for npm ls and -npm cache ls.

                      +

                      The depth to go when recursing directories for npm ls, +npm cache ls, and npm outdated.

                      +

                      For npm outdated, a setting of Infinity will be treated as 0 +since that gives more useful information. To show the outdated status +of all packages and dependents, use a large integer value, +e.g., npm outdated --depth 9999

                      description

                      • Default: true
                      • @@ -302,11 +319,22 @@

                        heading

                        The string that starts all the debugging log output.

                        https-proxy

                          -
                        • Default: the HTTPS_PROXY or https_proxy or HTTP_PROXY or -http_proxy environment variables.
                        • +
                        • Default: null
                        • Type: url
                        -

                        A proxy to use for outgoing https requests.

                        +

                        A proxy to use for outgoing https requests. If the HTTPS_PROXY or +https_proxy or HTTP_PROXY or http_proxy environment variables are set, +proxy settings will be honored by the underlying request library.

                        +

                        if-present

                        +
                          +
                        • Default: false
                        • +
                        • Type: Boolean
                        • +
                        +

                        If true, npm will not exit with an error code when run-script is invoked for +a script that isn't defined in the scripts section of package.json. This +option can be used when it's desirable to optionally run a script when it's +present and fail if the script fails. This is useful, for example, when running +scripts that may only apply for some builds in an otherwise generic CI setup.

                        ignore-scripts

                        • Default: false
                        • @@ -348,7 +376,7 @@

                          init-license

                          The value npm init should use by default for the package license.

                          init-version

                            -
                          • Default: "0.0.0"
                          • +
                          • Default: "1.0.0"
                          • Type: semver

                          The value that npm init should use by default for the package @@ -489,10 +517,12 @@

                          proprietary-attribs

                          this as true.

                          proxy

                            -
                          • Default: HTTP_PROXY or http_proxy environment variable, or null
                          • +
                          • Default: null
                          • Type: url
                          -

                          A proxy to use for outgoing http requests.

                          +

                          A proxy to use for outgoing http requests. If the HTTP_PROXY or +http_proxy environment variables are set, proxy settings will be +honored by the underlying request library.

                          rebuild-bundle

                          • Default: true
                          • @@ -564,7 +594,7 @@

                            save-prefix

                          Configure how versions of packages installed to a package.json file via --save or --save-dev get prefixed.

                          -

                          For example if a package has version 1.2.3, by default it's version is +

                          For example if a package has version 1.2.3, by default its version is set to ^1.2.3 which allows minor upgrades for that package, but after npm config set save-prefix='~' it would be set to ~1.2.3 which only allows patch upgrades.

                          @@ -648,6 +678,17 @@

                          tag

                          it will install the specified tag.

                          Also the tag that is added to the package@version specified by the npm tag command, if no explicit tag is given.

                          +

                          tag-version-prefix

                          +
                            +
                          • Default: "v"
                          • +
                          • Type: String
                          • +
                          +

                          If set, alters the prefix used when tagging a new version when performing a +version increment using npm-version. To remove the prefix altogether, set it +to the empty string: "".

                          +

                          Because other tools may rely on the convention that npm version tags look like +v1.0.0, only use this property if it is absolutely necessary. In +particular, use care when overriding this setting for public packages.

                          tmp

                          • Default: TMPDIR environment variable, or "/tmp"
                          • @@ -692,7 +733,7 @@

                            userconfig

                            umask

                            • Default: 022
                            • -
                            • Type: Octal numeric string
                            • +
                            • Type: Octal numeric string in range 0000..0777 (0..511)

                            The "umask" value to use when setting the file creation mode on files and folders.

                            @@ -730,7 +771,6 @@

                            viewer

                            SEE ALSO

                            • npm-config(1)
                            • -
                            • npm-config(7)
                            • npmrc(5)
                            • npm-scripts(7)
                            • npm-folders(5)
                            • diff --git a/deps/npm/html/partial/doc/misc/npm-developers.html b/deps/npm/html/partial/doc/misc/npm-developers.html index 7ba880a44bc..10d0cd89198 100644 --- a/deps/npm/html/partial/doc/misc/npm-developers.html +++ b/deps/npm/html/partial/doc/misc/npm-developers.html @@ -83,6 +83,14 @@

                              Keeping files out of your pa ignore the stuff matched by the .gitignore file. If you want to include something that is excluded by your .gitignore file, you can create an empty .npmignore file to override it.

                              +

                              .npmignore files follow the same pattern rules +as .gitignore files:

                              +
                                +
                              • Blank lines or lines starting with # are ignored.
                              • +
                              • Standard glob patterns work.
                              • +
                              • You can end patterns with a forward slash / to specify a directory.
                              • +
                              • You can negate a pattern by starting it with an exclamation point !.
                              • +

                              By default, the following paths and files are ignored, so there's no need to add them to .npmignore explicitly:

                                diff --git a/deps/npm/html/partial/doc/misc/npm-disputes.html b/deps/npm/html/partial/doc/misc/npm-disputes.html index 6a7abca7122..ee9992f7702 100644 --- a/deps/npm/html/partial/doc/misc/npm-disputes.html +++ b/deps/npm/html/partial/doc/misc/npm-disputes.html @@ -2,7 +2,7 @@

                                npm-disputes

                                Handling Module

                                SYNOPSIS

                                1. Get the author email with npm owner ls <pkgname>
                                2. -
                                3. Email the author, CC support@npmjs.com
                                4. +
                                5. Email the author, CC support@npmjs.com
                                6. After a few weeks, if there's no resolution, we'll sort it out.

                                Don't squat on package names. Publish code or move out of the way.

                                @@ -40,12 +40,12 @@

                                DESCRIPTION

                                owner (Bob).
                              • Joe emails Bob, explaining the situation as respectfully as possible, and what he would like to do with the module name. He -adds the npm support staff support@npmjs.com to the CC list of +adds the npm support staff support@npmjs.com to the CC list of the email. Mention in the email that Bob can run npm owner add joe foo to add Joe as an owner of the foo package.
                              • After a reasonable amount of time, if Bob has not responded, or if Bob and Joe can't come to any sort of resolution, email support -support@npmjs.com and we'll sort it out. ("Reasonable" is +support@npmjs.com and we'll sort it out. ("Reasonable" is usually at least 4 weeks, but extra time is allowed around common holidays.)
                              • diff --git a/deps/npm/html/partial/doc/misc/npm-faq.html b/deps/npm/html/partial/doc/misc/npm-faq.html index 7fc16344f79..448ef469483 100644 --- a/deps/npm/html/partial/doc/misc/npm-faq.html +++ b/deps/npm/html/partial/doc/misc/npm-faq.html @@ -1,6 +1,6 @@

                                npm-faq

                                Frequently Asked Questions

                                Where can I find these docs in HTML?

                                -

                                https://www.npmjs.org/doc/, or run:

                                +

                                https://docs.npmjs.com/, or run:

                                npm config set viewer browser
                                 

                                to open these documents in your default web browser rather than man.

                                It didn't work.

                                @@ -51,7 +51,7 @@

                                Should I check my Usually, no. Allow npm to resolve dependencies for your packages.

                                For packages you deploy, such as websites and apps, you should use npm shrinkwrap to lock down your full dependency tree:

                                -

                                https://www.npmjs.org/doc/cli/npm-shrinkwrap.html

                                +

                                https://docs.npmjs.com/cli/shrinkwrap

                                If you are paranoid about depending on the npm ecosystem, you should run a private npm mirror or a private cache.

                                If you want 100% confidence in being able to reproduce the specific bytes @@ -97,7 +97,7 @@

                                How do I update npm?

                                installed already. (Consider, if there is ever a bug in the update command.)

                                In those cases, you can do this:

                                -
                                curl https://www.npmjs.org/install.sh | sh
                                +
                                curl https://www.npmjs.com/install.sh | sh
                                 

                                What is a package?

                                A package is:

                                  @@ -219,28 +219,51 @@

                                  See npm-registry(7).

                                  I forgot my password, and can't publish. How do I reset it?

                                  -

                                  Go to https://npmjs.org/forgot.

                                  +

                                  Go to https://npmjs.com/forgot.

                                  I get ECONNREFUSED a lot. What's up?

                                  Either the registry is down, or node's DNS isn't able to reach out.

                                  To check if the registry is down, open up https://registry.npmjs.org/ in a web browser. This will also tell you if you are just unable to access the internet for some reason.

                                  -

                                  If the registry IS down, let us know by emailing support@npmjs.com +

                                  If the registry IS down, let us know by emailing support@npmjs.com or posting an issue at https://github.com/npm/npm/issues. If it's down for the world (and not just on your local network) then we're probably already being pinged about it.

                                  You can also often get a faster response by visiting the #npm channel on Freenode IRC.

                                  Why no namespaces?

                                  -

                                  Please see this discussion: https://github.com/npm/npm/issues/798

                                  -

                                  tl;dr - It doesn't actually make things better, and can make them worse.

                                  -

                                  If you want to namespace your own packages, you may: simply use the -- character to separate the names. npm is a mostly anarchic system. -There is not sufficient need to impose namespace rules on everyone.

                                  +

                                  npm has only one global namespace. If you want to namespace your own packages, +you may: simply use the - character to separate the names or use scoped +packages. npm is a mostly anarchic system. There is not sufficient need to +impose namespace rules on everyone.

                                  +

                                  As of 2.0, npm supports scoped packages, which allow you to publish a group of +related modules without worrying about name collisions.

                                  +

                                  Every npm user owns the scope associated with their username. For example, the +user named npm owns the scope @npm. Scoped packages are published inside a +scope by naming them as if they were files under the scope directory, e.g., by +setting name in package.json to @npm/npm.

                                  +

                                  Scoped packages are supported by the public npm registry. The npm client is +backwards-compatible with un-scoped registries, so it can be used to work with +scoped and un-scoped registries at the same time.

                                  +

                                  Unscoped packages can only depend on other unscoped packages. Scoped packages +can depend on packages from their own scope, a different scope, or the public +registry (unscoped).

                                  +

                                  For the current documentation of scoped packages, see +https://docs.npmjs.com/misc/scope

                                  +

                                  References:

                                  +
                                    +
                                  1. For the reasoning behind the "one global namespace", please see this +discussion: https://github.com/npm/npm/issues/798 (TL;DR: It doesn't +actually make things better, and can make them worse.)

                                    +
                                  2. +
                                  3. For the pre-implementation discussion of the scoped package feature, see +this discussion: https://github.com/npm/npm/issues/5239

                                    +
                                  4. +

                                  Who does npm?

                                  npm was originally written by Isaac Z. Schlueter, and many others have contributed to it, some of them quite substantially.

                                  -

                                  The npm open source project, The npm Registry, and the community +

                                  The npm open source project, The npm Registry, and the community website are maintained and operated by the good folks at npm, Inc.

                                  I have a question or request not addressed here. Where should I put it?

                                  diff --git a/deps/npm/html/partial/doc/misc/npm-index.html b/deps/npm/html/partial/doc/misc/npm-index.html index 6e4c0ca8004..feeb5792cdb 100644 --- a/deps/npm/html/partial/doc/misc/npm-index.html +++ b/deps/npm/html/partial/doc/misc/npm-index.html @@ -1,10 +1,12 @@

                                  npm-index

                                  Index of all npm documentation

                                  README

                                  -

                                  node package manager

                                  +

                                  a JavaScript package manager

                                  Command Line Documentation

                                  Using npm on the command line

                                  npm(1)

                                  -

                                  node package manager

                                  +

                                  javascript package manager

                                  +

                                  npm-access(1)

                                  +

                                  Set access level on published packages

                                  npm-adduser(1)

                                  Add a registry user account

                                  npm-bin(1)

                                  @@ -25,6 +27,8 @@

                                  npm-dedupe(1)

                                  Reduce duplication

                                  npm-deprecate(1)

                                  Deprecate a version of a package

                                  +

                                  npm-dist-tag(1)

                                  +

                                  Modify package distribution tags

                                  npm-docs(1)

                                  Docs for a package in a web browser maybe

                                  npm-edit(1)

                                  @@ -41,6 +45,8 @@

                                  npm-install(1)

                                  Install a package

                                  Symlink a package folder

                                  +

                                  npm-logout(1)

                                  +

                                  Log out of the registry

                                  npm-ls(1)

                                  List installed packages

                                  npm-outdated(1)

                                  @@ -60,7 +66,7 @@

                                  npm-rebuild(1)

                                  npm-repo(1)

                                Open package repository page in the browser

                                npm-restart(1)

                                -

                                Start a package

                                +

                                Restart a package

                                npm-rm(1)

                                Remove a package

                                npm-root(1)

                                @@ -98,7 +104,7 @@

                                npm-whoami(1)

                                API Documentation

                                Using npm in your Node programs

                                npm(3)

                                -

                                node package manager

                                +

                                javascript package manager

                                npm-bin(3)

                                Display npm bin folder

                                npm-bugs(3)

                                @@ -146,7 +152,7 @@

                                npm-rebuild(3)

                                npm-repo(3)

                              Open package repository page in the browser

                              npm-restart(3)

                              -

                              Start a package

                              +

                              Restart a package

                              npm-root(3)

                              Display npm root

                              npm-run-script(3)

                              diff --git a/deps/npm/html/partial/doc/misc/npm-registry.html b/deps/npm/html/partial/doc/misc/npm-registry.html index 0031f61b10c..8dd80d4d25b 100644 --- a/deps/npm/html/partial/doc/misc/npm-registry.html +++ b/deps/npm/html/partial/doc/misc/npm-registry.html @@ -21,9 +21,9 @@

                              Can I run my own private registry?If you set up continuous replication from the official CouchDB, and then set your internal CouchDB as the registry config, then you'll be able to read any published packages, in addition to your private ones, and by -default will only publish internally. If you then want to publish a -package for the whole world to see, you can simply override the ---registry config for that command.

                              +default will only publish internally.

                              +

                              If you then want to publish a package for the whole world to see, you can +simply override the --registry option for that publish command.

                              I don't want my package published in the official registry. It's private.

                              Set "private": true in your package.json to prevent it from being published at all, or @@ -38,7 +38,7 @@

                              Do I

                              No, but it's way easier. Basically, yes, you do, or you have to effectively implement the entire CouchDB API anyway.

                              Is there a website or something to see package docs and such?

                              -

                              Yes, head over to https://npmjs.org/

                              +

                              Yes, head over to https://npmjs.com/

                              SEE ALSO

                              • npm-config(1)
                              • diff --git a/deps/npm/html/partial/doc/misc/npm-scope.html b/deps/npm/html/partial/doc/misc/npm-scope.html index 5616efdcb8c..f65c4403676 100644 --- a/deps/npm/html/partial/doc/misc/npm-scope.html +++ b/deps/npm/html/partial/doc/misc/npm-scope.html @@ -7,9 +7,9 @@

                                DESCRIPTION

                                @somescope/somepackagename
                                 

                                Scopes are a way of grouping related packages together, and also affect a few things about the way npm treats the package.

                                -

                                As of 2014-09-03, scoped packages are not supported by the public npm registry. -However, the npm client is backwards-compatible with un-scoped registries, so -it can be used to work with scoped and un-scoped registries at the same time.

                                +

                                Scoped packages are supported by the public npm registry. The npm +client is backwards-compatible with un-scoped registries, so it can be +used to work with scoped and un-scoped registries at the same time.

                                Installing scoped packages

                                Scoped packages are installed to a sub-folder of the regular installation folder, e.g. if your other packages are installed in node_modules/packagename, @@ -32,10 +32,22 @@

                                Requiring scoped packages

                                There is nothing special about the way Node treats scope folders, this is just specifying to require the module mypackage in the folder called @myorg.

                                Publishing scoped packages

                                -

                                Scoped packages can be published to any registry that supports them. -As of 2014-09-03, the public npm registry does not support scoped packages, -so attempting to publish a scoped package to the registry will fail unless -you have associated that scope with a different registry, see below.

                                +

                                Scoped packages can be published to any registry that supports them, including +the public npm registry.

                                +

                                (As of 2015-04-19, the public npm registry does support scoped packages)

                                +

                                If you wish, you may associate a scope with a registry; see below.

                                +

                                Publishing public scoped packages to the public npm registry

                                +

                                To publish a public scoped package, you must specify --access public with +the initial publication. This will publish the package and set access +to public as if you had run npm access public after publishing.

                                +

                                Publishing private scoped packages to the npm registry

                                +

                                To publish a private scoped package to the npm registry, you must have +an npm Private Modules +account.

                                +

                                You can then publish the module with npm publish or npm publish +--access restricted, and it will be present in the npm registry, with +restricted access. You can then change the access permissions, if +desired, with npm access or on the npmjs.com website.

                                Associating a scope with a registry

                                Scopes can be associated with a separate registry. This allows you to seamlessly use a mix of packages from the public npm registry and one or more @@ -54,5 +66,6 @@

                                SEE ALSO

                                diff --git a/deps/npm/html/partial/doc/misc/npm-scripts.html b/deps/npm/html/partial/doc/misc/npm-scripts.html index 08bcbd54a5b..f4ce3221a3c 100644 --- a/deps/npm/html/partial/doc/misc/npm-scripts.html +++ b/deps/npm/html/partial/doc/misc/npm-scripts.html @@ -16,10 +16,10 @@

                                DESCRIPTION

                                Run BEFORE the package is uninstalled.
                              • postuninstall: Run AFTER the package is uninstalled.
                              • -
                              • preupdate: -Run BEFORE the package is updated with the update command.
                              • -
                              • update, postupdate: -Run AFTER the package is updated with the update command.
                              • +
                              • preversion, version: +Run BEFORE bump the package version.
                              • +
                              • postversion: +Run AFTER bump the package version.
                              • pretest, test, posttest: Run by the npm test command.
                              • prestop, stop, poststop: @@ -34,41 +34,23 @@

                                DESCRIPTION

                                run-script <pkg> <stage>
                                . Pre and post commands with matching names will be run for those as well (e.g. premyscript, myscript, postmyscript).

                                -

                                NOTE: INSTALL SCRIPTS ARE AN ANTIPATTERN

                                -

                                tl;dr Don't use install. Use a .gyp file for compilation, and -prepublish for anything else.

                                -

                                You should almost never have to explicitly set a preinstall or -install script. If you are doing this, please consider if there is -another option.

                                -

                                The only valid use of install or preinstall scripts is for -compilation which must be done on the target architecture. In early -versions of node, this was often done using the node-waf scripts, or -a standalone Makefile, and early versions of npm required that it be -explicitly set in package.json. This was not portable, and harder to -do properly.

                                -

                                In the current version of node, the standard way to do this is using a -.gyp file. If you have a file with a .gyp extension in the root -of your package, then npm will run the appropriate node-gyp commands -automatically at install time. This is the only officially supported -method for compiling binary addons, and does not require that you add -anything to your package.json file.

                                -

                                If you have to do other things before your package is used, in a way +

                                COMMON USES

                                +

                                If you need to perform operations on your package before it is used, in a way that is not dependent on the operating system or architecture of the -target system, then use a prepublish script instead. This includes +target system, use a prepublish script. This includes tasks such as:

                                  -
                                • Compile CoffeeScript source code into JavaScript.
                                • -
                                • Create minified versions of JavaScript source code.
                                • +
                                • Compiling CoffeeScript source code into JavaScript.
                                • +
                                • Creating minified versions of JavaScript source code.
                                • Fetching remote resources that your package will use.
                                -

                                The advantage of doing these things at prepublish time instead of -preinstall or install time is that they can be done once, in a -single place, and thus greatly reduce complexity and variability. +

                                The advantage of doing these things at prepublish time is that they can be done once, in a +single place, thus reducing complexity and variability. Additionally, this means that:

                                • You can depend on coffee-script as a devDependency, and thus your users don't need to have it installed.
                                • -
                                • You don't need to include the minifiers in your package, reducing +
                                • You don't need to include minifiers in your package, reducing the size for your users.
                                • You don't need to rely on your users having curl or wget or other system tools on the target machines.
                                • @@ -189,6 +171,11 @@

                                  BEST PRACTICES

                                • Don't prefix your script commands with "sudo". If root permissions are required for some reason, then it'll fail with that error, and the user will sudo the npm command in question.
                                • +
                                • Don't use install. Use a .gyp file for compilation, and prepublish +for anything else. You should almost never have to explicitly set a +preinstall or install script. If you are doing this, please consider if +there is another option. The only valid use of install or preinstall +scripts is for compilation which must be done on the target architecture.

                                SEE ALSO

                                  diff --git a/deps/npm/html/partial/doc/misc/semver.html b/deps/npm/html/partial/doc/misc/semver.html index 691a277dc78..9b763ed18ca 100644 --- a/deps/npm/html/partial/doc/misc/semver.html +++ b/deps/npm/html/partial/doc/misc/semver.html @@ -11,12 +11,12 @@

                                  Usage

                                  As a command-line utility:

                                  $ semver -h
                                   
                                  -Usage: semver <version> [<version> [...]] [-r <range> | -i <inc> | -d <dec>]
                                  +Usage: semver <version> [<version> [...]] [-r <range> | -i <inc> | --preid <identifier> | -l | -rv]
                                   Test if version(s) satisfy the supplied range(s), and sort them.
                                   
                                   Multiple versions or ranges may be supplied, unless increment
                                  -or decrement options are specified.  In that case, only a single
                                  -version may be used, and it is incremented by the specified level
                                  +option is specified.  In that case, only a single version may
                                  +be used, and it is incremented by the specified level
                                   
                                   Program exits successfully if any valid version satisfies
                                   all supplied ranges, and prints all satisfying versions.
                                  @@ -80,6 +80,20 @@ 

                                  Prerelease Tags

                                  the user is indicating that they are aware of the risk. However, it is still not appropriate to assume that they have opted into taking a similar risk on the next set of prerelease versions.

                                  +

                                  Prerelease Identifiers

                                  +

                                  The method .inc takes an additional identifier string argument that +will append the value of the string as a prerelease identifier:

                                  +
                                  > semver.inc('1.2.3', 'pre', 'beta')
                                  +'1.2.4-beta.0'
                                  +
                                  +

                                  command-line example:

                                  +
                                  $ semver 1.2.3 -i prerelease --preid beta
                                  +1.2.4-beta.0
                                  +
                                  +

                                  Which then can be used to increment further:

                                  +
                                  $ semver 1.2.4-beta.0 -i prerelease
                                  +1.2.4-beta.1
                                  +

                                  Advanced Range Syntax

                                  Advanced range syntax desugars to primitive comparators in deterministic ways.

                                  @@ -134,7 +148,6 @@

                                  Tilde Ranges ~1.2.3 ~1.21.2.4-beta.2 would not, because it is a prerelease of a different [major, minor, patch] tuple.

                                -

                                Note: this is the same as the ~> operator in rubygems.

                                Caret Ranges ^1.2.3 ^0.2.5 ^0.0.4

                                Allows changes that do not modify the left-most non-zero digit in the [major, minor, patch] tuple. In other words, this allows patch and @@ -195,6 +208,9 @@

                                Functions

                                increments it.
                              +
                            • major(v): Return the major version number.
                            • +
                            • minor(v): Return the minor version number.
                            • +
                            • patch(v): Return the patch version number.

                            Comparison

                              @@ -214,6 +230,9 @@

                              Comparison

                              v2 is greater. Sorts in ascending order if passed to Array.sort().
                            • rcompare(v1, v2): The reverse of compare. Sorts an array of versions in descending order when passed to Array.sort().
                            • +
                            • diff(v1, v2): Returns difference between two versions by the release type +(major, premajor, minor, preminor, patch, prepatch, or prerelease), +or null if the versions are the same.

                            Ranges

                              diff --git a/deps/npm/lib/access.js b/deps/npm/lib/access.js new file mode 100644 index 00000000000..cf960a67d8b --- /dev/null +++ b/deps/npm/lib/access.js @@ -0,0 +1,123 @@ +var assert = require("assert") +var resolve = require("path").resolve +var url = require("url") + +var log = require("npmlog") +var readPackageJson = require("read-package-json") + +var mapToRegistry = require("./utils/map-to-registry.js") +var npa = require("npm-package-arg") +var npm = require("./npm.js") + +module.exports = access + +access.usage = "npm access public []" + + "\nnpm access restricted []" + + "\nnpm access add []" + + "\nnpm access rm []" + + "\nnpm access ls []" + + "\nnpm access edit []" + +access.completion = function (opts, cb) { + var argv = opts.conf.argv.remain + if (argv.length === 2) { + return cb(null, ["public", "restricted", "add", "rm", "ls", "edit"]) + } + + switch (argv[2]) { + case "public": + case "restricted": + case "ls": + case "edit": + return cb(new Error("unimplemented: packages you can change")) + case "add": + if (argv.length === 3) return cb(null, ["read-only", "read-write"]) + + return cb(new Error("unimplemented: entities and packages")) + case "rm": + return cb(new Error("unimplemented: entities and packages")) + default: + return cb(new Error(argv[2]+" not recognized")) + } +} + +function access (args, cb) { + var cmd = args.shift() + switch (cmd) { + case "public": case "restricted": return changeAccess(args, cmd, cb) + case "add": case "set": return add(args, cb) + case "rm": case "del": case "clear": return rm(args, cb) + case "list": case "sl": case "ls": return ls(args, cb) + case "edit": case "ed": return edit(args, cb) + default: return cb("Usage:\n"+access.usage) + } +} + +function changeAccess (args, level, cb) { + assert(Array.isArray(args), "changeAccess requires args be an array") + assert( + ["public", "restricted"].indexOf(level) !== -1, + "access level must be either 'public' or 'restricted'" + ) + assert(typeof cb === "function", "changeAccess requires a callback") + + var p = (args.shift() || "").trim() + if (!p) return getCurrentPackage(level, cb) + changeAccess_(p, level, cb) +} + +function getCurrentPackage (level, cb) { + var here = resolve(npm.prefix, "package.json") + log.verbose("setPackageLevel", "here", here) + + readPackageJson(here, function (er, data) { + if (er) return cb(er) + + if (!data.name) { + return cb(new Error("Package must be named")) + } + + changeAccess_(data.name, level, cb) + }) +} + +function changeAccess_ (name, level, cb) { + log.verbose("changeAccess", "name", name, "level", level) + mapToRegistry(name, npm.config, function (er, uri, auth, base) { + if (er) return cb(er) + + var data = npa(name) + if (!data.scope) { + var msg = "Sorry, you can't change the access level of unscoped packages." + log.error("access", msg) + return cb(new Error(msg)) + } + + // name must be scoped, so escape separator + name = name.replace("/", "%2f") + // FIXME: mapToRegistry still isn't generic enough SIGH + uri = url.resolve(base, "-/package/"+name+"/access") + var params = { + level : level, + auth : auth + } + + npm.registry.access(uri, params, cb) + }) +} + +function add (args, cb) { + return cb(new Error("npm access add isn't implemented yet!")) +} + +function rm (args, cb) { + return cb(new Error("npm access rm isn't implemented yet!")) +} + +function ls (args, cb) { + return cb(new Error("npm access ls isn't implemented yet!")) +} + +function edit (args, cb) { + return cb(new Error("npm access edit isn't implemented yet!")) +} diff --git a/deps/npm/lib/adduser.js b/deps/npm/lib/adduser.js index 9693aebd389..f59372a296c 100644 --- a/deps/npm/lib/adduser.js +++ b/deps/npm/lib/adduser.js @@ -3,7 +3,6 @@ module.exports = adduser var log = require("npmlog") , npm = require("./npm.js") - , registry = npm.registry , read = require("read") , userValidate = require("npm-user-validate") , crypto @@ -125,13 +124,6 @@ function readEmail (c, u, cb) { } function save (c, u, cb) { - if (c.changed) { - delete registry.auth - delete registry.username - delete registry.password - registry.username = u.u - registry.password = u.p - } npm.spinner.start() // save existing configs, but yank off for this PUT @@ -143,17 +135,21 @@ function save (c, u, cb) { if (scope.charAt(0) !== "@") scope = "@" + scope var scopedRegistry = npm.config.get(scope + ":registry") - if (scopedRegistry) uri = scopedRegistry + var cliRegistry = npm.config.get("registry", "cli") + if (scopedRegistry && !cliRegistry) uri = scopedRegistry } - registry.adduser(uri, u.u, u.p, u.e, function (er, doc) { + var params = { + auth : { + username : u.u, + password : u.p, + email : u.e + } + } + npm.registry.adduser(uri, params, function (er, doc) { npm.spinner.stop() if (er) return cb(er) - registry.username = u.u - registry.password = u.p - registry.email = u.e - // don't want this polluting the configuration npm.config.del("_token", "user") diff --git a/deps/npm/lib/bin.js b/deps/npm/lib/bin.js index 719e8870dda..5465112d889 100644 --- a/deps/npm/lib/bin.js +++ b/deps/npm/lib/bin.js @@ -1,13 +1,14 @@ module.exports = bin var npm = require("./npm.js") +var osenv = require("osenv") bin.usage = "npm bin\nnpm bin -g\n(just prints the bin folder)" function bin (args, silent, cb) { if (typeof cb !== "function") cb = silent, silent = false var b = npm.bin - , PATH = (process.env.PATH || "").split(":") + , PATH = osenv.path() if (!silent) console.log(b) process.nextTick(cb.bind(this, null, b)) diff --git a/deps/npm/lib/bugs.js b/deps/npm/lib/bugs.js index 16744cd5c84..306d9bb4bfc 100644 --- a/deps/npm/lib/bugs.js +++ b/deps/npm/lib/bugs.js @@ -4,7 +4,6 @@ module.exports = bugs bugs.usage = "npm bugs " var npm = require("./npm.js") - , registry = npm.registry , log = require("npmlog") , opener = require("opener") , path = require("path") @@ -14,21 +13,18 @@ var npm = require("./npm.js") , mapToRegistry = require("./utils/map-to-registry.js") bugs.completion = function (opts, cb) { - if (opts.conf.argv.remain.length > 2) return cb() - mapToRegistry("-/short", npm.config, function (er, uri) { - if (er) return cb(er) - - registry.get(uri, { timeout : 60000 }, function (er, list) { - return cb(null, list || []) - }) - }) + // FIXME: there used to be registry completion here, but it stopped making + // sense somewhere around 50,000 packages on the registry + cb() } function bugs (args, cb) { - var n = args.length && npa(args[0]).name || '.' + var n = args.length && npa(args[0]).name || "." fs.stat(n, function (er, s) { - if (er && er.code === "ENOENT") return callRegistry(n, cb) - else if (er) return cb (er) + if (er) { + if (er.code === "ENOENT") return callRegistry(n, cb) + return cb(er) + } if (!s.isDirectory()) return callRegistry(n, cb) readJson(path.resolve(n, "package.json"), function(er, d) { if (er) return cb(er) @@ -38,35 +34,36 @@ function bugs (args, cb) { } function getUrlAndOpen (d, cb) { - var bugs = d.bugs - , repo = d.repository || d.repositories + var repo = d.repository || d.repositories , url - if (bugs) { - url = (typeof url === "string") ? bugs : bugs.url - } else if (repo) { + if (d.bugs) { + url = (typeof d.bugs === "string") ? d.bugs : d.bugs.url + } + else if (repo) { if (Array.isArray(repo)) repo = repo.shift() if (repo.hasOwnProperty("url")) repo = repo.url - log.verbose("repository", repo) - if (bugs && bugs.match(/^(https?:\/\/|git(:\/\/|@))github.com/)) { - url = bugs.replace(/^git(@|:\/\/)/, "https://") + log.verbose("bugs", "repository", repo) + if (repo && repo.match(/^(https?:\/\/|git(:\/\/|@))github.com/)) { + url = repo.replace(/^git(@|:\/\/)/, "https://") .replace(/^https?:\/\/github.com:/, "https://github.com/") - .replace(/\.git$/, '')+"/issues" + .replace(/\.git$/, "")+"/issues" } } if (!url) { - url = "https://npmjs.org/package/" + d.name + url = "https://www.npmjs.org/package/" + d.name } + log.silly("bugs", "url", url) opener(url, { command: npm.config.get("browser") }, cb) } -function callRegistry (n, cb) { - mapToRegistry(n, npm.config, function (er, uri) { +function callRegistry (name, cb) { + mapToRegistry(name, npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.get(uri + "/latest", { timeout : 3600 }, function (er, d) { + npm.registry.get(uri + "/latest", { auth : auth }, function (er, d) { if (er) return cb(er) - getUrlAndOpen (d, cb) + getUrlAndOpen(d, cb) }) }) } diff --git a/deps/npm/lib/build.js b/deps/npm/lib/build.js index 2e01ef6eeaa..c5ee76e5c85 100644 --- a/deps/npm/lib/build.js +++ b/deps/npm/lib/build.js @@ -43,7 +43,7 @@ function build (args, global, didPre, didRB, cb) { function build_ (global, didPre, didRB) { return function (folder, cb) { folder = path.resolve(folder) - if (build._didBuild[folder]) log.error("build", "already built", folder) + if (build._didBuild[folder]) log.info("build", "already built", folder) build._didBuild[folder] = true log.info("build", folder) readJson(path.resolve(folder, "package.json"), function (er, pkg) { @@ -85,20 +85,26 @@ function linkStuff (pkg, folder, global, didRB, cb) { // if it's global, and folder is in {prefix}/node_modules, // then bins are in {prefix}/bin // otherwise, then bins are in folder/../.bin - var parent = pkg.name[0] === "@" ? path.dirname(path.dirname(folder)) : path.dirname(folder) - , gnm = global && npm.globalDir - , gtop = parent === gnm - - log.verbose("linkStuff", [global, gnm, gtop, parent]) - log.info("linkStuff", pkg._id) - - shouldWarn(pkg, folder, global, function() { - asyncMap( [linkBins, linkMans, !didRB && rebuildBundles] - , function (fn, cb) { - if (!fn) return cb() - log.verbose(fn.name, pkg._id) - fn(pkg, folder, parent, gtop, cb) - }, cb) + var parent = pkg.name[0] === '@' ? path.dirname(path.dirname(folder)) : path.dirname(folder) + var gnm = global && npm.globalDir + var gtop = parent === gnm + + log.info('linkStuff', pkg._id) + log.silly('linkStuff', pkg._id, 'has', parent, 'as its parent node_modules') + if (global) log.silly('linkStuff', pkg._id, 'is part of a global install') + if (gnm) log.silly('linkStuff', pkg._id, 'is installed into a global node_modules') + if (gtop) log.silly('linkStuff', pkg._id, 'is installed into the top-level global node_modules') + + shouldWarn(pkg, folder, global, function () { + asyncMap( + [linkBins, linkMans, !didRB && rebuildBundles], + function (fn, cb) { + if (!fn) return cb() + log.verbose(fn.name, pkg._id) + fn(pkg, folder, parent, gtop, cb) + }, + cb + ) }) } @@ -212,6 +218,7 @@ function linkMans (pkg, folder, parent, gtop, cb) { if (!pkg.man || !gtop || process.platform === "win32") return cb() var manRoot = path.resolve(npm.config.get("prefix"), "share", "man") + log.verbose("linkMans", "man files are", pkg.man, "in", manRoot) // make sure that the mans are unique. // otherwise, if there are dupes, it'll fail with EEXIST @@ -225,12 +232,22 @@ function linkMans (pkg, folder, parent, gtop, cb) { asyncMap(pkg.man, function (man, cb) { if (typeof man !== "string") return cb() + log.silly("linkMans", "preparing to link", man) var parseMan = man.match(/(.*\.([0-9]+)(\.gz)?)$/) - , stem = parseMan[1] - , sxn = parseMan[2] - , bn = path.basename(stem) - , manDest = path.join(manRoot, "man" + sxn, bn) + if (!parseMan) { + return cb(new Error( + man+" is not a valid name for a man file. " + + "Man files must end with a number, " + + "and optionally a .gz suffix if they are compressed." + )) + } + + var stem = parseMan[1] + var sxn = parseMan[2] + var bn = path.basename(stem) + var manSrc = path.resolve(folder, man) + var manDest = path.join(manRoot, "man" + sxn, bn) - linkIfExists(man, manDest, gtop && folder, cb) + linkIfExists(manSrc, manDest, gtop && folder, cb) }, cb) } diff --git a/deps/npm/lib/cache.js b/deps/npm/lib/cache.js index e1afb0d1578..cae09b1813d 100644 --- a/deps/npm/lib/cache.js +++ b/deps/npm/lib/cache.js @@ -76,12 +76,12 @@ var npm = require("./npm.js") , addLocal = require("./cache/add-local.js") , addRemoteTarball = require("./cache/add-remote-tarball.js") , addRemoteGit = require("./cache/add-remote-git.js") - , maybeGithub = require("./cache/maybe-github.js") , inflight = require("inflight") , realizePackageSpecifier = require("realize-package-specifier") , npa = require("npm-package-arg") , getStat = require("./cache/get-stat.js") , cachedPackageRoot = require("./cache/cached-package-root.js") + , mapToRegistry = require("./utils/map-to-registry.js") cache.usage = "npm cache add " + "\nnpm cache add " @@ -134,9 +134,7 @@ function read (name, ver, forceBypass, cb) { var root = cachedPackageRoot({name : name, version : ver}) function c (er, data) { - log.silly("cache", "addNamed cb", name+"@"+ver) if (er) log.verbose("cache", "addNamed error for", name+"@"+ver, er) - if (data) deprCheck(data) return cb(er, data) @@ -172,6 +170,7 @@ function normalize (args) { if (normalized.substr(-1) === "/") { normalized = normalized.substr(0, normalized.length - 1) } + normalized = path.normalize(normalized) log.silly("ls", "normalized", normalized) return normalized @@ -202,7 +201,7 @@ function clean (args, cb) { if (!args) args = [] - var f = path.join(npm.cache, path.normalize(normalize(args))) + var f = path.join(npm.cache, normalize(args)) if (f === npm.cache) { fs.readdir(npm.cache, function (er, files) { if (er) return cb() @@ -213,7 +212,10 @@ function clean (args, cb) { }) , rm, cb ) }) - } else rm(path.join(npm.cache, path.normalize(normalize(args))), cb) + } + else { + rm(f, cb) + } } // npm cache add @@ -285,13 +287,16 @@ function add (args, where, cb) { addLocal(p, null, cb) break case "remote": - addRemoteTarball(p.spec, {name : p.name}, null, cb) + // get auth, if possible + mapToRegistry(spec, npm.config, function (err, uri, auth) { + if (err) return cb(err) + + addRemoteTarball(p.spec, {name : p.name}, null, auth, cb) + }) break case "git": - addRemoteGit(p.spec, false, cb) - break - case "github": - maybeGithub(p.spec, cb) + case "hosted": + addRemoteGit(p.rawSpec, cb) break default: if (p.name) return addNamed(p.name, p.spec, null, cb) diff --git a/deps/npm/lib/cache/add-local.js b/deps/npm/lib/cache/add-local.js index b425d7f9118..e7d286e4fb5 100644 --- a/deps/npm/lib/cache/add-local.js +++ b/deps/npm/lib/cache/add-local.js @@ -12,6 +12,7 @@ var assert = require("assert") , cachedPackageRoot = require("./cached-package-root.js") , addLocalTarball = require("./add-local-tarball.js") , sha = require("sha") + , inflight = require("inflight") module.exports = addLocal @@ -28,6 +29,8 @@ function addLocal (p, pkgData, cb_) { } if (data && !data._fromGithub) { data._from = path.relative(npm.prefix, p.spec) || "." + var resolved = path.relative(npm.prefix, p.spec) + if (resolved) data._resolved = "file:"+resolved } return cb_(er, data) } @@ -79,20 +82,24 @@ function addLocalDirectory (p, pkgData, shasum, cb) { var root = cachedPackageRoot(data) var tgz = path.resolve(root, "package.tgz") var pj = path.resolve(root, "package/package.json") + + var wrapped = inflight(tgz, next) + if (!wrapped) return log.verbose("addLocalDirectory", tgz, "already in flight; waiting") + log.verbose("addLocalDirectory", tgz, "not in flight; packing") + getCacheStat(function (er, cs) { mkdir(path.dirname(pj), function (er, made) { if (er) return cb(er) var fancy = !pathIsInside(p, npm.tmp) tar.pack(tgz, p, data, fancy, function (er) { if (er) { - log.error( "addLocalDirectory", "Could not pack %j to %j" - , p, tgz ) + log.error("addLocalDirectory", "Could not pack", p, "to", tgz) return cb(er) } - if (!cs || isNaN(cs.uid) || isNaN(cs.gid)) next() + if (!cs || isNaN(cs.uid) || isNaN(cs.gid)) wrapped() - chownr(made || tgz, cs.uid, cs.gid, next) + chownr(made || tgz, cs.uid, cs.gid, wrapped) }) }) }) diff --git a/deps/npm/lib/cache/add-named.js b/deps/npm/lib/cache/add-named.js index 1bd7af14486..cd06aa28893 100644 --- a/deps/npm/lib/cache/add-named.js +++ b/deps/npm/lib/cache/add-named.js @@ -7,7 +7,6 @@ var path = require("path") , readJson = require("read-package-json") , url = require("url") , npm = require("../npm.js") - , registry = npm.registry , deprCheck = require("../utils/depr-check.js") , inflight = require("inflight") , addRemoteTarball = require("./add-remote-tarball.js") @@ -18,7 +17,19 @@ var path = require("path") module.exports = addNamed function getOnceFromRegistry (name, from, next, done) { - mapToRegistry(name, npm.config, function (er, uri) { + function fixName(err, data, json, resp) { + // this is only necessary until npm/npm-registry-client#80 is fixed + if (err && err.pkgid && err.pkgid !== name) { + err.message = err.message.replace( + new RegExp(': ' + err.pkgid.replace(/(\W)/g, '\\$1') + '$'), + ': ' + name + ) + err.pkgid = name + } + next(err, data, json, resp) + } + + mapToRegistry(name, npm.config, function (er, uri, auth) { if (er) return done(er) var key = "registry:" + uri @@ -26,7 +37,7 @@ function getOnceFromRegistry (name, from, next, done) { if (!next) return log.verbose(from, key, "already in flight; waiting") else log.verbose(from, key, "not in flight; fetching") - registry.get(uri, null, next) + npm.registry.get(uri, { auth : auth }, fixName) }) } @@ -35,20 +46,23 @@ function addNamed (name, version, data, cb_) { assert(typeof cb_ === "function", "must have callback") var key = name + "@" + version - log.verbose("addNamed", key) + log.silly("addNamed", key) function cb (er, data) { if (data && !data._fromGithub) data._from = key cb_(er, data) } - log.silly("addNamed", "semver.valid", semver.valid(version)) - log.silly("addNamed", "semver.validRange", semver.validRange(version)) - var fn = ( semver.valid(version, true) ? addNameVersion - : semver.validRange(version, true) ? addNameRange - : addNameTag - ) - fn(name, version, data, cb) + if (semver.valid(version, true)) { + log.verbose('addNamed', JSON.stringify(version), 'is a plain semver version for', name) + addNameVersion(name, version, data, cb) + } else if (semver.validRange(version, true)) { + log.verbose('addNamed', JSON.stringify(version), 'is a valid semver range for', name) + addNameRange(name, version, data, cb) + } else { + log.verbose('addNamed', JSON.stringify(version), 'is being treated as a dist-tag for', name) + addNameTag(name, version, data, cb) + } } function addNameTag (name, tag, data, cb) { @@ -169,28 +183,28 @@ function addNameVersion (name, v, data, cb) { }) function fetchit () { - if (!npm.config.get("registry")) { - return cb(new Error("Cannot fetch: "+dist.tarball)) - } - - // Use the same protocol as the registry. https registry --> https - // tarballs, but only if they're the same hostname, or else detached - // tarballs may not work. - var tb = url.parse(dist.tarball) - var rp = url.parse(npm.config.get("registry")) - if (tb.hostname === rp.hostname - && tb.protocol !== rp.protocol) { - tb.protocol = url.parse(npm.config.get("registry")).protocol - delete tb.href - } - tb = url.format(tb) - - // Only add non-shasum'ed packages if --forced. Only ancient things - // would lack this for good reasons nowadays. - if (!dist.shasum && !npm.config.get("force")) { - return cb(new Error("package lacks shasum: " + data._id)) - } - return addRemoteTarball(tb, data, dist.shasum, cb) + mapToRegistry(name, npm.config, function (er, _, auth, ruri) { + if (er) return cb(er) + + // Use the same protocol as the registry. https registry --> https + // tarballs, but only if they're the same hostname, or else detached + // tarballs may not work. + var tb = url.parse(dist.tarball) + var rp = url.parse(ruri) + if (tb.hostname === rp.hostname && tb.protocol !== rp.protocol) { + tb.protocol = rp.protocol + delete tb.href + } + tb = url.format(tb) + + // Only add non-shasum'ed packages if --forced. Only ancient things + // would lack this for good reasons nowadays. + if (!dist.shasum && !npm.config.get("force")) { + return cb(new Error("package lacks shasum: " + data._id)) + } + + addRemoteTarball(tb, data, dist.shasum, auth, cb) + }) } } } diff --git a/deps/npm/lib/cache/add-remote-git.js b/deps/npm/lib/cache/add-remote-git.js index d8f3f1cd88f..dc40cb3b64c 100644 --- a/deps/npm/lib/cache/add-remote-git.js +++ b/deps/npm/lib/cache/add-remote-git.js @@ -1,220 +1,404 @@ -var mkdir = require("mkdirp") - , assert = require("assert") - , git = require("../utils/git.js") - , once = require("once") - , fs = require("graceful-fs") - , log = require("npmlog") - , path = require("path") - , url = require("url") - , chownr = require("chownr") - , zlib = require("zlib") - , crypto = require("crypto") - , npm = require("../npm.js") - , rm = require("../utils/gently-rm.js") - , inflight = require("inflight") - , getCacheStat = require("./get-stat.js") - , addLocalTarball = require("./add-local-tarball.js") - , writeStream = require("fs-write-stream-atomic") - - -// 1. cacheDir = path.join(cache,'_git-remotes',sha1(u)) -// 2. checkGitDir(cacheDir) ? 4. : 3. (rm cacheDir if necessary) -// 3. git clone --mirror u cacheDir -// 4. cd cacheDir && git fetch -a origin -// 5. git archive /tmp/random.tgz -// 6. addLocalTarball(/tmp/random.tgz) --format=tar --prefix=package/ -// silent flag is used if this should error quietly -module.exports = function addRemoteGit (u, silent, cb) { - assert(typeof u === "string", "must have git URL") - assert(typeof cb === "function", "must have callback") - - log.verbose("addRemoteGit", "u=%j silent=%j", u, silent) - var parsed = url.parse(u, true) - log.silly("addRemoteGit", "parsed", parsed) - - // git is so tricky! - // if the path is like ssh://foo:22/some/path then it works, but - // it needs the ssh:// - // If the path is like ssh://foo:some/path then it works, but - // only if you remove the ssh:// - var origUrl = u - u = u.replace(/^git\+/, "") - .replace(/#.*$/, "") - - // ssh paths that are scp-style urls don't need the ssh:// - if (parsed.pathname.match(/^\/?:/)) { - u = u.replace(/^ssh:\/\//, "") +var assert = require('assert') +var crypto = require('crypto') +var fs = require('graceful-fs') +var path = require('path') +var url = require('url') + +var chownr = require('chownr') +var dezalgo = require('dezalgo') +var hostedFromURL = require('hosted-git-info').fromUrl +var inflight = require('inflight') +var log = require('npmlog') +var mkdir = require('mkdirp') +var normalizeGitUrl = require('normalize-git-url') +var npa = require('npm-package-arg') +var realizePackageSpecifier = require('realize-package-specifier') + +var addLocal = require('./add-local.js') +var getCacheStat = require('./get-stat.js') +var git = require('../utils/git.js') +var npm = require('../npm.js') +var rm = require('../utils/gently-rm.js') + +var remotes = path.resolve(npm.config.get('cache'), '_git-remotes') +var templates = path.join(remotes, '_templates') + +var VALID_VARIABLES = [ + 'GIT_ASKPASS', + 'GIT_PROXY_COMMAND', + 'GIT_SSH', + 'GIT_SSH_COMMAND', + 'GIT_SSL_CAINFO', + 'GIT_SSL_NO_VERIFY' +] + +module.exports = addRemoteGit +function addRemoteGit (uri, _cb) { + assert(typeof uri === 'string', 'must have git URL') + assert(typeof _cb === 'function', 'must have callback') + var cb = dezalgo(_cb) + + log.verbose('addRemoteGit', 'caching', uri) + + // the URL comes in exactly as it was passed on the command line, or as + // normalized by normalize-package-data / read-package-json / read-installed, + // so figure out what to do with it using hosted-git-info + var parsed = hostedFromURL(uri) + if (parsed) { + // normalize GitHub syntax to org/repo (for now) + var from + if (parsed.type === 'github' && parsed.default === 'shortcut') { + from = parsed.path() + } else { + from = parsed.toString() + } + + log.verbose('addRemoteGit', from, 'is a repository hosted by', parsed.type) + + // prefer explicit URLs to pushing everything through shortcuts + if (parsed.default !== 'shortcut') { + return tryClone(from, parsed.toString(), false, cb) + } + + // try git:, then git+ssh:, then git+https: before failing + tryGitProto(from, parsed, cb) + } else { + // verify that this is a Git URL before continuing + parsed = npa(uri) + if (parsed.type !== 'git') { + return cb(new Error(uri + 'is not a Git or GitHub URL')) + } + + tryClone(parsed.rawSpec, uri, false, cb) } +} - cb = inflight(u, cb) - if (!cb) return log.verbose("addRemoteGit", u, "already in flight; waiting") - log.verbose("addRemoteGit", u, "not in flight; cloning") +function tryGitProto (from, hostedInfo, cb) { + var gitURL = hostedInfo.git() + if (!gitURL) return trySSH(from, hostedInfo, cb) - // figure out what we should check out. - var co = parsed.hash && parsed.hash.substr(1) || "master" + log.silly('tryGitProto', 'attempting to clone', gitURL) + tryClone(from, gitURL, true, function (er) { + if (er) return tryHTTPS(from, hostedInfo, cb) - var v = crypto.createHash("sha1").update(u).digest("hex").slice(0, 8) - v = u.replace(/[^a-zA-Z0-9]+/g, "-")+"-"+v + cb.apply(this, arguments) + }) +} - log.verbose("addRemoteGit", [u, co]) +function tryHTTPS (from, hostedInfo, cb) { + var httpsURL = hostedInfo.https() + if (!httpsURL) { + return cb(new Error(from + ' can not be cloned via Git, SSH, or HTTPS')) + } - var p = path.join(npm.config.get("cache"), "_git-remotes", v) + log.silly('tryHTTPS', 'attempting to clone', httpsURL) + tryClone(from, httpsURL, true, function (er) { + if (er) return trySSH(from, hostedInfo, cb) + + cb.apply(this, arguments) + }) +} - // we don't need global templates when cloning. use this empty dir to specify as template dir - mkdir(path.join(npm.config.get("cache"), "_git-remotes", "_templates"), function (er) { +function trySSH (from, hostedInfo, cb) { + var sshURL = hostedInfo.ssh() + if (!sshURL) return tryHTTPS(from, hostedInfo, cb) + + log.silly('trySSH', 'attempting to clone', sshURL) + tryClone(from, sshURL, false, cb) +} + +function tryClone (from, combinedURL, silent, cb) { + log.silly('tryClone', 'cloning', from, 'via', combinedURL) + + var normalized = normalizeGitUrl(combinedURL) + var cloneURL = normalized.url + var treeish = normalized.branch + + // ensure that similarly-named remotes don't collide + var repoID = cloneURL.replace(/[^a-zA-Z0-9]+/g, '-') + '-' + + crypto.createHash('sha1').update(combinedURL).digest('hex').slice(0, 8) + var cachedRemote = path.join(remotes, repoID) + + cb = inflight(repoID, cb) + if (!cb) { + return log.verbose('tryClone', repoID, 'already in flight; waiting') + } + log.verbose('tryClone', repoID, 'not in flight; caching') + + // initialize the remotes cache with the correct perms + getGitDir(function (er) { if (er) return cb(er) - checkGitDir(p, u, co, origUrl, silent, function (er, data) { - if (er) return cb(er, data) + fs.stat(cachedRemote, function (er, s) { + if (er) return mirrorRemote(from, cloneURL, treeish, cachedRemote, silent, finish) + if (!s.isDirectory()) return resetRemote(from, cloneURL, treeish, cachedRemote, finish) + + validateExistingRemote(from, cloneURL, treeish, cachedRemote, finish) + }) - addModeRecursive(p, npm.modes.file, function (er) { + // always set permissions on the cached remote + function finish (er, data) { + if (er) return cb(er, data) + addModeRecursive(cachedRemote, npm.modes.file, function (er) { return cb(er, data) }) - }) + } }) } -function checkGitDir (p, u, co, origUrl, silent, cb) { - fs.stat(p, function (er, s) { - if (er) return cloneGitRemote(p, u, co, origUrl, silent, cb) - if (!s.isDirectory()) return rm(p, function (er){ - if (er) return cb(er) - cloneGitRemote(p, u, co, origUrl, silent, cb) - }) +// don't try too hard to hold on to a remote +function resetRemote (from, cloneURL, treeish, cachedRemote, cb) { + log.info('resetRemote', 'resetting', cachedRemote, 'for', from) + rm(cachedRemote, function (er) { + if (er) return cb(er) + mirrorRemote(from, cloneURL, treeish, cachedRemote, false, cb) + }) +} - var args = [ "config", "--get", "remote.origin.url" ] - var env = gitEnv() - - // check for git - git.whichAndExec(args, {cwd: p, env: env}, function (er, stdout, stderr) { - var stdoutTrimmed = (stdout + "\n" + stderr).trim() - if (er || u !== stdout.trim()) { - log.warn( "`git config --get remote.origin.url` returned " - + "wrong result ("+u+")", stdoutTrimmed ) - return rm(p, function (er){ - if (er) return cb(er) - cloneGitRemote(p, u, co, origUrl, silent, cb) - }) +// reuse a cached remote when possible, but nuke it if it's in an +// inconsistent state +function validateExistingRemote (from, cloneURL, treeish, cachedRemote, cb) { + git.whichAndExec( + ['config', '--get', 'remote.origin.url'], + { cwd: cachedRemote, env: gitEnv() }, + function (er, stdout, stderr) { + var originURL + if (stdout) { + originURL = stdout.trim() + log.silly('validateExistingRemote', from, 'remote.origin.url:', originURL) } - log.verbose("git remote.origin.url", stdoutTrimmed) - archiveGitRemote(p, u, co, origUrl, cb) - }) - }) + + if (stderr) stderr = stderr.trim() + if (stderr || er) { + log.warn('addRemoteGit', from, 'resetting remote', cachedRemote, 'because of error:', stderr || er) + return resetRemote(from, cloneURL, treeish, cachedRemote, cb) + } else if (cloneURL !== originURL) { + log.warn( + 'addRemoteGit', + from, + 'pre-existing cached repo', cachedRemote, 'points to', originURL, 'and not', cloneURL + ) + return resetRemote(from, cloneURL, treeish, cachedRemote, cb) + } + + log.verbose('validateExistingRemote', from, 'is updating existing cached remote', cachedRemote) + updateRemote(from, cloneURL, treeish, cachedRemote, cb) + } + ) } -function cloneGitRemote (p, u, co, origUrl, silent, cb) { - mkdir(p, function (er) { +// make a complete bare mirror of the remote repo +// NOTE: npm uses a blank template directory to prevent weird inconsistencies +// https://github.com/npm/npm/issues/5867 +function mirrorRemote (from, cloneURL, treeish, cachedRemote, silent, cb) { + mkdir(cachedRemote, function (er) { if (er) return cb(er) - var args = [ "clone", "--template=" + path.join(npm.config.get("cache"), - "_git_remotes", "_templates"), "--mirror", u, p ] - var env = gitEnv() - - // check for git - git.whichAndExec(args, {cwd: p, env: env}, function (er, stdout, stderr) { - stdout = (stdout + "\n" + stderr).trim() - if (er) { - if (silent) { - log.verbose("git clone " + u, stdout) - } else { - log.error("git clone " + u, stdout) + var args = [ + 'clone', + '--template=' + templates, + '--mirror', + cloneURL, cachedRemote + ] + git.whichAndExec( + ['clone', '--template=' + templates, '--mirror', cloneURL, cachedRemote], + { cwd: cachedRemote, env: gitEnv() }, + function (er, stdout, stderr) { + if (er) { + var combined = (stdout + '\n' + stderr).trim() + var command = 'git ' + args.join(' ') + ':' + if (silent) { + log.verbose(command, combined) + } else { + log.error(command, combined) + } + return cb(er) } - return cb(er) + log.verbose('mirrorRemote', from, 'git clone ' + cloneURL, stdout.trim()) + setPermissions(from, cloneURL, treeish, cachedRemote, cb) } - log.verbose("git clone " + u, stdout) - archiveGitRemote(p, u, co, origUrl, cb) - }) + ) }) } -function archiveGitRemote (p, u, co, origUrl, cb) { - var archive = [ "fetch", "-a", "origin" ] - var resolve = [ "rev-list", "-n1", co ] - var env = gitEnv() - - var resolved = null - var tmp - - git.whichAndExec(archive, {cwd: p, env: env}, function (er, stdout, stderr) { - stdout = (stdout + "\n" + stderr).trim() - if (er) { - log.error("git fetch -a origin ("+u+")", stdout) - return cb(er) - } - log.verbose("git fetch -a origin ("+u+")", stdout) - tmp = path.join(npm.tmp, Date.now()+"-"+Math.random(), "tmp.tgz") +function setPermissions (from, cloneURL, treeish, cachedRemote, cb) { + if (process.platform === 'win32') { + log.verbose('setPermissions', from, 'skipping chownr on Windows') + resolveHead(from, cloneURL, treeish, cachedRemote, cb) + } else { + getGitDir(function (er, cs) { + if (er) { + log.error('setPermissions', from, 'could not get cache stat') + return cb(er) + } - if (process.platform === "win32") { - log.silly("verifyOwnership", "skipping for windows") - resolveHead() - } else { - getCacheStat(function(er, cs) { + chownr(cachedRemote, cs.uid, cs.gid, function (er) { if (er) { - log.error("Could not get cache stat") + log.error( + 'setPermissions', + 'Failed to change git repository ownership under npm cache for', + cachedRemote + ) return cb(er) } - chownr(p, cs.uid, cs.gid, function(er) { - if (er) { - log.error("Failed to change folder ownership under npm cache for %s", p) - return cb(er) - } - resolveHead() - }) + + log.verbose('setPermissions', from, 'set permissions on', cachedRemote) + resolveHead(from, cloneURL, treeish, cachedRemote, cb) }) + }) + } +} + +// always fetch the origin, even right after mirroring, because this way +// permissions will get set correctly +function updateRemote (from, cloneURL, treeish, cachedRemote, cb) { + git.whichAndExec( + ['fetch', '-a', 'origin'], + { cwd: cachedRemote, env: gitEnv() }, + function (er, stdout, stderr) { + if (er) { + var combined = (stdout + '\n' + stderr).trim() + log.error('git fetch -a origin (' + cloneURL + ')', combined) + return cb(er) + } + log.verbose('updateRemote', 'git fetch -a origin (' + cloneURL + ')', stdout.trim()) + + setPermissions(from, cloneURL, treeish, cachedRemote, cb) } - }) + ) +} - function resolveHead () { - git.whichAndExec(resolve, {cwd: p, env: env}, function (er, stdout, stderr) { - stdout = (stdout + "\n" + stderr).trim() +// branches and tags are both symbolic labels that can be attached to different +// commits, so resolve the commit-ish to the current actual treeish the label +// corresponds to +// +// important for shrinkwrap +function resolveHead (from, cloneURL, treeish, cachedRemote, cb) { + log.verbose('resolveHead', from, 'original treeish:', treeish) + var args = ['rev-list', '-n1', treeish] + git.whichAndExec( + args, + { cwd: cachedRemote, env: gitEnv() }, + function (er, stdout, stderr) { if (er) { - log.error("Failed resolving git HEAD (" + u + ")", stderr) + log.error('git ' + args.join(' ') + ':', stderr) return cb(er) } - log.verbose("git rev-list -n1 " + co, stdout) - var parsed = url.parse(origUrl) - parsed.hash = stdout - resolved = url.format(parsed) - if (parsed.protocol !== "git:") { - resolved = "git+" + resolved + var resolvedTreeish = stdout.trim() + log.silly('resolveHead', from, 'resolved treeish:', resolvedTreeish) + + var resolvedURL = getResolved(cloneURL, resolvedTreeish) + if (!resolvedURL) { + return cb(new Error( + 'unable to clone ' + from + ' because git clone string ' + + cloneURL + ' is in a form npm can\'t handle' + )) } + log.verbose('resolveHead', from, 'resolved Git URL:', resolvedURL) - // https://github.com/npm/npm/issues/3224 - // node incorrectly sticks a / at the start of the path - // We know that the host won't change, so split and detect this - var spo = origUrl.split(parsed.host) - var spr = resolved.split(parsed.host) - if (spo[1].charAt(0) === ":" && spr[1].charAt(0) === "/") - spr[1] = spr[1].slice(1) - resolved = spr.join(parsed.host) - - log.verbose("resolved git url", resolved) - next() - }) - } + // generate a unique filename + var tmpdir = path.join( + npm.tmp, + 'git-cache-' + crypto.pseudoRandomBytes(6).toString('hex'), + resolvedTreeish + ) + log.silly('resolveHead', 'Git working directory:', tmpdir) - function next () { - mkdir(path.dirname(tmp), function (er) { - if (er) return cb(er) - var gzip = zlib.createGzip({ level: 9 }) - var args = ["archive", co, "--format=tar", "--prefix=package/"] - var out = writeStream(tmp) - var env = gitEnv() - cb = once(cb) - var cp = git.spawn(args, { env: env, cwd: p }) - cp.on("error", cb) - cp.stderr.on("data", function(chunk) { - log.silly(chunk.toString(), "git archive") + mkdir(tmpdir, function (er) { + if (er) return cb(er) + + cloneResolved(from, resolvedURL, resolvedTreeish, cachedRemote, tmpdir, cb) }) + } + ) +} + +// make a clone from the mirrored cache so we have a temporary directory in +// which we can check out the resolved treeish +function cloneResolved (from, resolvedURL, resolvedTreeish, cachedRemote, tmpdir, cb) { + var args = ['clone', cachedRemote, tmpdir] + git.whichAndExec( + args, + { cwd: cachedRemote, env: gitEnv() }, + function (er, stdout, stderr) { + stdout = (stdout + '\n' + stderr).trim() + if (er) { + log.error('git ' + args.join(' ') + ':', stderr) + return cb(er) + } + log.verbose('cloneResolved', from, 'clone', stdout) + + checkoutTreeish(from, resolvedURL, resolvedTreeish, tmpdir, cb) + } + ) +} + +// there is no safe way to do a one-step clone to a treeish that isn't +// guaranteed to be a branch, so explicitly check out the treeish once it's +// cloned +function checkoutTreeish (from, resolvedURL, resolvedTreeish, tmpdir, cb) { + var args = ['checkout', resolvedTreeish] + git.whichAndExec( + args, + { cwd: tmpdir, env: gitEnv() }, + function (er, stdout, stderr) { + stdout = (stdout + '\n' + stderr).trim() + if (er) { + log.error('git ' + args.join(' ') + ':', stderr) + return cb(er) + } + log.verbose('checkoutTreeish', from, 'checkout', stdout) + + // convince addLocal that the checkout is a local dependency + realizePackageSpecifier(tmpdir, function (er, spec) { + if (er) { + log.error('addRemoteGit', 'Failed to map', tmpdir, 'to a package specifier') + return cb(er) + } + + // ensure pack logic is applied + // https://github.com/npm/npm/issues/6400 + addLocal(spec, null, function (er, data) { + if (data) { + if (npm.config.get('save-exact')) { + log.verbose('addRemoteGit', 'data._from:', resolvedURL, '(save-exact)') + data._from = resolvedURL + } else { + log.verbose('addRemoteGit', 'data._from:', from) + data._from = from + } + + log.verbose('addRemoteGit', 'data._resolved:', resolvedURL) + data._resolved = resolvedURL + } - cp.stdout.pipe(gzip).pipe(out).on("close", function() { - addLocalTarball(tmp, null, null, function(er, data) { - if (data) data._resolved = resolved cb(er, data) }) }) + } + ) +} + +function getGitDir (cb) { + getCacheStat(function (er, stats) { + if (er) return cb(er) + + // We don't need global templates when cloning. Use an empty directory for + // the templates, creating it (and setting its permissions) if necessary. + mkdir(templates, function (er) { + if (er) return cb(er) + + // Ensure that both the template and remotes directories have the correct + // permissions. + fs.chown(templates, stats.uid, stats.gid, function (er) { + if (er) return cb(er) + + fs.chown(remotes, stats.uid, stats.gid, function (er) { + cb(er, stats) + }) + }) }) - } + }) } var gitEnv_ @@ -222,49 +406,85 @@ function gitEnv () { // git responds to env vars in some weird ways in post-receive hooks // so don't carry those along. if (gitEnv_) return gitEnv_ - gitEnv_ = {} + + // allow users to override npm's insistence on not prompting for + // passphrases, but default to just failing when credentials + // aren't available + gitEnv_ = { GIT_ASKPASS: 'echo' } + for (var k in process.env) { - if (!~["GIT_PROXY_COMMAND","GIT_SSH","GIT_SSL_NO_VERIFY","GIT_SSL_CAINFO"].indexOf(k) && k.match(/^GIT/)) continue + if (!~VALID_VARIABLES.indexOf(k) && k.match(/^GIT/)) continue gitEnv_[k] = process.env[k] } return gitEnv_ } +addRemoteGit.getResolved = getResolved +function getResolved (uri, treeish) { + // normalize hosted-git-info clone URLs back into regular URLs + // this will only work on URLs that hosted-git-info recognizes + // https://github.com/npm/npm/issues/7961 + var rehydrated = hostedFromURL(uri) + if (rehydrated) uri = rehydrated.toString() + + var parsed = url.parse(uri) + + // non-hosted SSH strings that are not URLs (git@whatever.com:foo.git) are + // no bueno + // https://github.com/npm/npm/issues/7961 + if (!parsed.protocol) return + + parsed.hash = treeish + if (!/^git[+:]/.test(parsed.protocol)) { + parsed.protocol = 'git+' + parsed.protocol + } + + // node incorrectly sticks a / at the start of the path We know that the host + // won't change, so split and detect this + // https://github.com/npm/npm/issues/3224 + var spo = uri.split(parsed.host) + var spr = url.format(parsed).split(parsed.host) + if (spo[1] && spo[1].charAt(0) === ':' && spr[1] && spr[1].charAt(0) === '/') { + spr[1] = spr[1].slice(1) + } + return spr.join(parsed.host) +} + // similar to chmodr except it add permissions rather than overwriting them // adapted from https://github.com/isaacs/chmodr/blob/master/chmodr.js -function addModeRecursive(p, mode, cb) { - fs.readdir(p, function (er, children) { +function addModeRecursive (cachedRemote, mode, cb) { + fs.readdir(cachedRemote, function (er, children) { // Any error other than ENOTDIR means it's not readable, or doesn't exist. // Give up. - if (er && er.code !== "ENOTDIR") return cb(er) - if (er || !children.length) return addMode(p, mode, cb) + if (er && er.code !== 'ENOTDIR') return cb(er) + if (er || !children.length) return addMode(cachedRemote, mode, cb) var len = children.length var errState = null children.forEach(function (child) { - addModeRecursive(path.resolve(p, child), mode, then) + addModeRecursive(path.resolve(cachedRemote, child), mode, then) }) function then (er) { if (errState) return undefined if (er) return cb(errState = er) - if (--len === 0) return addMode(p, dirMode(mode), cb) + if (--len === 0) return addMode(cachedRemote, dirMode(mode), cb) } }) } -function addMode(p, mode, cb) { - fs.stat(p, function (er, stats) { +function addMode (cachedRemote, mode, cb) { + fs.stat(cachedRemote, function (er, stats) { if (er) return cb(er) mode = stats.mode | mode - fs.chmod(p, mode, cb) + fs.chmod(cachedRemote, mode, cb) }) } // taken from https://github.com/isaacs/chmodr/blob/master/chmodr.js -function dirMode(mode) { - if (mode & parseInt("0400", 8)) mode |= parseInt("0100", 8) - if (mode & parseInt( "040", 8)) mode |= parseInt( "010", 8) - if (mode & parseInt( "04", 8)) mode |= parseInt( "01", 8) +function dirMode (mode) { + if (mode & parseInt('0400', 8)) mode |= parseInt('0100', 8) + if (mode & parseInt('040', 8)) mode |= parseInt('010', 8) + if (mode & parseInt('04', 8)) mode |= parseInt('01', 8) return mode } diff --git a/deps/npm/lib/cache/add-remote-tarball.js b/deps/npm/lib/cache/add-remote-tarball.js index 9591ba89d23..66d22009663 100644 --- a/deps/npm/lib/cache/add-remote-tarball.js +++ b/deps/npm/lib/cache/add-remote-tarball.js @@ -6,22 +6,21 @@ var mkdir = require("mkdirp") , retry = require("retry") , createWriteStream = require("fs-write-stream-atomic") , npm = require("../npm.js") - , registry = npm.registry , inflight = require("inflight") , addLocalTarball = require("./add-local-tarball.js") , cacheFile = require("npm-cache-filename") module.exports = addRemoteTarball -function addRemoteTarball (u, pkgData, shasum, cb_) { +function addRemoteTarball (u, pkgData, shasum, auth, cb_) { assert(typeof u === "string", "must have module URL") assert(typeof cb_ === "function", "must have callback") function cb (er, data) { if (data) { data._from = u - data._shasum = data._shasum || shasum data._resolved = u + data._shasum = data._shasum || shasum } cb_(er, data) } @@ -42,11 +41,11 @@ function addRemoteTarball (u, pkgData, shasum, cb_) { log.verbose("addRemoteTarball", [u, shasum]) mkdir(path.dirname(tmp), function (er) { if (er) return cb(er) - addRemoteTarball_(u, tmp, shasum, next) + addRemoteTarball_(u, tmp, shasum, auth, next) }) } -function addRemoteTarball_(u, tmp, shasum, cb) { +function addRemoteTarball_ (u, tmp, shasum, auth, cb) { // Tuned to spread 3 attempts over about a minute. // See formula at . var operation = retry.operation({ @@ -59,12 +58,12 @@ function addRemoteTarball_(u, tmp, shasum, cb) { operation.attempt(function (currentAttempt) { log.info("retry", "fetch attempt " + currentAttempt + " at " + (new Date()).toLocaleTimeString()) - fetchAndShaCheck(u, tmp, shasum, function (er, response, shasum) { + fetchAndShaCheck(u, tmp, shasum, auth, function (er, response, shasum) { // Only retry on 408, 5xx or no `response`. var sc = response && response.statusCode var statusRetry = !sc || (sc === 408 || sc >= 500) if (er && statusRetry && operation.retry(er)) { - log.info("retry", "will retry, error on last attempt: " + er) + log.warn("retry", "will retry, error on last attempt: " + er) return } cb(er, response, shasum) @@ -72,8 +71,8 @@ function addRemoteTarball_(u, tmp, shasum, cb) { }) } -function fetchAndShaCheck (u, tmp, shasum, cb) { - registry.fetch(u, null, function (er, response) { +function fetchAndShaCheck (u, tmp, shasum, auth, cb) { + npm.registry.fetch(u, { auth : auth }, function (er, response) { if (er) { log.error("fetch failed", u) return cb(er, response) diff --git a/deps/npm/lib/cache/caching-client.js b/deps/npm/lib/cache/caching-client.js new file mode 100644 index 00000000000..ec8eb8e16ce --- /dev/null +++ b/deps/npm/lib/cache/caching-client.js @@ -0,0 +1,217 @@ +module.exports = CachingRegistryClient + +var path = require("path") + , fs = require("graceful-fs") + , url = require("url") + , assert = require("assert") + , inherits = require("util").inherits + +var RegistryClient = require("npm-registry-client") + , npm = require("../npm.js") + , log = require("npmlog") + , getCacheStat = require("./get-stat.js") + , cacheFile = require("npm-cache-filename") + , mkdirp = require("mkdirp") + , rimraf = require("rimraf") + , chownr = require("chownr") + , writeFile = require("write-file-atomic") + +function CachingRegistryClient (config) { + RegistryClient.call(this, adaptConfig(config)) + + this._mapToCache = cacheFile(config.get("cache")) + + // swizzle in our custom cache invalidation logic + this._request = this.request + this.request = this._invalidatingRequest + this.get = get +} +inherits(CachingRegistryClient, RegistryClient) + +CachingRegistryClient.prototype._invalidatingRequest = function (uri, params, cb) { + var client = this + this._request.call(this, uri, params, function () { + var args = arguments + + var method = params.method + if (method !== "HEAD" && method !== "GET") { + var invalidated = client._mapToCache(uri) + // invalidate cache + // + // This is irrelevant for commands that do etag / last-modified caching, + // but ls and view also have a timed cache, so this keeps the user from + // thinking that it didn't work when it did. + // Note that failure is an acceptable option here, since the only + // result will be a stale cache for some helper commands. + log.verbose("request", "invalidating", invalidated, "on", method) + return rimraf(invalidated, function () { + cb.apply(undefined, args) + }) + } + + cb.apply(undefined, args) + }) +} + +function get (uri, params, cb) { + assert(typeof uri === "string", "must pass registry URI to get") + assert(params && typeof params === "object", "must pass params to get") + assert(typeof cb === "function", "must pass callback to get") + + var parsed = url.parse(uri) + assert( + parsed.protocol === "http:" || parsed.protocol === "https:", + "must have a URL that starts with http: or https:" + ) + + var cacheBase = cacheFile(npm.config.get("cache"))(uri) + var cachePath = path.join(cacheBase, ".cache.json") + + // If the GET is part of a write operation (PUT or DELETE), then + // skip past the cache entirely, but still save the results. + if (uri.match(/\?write=true$/)) { + log.verbose("get", "GET as part of write; not caching result") + return get_.call(this, uri, cachePath, params, cb) + } + + var client = this + fs.stat(cachePath, function (er, stat) { + if (!er) { + fs.readFile(cachePath, function (er, data) { + try { + data = JSON.parse(data) + } + catch (ex) { + data = null + } + + params.stat = stat + params.data = data + + get_.call(client, uri, cachePath, params, cb) + }) + } + else { + get_.call(client, uri, cachePath, params, cb) + } + }) +} + +function get_ (uri, cachePath, params, cb) { + var staleOk = params.staleOk === undefined ? false : params.staleOk + , timeout = params.timeout === undefined ? -1 : params.timeout + , data = params.data + , stat = params.stat + , etag + , lastModified + + timeout = Math.min(timeout, npm.config.get("cache-max") || 0) + timeout = Math.max(timeout, npm.config.get("cache-min") || -Infinity) + if (process.env.COMP_CWORD !== undefined && + process.env.COMP_LINE !== undefined && + process.env.COMP_POINT !== undefined) { + timeout = Math.max(timeout, 60000) + } + + if (data) { + if (data._etag) etag = data._etag + if (data._lastModified) lastModified = data._lastModified + + if (stat && timeout && timeout > 0) { + if ((Date.now() - stat.mtime.getTime())/1000 < timeout) { + log.verbose("get", uri, "not expired, no request") + delete data._etag + delete data._lastModified + return cb(null, data, JSON.stringify(data), { statusCode : 304 }) + } + + if (staleOk) { + log.verbose("get", uri, "staleOk, background update") + delete data._etag + delete data._lastModified + process.nextTick( + cb.bind(null, null, data, JSON.stringify(data), { statusCode : 304 } ) + ) + cb = function () {} + } + } + } + + var options = { + etag : etag, + lastModified : lastModified, + follow : params.follow, + auth : params.auth + } + this.request(uri, options, function (er, remoteData, raw, response) { + // if we get an error talking to the registry, but we have it + // from the cache, then just pretend we got it. + if (er && cachePath && data && !data.error) { + er = null + response = { statusCode: 304 } + } + + if (response) { + log.silly("get", "cb", [response.statusCode, response.headers]) + if (response.statusCode === 304 && (etag || lastModified)) { + remoteData = data + log.verbose(etag ? "etag" : "lastModified", uri+" from cache") + } + } + + data = remoteData + if (!data) er = er || new Error("failed to fetch from registry: " + uri) + + if (er) return cb(er, data, raw, response) + + saveToCache(cachePath, data, saved) + + // just give the write the old college try. if it fails, whatever. + function saved () { + delete data._etag + delete data._lastModified + cb(er, data, raw, response) + } + + function saveToCache (cachePath, data, saved) { + log.verbose("get", "saving", data.name, "to", cachePath) + getCacheStat(function (er, st) { + mkdirp(path.dirname(cachePath), function (er, made) { + if (er) return saved() + + writeFile(cachePath, JSON.stringify(data), function (er) { + if (er) return saved() + + chownr(made || cachePath, st.uid, st.gid, saved) + }) + }) + }) + } + }) +} + +function adaptConfig (config) { + return { + proxy : { + http : config.get("proxy"), + https : config.get("https-proxy"), + localAddress : config.get("local-address") + }, + ssl : { + certificate : config.get("cert"), + key : config.get("key"), + ca : config.get("ca"), + strict : config.get("strict-ssl") + }, + retry : { + retries : config.get("fetch-retries"), + factor : config.get("fetch-retry-factor"), + minTimeout : config.get("fetch-retry-mintimeout"), + maxTimeout : config.get("fetch-retry-maxtimeout") + }, + userAgent : config.get("user-agent"), + log : log, + defaultTag : config.get("tag"), + couchToken : config.get("_token") + } +} diff --git a/deps/npm/lib/cache/get-stat.js b/deps/npm/lib/cache/get-stat.js index 45b60ce7936..98f95ad6ae1 100644 --- a/deps/npm/lib/cache/get-stat.js +++ b/deps/npm/lib/cache/get-stat.js @@ -22,11 +22,18 @@ module.exports = function getCacheStat (cb) { function makeCacheDir (cb) { cb = inflight("makeCacheDir", cb) - if (!cb) return log.verbose("getCacheStat", "cache creation already in flight; waiting") + if (!cb) { + return log.verbose( + "getCacheStat", + "cache creation already in flight; waiting" + ) + } log.verbose("getCacheStat", "cache creation not in flight; initializing") if (!process.getuid) return mkdir(npm.cache, function (er) { - return cb(er, {}) + log.verbose("makeCacheDir", "UID & GID are irrelevant on", process.platform) + cacheStat = { uid : 0, gid : 0 } + return cb(er, cacheStat) }) var uid = +process.getuid() @@ -36,8 +43,9 @@ function makeCacheDir (cb) { if (process.env.SUDO_UID) uid = +process.env.SUDO_UID if (process.env.SUDO_GID) gid = +process.env.SUDO_GID } + if (uid !== 0 || !process.env.HOME) { - cacheStat = {uid: uid, gid: gid} + cacheStat = { uid : uid, gid : gid } return mkdir(npm.cache, afterMkdir) } diff --git a/deps/npm/lib/cache/maybe-github.js b/deps/npm/lib/cache/maybe-github.js deleted file mode 100644 index 5ecdb691552..00000000000 --- a/deps/npm/lib/cache/maybe-github.js +++ /dev/null @@ -1,32 +0,0 @@ -var assert = require("assert") - , log = require("npmlog") - , addRemoteGit = require("./add-remote-git.js") - -module.exports = function maybeGithub (p, cb) { - assert(typeof p === "string", "must pass package name") - assert(typeof cb === "function", "must pass callback") - - var u = "git://github.com/" + p - log.info("maybeGithub", "Attempting %s from %s", p, u) - - return addRemoteGit(u, true, function (er, data) { - if (er) { - var upriv = "git+ssh://git@github.com:" + p - log.info("maybeGithub", "Attempting %s from %s", p, upriv) - - return addRemoteGit(upriv, false, function (er, data) { - if (er) return cb(er) - - success(upriv, data) - }) - } - - success(u, data) - }) - - function success (u, data) { - data._from = u - data._fromGithub = true - return cb(null, data) - } -} diff --git a/deps/npm/lib/cache/update-index.js b/deps/npm/lib/cache/update-index.js new file mode 100644 index 00000000000..ab1ede120b2 --- /dev/null +++ b/deps/npm/lib/cache/update-index.js @@ -0,0 +1,104 @@ +module.exports = updateIndex + +var fs = require('graceful-fs') +var assert = require('assert') +var path = require('path') +var mkdir = require('mkdirp') +var chownr = require('chownr') +var npm = require('../npm.js') +var log = require('npmlog') +var cacheFile = require('npm-cache-filename') +var getCacheStat = require('./get-stat.js') +var mapToRegistry = require('../utils/map-to-registry.js') + +/* /-/all is special. + * It uses timestamp-based caching and partial updates, + * because it is a monster. + */ +function updateIndex (staleness, cb) { + assert(typeof cb === 'function', 'must pass callback to updateIndex') + + mapToRegistry('-/all', npm.config, function (er, uri, auth) { + if (er) return cb(er) + + var params = { + timeout: staleness, + follow: true, + staleOk: true, + auth: auth + } + var cacheBase = cacheFile(npm.config.get('cache'))(uri) + var cachePath = path.join(cacheBase, '.cache.json') + log.info('updateIndex', cachePath) + + getCacheStat(function (er, st) { + if (er) return cb(er) + + mkdir(cacheBase, function (er, made) { + if (er) return cb(er) + + fs.readFile(cachePath, function (er, data) { + if (er) { + log.warn('', 'Building the local index for the first time, please be patient') + return updateIndex_(uri, params, {}, cachePath, cb) + } + + chownr(made || cachePath, st.uid, st.gid, function (er) { + if (er) return cb(er) + + try { + data = JSON.parse(data) + } catch (ex) { + fs.writeFile(cachePath, '{}', function (er) { + if (er) return cb(new Error('Broken cache.')) + + log.warn('', 'Building the local index for the first time, please be patient') + return updateIndex_(uri, params, {}, cachePath, cb) + }) + } + + var t = +data._updated || 0 + // use the cache and update in the background if it's not too old + if (Date.now() - t < 60000) { + cb(null, data) + cb = function () {} + } + + if (t === 0) { + log.warn('', 'Building the local index for the first time, please be patient') + } else { + log.verbose('updateIndex', 'Cached search data present with timestamp', t) + uri += '/since?stale=update_after&startkey=' + t + } + updateIndex_(uri, params, data, cachePath, cb) + }) + }) + }) + }) + }) +} + +function updateIndex_ (all, params, data, cachePath, cb) { + log.silly('update-index', 'fetching', all) + npm.registry.request(all, params, function (er, updates, _, res) { + if (er) return cb(er, data) + + var headers = res.headers + var updated = updates._updated || Date.parse(headers.date) + + Object.keys(updates).forEach(function (p) { data[p] = updates[p] }) + + data._updated = updated + getCacheStat(function (er, st) { + if (er) return cb(er) + + fs.writeFile(cachePath, JSON.stringify(data), function (er) { + delete data._updated + if (er) return cb(er) + chownr(cachePath, st.uid, st.gid, function (er) { + cb(er, data) + }) + }) + }) + }) +} diff --git a/deps/npm/lib/config.js b/deps/npm/lib/config.js index f51156aad4e..c79cdc5b8b2 100644 --- a/deps/npm/lib/config.js +++ b/deps/npm/lib/config.js @@ -18,6 +18,7 @@ var log = require("npmlog") , ini = require("ini") , editor = require("editor") , os = require("os") + , umask = require("./utils/umask") config.completion = function (opts, cb) { var argv = opts.conf.argv.remain @@ -84,7 +85,7 @@ function edit (cb) { ] ) .concat(Object.keys(npmconf.defaults).reduce(function (arr, key) { - var obj = {}; + var obj = {} obj[key] = npmconf.defaults[key] if (key === "logstream") return arr return arr.concat( @@ -132,16 +133,19 @@ function set (key, val, cb) { val = val.trim() log.info("config", "set %j %j", key, val) var where = npm.config.get("global") ? "global" : "user" + if (key.match(/umask/)) val = umask.fromString(val) npm.config.set(key, val, where) npm.config.save(where, cb) } function get (key, cb) { if (!key) return list(cb) - if (key.charAt(0) === "_") { + if (!public(key)) { return cb(new Error("---sekretz---")) } - console.log(npm.config.get(key)) + var val = npm.config.get(key) + if (key.match(/umask/)) val = umask.toString(val) + console.log(val) cb() } @@ -150,7 +154,9 @@ function sort (a, b) { } function public (k) { - return !(k.charAt(0) === "_" || types[k] !== types[k]) + return !(k.charAt(0) === "_" || + k.indexOf(":_") !== -1 || + types[k] !== types[k]) } function getKeys (data) { diff --git a/deps/npm/lib/config/clear-credentials-by-uri.js b/deps/npm/lib/config/clear-credentials-by-uri.js new file mode 100644 index 00000000000..88131f7adb5 --- /dev/null +++ b/deps/npm/lib/config/clear-credentials-by-uri.js @@ -0,0 +1,16 @@ +var assert = require("assert") + +var toNerfDart = require("./nerf-dart.js") + +module.exports = clearCredentialsByURI + +function clearCredentialsByURI (uri) { + assert(uri && typeof uri === "string", "registry URL is required") + + var nerfed = toNerfDart(uri) + + this.del(nerfed + ":_authToken", "user") + this.del(nerfed + ":_password", "user") + this.del(nerfed + ":username", "user") + this.del(nerfed + ":email", "user") +} diff --git a/deps/npm/lib/config/core.js b/deps/npm/lib/config/core.js index 6c6112532fa..f11a98dfb88 100644 --- a/deps/npm/lib/config/core.js +++ b/deps/npm/lib/config/core.js @@ -8,8 +8,9 @@ var fs = require("fs") var path = require("path") var nopt = require("nopt") var ini = require("ini") -var Octal = configDefs.Octal +var Umask = configDefs.Umask var mkdirp = require("mkdirp") +var umask = require("../utils/umask") exports.load = load exports.Conf = Conf @@ -73,8 +74,10 @@ function load () { loading = true cb = once(function (er, conf) { - if (!er) + if (!er) { exports.loaded = conf + loading = false + } loadCbs.forEach(function (fn) { fn(er, conf) }) @@ -151,10 +154,17 @@ function load_(builtin, rc, cli, cb) { // annoying humans and their expectations! if (conf.get("prefix")) { var etc = path.resolve(conf.get("prefix"), "etc") - defaults.globalconfig = path.resolve(etc, "npmrc") - defaults.globalignorefile = path.resolve(etc, "npmignore") + mkdirp(etc, function (err) { + defaults.globalconfig = path.resolve(etc, "npmrc") + defaults.globalignorefile = path.resolve(etc, "npmignore") + afterUserContinuation() + }) + } else { + afterUserContinuation() } + } + function afterUserContinuation() { conf.addFile(conf.get("globalconfig"), "global") // move the builtin into the conf stack now. @@ -219,6 +229,7 @@ Conf.prototype.setUser = require("./set-user.js") Conf.prototype.findPrefix = require("./find-prefix.js") Conf.prototype.getCredentialsByURI = require("./get-credentials-by-uri.js") Conf.prototype.setCredentialsByURI = require("./set-credentials-by-uri.js") +Conf.prototype.clearCredentialsByURI = require("./clear-credentials-by-uri.js") Conf.prototype.loadExtras = function(cb) { this.setUser(function(er) { @@ -362,8 +373,8 @@ function parseField (f, k) { var isPath = -1 !== typeList.indexOf(path) var isBool = -1 !== typeList.indexOf(Boolean) var isString = -1 !== typeList.indexOf(String) - var isOctal = -1 !== typeList.indexOf(Octal) - var isNumber = isOctal || (-1 !== typeList.indexOf(Number)) + var isUmask = -1 !== typeList.indexOf(Umask) + var isNumber = -1 !== typeList.indexOf(Number) f = (""+f).trim() @@ -396,8 +407,11 @@ function parseField (f, k) { f = path.resolve(f) } + if (isUmask) + f = umask.fromString(f) + if (isNumber && !isNaN(f)) - f = isOctal ? parseInt(f, 8) : +f + f = +f return f } diff --git a/deps/npm/lib/config/defaults.js b/deps/npm/lib/config/defaults.js index 7bd672114de..a90d4c22b0a 100644 --- a/deps/npm/lib/config/defaults.js +++ b/deps/npm/lib/config/defaults.js @@ -9,6 +9,7 @@ var path = require("path") , nopt = require("nopt") , os = require("os") , osenv = require("osenv") + , umask = require("../utils/umask") var log try { @@ -20,19 +21,10 @@ try { } } } -exports.Octal = Octal -function Octal () {} -function validateOctal (data, k, val) { - // must be either an integer or an octal string. - if (typeof val === "number") { - data[k] = val - return true - } - - if (typeof val === "string") { - if (val.charAt(0) !== "0" || isNaN(val)) return false - data[k] = parseInt(val, 8).toString(8) - } +exports.Umask = Umask +function Umask () {} +function validateUmask (data, k, val) { + return umask.validate(data, k, val) } function validateSemver (data, k, val) { @@ -40,24 +32,14 @@ function validateSemver (data, k, val) { data[k] = semver.valid(val) } -function validateTag (data, k, val) { - val = ("" + val).trim() - if (!val || semver.validRange(val)) return false - data[k] = val -} - function validateStream (data, k, val) { if (!(val instanceof Stream)) return false data[k] = val } nopt.typeDefs.semver = { type: semver, validate: validateSemver } -nopt.typeDefs.Octal = { type: Octal, validate: validateOctal } nopt.typeDefs.Stream = { type: Stream, validate: validateStream } - -// Don't let --tag=1.2.3 ever be a thing -var tag = {} -nopt.typeDefs.tag = { type: tag, validate: validateTag } +nopt.typeDefs.Umask = { type: Umask, validate: validateUmask } nopt.invalidHandler = function (k, val, type) { log.warn("invalid config", k + "=" + JSON.stringify(val)) @@ -68,11 +50,8 @@ nopt.invalidHandler = function (k, val, type) { } switch (type) { - case tag: - log.warn("invalid config", "Tag must not be a SemVer range") - break - case Octal: - log.warn("invalid config", "Must be octal number, starting with 0") + case Umask: + log.warn("invalid config", "Must be umask, octal number in range 0000..0777") break case url: log.warn("invalid config", "Must be a full url with 'http://'") @@ -127,7 +106,9 @@ Object.defineProperty(exports, "defaults", {get: function () { } defaults = { - "always-auth" : false + access : null + , "always-auth" : false + , "bin-links" : true , browser : null @@ -166,6 +147,7 @@ Object.defineProperty(exports, "defaults", {get: function () { , group : process.platform === "win32" ? 0 : process.env.SUDO_GID || (process.getgid && process.getgid()) , heading: "npm" + , "if-present": false , "ignore-scripts": false , "init-module": path.resolve(home, ".npm-init.js") , "init-author-name" : "" @@ -189,9 +171,8 @@ Object.defineProperty(exports, "defaults", {get: function () { , prefix : globalPrefix , production: process.env.NODE_ENV === "production" , "proprietary-attribs": true - , proxy : process.env.HTTP_PROXY || process.env.http_proxy || null - , "https-proxy" : process.env.HTTPS_PROXY || process.env.https_proxy || - process.env.HTTP_PROXY || process.env.http_proxy || null + , proxy : null + , "https-proxy" : null , "user-agent" : "npm/{npm-version} " + "node/{node-version} " + "{platform} " @@ -215,6 +196,7 @@ Object.defineProperty(exports, "defaults", {get: function () { , spin: true , "strict-ssl": true , tag : "latest" + , "tag-version-prefix" : "v" , tmp : temp , unicode : true , "unsafe-perm" : process.platform === "win32" @@ -225,7 +207,7 @@ Object.defineProperty(exports, "defaults", {get: function () { , usage : false , user : process.platform === "win32" ? 0 : "nobody" , userconfig : path.resolve(home, ".npmrc") - , umask: process.umask ? process.umask() : parseInt("022", 8) + , umask: process.umask ? process.umask() : umask.fromString("022") , version : false , versions : false , viewer: process.platform === "win32" ? "browser" : "man" @@ -237,7 +219,8 @@ Object.defineProperty(exports, "defaults", {get: function () { }}) exports.types = - { "always-auth" : Boolean + { access : [null, "restricted", "public"] + , "always-auth" : Boolean , "bin-links": Boolean , browser : [null, String] , ca: [null, String, Array] @@ -268,6 +251,7 @@ exports.types = , "https-proxy" : [null, url] , "user-agent" : String , "heading": String + , "if-present": Boolean , "ignore-scripts": Boolean , "init-module": path , "init-author-name" : String @@ -281,7 +265,7 @@ exports.types = // local-address must be listed as an IP for a local network interface // must be IPv4 due to node bug , "local-address" : getLocalAddresses() - , loglevel : ["silent","error","warn","http","info","verbose","silly"] + , loglevel : ["silent", "error", "warn", "http", "info", "verbose", "silly"] , logstream : Stream , long : Boolean , message: String @@ -293,7 +277,7 @@ exports.types = , prefix: path , production: Boolean , "proprietary-attribs": Boolean - , proxy : [null, url] + , proxy : [null, false, url] // allow proxy to be disabled explicitly , "rebuild-bundle" : Boolean , registry : [null, url] , rollback : Boolean @@ -316,24 +300,35 @@ exports.types = , "sign-git-tag": Boolean , spin: ["always", Boolean] , "strict-ssl": Boolean - , tag : tag + , tag : String , tmp : path , unicode : Boolean , "unsafe-perm" : Boolean , usage : Boolean , user : [Number, String] , userconfig : path - , umask: Octal + , umask: Umask , version : Boolean + , "tag-version-prefix" : String , versions : Boolean , viewer: String , _exit : Boolean } -function getLocalAddresses() { - Object.keys(os.networkInterfaces()).map(function (nic) { - return os.networkInterfaces()[nic].filter(function (addr) { - return addr.family === "IPv4" +function getLocalAddresses () { + var interfaces + // #8094: some environments require elevated permissions to enumerate + // interfaces, and synchronously throw EPERM when run without + // elevated privileges + try { + interfaces = os.networkInterfaces() + } catch (e) { + interfaces = {} + } + + return Object.keys(interfaces).map(function (nic) { + return interfaces[nic].filter(function (addr) { + return addr.family === 'IPv4' }) .map(function (addr) { return addr.address diff --git a/deps/npm/lib/config/load-cafile.js b/deps/npm/lib/config/load-cafile.js index dc1ff9f03a9..cc63615ff55 100644 --- a/deps/npm/lib/config/load-cafile.js +++ b/deps/npm/lib/config/load-cafile.js @@ -9,8 +9,12 @@ function loadCAFile(cafilePath, cb) { fs.readFile(cafilePath, "utf8", afterCARead.bind(this)) function afterCARead(er, cadata) { - if (er) + + if (er) { + // previous cafile no longer exists, so just continue on gracefully + if (er.code === 'ENOENT') return cb() return cb(er) + } var delim = "-----END CERTIFICATE-----" var output diff --git a/deps/npm/lib/config/nerf-dart.js b/deps/npm/lib/config/nerf-dart.js index 3b26a56c65f..07c817500f6 100644 --- a/deps/npm/lib/config/nerf-dart.js +++ b/deps/npm/lib/config/nerf-dart.js @@ -13,9 +13,11 @@ module.exports = toNerfDart */ function toNerfDart(uri) { var parsed = url.parse(uri) - parsed.pathname = "/" delete parsed.protocol delete parsed.auth + delete parsed.query + delete parsed.search + delete parsed.hash - return url.format(parsed) + return url.resolve(url.format(parsed), ".") } diff --git a/deps/npm/lib/dedupe.js b/deps/npm/lib/dedupe.js index 74397d0cb95..c63705e18d6 100644 --- a/deps/npm/lib/dedupe.js +++ b/deps/npm/lib/dedupe.js @@ -240,10 +240,10 @@ function findVersions (npm, summary, cb) { var versions = data.versions var ranges = data.ranges - mapToRegistry(name, npm.config, function (er, uri) { + mapToRegistry(name, npm.config, function (er, uri, auth) { if (er) return cb(er) - npm.registry.get(uri, null, next) + npm.registry.get(uri, { auth : auth }, next) }) function next (er, data) { @@ -314,11 +314,28 @@ function readInstalled (dir, counter, parent, cb) { }) fs.readdir(path.resolve(dir, "node_modules"), function (er, c) { - children = c || [] // error is ok, just means no children. - children = children.filter(function (p) { - return !p.match(/^[\._-]/) - }) - next() + children = children || [] // error is ok, just means no children. + // check if there are scoped packages. + asyncMap(c || [], function (child, cb) { + if (child.indexOf('@') === 0) { + fs.readdir(path.resolve(dir, "node_modules", child), function (er, scopedChildren) { + // error is ok, just means no children. + (scopedChildren || []).forEach(function (sc) { + children.push(path.join(child, sc)) + }) + cb() + }) + } else { + children.push(child) + cb() + } + }, function (er) { + if (er) return cb(er) + children = children.filter(function (p) { + return !p.match(/^[\._-]/) + }) + next(); + }); }) function next () { diff --git a/deps/npm/lib/deprecate.js b/deps/npm/lib/deprecate.js index 17dd4eab0c1..c90ad902723 100644 --- a/deps/npm/lib/deprecate.js +++ b/deps/npm/lib/deprecate.js @@ -12,13 +12,16 @@ deprecate.completion = function (opts, cb) { if (opts.conf.argv.remain.length > 2) return cb() // get the list of packages by user var path = "/-/by-user/" - mapToRegistry(path, npm.config, function (er, uri) { + mapToRegistry(path, npm.config, function (er, uri, c) { if (er) return cb(er) - var c = npm.config.getCredentialsByURI(uri) if (!(c && c.username)) return cb() - npm.registry.get(uri + c.username, { timeout : 60000 }, function (er, list) { + var params = { + timeout : 60000, + auth : c + } + npm.registry.get(uri + c.username, params, function (er, list) { if (er) return cb() console.error(list) return cb(null, list[c.username]) @@ -34,11 +37,14 @@ function deprecate (args, cb) { // fetch the data and make sure it exists. var p = npa(pkg) - mapToRegistry(p.name, npm.config, next) - - function next (er, uri) { + mapToRegistry(p.name, npm.config, function (er, uri, auth) { if (er) return cb(er) - npm.registry.deprecate(uri, p.spec, msg, cb) - } + var params = { + version : p.spec, + message : msg, + auth : auth + } + npm.registry.deprecate(uri, params, cb) + }) } diff --git a/deps/npm/lib/dist-tag.js b/deps/npm/lib/dist-tag.js new file mode 100644 index 00000000000..48b40202f9a --- /dev/null +++ b/deps/npm/lib/dist-tag.js @@ -0,0 +1,151 @@ +module.exports = distTag + +var log = require("npmlog") +var npa = require("npm-package-arg") +var semver = require("semver") + +var npm = require("./npm.js") +var mapToRegistry = require("./utils/map-to-registry.js") +var readLocalPkg = require("./utils/read-local-package.js") + +distTag.usage = "npm dist-tag add @ []" + + "\nnpm dist-tag rm " + + "\nnpm dist-tag ls []" + +distTag.completion = function (opts, cb) { + var argv = opts.conf.argv.remain + if (argv.length === 2) { + return cb(null, ["add", "rm", "ls"]) + } + + switch (argv[2]) { + default: + return cb() + } +} + +function distTag (args, cb) { + var cmd = args.shift() + switch (cmd) { + case "add": case "a": case "set": case "s": + return add(args[0], args[1], cb) + case "rm": case "r": case "del": case "d": case "remove": + return remove(args[1], args[0], cb) + case "ls": case "l": case "sl": case "list": + return list(args[0], cb) + default: + return cb("Usage:\n"+distTag.usage) + } +} + +function add (spec, tag, cb) { + var thing = npa(spec || "") + var pkg = thing.name + var version = thing.rawSpec + var t = (tag || npm.config.get("tag")).trim() + + log.verbose("dist-tag add", t, "to", pkg+"@"+version) + + if (!pkg || !version || !t) return cb("Usage:\n"+distTag.usage) + + if (semver.validRange(t)) { + var er = new Error("Tag name must not be a valid SemVer range: " + t) + return cb(er) + } + + fetchTags(pkg, function (er, tags) { + if (er) return cb(er) + + if (tags[t] === version) { + log.warn("dist-tag add", t, "is already set to version", version) + return cb() + } + tags[t] = version + + mapToRegistry(pkg, npm.config, function (er, uri, auth, base) { + var params = { + package : pkg, + distTag : t, + version : version, + auth : auth + } + + npm.registry.distTags.add(base, params, function (er) { + if (er) return cb(er) + + console.log("+"+t+": "+pkg+"@"+version) + cb() + }) + }) + }) +} + +function remove (tag, pkg, cb) { + log.verbose("dist-tag del", tag, "from", pkg) + + fetchTags(pkg, function (er, tags) { + if (er) return cb(er) + + if (!tags[tag]) { + log.info("dist-tag del", tag, "is not a dist-tag on", pkg) + return cb(new Error(tag+" is not a dist-tag on "+pkg)) + } + + var version = tags[tag] + delete tags[tag] + + mapToRegistry(pkg, npm.config, function (er, uri, auth, base) { + var params = { + package : pkg, + distTag : tag, + auth : auth + } + + npm.registry.distTags.rm(base, params, function (er) { + if (er) return cb(er) + + console.log("-"+tag+": "+pkg+"@"+version) + cb() + }) + }) + }) +} + +function list (pkg, cb) { + if (!pkg) return readLocalPkg(function (er, pkg) { + if (er) return cb(er) + if (!pkg) return cb(distTag.usage) + list(pkg, cb) + }) + + fetchTags(pkg, function (er, tags) { + if (er) { + log.error("dist-tag ls", "Couldn't get dist-tag data for", pkg) + return cb(er) + } + var msg = Object.keys(tags).map(function (k) { + return k+": "+tags[k] + }).sort().join("\n") + console.log(msg) + cb(er, tags) + }) +} + +function fetchTags (pkg, cb) { + mapToRegistry(pkg, npm.config, function (er, uri, auth, base) { + if (er) return cb(er) + + var params = { + package : pkg, + auth : auth + } + npm.registry.distTags.fetch(base, params, function (er, tags) { + if (er) return cb(er) + if (!tags || !Object.keys(tags).length) { + return cb(new Error("No dist-tags found for " + pkg)) + } + + cb(null, tags) + }) + }) +} diff --git a/deps/npm/lib/docs.js b/deps/npm/lib/docs.js index dead3f7551c..0de2349ddc9 100644 --- a/deps/npm/lib/docs.js +++ b/deps/npm/lib/docs.js @@ -4,23 +4,18 @@ docs.usage = "npm docs " docs.usage += "\n" docs.usage += "npm docs ." -docs.completion = function (opts, cb) { - mapToRegistry("/-/short", npm.config, function (er, uri) { - if (er) return cb(er) - - registry.get(uri, { timeout : 60000 }, function (er, list) { - return cb(null, list || []) - }) - }) -} - var npm = require("./npm.js") - , registry = npm.registry , opener = require("opener") , path = require("path") , log = require("npmlog") , mapToRegistry = require("./utils/map-to-registry.js") +docs.completion = function (opts, cb) { + // FIXME: there used to be registry completion here, but it stopped making + // sense somewhere around 50,000 packages on the registry + cb() +} + function url (json) { return json.homepage ? json.homepage : "https://npmjs.org/package/" + json.name } @@ -28,7 +23,7 @@ function url (json) { function docs (args, cb) { args = args || [] var pending = args.length - if (!pending) return getDoc('.', cb) + if (!pending) return getDoc(".", cb) args.forEach(function(proj) { getDoc(proj, function(err) { if (err) { @@ -40,10 +35,10 @@ function docs (args, cb) { } function getDoc (project, cb) { - project = project || '.' + project = project || "." var package = path.resolve(npm.localPrefix, "package.json") - if (project === '.' || project === './') { + if (project === "." || project === "./") { var json try { json = require(package) @@ -57,10 +52,10 @@ function getDoc (project, cb) { return opener(url(json), { command: npm.config.get("browser") }, cb) } - mapToRegistry(project, npm.config, function (er, uri) { + mapToRegistry(project, npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.get(uri + "/latest", { timeout : 3600 }, next) + npm.registry.get(uri + "/latest", { timeout : 3600, auth : auth }, next) }) function next (er, json) { diff --git a/deps/npm/lib/explore.js b/deps/npm/lib/explore.js index e87e839354b..96475a0691f 100644 --- a/deps/npm/lib/explore.js +++ b/deps/npm/lib/explore.js @@ -6,7 +6,7 @@ explore.usage = "npm explore [ -- ]" explore.completion = require("./utils/completion/installed-shallow.js") var npm = require("./npm.js") - , spawn = require("child_process").spawn + , spawn = require("./utils/spawn") , path = require("path") , fs = require("graceful-fs") diff --git a/deps/npm/lib/help.js b/deps/npm/lib/help.js index 747bd5020da..942d27b41e1 100644 --- a/deps/npm/lib/help.js +++ b/deps/npm/lib/help.js @@ -7,7 +7,7 @@ help.completion = function (opts, cb) { } var path = require("path") - , spawn = require("child_process").spawn + , spawn = require("./utils/spawn") , npm = require("./npm.js") , log = require("npmlog") , opener = require("opener") @@ -59,19 +59,26 @@ function help (args, cb) { var manroot = path.resolve(__dirname, "..", "man") // legacy - if (section === "global") - section = "folders" - else if (section === "json") - section = "package.json" + if (section === "global") section = "folders" + else if (section === "json") section = "package.json" // find either /section.n or /npm-section.n - var f = "+(npm-" + section + "|" + section + ").[0-9]" + // The glob is used in the glob. The regexp is used much + // further down. Globs and regexps are different + var compextglob = ".+(gz|bz2|lzma|[FYzZ]|xz)" + var compextre = "\\.(gz|bz2|lzma|[FYzZ]|xz)$" + var f = "+(npm-" + section + "|" + section + ").[0-9]?(" + compextglob + ")" return glob(manroot + "/*/" + f, function (er, mans) { - if (er) - return cb(er) + if (er) return cb(er) + + if (!mans.length) return npm.commands["help-search"](args, cb) - if (!mans.length) - return npm.commands["help-search"](args, cb) + mans = mans.map(function (man) { + var ext = path.extname(man) + if (man.match(new RegExp(compextre))) man = path.basename(man, ext) + + return man + }) viewMan(pickMan(mans, pref), cb) }) diff --git a/deps/npm/lib/init.js b/deps/npm/lib/init.js index 925654beef7..a889774b02b 100644 --- a/deps/npm/lib/init.js +++ b/deps/npm/lib/init.js @@ -17,7 +17,7 @@ function init (args, cb) { if (!initJson.yes(npm.config)) { console.log( ["This utility will walk you through creating a package.json file." - ,"It only covers the most common items, and tries to guess sane defaults." + ,"It only covers the most common items, and tries to guess sensible defaults." ,"" ,"See `npm help json` for definitive documentation on these fields" ,"and exactly what they do." @@ -31,11 +31,11 @@ function init (args, cb) { initJson(dir, initFile, npm.config, function (er, data) { log.resume() log.silly("package data", data) - log.info("init", "written successfully") if (er && er.message === "canceled") { log.warn("init", "canceled") return cb(null, data) } + log.info("init", "written successfully") cb(er, data) }) } diff --git a/deps/npm/lib/install.js b/deps/npm/lib/install.js index e539307aff3..4ab248a492d 100644 --- a/deps/npm/lib/install.js +++ b/deps/npm/lib/install.js @@ -32,38 +32,58 @@ install.completion = function (opts, cb) { // install can complete to a folder with a package.json, or any package. // if it has a slash, then it's gotta be a folder // if it starts with https?://, then just give up, because it's a url - // for now, not yet implemented. - var registry = npm.registry - mapToRegistry("-/short", npm.config, function (er, uri) { - if (er) return cb(er) - - registry.get(uri, null, function (er, pkgs) { - if (er) return cb() - if (!opts.partialWord) return cb(null, pkgs) + if (/^https?:\/\//.test(opts.partialWord)) { + // do not complete to URLs + return cb(null, []) + } - var name = npa(opts.partialWord).name - pkgs = pkgs.filter(function (p) { - return p.indexOf(name) === 0 + if (/\//.test(opts.partialWord)) { + // Complete fully to folder if there is exactly one match and it + // is a folder containing a package.json file. If that is not the + // case we return 0 matches, which will trigger the default bash + // complete. + var lastSlashIdx = opts.partialWord.lastIndexOf("/") + var partialName = opts.partialWord.slice(lastSlashIdx + 1) + var partialPath = opts.partialWord.slice(0, lastSlashIdx) + if (partialPath === "") partialPath = "/" + + function annotatePackageDirMatch (sibling, cb) { + var fullPath = path.join(partialPath, sibling) + if (sibling.slice(0, partialName.length) !== partialName) { + return cb(null, null) // not name match + } + fs.readdir(fullPath, function (err, contents) { + if (err) return cb(null, { isPackage: false }) + + cb( + null, + { + fullPath: fullPath, + isPackage: contents.indexOf("package.json") !== -1 + } + ) }) + } - if (pkgs.length !== 1 && opts.partialWord === name) { - return cb(null, pkgs) - } + return fs.readdir(partialPath, function (err, siblings) { + if (err) return cb(null, []) // invalid dir: no matching - mapToRegistry(pkgs[0], npm.config, function (er, uri) { - if (er) return cb(er) + asyncMap(siblings, annotatePackageDirMatch, function (err, matches) { + if (err) return cb(err) - registry.get(uri, null, function (er, d) { - if (er) return cb() - return cb(null, Object.keys(d["dist-tags"] || {}) - .concat(Object.keys(d.versions || {})) - .map(function (t) { - return pkgs[0] + "@" + t - })) - }) + var cleaned = matches.filter(function (x) { return x !== null }) + if (cleaned.length !== 1) return cb(null, []) + if (!cleaned[0].isPackage) return cb(null, []) + + // Success - only one match and it is a package dir + return cb(null, [cleaned[0].fullPath]) }) }) - }) + } + + // FIXME: there used to be registry completion here, but it stopped making + // sense somewhere around 50,000 packages on the registry + cb() } var npm = require("./npm.js") @@ -89,6 +109,8 @@ var npm = require("./npm.js") , locker = require("./utils/locker.js") , lock = locker.lock , unlock = locker.unlock + , warnStrict = require("./utils/warn-deprecated.js")("engineStrict") + , warnPeers = require("./utils/warn-deprecated.js")("peerDependencies") function install (args, cb_) { var hasArguments = !!args.length @@ -96,7 +118,7 @@ function install (args, cb_) { function cb (er, installed) { if (er) return cb_(er) - findPeerInvalid(where, function (er, problem) { + validateInstall(where, function (er, problem) { if (er) return cb_(er) if (problem) { @@ -159,6 +181,11 @@ function install (args, cb_) { "install", "peerDependency", dep, "wasn't going to be installed; adding" ) + warnPeers([ + "The peer dependency "+dep+" included from "+data.name+" will no", + "longer be automatically installed to fulfill the peerDependency ", + "in npm 3+. Your application will need to depend on it explicitly." + ], dep+","+data.name) peers.push(dep) } }) @@ -196,8 +223,9 @@ function install (args, cb_) { // initial "family" is the name:version of the root, if it's got // a package.json file. - var jsonFile = path.resolve(where, "package.json") - readJson(jsonFile, log.warn, function (er, data) { + var jsonPath = path.resolve(where, "package.json") + log.verbose('install', 'initial load of', jsonPath) + readJson(jsonPath, log.warn, function (er, data) { if (er && er.code !== "ENOENT" && er.code !== "ENOTDIR") return cb(er) @@ -218,11 +246,26 @@ function install (args, cb_) { }) } -function findPeerInvalid (where, cb) { - readInstalled(where, { log: log.warn, dev: true }, function (er, data) { - if (er) return cb(er) +function validateInstall (where, cb) { + var jsonPath = path.resolve(where, 'package.json') + log.verbose('validateInstall', 'loading', jsonPath, 'for validation') + readJson(jsonPath, log.warn, function (er, data) { + if (er + && er.code !== 'ENOENT' + && er.code !== 'ENOTDIR') return cb(er) + + if (data && data.engineStrict) { + warnStrict([ + "Per-package engineStrict (found in this package's package.json) ", + "won't be used in npm 3+. Use the config setting `engine-strict` instead." + ], data.name) + } + + readInstalled(where, { log: log.warn, dev: true }, function (er, data) { + if (er) return cb(er) - cb(null, findPeerInvalid_(data.dependencies, [])) + cb(null, findPeerInvalid_(data.dependencies, [])) + }) }) } @@ -274,11 +317,11 @@ function findPeerInvalid_ (packageMap, fpiList) { function readDependencies (context, where, opts, cb) { var wrap = context ? context.wrap : null - readJson( path.resolve(where, "package.json") - , log.warn - , function (er, data) { + var jsonPath = path.resolve(where, 'package.json') + log.verbose('readDependencies', 'loading dependencies from', jsonPath) + readJson(jsonPath, log.warn, function (er, data) { if (er && er.code === "ENOENT") er.code = "ENOPACKAGEJSON" - if (er) return cb(er) + if (er) return cb(er) if (opts && opts.dev) { if (!data.dependencies) data.dependencies = {} @@ -362,7 +405,6 @@ function readWrap (w) { // if the -S|--save option is specified, then write installed packages // as dependencies to a package.json file. -// This is experimental. function save (where, installed, tree, pretty, hasArguments, cb) { if (!hasArguments || !npm.config.get("save") && @@ -381,9 +423,9 @@ function save (where, installed, tree, pretty, hasArguments, cb) { var saveTarget = path.resolve(where, "package.json") asyncMap(Object.keys(tree), function (k, cb) { - // if "what" was a url, then save that instead. + // if "from" is remote, git, or hosted, then save that instead. var t = tree[k] - , u = url.parse(t.from) + , f = npa(t.from) , a = npa(t.what) , w = [a.name, a.spec] @@ -391,7 +433,7 @@ function save (where, installed, tree, pretty, hasArguments, cb) { fs.stat(t.from, function (er){ if (!er) { w[1] = "file:" + t.from - } else if (u && u.protocol) { + } else if (['hosted', 'git', 'remote'].indexOf(f.type) !== -1) { w[1] = t.from } cb(null, [w]) @@ -433,7 +475,7 @@ function save (where, installed, tree, pretty, hasArguments, cb) { data.bundleDependencies = bundle.sort() } - log.verbose("saving", things) + log.verbose("save", "saving", things) data[deps] = data[deps] || {} Object.keys(things).forEach(function (t) { data[deps][t] = things[t] @@ -446,6 +488,7 @@ function save (where, installed, tree, pretty, hasArguments, cb) { data[deps] = sortedObject(data[deps]) + log.silly("save", "writing", saveTarget) data = JSON.stringify(data, null, 2) + "\n" writeFileAtomic(saveTarget, data, function (er) { cb(er, installed, tree, pretty) @@ -562,7 +605,9 @@ function installManyTop (what, where, context, cb_) { if (context.explicit) return next() - readJson(path.join(where, "package.json"), log.warn, function (er, data) { + var jsonPath = path.join(where, 'package.json') + log.verbose('installManyTop', 'reading for lifecycle', jsonPath) + readJson(jsonPath, log.warn, function (er, data) { if (er) return next(er) lifecycle(data, "preinstall", where, next) }) @@ -597,8 +642,9 @@ function installManyTop_ (what, where, context, cb) { // recombine unscoped with @scope/package packages asyncMap(unscoped.concat(scoped).map(function (p) { return path.resolve(nm, p, "package.json") - }), function (jsonfile, cb) { - readJson(jsonfile, log.warn, function (er, data) { + }), function (jsonPath, cb) { + log.verbose('installManyTop', 'reading scoped package data from', jsonPath) + readJson(jsonPath, log.info, function (er, data) { if (er && er.code !== "ENOENT" && er.code !== "ENOTDIR") return cb(er) if (er) return cb(null, []) cb(null, [[data.name, data.version]]) @@ -641,8 +687,6 @@ function installMany (what, where, context, cb) { var parent = data - var d = data.dependencies || {} - // if we're explicitly installing "what" into "where", then the shrinkwrap // for "where" doesn't apply. This would be the case if someone were adding // a new package to a shrinkwrapped package. (data.dependencies will not be @@ -650,47 +694,88 @@ function installMany (what, where, context, cb) { // there's no harm in using that.) if (context.explicit) wrap = null + var deps = data.dependencies || {} + var devDeps = data.devDependencies || {} + // what is a list of things. // resolve each one. asyncMap( what - , targetResolver(where, context, d) + , targetResolver(where, context, deps, devDeps) , function (er, targets) { if (er) return cb(er) - // each target will be a data object corresponding - // to a package, folder, or whatever that is in the cache now. - var newPrev = Object.create(context.family) - , newAnc = Object.create(context.ancestors) + var bundled = data.bundleDependencies || data.bundledDependencies || [] + // only take the hit for readInstalled if there are probably bundled + // dependencies to read + if (bundled.length) { + readInstalled(where, { dev: true }, andBuildResolvedTree) + } else { + andBuildResolvedTree() + } + + function andBuildResolvedTree (er, current) { + if (er) return cb(er) + + // each target will be a data object corresponding + // to a package, folder, or whatever that is in the cache now. + var newPrev = Object.create(context.family) + , newAnc = Object.create(context.ancestors) - if (!context.root) { - newAnc[data.name] = data.version + if (!context.root) { + newAnc[data.name] = data.version + } + bundled.forEach(function (bundle) { + var bundleData = current.dependencies[bundle] + if ((!bundleData || !bundleData.version) && current.devDependencies) { + log.verbose( + 'installMany', bundle, 'was bundled with', + data.name + '@' + data.version + + ", but wasn't found in dependencies. Trying devDependencies" + ) + bundleData = current.devDependencies[bundle] + } + + if (!bundleData || !bundleData.version) { + log.warn( + 'installMany', bundle, 'was bundled with', + data.name + '@' + data.version + + ", but bundled package wasn't found in unpacked tree" + ) + } else { + log.verbose( + 'installMany', bundle + '@' + bundleData.version, + 'was bundled with', data.name + '@' + data.version + ) + newPrev[bundle] = bundleData.version + } + }) + targets.forEach(function (t) { + newPrev[t.name] = t.version + }) + log.silly("install resolved", targets) + targets.filter(function (t) { return t }).forEach(function (t) { + log.info("install", "%s into %s", t._id, where) + }) + asyncMap(targets, function (target, cb) { + log.info("installOne", target._id) + var wrapData = wrap ? wrap[target.name] : null + var newWrap = wrapData && wrapData.dependencies + ? wrap[target.name].dependencies || {} + : null + var newContext = { family: newPrev + , ancestors: newAnc + , parent: parent + , explicit: false + , wrap: newWrap } + installOne(target, where, newContext, cb) + }, cb) } - targets.forEach(function (t) { - newPrev[t.name] = t.version - }) - log.silly("install resolved", targets) - targets.filter(function (t) { return t }).forEach(function (t) { - log.info("install", "%s into %s", t._id, where) - }) - asyncMap(targets, function (target, cb) { - log.info("installOne", target._id) - var wrapData = wrap ? wrap[target.name] : null - var newWrap = wrapData && wrapData.dependencies - ? wrap[target.name].dependencies || {} - : null - var newContext = { family: newPrev - , ancestors: newAnc - , parent: parent - , explicit: false - , wrap: newWrap } - installOne(target, where, newContext, cb) - }, cb) }) }) } -function targetResolver (where, context, deps) { +function targetResolver (where, context, deps, devDeps) { var alreadyInstalledManually = [] , resolveLeft = 0 , nm = path.resolve(where, "node_modules") @@ -712,7 +797,9 @@ function targetResolver (where, context, deps) { }) asyncMap(inst, function (pkg, cb) { - readJson(path.resolve(name, pkg, "package.json"), log.warn, function (er, d) { + var jsonPath = path.resolve(name, pkg, 'package.json') + log.verbose('targetResolver', 'reading package data from', jsonPath) + readJson(jsonPath, log.info, function (er, d) { if (er && er.code !== "ENOENT" && er.code !== "ENOTDIR") return cb(er) // error means it's not a package, most likely. if (er) return cb(null, []) @@ -720,9 +807,10 @@ function targetResolver (where, context, deps) { // if it's a bundled dep, then assume that anything there is valid. // otherwise, make sure that it's a semver match with what we want. var bd = parent.bundleDependencies - if (bd && bd.indexOf(d.name) !== -1 || - semver.satisfies(d.version, deps[d.name] || "*", true) || - deps[d.name] === d._resolved) { + var isBundled = bd && bd.indexOf(d.name) !== -1 + var expectedVersion = deps[d.name] || (devDeps && devDeps[d.name]) || "*" + var currentIsSatisfactory = semver.satisfies(d.version, expectedVersion, true) + if (isBundled || currentIsSatisfactory || deps[d.name] === d._resolved) { return cb(null, d.name) } @@ -761,6 +849,7 @@ function targetResolver (where, context, deps) { // check for a version installed higher in the tree. // If installing from a shrinkwrap, it must match exactly. if (context.family[what]) { + log.verbose('install', what, 'is installed as', context.family[what]) if (wrap && wrap[what].version === context.family[what]) { log.verbose("shrinkwrap", "use existing", what) return cb(null, []) @@ -803,7 +892,8 @@ function targetResolver (where, context, deps) { return cb(null, []) } - var isGit = npa(what).type === "git" + var type = npa(what).type + var isGit = type === "git" || type === "hosted" if (!er && data && @@ -828,8 +918,12 @@ function targetResolver (where, context, deps) { function installOne (target, where, context, cb) { // the --link flag makes this a "link" command if it's at the // the top level. + var isGit = false + var type = npa(target._from).type + if (target && target._from) isGit = type === 'git' || type === 'hosted' + if (where === npm.prefix && npm.config.get("link") - && !npm.config.get("global")) { + && !npm.config.get("global") && !isGit) { return localLink(target, where, context, cb) } installOne_(target, where, context, function (er, installedWhat) { @@ -849,11 +943,11 @@ function installOne (target, where, context, cb) { function localLink (target, where, context, cb) { log.verbose("localLink", target._id) - var jsonFile = path.resolve( npm.globalDir, target.name - , "package.json" ) - , parent = context.parent + var jsonPath = path.resolve(npm.globalDir, target.name , 'package.json') + var parent = context.parent - readJson(jsonFile, log.warn, function (er, data) { + log.verbose('localLink', 'reading data to link', target.name, 'from', jsonPath) + readJson(jsonPath, log.warn, function (er, data) { function thenLink () { npm.commands.link([target.name], function (er, d) { log.silly("localLink", "back from link", [er, d]) @@ -912,18 +1006,12 @@ function installOne_ (target, where, context, cb_) { if (prettyWhere === ".") prettyWhere = null cb_ = inflight(target.name + ":" + where, cb_) - if (!cb_) return log.verbose( - "installOne", - "of", target.name, - "to", where, - "already in flight; waiting" - ) - else log.verbose( - "installOne", - "of", target.name, - "to", where, - "not in flight; installing" - ) + if (!cb_) { + return log.verbose("installOne", "of", target.name, "to", where, "already in flight; waiting") + } + else { + log.verbose("installOne", "of", target.name, "to", where, "not in flight; installing") + } function cb(er, data) { unlock(nm, target.name, function () { cb_(er, data) }) @@ -982,23 +1070,24 @@ function write (target, targetFolder, context, cb_) { log.silly("install write", "writing", target.name, target.version, "to", targetFolder) chain( - [ [ cache.unpack, target.name, target.version, targetFolder - , null, null, user, group ] - , [ fs, "writeFile" - , path.resolve(targetFolder, "package.json") - , JSON.stringify(target, null, 2) + "\n" ] - , [ lifecycle, target, "preinstall", targetFolder ] - , function (cb) { - if (!target.bundleDependencies) return cb() - - var bd = path.resolve(targetFolder, "node_modules") - fs.readdir(bd, function (er, b) { - // nothing bundled, maybe - if (er) return cb() - bundled = b || [] - cb() - }) - } ] + [ [ cache.unpack, target.name, target.version, targetFolder, null, null, user, group ], + function writePackageJSON (cb) { + var jsonPath = path.resolve(targetFolder, 'package.json') + log.verbose('write', 'writing to', jsonPath) + writeFileAtomic(jsonPath, JSON.stringify(target, null, 2) + '\n', cb) + }, + [ lifecycle, target, "preinstall", targetFolder ], + function collectBundled (cb) { + if (!target.bundleDependencies) return cb() + + var bd = path.resolve(targetFolder, "node_modules") + fs.readdir(bd, function (er, b) { + // nothing bundled, maybe + if (er) return cb() + bundled = b || [] + cb() + }) + } ] // nest the chain so that we can throw away the results returned // up until this point, since we really don't care about it. @@ -1008,6 +1097,7 @@ function write (target, targetFolder, context, cb_) { // before continuing to installing dependencies, check for a shrinkwrap. var opt = { dev: npm.config.get("dev") } readDependencies(context, targetFolder, opt, function (er, data, wrap) { + if (er) return cb(er); var deps = prepareForInstallMany(data, "dependencies", bundled, wrap, family) var depsTargetFolder = targetFolder @@ -1036,7 +1126,23 @@ function write (target, targetFolder, context, cb_) { // favor of killing implicit peerDependency installs with fire. var peerDeps = prepareForInstallMany(data, "peerDependencies", bundled, wrap, family) - var pdTargetFolder = path.resolve(targetFolder, "..", "..") + peerDeps.forEach(function (pd) { + warnPeers([ + "The peer dependency "+pd+" included from "+data.name+" will no", + "longer be automatically installed to fulfill the peerDependency ", + "in npm 3+. Your application will need to depend on it explicitly." + ], pd+","+data.name) + }) + + // Package scopes cause an addditional tree level which needs to be + // considered when resolving a peerDependency's target folder. + var pdTargetFolder + if (npa(target.name).scope) { + pdTargetFolder = path.resolve(targetFolder, '../../..') + } else { + pdTargetFolder = path.resolve(targetFolder, '../..') + } + var pdContext = context if (peerDeps.length > 0) { actions.push( @@ -1076,8 +1182,9 @@ function prepareForInstallMany (packageData, depsKey, bundled, wrap, family) { // something in the "family" list, unless we're installing // from a shrinkwrap. if (wrap) return wrap - if (semver.validRange(family[d], true)) + if (semver.validRange(family[d], true)) { return !semver.satisfies(family[d], packageData[depsKey][d], true) + } return true }).map(function (d) { var v = packageData[depsKey][d] diff --git a/deps/npm/lib/link.js b/deps/npm/lib/link.js index 8c6a9302905..916ebd6afef 100644 --- a/deps/npm/lib/link.js +++ b/deps/npm/lib/link.js @@ -8,7 +8,6 @@ var npm = require("./npm.js") , asyncMap = require("slide").asyncMap , chain = require("slide").chain , path = require("path") - , rm = require("./utils/gently-rm.js") , build = require("./build.js") , npa = require("npm-package-arg") @@ -128,20 +127,17 @@ function linkPkg (folder, cb_) { return cb(er) } var target = path.resolve(npm.globalDir, d.name) - rm(target, function (er) { + symlink(me, target, false, true, function (er) { if (er) return cb(er) - symlink(me, target, function (er) { + log.verbose("link", "build target", target) + // also install missing dependencies. + npm.commands.install(me, [], function (er) { if (er) return cb(er) - log.verbose("link", "build target", target) - // also install missing dependencies. - npm.commands.install(me, [], function (er) { + // build the global stuff. Don't run *any* scripts, because + // install command already will have done that. + build([target], true, build._noLC, true, function (er) { if (er) return cb(er) - // build the global stuff. Don't run *any* scripts, because - // install command already will have done that. - build([target], true, build._noLC, true, function (er) { - if (er) return cb(er) - resultPrinter(path.basename(me), me, target, cb) - }) + resultPrinter(path.basename(me), me, target, cb) }) }) }) diff --git a/deps/npm/lib/logout.js b/deps/npm/lib/logout.js new file mode 100644 index 00000000000..64635be4dec --- /dev/null +++ b/deps/npm/lib/logout.js @@ -0,0 +1,40 @@ +module.exports = logout + +var dezalgo = require("dezalgo") +var log = require("npmlog") + +var npm = require("./npm.js") +var mapToRegistry = require("./utils/map-to-registry.js") + +logout.usage = "npm logout [--registry] [--scope]" + +function logout (args, cb) { + npm.spinner.start() + cb = dezalgo(cb) + + mapToRegistry("/", npm.config, function (err, uri, auth, normalized) { + if (err) return cb(err) + + if (auth.token) { + log.verbose("logout", "clearing session token for", normalized) + npm.registry.logout(normalized, { auth: auth }, function (err) { + if (err) return cb(err) + + npm.config.clearCredentialsByURI(normalized) + npm.spinner.stop() + npm.config.save("user", cb) + }) + } + else if (auth.username || auth.password) { + log.verbose("logout", "clearing user credentials for", normalized) + npm.config.clearCredentialsByURI(normalized) + npm.spinner.stop() + npm.config.save("user", cb) + } + else { + cb(new Error( + "Not logged in to", normalized + ",", "so can't log out." + )) + } + }) +} diff --git a/deps/npm/lib/ls.js b/deps/npm/lib/ls.js index ed329d19e1b..c7877b925e6 100644 --- a/deps/npm/lib/ls.js +++ b/deps/npm/lib/ls.js @@ -40,6 +40,7 @@ function ls (args, silent, cb) { var opt = { depth: depth, log: log.warn, dev: true } readInstalled(dir, opt, function (er, data) { pruneNestedExtraneous(data) + filterByEnv(data) var bfs = bfsify(data, args) , lite = getLite(bfs) @@ -88,6 +89,21 @@ function pruneNestedExtraneous (data, visited) { } } +function filterByEnv (data) { + var dev = npm.config.get("dev") + var production = npm.config.get("production") + if (dev === production) return + var dependencies = {} + var devDependencies = data.devDependencies || [] + Object.keys(data.dependencies).forEach(function (name) { + var keys = Object.keys(devDependencies) + if (production && keys.indexOf(name) !== -1) return + if (dev && keys.indexOf(name) === -1) return + dependencies[name] = data.dependencies[name] + }) + data.dependencies = dependencies +} + function alphasort (a, b) { a = a.toLowerCase() b = b.toLowerCase() @@ -250,8 +266,7 @@ function makeArchy_ (data, long, dir, depth, parent, d) { if (data._found === true && data._id) { if (npm.color) { out.label = color.bgBlack(color.yellow(out.label.trim())) + " " - } - else { + } else { out.label = out.label.trim() + " " } } @@ -278,8 +293,11 @@ function makeArchy_ (data, long, dir, depth, parent, d) { // add giturl to name@version if (data._resolved) { - if (npa(data._resolved).type === "git") - out.label += " (" + data._resolved + ")" + var type = npa(data._resolved).type + var isGit = type === 'git' || type === 'hosted' + if (isGit) { + out.label += ' (' + data._resolved + ')' + } } if (long) { @@ -291,10 +309,13 @@ function makeArchy_ (data, long, dir, depth, parent, d) { } // now all the children. - out.nodes = Object.keys(data.dependencies || {}) - .sort(alphasort).map(function (d) { - return makeArchy_(data.dependencies[d], long, dir, depth + 1, data, d) - }) + out.nodes = [] + if (depth <= npm.config.get("depth")) { + out.nodes = Object.keys(data.dependencies || {}) + .sort(alphasort).map(function (d) { + return makeArchy_(data.dependencies[d], long, dir, depth + 1, data, d) + }) + } if (out.nodes.length === 0 && data.path === dir) { out.nodes = ["(empty)"] diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js index e933a1346cc..a2756ed7d29 100644 --- a/deps/npm/lib/npm.js +++ b/deps/npm/lib/npm.js @@ -11,9 +11,6 @@ if (typeof WScript !== "undefined") { } -// monkey-patch support for 0.6 child processes -require('child-process-close') - var EventEmitter = require("events").EventEmitter , npm = module.exports = new EventEmitter() , npmconf = require("./config/core.js") @@ -22,8 +19,7 @@ var EventEmitter = require("events").EventEmitter , path = require("path") , abbrev = require("abbrev") , which = require("which") - , semver = require("semver") - , RegClient = require("npm-registry-client") + , CachingRegClient = require("./cache/caching-client.js") , charSpin = require("char-spinner") npm.config = { @@ -41,7 +37,6 @@ npm.commands = {} npm.rollbacks = [] try { - var pv = process.version.replace(/^v/, '') // startup, ok to do this synchronously var j = JSON.parse(fs.readFileSync( path.join(__dirname, "../package.json"))+"") @@ -68,7 +63,9 @@ var commandCache = {} , "i" : "install" , "isntall" : "install" , "up" : "update" + , "upgrade" : "update" , "c" : "config" + , "dist-tags" : "dist-tag" , "info" : "view" , "show" : "view" , "find" : "search" @@ -86,6 +83,7 @@ var commandCache = {} , "find-dupes": "dedupe" , "ddp": "dedupe" , "v": "view" + , "verison": "version" } , aliasNames = Object.keys(aliases) @@ -110,8 +108,10 @@ var commandCache = {} , "stars" , "tag" , "adduser" + , "logout" , "unpublish" , "owner" + , "access" , "deprecate" , "shrinkwrap" @@ -132,6 +132,7 @@ var commandCache = {} , "prefix" , "bin" , "whoami" + , "dist-tag" , "test" , "stop" @@ -142,16 +143,21 @@ var commandCache = {} ] , plumbing = [ "build" , "unbuild" - , "isntall" , "xmas" , "substack" , "visnup" ] - , fullList = npm.fullList = cmdList.concat(aliasNames).filter(function (c) { + , littleGuys = [ "isntall" ] + , fullList = cmdList.concat(aliasNames).filter(function (c) { return plumbing.indexOf(c) === -1 }) , abbrevs = abbrev(fullList) +// we have our reasons +fullList = npm.fullList = fullList.filter(function (c) { + return littleGuys.indexOf(c) === -1 +}) + npm.spinner = { int: null , started: false @@ -216,7 +222,7 @@ Object.keys(abbrevs).concat(plumbing).forEach(function addCommand (c) { }) return commandCache[a] - }, enumerable: fullList.indexOf(c) !== -1 }) + }, enumerable: fullList.indexOf(c) !== -1, configurable: true }) // make css-case commands callable via camelCase as well if (c.match(/\-([a-z])/)) { @@ -351,7 +357,7 @@ function load (npm, cli, cb) { // at this point the configs are all set. // go ahead and spin up the registry client. - npm.registry = new RegClient(npm.config) + npm.registry = new CachingRegClient(npm.config) var umask = npm.config.get("umask") npm.modes = { exec: 0777 & (~umask) diff --git a/deps/npm/lib/outdated.js b/deps/npm/lib/outdated.js index fdfd7624db2..fa27dfc8027 100644 --- a/deps/npm/lib/outdated.js +++ b/deps/npm/lib/outdated.js @@ -22,7 +22,6 @@ outdated.completion = require("./utils/completion/installed-deep.js") var path = require("path") - , fs = require("graceful-fs") , readJson = require("read-package-json") , cache = require("./cache.js") , asyncMap = require("slide").asyncMap @@ -35,24 +34,40 @@ var path = require("path") , os = require("os") , mapToRegistry = require("./utils/map-to-registry.js") , npa = require("npm-package-arg") + , readInstalled = require("read-installed") + , long = npm.config.get("long") + , log = require("npmlog") function outdated (args, silent, cb) { if (typeof cb !== "function") cb = silent, silent = false var dir = path.resolve(npm.dir, "..") + + // default depth for `outdated` is 0 (cf. `ls`) + if (npm.config.get("depth") === Infinity) npm.config.set("depth", 0) + outdated_(args, dir, {}, 0, function (er, list) { + if (!list) list = [] if (er || silent || list.length === 0) return cb(er, list) + list.sort(function(a, b) { + var aa = a[1].toLowerCase() + , bb = b[1].toLowerCase() + return aa === bb ? 0 + : aa < bb ? -1 : 1 + }) if (npm.config.get("json")) { console.log(makeJSON(list)) } else if (npm.config.get("parseable")) { console.log(makeParseable(list)) } else { var outList = list.map(makePretty) - var outTable = [[ "Package" - , "Current" - , "Wanted" - , "Latest" - , "Location" - ]].concat(outList) + var outHead = [ "Package" + , "Current" + , "Wanted" + , "Latest" + , "Location" + ] + if (long) outHead.push("Package Type") + var outTable = [outHead].concat(outList) if (npm.color) { outTable[0] = outTable[0].map(function(heading) { @@ -69,13 +84,14 @@ function outdated (args, silent, cb) { }) } -// [[ dir, dep, has, want, latest ]] +// [[ dir, dep, has, want, latest, type ]] function makePretty (p) { var dep = p[1] , dir = path.resolve(p[0], "node_modules", dep) , has = p[2] , want = p[3] , latest = p[4] + , type = p[6] if (!npm.config.get("global")) { dir = path.relative(process.cwd(), dir) @@ -87,12 +103,14 @@ function makePretty (p) { , latest , dirToPrettyLocation(dir) ] + if (long) columns[5] = type if (npm.color) { columns[0] = color[has === want ? "yellow" : "red"](columns[0]) // dep columns[2] = color.green(columns[2]) // want columns[3] = color.magenta(columns[3]) // latest columns[4] = color.brightBlack(columns[4]) // dir + if (long) columns[5] = color.brightBlack(columns[5]) // type } return columns @@ -111,17 +129,22 @@ function dirToPrettyLocation (dir) { function makeParseable (list) { return list.map(function (p) { + var dep = p[1] , dir = path.resolve(p[0], "node_modules", dep) , has = p[2] , want = p[3] , latest = p[4] + , type = p[6] - return [ dir + var out = [ dir , dep + "@" + want , (has ? (dep + "@" + has) : "MISSING") , dep + "@" + latest - ].join(":") + ] + if (long) out.push(type) + + return out.join(":") }).join(os.EOL) } @@ -137,6 +160,7 @@ function makeJSON (list) { , latest: p[4] , location: dir } + if (long) out[p[1]].type = p[6] }) return JSON.stringify(out, null, 2) } @@ -154,13 +178,23 @@ function outdated_ (args, dir, parentHas, depth, cb) { return cb(null, []) } var deps = null + var types = {} readJson(path.resolve(dir, "package.json"), function (er, d) { d = d || {} if (er && er.code !== "ENOENT" && er.code !== "ENOTDIR") return cb(er) deps = (er) ? true : (d.dependencies || {}) + if (!er) { + Object.keys(deps).forEach(function (k) { + types[k] = "dependencies" + }) + } if (npm.config.get("save-dev")) { deps = d.devDependencies || {} + Object.keys(deps).forEach(function (k) { + types[k] = "devDependencies" + }) + return next() } @@ -174,6 +208,9 @@ function outdated_ (args, dir, parentHas, depth, cb) { if (npm.config.get("save-optional")) { deps = d.optionalDependencies || {} + Object.keys(deps).forEach(function (k) { + types[k] = "optionalDependencies" + }) return next() } @@ -186,6 +223,7 @@ function outdated_ (args, dir, parentHas, depth, cb) { Object.keys(d.devDependencies || {}).forEach(function (k) { if (!(k in parentHas)) { deps[k] = d.devDependencies[k] + types[k] = "devDependencies" } }) } @@ -193,11 +231,12 @@ function outdated_ (args, dir, parentHas, depth, cb) { }) var has = null - fs.readdir(path.resolve(dir, "node_modules"), function (er, pkgs) { + readInstalled(path.resolve(dir), { dev : true }, function (er, data) { if (er) { has = Object.create(parentHas) return next() } + var pkgs = Object.keys(data.dependencies) pkgs = pkgs.filter(function (p) { return !p.match(/^[\._-]/) }) @@ -205,6 +244,7 @@ function outdated_ (args, dir, parentHas, depth, cb) { var jsonFile = path.resolve(dir, "node_modules", pkg, "package.json") readJson(jsonFile, function (er, d) { if (er && er.code !== "ENOENT" && er.code !== "ENOTDIR") return cb(er) + if (d && d.name && d.private) delete deps[d.name] cb(null, er ? [] : [[d.name, d.version, d._from]]) }) }, function (er, pvs) { @@ -234,12 +274,14 @@ function outdated_ (args, dir, parentHas, depth, cb) { // if has[dep] !== shouldHave[dep], then cb with the data // otherwise dive into the folder asyncMap(Object.keys(deps), function (dep, cb) { - shouldUpdate(args, dir, dep, has, deps[dep], depth, cb) + if (!long) return shouldUpdate(args, dir, dep, has, deps[dep], depth, cb) + + shouldUpdate(args, dir, dep, has, deps[dep], depth, cb, types[dep]) }, cb) } } -function shouldUpdate (args, dir, dep, has, req, depth, cb) { +function shouldUpdate (args, dir, dep, has, req, depth, cb, type) { // look up the most recent version. // if that's what we already have, or if it's not on the args list, // then dive into it. Otherwise, cb() with the data. @@ -258,25 +300,54 @@ function shouldUpdate (args, dir, dep, has, req, depth, cb) { } function doIt (wanted, latest) { - cb(null, [[ dir, dep, curr && curr.version, wanted, latest, req ]]) - } - - if (args.length && args.indexOf(dep) === -1) { - return skip() + if (!long) { + return cb(null, [[ dir, dep, curr && curr.version, wanted, latest, req]]) + } + cb(null, [[ dir, dep, curr && curr.version, wanted, latest, req, type]]) } - if (npa(req).type === "git") + if (args.length && args.indexOf(dep) === -1) return skip() + var parsed = npa(dep + '@' + req) + if (parsed.type === "git" || (parsed.hosted && parsed.hosted.type === "github")) { return doIt("git", "git") + } // search for the latest package - mapToRegistry(dep, npm.config, function (er, uri) { + mapToRegistry(dep, npm.config, function (er, uri, auth) { if (er) return cb(er) - npm.registry.get(uri, null, updateDeps) + npm.registry.get(uri, { auth : auth }, updateDeps) }) + function updateLocalDeps (latestRegistryVersion) { + readJson(path.resolve(parsed.spec, 'package.json'), function (er, localDependency) { + if (er) return cb() + + var wanted = localDependency.version + var latest = localDependency.version + + if (latestRegistryVersion) { + latest = latestRegistryVersion + if (semver.lt(wanted, latestRegistryVersion)) { + wanted = latestRegistryVersion + req = dep + '@' + latest + } + } + + if (curr.version !== wanted) { + doIt(wanted, latest) + } else { + skip() + } + }) + } + function updateDeps (er, d) { - if (er) return cb() + if (er) { + if (parsed.type !== 'local') return cb() + return updateLocalDeps() + } + if (!d || !d["dist-tags"] || !d.versions) return cb() var l = d.versions[d["dist-tags"].latest] if (!l) return cb() @@ -316,10 +387,14 @@ function shouldUpdate (args, dir, dep, has, req, depth, cb) { if (!curr || dFromUrl && cFromUrl && d._from !== curr.from || d.version !== curr.version - || d.version !== l.version) + || d.version !== l.version) { + if (parsed.type === 'local') return updateLocalDeps(l.version) + doIt(d.version, l.version) - else + } + else { skip() + } } } } diff --git a/deps/npm/lib/owner.js b/deps/npm/lib/owner.js index 2fdee7adb69..c9adb792249 100644 --- a/deps/npm/lib/owner.js +++ b/deps/npm/lib/owner.js @@ -1,4 +1,3 @@ - module.exports = owner owner.usage = "npm owner add " @@ -6,10 +5,9 @@ owner.usage = "npm owner add " + "\nnpm owner ls " var npm = require("./npm.js") - , registry = npm.registry , log = require("npmlog") - , readJson = require("read-package-json") , mapToRegistry = require("./utils/map-to-registry.js") + , readLocalPkg = require("./utils/read-local-package.js") owner.completion = function (opts, cb) { var argv = opts.conf.argv.remain @@ -28,22 +26,19 @@ owner.completion = function (opts, cb) { var byUser, theUser switch (argv[2]) { case "ls": - if (argv.length > 3) return cb() - return mapToRegistry("-/short", npm.config, function (er, uri) { - if (er) return cb(er) - - registry.get(uri, null, cb) - }) + // FIXME: there used to be registry completion here, but it stopped + // making sense somewhere around 50,000 packages on the registry + return cb() case "rm": if (argv.length > 3) { theUser = encodeURIComponent(argv[3]) byUser = "-/by-user/" + theUser + "|" + un - return mapToRegistry(byUser, npm.config, function (er, uri) { + return mapToRegistry(byUser, npm.config, function (er, uri, auth) { if (er) return cb(er) console.error(uri) - registry.get(uri, null, function (er, d) { + npm.registry.get(uri, { auth : auth }, function (er, d) { if (er) return cb(er) // return the intersection return cb(null, d[theUser].filter(function (p) { @@ -58,11 +53,11 @@ owner.completion = function (opts, cb) { if (argv.length > 3) { theUser = encodeURIComponent(argv[3]) byUser = "-/by-user/" + theUser + "|" + un - return mapToRegistry(byUser, npm.config, function (er, uri) { + return mapToRegistry(byUser, npm.config, function (er, uri, auth) { if (er) return cb(er) console.error(uri) - registry.get(uri, null, function (er, d) { + npm.registry.get(uri, { auth : auth }, function (er, d) { console.error(uri, er || d) // return mine that they're not already on. if (er) return cb(er) @@ -75,10 +70,10 @@ owner.completion = function (opts, cb) { }) } // just list all users who aren't me. - return mapToRegistry("-/users", npm.config, function (er, uri) { + return mapToRegistry("-/users", npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.get(uri, null, function (er, list) { + npm.registry.get(uri, { auth : auth }, function (er, list) { if (er) return cb() return cb(null, Object.keys(list).filter(function (n) { return n !== un @@ -109,10 +104,10 @@ function ls (pkg, cb) { ls(pkg, cb) }) - mapToRegistry(pkg, npm.config, function (er, uri) { + mapToRegistry(pkg, npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.get(uri, null, function (er, data) { + npm.registry.get(uri, { auth : auth }, function (er, data) { var msg = "" if (er) { log.error("owner ls", "Couldn't get owner data", pkg) @@ -161,7 +156,7 @@ function rm (user, pkg, cb) { }) log.verbose("owner rm", "%s from %s", user, pkg) - mutate(pkg, null, function (u, owners) { + mutate(pkg, user, function (u, owners) { var found = false , m = owners.filter(function (o) { var match = (o.name === user) @@ -181,10 +176,10 @@ function rm (user, pkg, cb) { function mutate (pkg, user, mutation, cb) { if (user) { var byUser = "-/user/org.couchdb.user:" + user - mapToRegistry(byUser, npm.config, function (er, uri) { + mapToRegistry(byUser, npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.get(uri, null, mutate_) + npm.registry.get(uri, { auth : auth }, mutate_) }) } else { mutate_(null, null) @@ -200,31 +195,52 @@ function mutate (pkg, user, mutation, cb) { } if (u) u = { "name" : u.name, "email" : u.email } - mapToRegistry(pkg, npm.config, function (er, uri) { + mapToRegistry(pkg, npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.get(uri, null, function (er, data) { + npm.registry.get(uri, { auth : auth }, function (er, data) { if (er) { log.error("owner mutate", "Error getting package data for %s", pkg) return cb(er) } + + // save the number of maintainers before mutation so that we can figure + // out if maintainers were added or removed + var beforeMutation = data.maintainers.length + var m = mutation(u, data.maintainers) if (!m) return cb() // handled if (m instanceof Error) return cb(m) // error - data = { _id : data._id - , _rev : data._rev - , maintainers : m - } - var dataPath = pkg + "/-rev/" + data._rev - mapToRegistry(dataPath, npm.config, function (er, uri) { + + data = { + _id : data._id, + _rev : data._rev, + maintainers : m + } + var dataPath = pkg.replace("/", "%2f") + "/-rev/" + data._rev + mapToRegistry(dataPath, npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.request("PUT", uri, { body : data }, function (er, data) { - if (!er && data.error) er = new Error( - "Failed to update package metadata: " + JSON.stringify(data)) + var params = { + method : "PUT", + body : data, + auth : auth + } + npm.registry.request(uri, params, function (er, data) { + if (!er && data.error) { + er = new Error("Failed to update package metadata: "+JSON.stringify(data)) + } + if (er) { log.error("owner mutate", "Failed to update package metadata") } + else if (m.length > beforeMutation) { + console.log("+ %s (%s)", user, pkg) + } + else if (m.length < beforeMutation) { + console.log("- %s (%s)", user, pkg) + } + cb(er, data) }) }) @@ -233,14 +249,6 @@ function mutate (pkg, user, mutation, cb) { } } -function readLocalPkg (cb) { - if (npm.config.get("global")) return cb() - var path = require("path") - readJson(path.resolve(npm.prefix, "package.json"), function (er, d) { - return cb(er, d && d.name) - }) -} - function unknown (action, cb) { cb("Usage: \n" + owner.usage) } diff --git a/deps/npm/lib/publish.js b/deps/npm/lib/publish.js index 2a0fcff5a5c..8f1c73c3c98 100644 --- a/deps/npm/lib/publish.js +++ b/deps/npm/lib/publish.js @@ -1,21 +1,23 @@ module.exports = publish -var url = require("url") - , npm = require("./npm.js") +var npm = require("./npm.js") , log = require("npmlog") , path = require("path") , readJson = require("read-package-json") , lifecycle = require("./utils/lifecycle.js") , chain = require("slide").chain - , Conf = require("./config/core.js").Conf - , RegClient = require("npm-registry-client") , mapToRegistry = require("./utils/map-to-registry.js") , cachedPackageRoot = require("./cache/cached-package-root.js") + , createReadStream = require("graceful-fs").createReadStream + , npa = require("npm-package-arg") + , semver = require('semver') + , getPublishConfig = require("./utils/get-publish-config.js") -publish.usage = "npm publish " - + "\nnpm publish " +publish.usage = "npm publish [--tag ]" + + "\nnpm publish [--tag ]" + "\n\nPublishes '.' if no argument supplied" + + "\n\nSets tag `latest` if no --tag specified" publish.completion = function (opts, cb) { // publish can complete to a folder with a package.json @@ -33,6 +35,13 @@ function publish (args, isRetry, cb) { if (args.length !== 1) return cb(publish.usage) log.verbose("publish", args) + + var t = npm.config.get('tag').trim() + if (semver.validRange(t)) { + var er = new Error("Tag name must not be a valid SemVer range: " + t) + return cb(er) + } + var arg = args[0] // if it's a local folder, then run the prepublish there, first. readJson(path.resolve(arg, "package.json"), function (er, data) { @@ -73,22 +82,13 @@ function cacheAddPublish (dir, didPre, isRetry, cb) { function publish_ (arg, data, isRetry, cachedir, cb) { if (!data) return cb(new Error("no package.json file found")) - var registry = npm.registry - var config = npm.config - - // check for publishConfig hash - if (data.publishConfig) { - config = new Conf(npm.config) - config.save = npm.config.save.bind(npm.config) - - // don't modify the actual publishConfig object, in case we have - // to set a login token or some other data. - config.unshift(Object.keys(data.publishConfig).reduce(function (s, k) { - s[k] = data.publishConfig[k] - return s - }, {})) - registry = new RegClient(config) - } + var mappedConfig = getPublishConfig( + data.publishConfig, + npm.config, + npm.registry + ) + var config = mappedConfig.config + var registry = mappedConfig.client data._npmVersion = npm.version data._nodeVersion = process.versions.node @@ -101,21 +101,39 @@ function publish_ (arg, data, isRetry, cachedir, cb) { ) ) - mapToRegistry(data.name, config, function (er, registryURI) { + mapToRegistry(data.name, config, function (er, registryURI, auth, registryBase) { if (er) return cb(er) - var tarball = cachedir + ".tgz" + var tarballPath = cachedir + ".tgz" // we just want the base registry URL in this case - var registryBase = url.resolve(registryURI, ".") log.verbose("publish", "registryBase", registryBase) + log.silly("publish", "uploading", tarballPath) + + data._npmUser = { + name : auth.username, + email : auth.email + } + + var params = { + metadata : data, + body : createReadStream(tarballPath), + auth : auth + } - var c = config.getCredentialsByURI(registryBase) - data._npmUser = {name: c.username, email: c.email} + // registry-frontdoor cares about the access level, which is only + // configurable for scoped packages + if (config.get("access")) { + if (!npa(data.name).scope && config.get("access") === "restricted") { + return cb(new Error("Can't restrict access to unscoped packages.")) + } + + params.access = config.get("access") + } - registry.publish(registryBase, data, tarball, function (er) { - if (er && er.code === "EPUBLISHCONFLICT" - && npm.config.get("force") && !isRetry) { + registry.publish(registryBase, params, function (er) { + if (er && er.code === "EPUBLISHCONFLICT" && + npm.config.get("force") && !isRetry) { log.warn("publish", "Forced publish over " + data._id) return npm.commands.unpublish([data._id], function (er) { // ignore errors. Use the force. Reach out with your feelings. diff --git a/deps/npm/lib/repo.js b/deps/npm/lib/repo.js index c6db8e37b01..1b0454773d7 100644 --- a/deps/npm/lib/repo.js +++ b/deps/npm/lib/repo.js @@ -3,21 +3,9 @@ module.exports = repo repo.usage = "npm repo " -repo.completion = function (opts, cb) { - if (opts.conf.argv.remain.length > 2) return cb() - mapToRegistry("/-/short", npm.config, function (er, uri) { - if (er) return cb(er) - - registry.get(uri, { timeout : 60000 }, function (er, list) { - return cb(null, list || []) - }) - }) -} - var npm = require("./npm.js") - , registry = npm.registry , opener = require("opener") - , github = require('github-url-from-git') + , github = require("github-url-from-git") , githubUserRepo = require("github-url-from-username-repo") , path = require("path") , readJson = require("read-package-json") @@ -26,6 +14,12 @@ var npm = require("./npm.js") , mapToRegistry = require("./utils/map-to-registry.js") , npa = require("npm-package-arg") +repo.completion = function (opts, cb) { + // FIXME: there used to be registry completion here, but it stopped making + // sense somewhere around 50,000 packages on the registry + cb() +} + function repo (args, cb) { var n = args.length && npa(args[0]).name || "." fs.stat(n, function (er, s) { @@ -41,18 +35,18 @@ function repo (args, cb) { function getUrlAndOpen (d, cb) { var r = d.repository - if (!r) return cb(new Error('no repository')) + if (!r) return cb(new Error("no repository")) // XXX remove this when npm@v1.3.10 from node 0.10 is deprecated // from https://github.com/npm/npm-www/issues/418 if (githubUserRepo(r.url)) r.url = githubUserRepo(r.url) - var url = (r.url && ~r.url.indexOf('github')) + var url = (r.url && ~r.url.indexOf("github")) ? github(r.url) : nonGithubUrl(r.url) if (!url) - return cb(new Error('no repository: could not get url')) + return cb(new Error("no repository: could not get url")) opener(url, { command: npm.config.get("browser") }, cb) } @@ -60,7 +54,7 @@ function callRegistry (n, cb) { mapToRegistry(n, npm.config, function (er, uri) { if (er) return cb(er) - registry.get(uri + "/latest", { timeout : 3600 }, function (er, d) { + npm.registry.get(uri + "/latest", { timeout : 3600 }, function (er, d) { if (er) return cb(er) getUrlAndOpen(d, cb) }) @@ -69,16 +63,16 @@ function callRegistry (n, cb) { function nonGithubUrl (url) { try { - var idx = url.indexOf('@') + var idx = url.indexOf("@") if (idx !== -1) { - url = url.slice(idx+1).replace(/:([^\d]+)/, '/$1') + url = url.slice(idx+1).replace(/:([^\d]+)/, "/$1") } url = url_.parse(url) - var protocol = url.protocol === 'https:' - ? 'https:' - : 'http:' - return protocol + '//' + (url.host || '') + - url.path.replace(/\.git$/, '') + var protocol = url.protocol === "https:" + ? "https:" + : "http:" + return protocol + "//" + (url.host || "") + + url.path.replace(/\.git$/, "") } catch(e) {} } diff --git a/deps/npm/lib/run-script.js b/deps/npm/lib/run-script.js index 4495b93c48e..057af2bc69c 100644 --- a/deps/npm/lib/run-script.js +++ b/deps/npm/lib/run-script.js @@ -1,4 +1,3 @@ - module.exports = runScript var lifecycle = require("./utils/lifecycle.js") @@ -14,7 +13,6 @@ runScript.completion = function (opts, cb) { // see if there's already a package specified. var argv = opts.conf.argv.remain - , installedShallow = require("./utils/completion/installed-shallow.js") if (argv.length >= 4) return cb() @@ -42,33 +40,11 @@ runScript.completion = function (opts, cb) { }) } - // complete against the installed-shallow, and the pwd's scripts. - // but only packages that have scripts - var installed - , scripts - installedShallow(opts, function (d) { - return d.scripts - }, function (er, inst) { - installed = inst - next() - }) - - if (npm.config.get("global")) { - scripts = [] - next() - } - else readJson(path.join(npm.localPrefix, "package.json"), function (er, d) { + readJson(path.join(npm.localPrefix, "package.json"), function (er, d) { if (er && er.code !== "ENOENT" && er.code !== "ENOTDIR") return cb(er) d = d || {} - scripts = Object.keys(d.scripts || {}) - next() + cb(null, Object.keys(d.scripts || {})) }) - - function next () { - if (!installed || !scripts) return - - cb(null, scripts.concat(installed)) - } } function runScript (args, cb) { @@ -85,31 +61,56 @@ function runScript (args, cb) { function list(cb) { var json = path.join(npm.localPrefix, "package.json") + var cmdList = [ "publish", "install", "uninstall" + , "test", "stop", "start", "restart" + ].reduce(function (l, p) { + return l.concat(["pre" + p, p, "post" + p]) + }, []) return readJson(json, function(er, d) { if (er && er.code !== "ENOENT" && er.code !== "ENOTDIR") return cb(er) if (er) d = {} - var scripts = Object.keys(d.scripts || {}) + var allScripts = Object.keys(d.scripts || {}) + var scripts = [] + var runScripts = [] + allScripts.forEach(function (script) { + if (cmdList.indexOf(script) !== -1) scripts.push(script) + else runScripts.push(script) + }) if (log.level === "silent") { - return cb(null, scripts) + return cb(null, allScripts) } if (npm.config.get("json")) { console.log(JSON.stringify(d.scripts || {}, null, 2)) - return cb(null, scripts) + return cb(null, allScripts) } - var s = ":" - var prefix = "" - if (!npm.config.get("parseable")) { - s = "\n " - prefix = " " - console.log("Available scripts in the %s package:", d.name) + if (npm.config.get("parseable")) { + allScripts.forEach(function(script) { + console.log(script + ":" + d.scripts[script]) + }) + return cb(null, allScripts) + } + + var s = "\n " + var prefix = " " + if (scripts.length) { + console.log("Lifecycle scripts included in %s:", d.name) } scripts.forEach(function(script) { console.log(prefix + script + s + d.scripts[script]) }) - return cb(null, scripts) + if (!scripts.length && runScripts.length) { + console.log("Scripts available in %s via `npm run-script`:", d.name) + } + else if (runScripts.length) { + console.log("\navailable via `npm run-script`:") + } + runScripts.forEach(function(script) { + console.log(prefix + script + s + d.scripts[script]) + }) + return cb(null, allScripts) }) } @@ -117,13 +118,30 @@ function run (pkg, wd, cmd, args, cb) { if (!pkg.scripts) pkg.scripts = {} var cmds - if (cmd === "restart") { + if (cmd === "restart" && !pkg.scripts.restart) { cmds = [ "prestop", "stop", "poststop", "restart", "prestart", "start", "poststart" ] } else { + if (!pkg.scripts[cmd]) { + if (cmd === "test") { + pkg.scripts.test = "echo \"Error: no test specified\"" + } else if (cmd === "env") { + if (process.platform === "win32") { + log.verbose("run-script using default platform env: SET (Windows)") + pkg.scripts[cmd] = "SET" + } else { + log.verbose("run-script using default platform env: env (Unix)") + pkg.scripts[cmd] = "env" + } + } else if (npm.config.get("if-present")) { + return cb(null); + } else { + return cb(new Error("missing script: " + cmd)) + } + } cmds = [cmd] } @@ -134,7 +152,9 @@ function run (pkg, wd, cmd, args, cb) { log.verbose("run-script", cmds) chain(cmds.map(function (c) { // pass cli arguments after -- to script. - if (pkg.scripts[c] && c === cmd) pkg.scripts[c] = pkg.scripts[c] + joinArgs(args) + if (pkg.scripts[c] && c === cmd) { + pkg.scripts[c] = pkg.scripts[c] + joinArgs(args) + } // when running scripts explicitly, assume that they're trusted. return [lifecycle, pkg, c, wd, true] @@ -146,8 +166,7 @@ function run (pkg, wd, cmd, args, cb) { function joinArgs (args) { var joinedArgs = "" args.forEach(function(arg) { - if (arg.match(/[ '"]/)) arg = '"' + arg.replace(/"/g, '\\"') + '"' - joinedArgs += " " + arg + joinedArgs += ' "' + arg.replace(/"/g, '\\"') + '"' }) return joinedArgs } diff --git a/deps/npm/lib/search.js b/deps/npm/lib/search.js index 5dd060f829c..840bc2f6b78 100644 --- a/deps/npm/lib/search.js +++ b/deps/npm/lib/search.js @@ -2,9 +2,8 @@ module.exports = exports = search var npm = require("./npm.js") - , registry = npm.registry - , columnify = require('columnify') - , mapToRegistry = require("./utils/map-to-registry.js") + , columnify = require("columnify") + , updateIndex = require("./cache/update-index.js") search.usage = "npm search [some search terms ...]" @@ -35,19 +34,24 @@ function search (args, silent, staleness, cb) { if (typeof cb !== "function") cb = silent, silent = false var searchopts = npm.config.get("searchopts") - , searchexclude = npm.config.get("searchexclude") + var searchexclude = npm.config.get("searchexclude") + if (typeof searchopts !== "string") searchopts = "" searchopts = searchopts.split(/\s+/) - if (typeof searchexclude === "string") { - searchexclude = searchexclude.split(/\s+/) - } else searchexclude = [] var opts = searchopts.concat(args).map(function (s) { return s.toLowerCase() }).filter(function (s) { return s }) + + if (typeof searchexclude === "string") { + searchexclude = searchexclude.split(/\s+/) + } else { + searchexclude = [] + } searchexclude = searchexclude.map(function (s) { return s.toLowerCase() }) - getFilteredData( staleness, opts, searchexclude, function (er, data) { + + getFilteredData(staleness, opts, searchexclude, function (er, data) { // now data is the list of data that we want to show. // prettify and print it, and then provide the raw // data to the cb. @@ -58,18 +62,9 @@ function search (args, silent, staleness, cb) { } function getFilteredData (staleness, args, notArgs, cb) { - var opts = { - timeout : staleness, - follow : true, - staleOk : true - } - mapToRegistry("-/all", npm.config, function (er, uri) { + updateIndex(staleness, function (er, data) { if (er) return cb(er) - - registry.get(uri, opts, function (er, data) { - if (er) return cb(er) - return cb(null, filter(data, args, notArgs)) - }) + return cb(null, filter(data, args, notArgs)) }) } @@ -164,7 +159,7 @@ function prettify (data, args) { dat.keywords = dat.keywords.split(/[,\s]+/) } if (Array.isArray(dat.keywords)) { - dat.keywords = dat.keywords.join(' ') + dat.keywords = dat.keywords.join(" ") } // split author on whitespace or , @@ -172,7 +167,7 @@ function prettify (data, args) { dat.author = dat.author.split(/[,\s]+/) } if (Array.isArray(dat.author)) { - dat.author = dat.author.join(' ') + dat.author = dat.author.join(" ") } return dat }) @@ -194,7 +189,7 @@ function prettify (data, args) { include: columns , truncate: truncate , config: { - name: { maxWidth: 40, truncate: false, truncateMarker: '' } + name: { maxWidth: 40, truncate: false, truncateMarker: "" } , description: { maxWidth: 60 } , author: { maxWidth: 20 } , date: { maxWidth: 11 } @@ -260,9 +255,9 @@ function getMaxWidth() { function trimToMaxWidth(str) { var maxWidth = getMaxWidth() - return str.split('\n').map(function(line) { + return str.split("\n").map(function(line) { return line.slice(0, maxWidth) - }).join('\n') + }).join("\n") } function highlightSearchTerms(str, terms) { diff --git a/deps/npm/lib/shrinkwrap.js b/deps/npm/lib/shrinkwrap.js index a5783837c67..03192a3fa47 100644 --- a/deps/npm/lib/shrinkwrap.js +++ b/deps/npm/lib/shrinkwrap.js @@ -20,6 +20,12 @@ function shrinkwrap (args, silent, cb) { log.warn("shrinkwrap", "doesn't take positional args") } + // https://github.com/npm/npm/issues/7641 + // introduced because `npm ls` can now show dev and prod depenednecy + // trees separately + if (npm.config.get("dev")) { + npm.config.set("production", true) + } npm.commands.ls([], true, function (er, _, pkginfo) { if (er) return cb(er) shrinkwrap_(pkginfo, silent, npm.config.get("dev"), cb) @@ -45,7 +51,7 @@ function shrinkwrap_ (pkginfo, silent, dev, cb) { return } - log.warn("shrinkwrap", "Excluding devDependency: %s", dep) + log.warn("shrinkwrap", "Excluding devDependency: %s", dep, data.dependencies) delete pkginfo.dependencies[dep] }) } diff --git a/deps/npm/lib/star.js b/deps/npm/lib/star.js index 123c4ebbb44..1f324336c0c 100644 --- a/deps/npm/lib/star.js +++ b/deps/npm/lib/star.js @@ -2,7 +2,6 @@ module.exports = star var npm = require("./npm.js") - , registry = npm.registry , log = require("npmlog") , asyncMap = require("slide").asyncMap , mapToRegistry = require("./utils/map-to-registry.js") @@ -11,13 +10,9 @@ star.usage = "npm star [pkg, pkg, ...]\n" + "npm unstar [pkg, pkg, ...]" star.completion = function (opts, cb) { - mapToRegistry("-/short", npm.config, function (er, uri) { - if (er) return cb(er) - - registry.get(uri, { timeout : 60000 }, function (er, list) { - return cb(null, list || []) - }) - }) + // FIXME: there used to be registry completion here, but it stopped making + // sense somewhere around 50,000 packages on the registry + cb() } function star (args, cb) { @@ -27,10 +22,14 @@ function star (args, cb) { , using = !(npm.command.match(/^un/)) if (!using) s = u asyncMap(args, function (pkg, cb) { - mapToRegistry(pkg, npm.config, function (er, uri) { + mapToRegistry(pkg, npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.star(uri, using, function (er, data, raw, req) { + var params = { + starred : using, + auth : auth + } + npm.registry.star(uri, params, function (er, data, raw, req) { if (!er) { console.log(s + " "+pkg) log.verbose("star", data) diff --git a/deps/npm/lib/stars.js b/deps/npm/lib/stars.js index dee5c152afa..01ec76e42c1 100644 --- a/deps/npm/lib/stars.js +++ b/deps/npm/lib/stars.js @@ -3,17 +3,31 @@ module.exports = stars stars.usage = "npm stars [username]" var npm = require("./npm.js") - , registry = npm.registry , log = require("npmlog") , mapToRegistry = require("./utils/map-to-registry.js") function stars (args, cb) { npm.commands.whoami([], true, function (er, username) { var name = args.length === 1 ? args[0] : username - mapToRegistry("", npm.config, function (er, uri) { + + if (er) { + if (er.code === 'ENEEDAUTH' && !name) { + var needAuth = new Error("'npm stars' on your own user account requires auth") + needAuth.code = 'ENEEDAUTH' + return cb(needAuth) + } + + if (er.code !== 'ENEEDAUTH') return cb(er) + } + + mapToRegistry("", npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.stars(uri, name, showstars) + var params = { + username : name, + auth : auth + } + npm.registry.stars(uri, params, showstars) }) }) diff --git a/deps/npm/lib/tag.js b/deps/npm/lib/tag.js index 47e9a8c0ac7..75da0b2174f 100644 --- a/deps/npm/lib/tag.js +++ b/deps/npm/lib/tag.js @@ -6,10 +6,10 @@ tag.usage = "npm tag @ []" tag.completion = require("./unpublish.js").completion var npm = require("./npm.js") - , registry = npm.registry , mapToRegistry = require("./utils/map-to-registry.js") , npa = require("npm-package-arg") , semver = require("semver") + , log = require("npmlog") function tag (args, cb) { var thing = npa(args.shift() || "") @@ -26,9 +26,16 @@ function tag (args, cb) { return cb(er) } - mapToRegistry(project, npm.config, function (er, uri) { + log.warn("tag", "This command is deprecated. Use `npm dist-tag` instead.") + + mapToRegistry(project, npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.tag(uri, version, t, cb) + var params = { + version : version, + tag : t, + auth : auth + } + npm.registry.tag(uri, params, cb) }) } diff --git a/deps/npm/lib/unbuild.js b/deps/npm/lib/unbuild.js index 8bd6e8507f3..d5fe0e6a0d1 100644 --- a/deps/npm/lib/unbuild.js +++ b/deps/npm/lib/unbuild.js @@ -5,6 +5,7 @@ var readJson = require("read-package-json") , gentlyRm = require("./utils/gently-rm.js") , npm = require("./npm.js") , path = require("path") + , isInside = require("path-is-inside") , lifecycle = require("./utils/lifecycle.js") , asyncMap = require("slide").asyncMap , chain = require("slide").chain @@ -23,12 +24,12 @@ function unbuild_ (silent) { return function (folder, cb_) { cb_(er, path.relative(npm.root, folder)) } folder = path.resolve(folder) + var base = isInside(folder, npm.prefix) ? npm.prefix : folder delete build._didBuild[folder] log.verbose("unbuild", folder.substr(npm.prefix.length + 1)) readJson(path.resolve(folder, "package.json"), function (er, pkg) { // if no json, then just trash it, but no scripts or whatever. - if (er) return gentlyRm(folder, false, cb) - readJson.cache.del(folder) + if (er) return gentlyRm(folder, false, base, cb) chain ( [ [lifecycle, pkg, "preuninstall", folder, false, true] , [lifecycle, pkg, "uninstall", folder, false, true] @@ -38,7 +39,7 @@ function unbuild_ (silent) { return function (folder, cb_) { } , [rmStuff, pkg, folder] , [lifecycle, pkg, "postuninstall", folder, false, true] - , [gentlyRm, folder, undefined] ] + , [gentlyRm, folder, false, base] ] , cb ) }) }} @@ -51,8 +52,6 @@ function rmStuff (pkg, folder, cb) { , gnm = npm.dir , top = gnm === parent - readJson.cache.del(path.resolve(folder, "package.json")) - log.verbose("unbuild rmStuff", pkg._id, "from", gnm) if (!top) log.verbose("unbuild rmStuff", "in", parent) asyncMap([rmBins, rmMans], function (fn, cb) { @@ -63,15 +62,12 @@ function rmStuff (pkg, folder, cb) { function rmBins (pkg, folder, parent, top, cb) { if (!pkg.bin) return cb() var binRoot = top ? npm.bin : path.resolve(parent, ".bin") - log.verbose([binRoot, pkg.bin], "binRoot") asyncMap(Object.keys(pkg.bin), function (b, cb) { if (process.platform === "win32") { - chain([ [gentlyRm, path.resolve(binRoot, b) + ".cmd", undefined] - , [gentlyRm, path.resolve(binRoot, b), undefined] ], cb) + chain([ [gentlyRm, path.resolve(binRoot, b) + ".cmd", true] + , [gentlyRm, path.resolve(binRoot, b), true] ], cb) } else { - gentlyRm( path.resolve(binRoot, b) - , !npm.config.get("force") && folder - , cb ) + gentlyRm(path.resolve(binRoot, b), true, cb) } }, cb) } @@ -84,6 +80,7 @@ function rmMans (pkg, folder, parent, top, cb) { return cb() } var manRoot = path.resolve(npm.config.get("prefix"), "share", "man") + log.verbose("rmMans", "man files are", pkg.man, "in", manRoot) asyncMap(pkg.man, function (man, cb) { if (Array.isArray(man)) { man.forEach(rmMan) @@ -91,21 +88,28 @@ function rmMans (pkg, folder, parent, top, cb) { rmMan(man) } - function rmMan(man) { - var parseMan = man.match(/(.*)\.([0-9]+)(\.gz)?$/) - , stem = parseMan[1] - , sxn = parseMan[2] - , gz = parseMan[3] || "" - , bn = path.basename(stem) - , manDest = path.join( manRoot - , "man"+sxn - , (bn.indexOf(pkg.name) === 0 ? bn - : pkg.name + "-" + bn) - + "." + sxn + gz - ) - gentlyRm( manDest - , !npm.config.get("force") && folder - , cb ) + function rmMan (man) { + log.silly("rmMan", "preparing to remove", man) + var parseMan = man.match(/(.*\.([0-9]+)(\.gz)?)$/) + if (!parseMan) { + log.error( + "rmMan", man, "is not a valid name for a man file.", + "Man files must end with a number, " + + "and optionally a .gz suffix if they are compressed." + ) + return cb() + } + + var stem = parseMan[1] + var sxn = parseMan[2] + var gz = parseMan[3] || "" + var bn = path.basename(stem) + var manDest = path.join( + manRoot, + "man"+sxn, + (bn.indexOf(pkg.name) === 0 ? bn : pkg.name+"-"+bn)+"."+sxn+gz + ) + gentlyRm(manDest, true, cb) } }, cb) } diff --git a/deps/npm/lib/uninstall.js b/deps/npm/lib/uninstall.js index 68869f57902..600c6819740 100644 --- a/deps/npm/lib/uninstall.js +++ b/deps/npm/lib/uninstall.js @@ -28,12 +28,11 @@ function uninstall (args, cb) { if (args.length) return uninstall_(args, nm, cb) // remove this package from the global space, if it's installed there - if (npm.config.get("global")) return cb(uninstall.usage) - readJson(path.resolve(npm.prefix, "package.json"), function (er, pkg) { + readJson(path.resolve(npm.localPrefix, "package.json"), function (er, pkg) { if (er && er.code !== "ENOENT" && er.code !== "ENOTDIR") return cb(er) if (er) return cb(uninstall.usage) uninstall_( [pkg.name] - , npm.dir + , npm.globalDir , cb ) }) diff --git a/deps/npm/lib/unpublish.js b/deps/npm/lib/unpublish.js index 2566cd5ae62..111f27aa2d2 100644 --- a/deps/npm/lib/unpublish.js +++ b/deps/npm/lib/unpublish.js @@ -2,12 +2,12 @@ module.exports = unpublish var log = require("npmlog") - , npm = require("./npm.js") - , registry = npm.registry - , readJson = require("read-package-json") - , path = require("path") - , mapToRegistry = require("./utils/map-to-registry.js") - , npa = require("npm-package-arg") +var npm = require("./npm.js") +var readJson = require("read-package-json") +var path = require("path") +var mapToRegistry = require("./utils/map-to-registry.js") +var npa = require("npm-package-arg") +var getPublishConfig = require("./utils/get-publish-config.js") unpublish.usage = "npm unpublish [@]" @@ -19,10 +19,10 @@ unpublish.completion = function (opts, cb) { var un = encodeURIComponent(username) if (!un) return cb() var byUser = "-/by-user/" + un - mapToRegistry(byUser, npm.config, function (er, uri) { + mapToRegistry(byUser, npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.get(uri, null, function (er, pkgs) { + npm.registry.get(uri, { auth : auth }, function (er, pkgs) { // do a bit of filtering at this point, so that we don't need // to fetch versions for more than one thing, but also don't // accidentally a whole project. @@ -33,10 +33,10 @@ unpublish.completion = function (opts, cb) { return p.indexOf(pp) === 0 }) if (pkgs.length > 1) return cb(null, pkgs) - mapToRegistry(pkgs[0], npm.config, function (er, uri) { + mapToRegistry(pkgs[0], npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.get(uri, null, function (er, d) { + npm.registry.get(uri, { auth : auth }, function (er, d) { if (er) return cb(er) var vers = Object.keys(d.versions) if (!vers.length) return cb(null, pkgs) @@ -72,19 +72,29 @@ function unpublish (args, cb) { return readJson(cwdJson, function (er, data) { if (er && er.code !== "ENOENT" && er.code !== "ENOTDIR") return cb(er) if (er) return cb("Usage:\n" + unpublish.usage) - gotProject(data.name, data.version, cb) + log.verbose('unpublish', data) + gotProject(data.name, data.version, data.publishConfig, cb) }) } return gotProject(project, version, cb) } -function gotProject (project, version, cb_) { +function gotProject (project, version, publishConfig, cb_) { + if (typeof cb_ !== 'function') { + cb_ = publishConfig + publishConfig = null + } + function cb (er) { if (er) return cb_(er) console.log("- " + project + (version ? "@" + version : "")) cb_() } + var mappedConfig = getPublishConfig(publishConfig, npm.config, npm.registry) + var config = mappedConfig.config + var registry = mappedConfig.client + // remove from the cache first npm.commands.cache(["clean", project, version], function (er) { if (er) { @@ -92,10 +102,14 @@ function gotProject (project, version, cb_) { return cb(er) } - mapToRegistry(project, npm.config, function (er, uri) { + mapToRegistry(project, config, function (er, uri, auth) { if (er) return cb(er) - registry.unpublish(uri, version, cb) + var params = { + version: version, + auth: auth + } + registry.unpublish(uri, params, cb) }) }) } diff --git a/deps/npm/lib/update.js b/deps/npm/lib/update.js index 06d199cc098..3e9438e9231 100644 --- a/deps/npm/lib/update.js +++ b/deps/npm/lib/update.js @@ -22,10 +22,26 @@ update.completion = npm.commands.outdated.completion function update (args, cb) { npm.commands.outdated(args, true, function (er, outdated) { - log.info("outdated", "updating", outdated) if (er) return cb(er) - asyncMap(outdated, function (ww, cb) { + var wanted = outdated.filter(function (ww) { + var dep = ww[1] + var current = ww[2] + var wanted = ww[3] + var latest = ww[4] + if (current === wanted && wanted !== latest) { + log.verbose( + 'outdated', + 'not updating', dep, + "because it's currently at the maximum version that matches its specified semver range" + ) + } + return current !== wanted + }) + if (wanted.length === 0) return cb() + + log.info('outdated', 'updating', wanted) + asyncMap(wanted, function (ww, cb) { // [[ dir, dep, has, want, req ]] var where = ww[0] , dep = ww[1] diff --git a/deps/npm/lib/utils/completion.sh b/deps/npm/lib/utils/completion.sh index d0275905978..3c7a3590d80 100755 --- a/deps/npm/lib/utils/completion.sh +++ b/deps/npm/lib/utils/completion.sh @@ -21,10 +21,10 @@ if type complete &>/dev/null; then 2>/dev/null)) || return $? IFS="$si" } - complete -F _npm_completion npm + complete -o default -F _npm_completion npm elif type compdef &>/dev/null; then _npm_completion() { - si=$IFS + local si=$IFS compadd -- $(COMP_CWORD=$((CURRENT-1)) \ COMP_LINE=$BUFFER \ COMP_POINT=0 \ diff --git a/deps/npm/lib/utils/completion/file-completion.js b/deps/npm/lib/utils/completion/file-completion.js index 5201a15ff64..6ce2f83467d 100644 --- a/deps/npm/lib/utils/completion/file-completion.js +++ b/deps/npm/lib/utils/completion/file-completion.js @@ -15,10 +15,8 @@ function fileCompletion (root, req, depth, cb) { glob(pattern, opts, function (er, files) { if (er) return cb(er) return cb(null, (files || []).map(function (f) { - return path.join(req, f.substr(root.length + 1) - .substr((f === req ? path.dirname(req) - : req).length) - .replace(/^\//, "")) + var tail = f.substr(root.length + 1).replace(/^\//, "") + return path.join(req, tail) })) }) }) diff --git a/deps/npm/lib/utils/error-handler.js b/deps/npm/lib/utils/error-handler.js index 95b78a8ccbe..6ffb2867e27 100644 --- a/deps/npm/lib/utils/error-handler.js +++ b/deps/npm/lib/utils/error-handler.js @@ -12,6 +12,7 @@ var cbCalled = false , rollbacks = npm.rollbacks , chain = require("slide").chain , writeStream = require("fs-write-stream-atomic") + , nameValidator = require("validate-npm-package-name") process.on("exit", function (code) { @@ -181,7 +182,7 @@ function errorHandler (er) { case "ELIFECYCLE": log.error("", er.message) - log.error("", ["","Failed at the "+er.pkgid+" "+er.stage+" script." + log.error("", ["","Failed at the "+er.pkgid+" "+er.stage+" script '"+er.script+"'." ,"This is most likely a problem with the "+er.pkgname+" package," ,"not with npm itself." ,"Tell the author that this fails on your system:" @@ -216,8 +217,21 @@ function errorHandler (er) { case "E404": var msg = [er.message] if (er.pkgid && er.pkgid !== "-") { - msg.push("", "'"+er.pkgid+"' is not in the npm registry." - ,"You should bug the author to publish it (or use the name yourself!)") + msg.push("", "'" + er.pkgid + "' is not in the npm registry.") + + var valResult = nameValidator(er.pkgid) + + if (valResult.validForNewPackages) { + msg.push("You should bug the author to publish it (or use the name yourself!)") + } else { + msg.push("Your package name is not valid, because", "") + + var errorsArray = (valResult.errors || []).concat(valResult.warnings || []) + errorsArray.forEach(function(item, idx) { + msg.push(" " + (idx + 1) + ". " + item) + }) + } + if (er.parent) { msg.push("It was specified as a dependency of '"+er.parent+"'") } @@ -287,6 +301,7 @@ function errorHandler (er) { case "ECONNRESET": case "ENOTFOUND": case "ETIMEDOUT": + case "EAI_FAIL": log.error("network", [er.message ,"This is most likely not a problem with npm itself" ,"and is related to network connectivity." @@ -304,11 +319,15 @@ function errorHandler (er) { break case "ETARGET": - log.error("notarget", [er.message + var msg = [er.message ,"This is most likely not a problem with npm itself." ,"In most cases you or one of your dependencies are requesting" ,"a package version that doesn't exist." - ].join("\n")) + ] + if (er.parent) { + msg.push("\nIt was specified as a dependency of '"+er.parent+"'\n") + } + log.error("notarget", msg.join("\n")) break case "ENOTSUP": @@ -339,10 +358,18 @@ function errorHandler (er) { ].join("\n")) break + case "ENOENT": + log.error("enoent", [er.message + ,"This is most likely not a problem with npm itself" + ,"and is related to npm not being able to find a file." + ,er.file?"\nCheck if the file '"+er.file+"' is present.":"" + ].join("\n")) + break + default: log.error("", er.message || er) log.error("", ["", "If you need help, you may report this error at:" - ," " + ," " ].join("\n")) break } diff --git a/deps/npm/lib/utils/gently-rm.js b/deps/npm/lib/utils/gently-rm.js index d43d0725ebb..ad0b4d03993 100644 --- a/deps/npm/lib/utils/gently-rm.js +++ b/deps/npm/lib/utils/gently-rm.js @@ -3,102 +3,133 @@ module.exports = gentlyRm -var npm = require("../npm.js") - , log = require("npmlog") - , resolve = require("path").resolve - , dirname = require("path").dirname - , lstat = require("graceful-fs").lstat - , readlink = require("graceful-fs").readlink - , isInside = require("path-is-inside") - , vacuum = require("fs-vacuum") - , rimraf = require("rimraf") - , some = require("async-some") - -function gentlyRm (path, gently, cb) { +var npm = require('../npm.js') +var log = require('npmlog') +var resolve = require('path').resolve +var dirname = require('path').dirname +var lstat = require('graceful-fs').lstat +var readlink = require('graceful-fs').readlink +var isInside = require('path-is-inside') +var vacuum = require('fs-vacuum') +var some = require('async-some') +var asyncMap = require('slide').asyncMap +var normalize = require('path').normalize + +function gentlyRm (target, gently, base, cb) { + if (!cb) { + cb = base + base = undefined + } + if (!cb) { cb = gently - gently = null + gently = false } - // never rm the root, prefix, or bin dirs. - // just a safety precaution. + log.silly( + 'gentlyRm', + target, + 'is being', gently ? 'gently removed' : 'purged', + base ? 'from base ' + base : '' + ) + + // never rm the root, prefix, or bin dirs + // + // globals included because of `npm link` -- as far as the package requesting + // the link is concerned, the linked package is always installed globally var prefixes = [ - npm.dir, npm.root, npm.bin, npm.prefix, - npm.globalDir, npm.globalRoot, npm.globalBin, npm.globalPrefix + npm.prefix, + npm.globalPrefix, + npm.dir, + npm.root, + npm.globalDir, + npm.bin, + npm.globalBin ] - var resolved = resolve(path) + var resolved = normalize(resolve(npm.prefix, target)) if (prefixes.indexOf(resolved) !== -1) { - log.verbose("gentlyRm", resolved, "is part of npm and can't be removed") - return cb(new Error("May not delete: "+resolved)) + log.verbose('gentlyRm', resolved, "is part of npm and can't be removed") + return cb(new Error('May not delete: ' + resolved)) } - var options = {log : log.silly.bind(log, "gentlyRm")} - if (npm.config.get("force") || !gently) options.purge = true + var options = { log: log.silly.bind(log, 'vacuum-fs') } + if (npm.config.get('force') || !gently) options.purge = true + if (base) options.base = normalize(resolve(npm.prefix, base)) if (!gently) { - log.verbose("gentlyRm", "vacuuming", resolved) + log.verbose('gentlyRm', "don't care about contents; nuking", resolved) return vacuum(resolved, options, cb) } - var parent = resolve(gently) - log.verbose("gentlyRm", "verifying that", parent, "is managed by npm") + var parent = options.base = normalize(base ? resolve(npm.prefix, base) : npm.prefix) + + // is the parent directory managed by npm? + log.silly('gentlyRm', 'verifying', parent, 'is an npm working directory') some(prefixes, isManaged(parent), function (er, matched) { if (er) return cb(er) if (!matched) { - log.verbose("gentlyRm", parent, "is not managed by npm") + log.error('gentlyRm', 'containing path', parent, "isn't under npm's control") return clobberFail(resolved, parent, cb) } + log.silly('gentlyRm', 'containing path', parent, "is under npm's control, in", matched) - log.silly("gentlyRm", parent, "is managed by npm") - + // is the target directly contained within the (now known to be + // managed) parent? if (isInside(resolved, parent)) { - log.silly("gentlyRm", resolved, "is under", parent) - log.verbose("gentlyRm", "vacuuming", resolved, "up to", parent) - options.base = parent + log.silly('gentlyRm', 'deletion target', resolved, 'is under', parent) + log.verbose('gentlyRm', 'vacuuming from', resolved, 'up to', parent) return vacuum(resolved, options, cb) } - - log.silly("gentlyRm", resolved, "is not under", parent) - log.silly("gentlyRm", "checking to see if", resolved, "is a link") - lstat(resolved, function (er, stat) { - if (er) { - if (er.code === "ENOENT") return cb(null) - return cb(er) + log.silly('gentlyRm', resolved, 'is not under', parent) + + // the target isn't directly within the parent, but is it itself managed? + log.silly('gentlyRm', 'verifying', resolved, 'is an npm working directory') + some(prefixes, isManaged(resolved), function (er, matched) { + if (er) return cb(er) + + if (matched) { + log.silly('gentlyRm', resolved, "is under npm's control, in", matched) + options.base = matched + log.verbose('gentlyRm', 'removing', resolved, 'with base', options.base) + return vacuum(resolved, options, cb) } + log.verbose('gentlyRm', resolved, "is not under npm's control") - if (!stat.isSymbolicLink()) { - log.verbose("gentlyRm", resolved, "is outside", parent, "and not a link") - return clobberFail(resolved, parent, cb) - } - - log.silly("gentlyRm", resolved, "is a link") - readlink(resolved, function (er, link) { + // the target isn't managed directly, but maybe it's a link... + log.silly('gentlyRm', 'checking to see if', resolved, 'is a link') + lstat(resolved, function (er, stat) { if (er) { - if (er.code === "ENOENT") return cb(null) + // race conditions are common when unbuilding + if (er.code === 'ENOENT') return cb(null) return cb(er) } - var source = resolve(dirname(resolved), link) - if (isInside(source, parent)) { - log.silly("gentlyRm", source, "inside", parent) - log.verbose("gentlyRm", "vacuuming", resolved) - return vacuum(resolved, options, cb) + if (!stat.isSymbolicLink()) { + log.error('gentlyRm', resolved, 'is outside', parent, 'and not a link') + return clobberFail(resolved, parent, cb) } - log.silly("gentlyRm", "checking to see if", source, "is managed by npm") - some(prefixes, isManaged(source), function (er, matched) { - if (er) return cb(er) + // ...and maybe the link source, when read... + log.silly('gentlyRm', resolved, 'is a link') + readlink(resolved, function (er, link) { + if (er) { + // race conditions are common when unbuilding + if (er.code === 'ENOENT') return cb(null) + return cb(er) + } - if (matched) { - log.silly("gentlyRm", source, "is under", matched) - log.verbose("gentlyRm", "removing", resolved) - rimraf(resolved, cb) + // ...is inside the managed parent + var source = resolve(dirname(resolved), link) + if (isInside(source, parent)) { + log.silly('gentlyRm', source, 'symlink target', resolved, 'is inside', parent) + log.verbose('gentlyRm', 'vacuuming', resolved) + return vacuum(resolved, options, cb) } - log.verbose("gentlyRm", source, "is not managed by npm") - return clobberFail(path, parent, cb) + log.error('gentlyRm', source, 'symlink target', resolved, 'is not controlled by npm', parent) + return clobberFail(target, parent, cb) }) }) }) @@ -107,60 +138,60 @@ function gentlyRm (path, gently, cb) { var resolvedPaths = {} function isManaged (target) { - return predicate - - function predicate (path, cb) { + return function predicate (path, cb) { if (!path) { - log.verbose("isManaged", "no path") + log.verbose('isManaged', 'no path passed for target', target) return cb(null, false) } - path = resolve(path) + asyncMap([path, target], resolveSymlink, function (er, results) { + if (er) { + if (er.code === 'ENOENT') return cb(null, false) - // if the path has already been memoized, return immediately - var resolved = resolvedPaths[path] - if (resolved) { - var inside = isInside(target, resolved) - log.silly("isManaged", target, inside ? "is" : "is not", "inside", resolved) + return cb(er) + } + + var path = results[0] + var target = results[1] + var inside = isInside(target, path) + if (!inside) log.silly('isManaged', target, 'is not inside', path) return cb(null, inside && path) - } + }) + } - // otherwise, check the path - lstat(path, function (er, stat) { - if (er) { - if (er.code === "ENOENT") return cb(null, false) + function resolveSymlink (toResolve, cb) { + var resolved = resolve(npm.prefix, toResolve) - return cb(er) - } + // if the path has already been memoized, return immediately + var cached = resolvedPaths[resolved] + if (cached) return cb(null, cached) - // if it's not a link, cache & test the path itself - if (!stat.isSymbolicLink()) return cacheAndTest(path, path, target, cb) + // otherwise, check the path + lstat(resolved, function (er, stat) { + if (er) return cb(er) - // otherwise, cache & test the link's source - readlink(path, function (er, source) { - if (er) { - if (er.code === "ENOENT") return cb(null, false) + // if it's not a link, cache & return the path itself + if (!stat.isSymbolicLink()) { + resolvedPaths[resolved] = resolved + return cb(null, resolved) + } - return cb(er) - } + // otherwise, cache & return the link's source + readlink(resolved, function (er, source) { + if (er) return cb(er) - cacheAndTest(resolve(path, source), path, target, cb) + resolved = resolve(resolved, source) + resolvedPaths[resolved] = resolved + cb(null, resolved) }) }) } - - function cacheAndTest (resolved, source, target, cb) { - resolvedPaths[source] = resolved - var inside = isInside(target, resolved) - log.silly("cacheAndTest", target, inside ? "is" : "is not", "inside", resolved) - cb(null, inside && source) - } } -function clobberFail (p, g, cb) { - var er = new Error("Refusing to delete: "+p+" not in "+g) - er.code = "EEXIST" - er.path = p +function clobberFail (target, root, cb) { + var er = new Error('Refusing to delete: ' + target + ' not in ' + root) + er.code = 'EEXIST' + er.path = target return cb(er) } diff --git a/deps/npm/lib/utils/get-publish-config.js b/deps/npm/lib/utils/get-publish-config.js new file mode 100644 index 00000000000..dcbb7b9c0c7 --- /dev/null +++ b/deps/npm/lib/utils/get-publish-config.js @@ -0,0 +1,25 @@ +var Conf = require('../config/core.js').Conf +var CachingRegClient = require('../cache/caching-client.js') +var log = require('npmlog') + +module.exports = getPublishConfig + +function getPublishConfig (publishConfig, defaultConfig, defaultClient) { + var config = defaultConfig + var client = defaultClient + log.verbose('getPublishConfig', publishConfig) + if (publishConfig) { + config = new Conf(defaultConfig) + config.save = defaultConfig.save.bind(defaultConfig) + + // don't modify the actual publishConfig object, in case we have + // to set a login token or some other data. + config.unshift(Object.keys(publishConfig).reduce(function (s, k) { + s[k] = publishConfig[k] + return s + }, {})) + client = new CachingRegClient(config) + } + + return { config: config, client: client } +} diff --git a/deps/npm/lib/utils/git.js b/deps/npm/lib/utils/git.js index db5cc7baf07..9c80ea55375 100644 --- a/deps/npm/lib/utils/git.js +++ b/deps/npm/lib/utils/git.js @@ -6,37 +6,38 @@ exports.chainableExec = chainableExec exports.whichAndExec = whichAndExec var exec = require("child_process").execFile - , spawn = require("child_process").spawn + , spawn = require("./spawn") , npm = require("../npm.js") , which = require("which") , git = npm.config.get("git") , assert = require("assert") , log = require("npmlog") -function prefixGitArgs() { +function prefixGitArgs () { return process.platform === "win32" ? ["-c", "core.longpaths=true"] : [] } -function execGit(args, options, cb) { - log.info("git", args) - return exec(git, prefixGitArgs().concat(args || []), options, cb) +function execGit (args, options, cb) { + log.info('git', args) + var fullArgs = prefixGitArgs().concat(args || []) + return exec(git, fullArgs, options, cb) } -function spawnGit(args, options, cb) { +function spawnGit (args, options) { log.info("git", args) return spawn(git, prefixGitArgs().concat(args || []), options) } -function chainableExec() { +function chainableExec () { var args = Array.prototype.slice.call(arguments) return [execGit].concat(args) } -function whichGit(cb) { +function whichGit (cb) { return which(git, cb) } -function whichAndExec(args, options, cb) { +function whichAndExec (args, options, cb) { assert.equal(typeof cb, "function", "no callback provided") // check for git whichGit(function (err) { diff --git a/deps/npm/lib/utils/lifecycle.js b/deps/npm/lib/utils/lifecycle.js index c0eb83dfb1d..299fa56988c 100644 --- a/deps/npm/lib/utils/lifecycle.js +++ b/deps/npm/lib/utils/lifecycle.js @@ -3,14 +3,15 @@ exports.cmd = cmd exports.makeEnv = makeEnv var log = require("npmlog") - , spawn = require("child_process").spawn - , npm = require("../npm.js") - , path = require("path") - , fs = require("graceful-fs") - , chain = require("slide").chain - , Stream = require("stream").Stream - , PATH = "PATH" - , uidNumber = require("uid-number") +var spawn = require("./spawn") +var npm = require("../npm.js") +var path = require("path") +var fs = require("graceful-fs") +var chain = require("slide").chain +var Stream = require("stream").Stream +var PATH = "PATH" +var uidNumber = require("uid-number") +var umask = require("./umask") // windows calls it's path "Path" usually, but this is not guaranteed. if (process.platform === "win32") { @@ -198,7 +199,7 @@ function runCmd_ (cmd, pkg, env, wd, stage, unsafe, uid, gid, cb_) { var shFlag = "-c" if (process.platform === "win32") { - sh = "cmd" + sh = process.env.comspec || "cmd" shFlag = "/c" conf.windowsVerbatimArguments = true } @@ -316,6 +317,7 @@ function makeEnv (data, prefix, env) { } var value = npm.config.get(i) if (value instanceof Stream || Array.isArray(value)) return + if (i.match(/umask/)) value = umask.toString(value) if (!value) value = "" else if (typeof value === "number") value = "" + value else if (typeof value !== "string") value = JSON.stringify(value) diff --git a/deps/npm/lib/utils/link.js b/deps/npm/lib/utils/link.js index 9e01d82e61a..e353bfae937 100644 --- a/deps/npm/lib/utils/link.js +++ b/deps/npm/lib/utils/link.js @@ -16,13 +16,14 @@ function linkIfExists (from, to, gently, cb) { }) } -function link (from, to, gently, cb) { +function link (from, to, gently, abs, cb) { + if (typeof cb !== "function") cb = abs, abs = false if (typeof cb !== "function") cb = gently, gently = null if (npm.config.get("force")) gently = false to = path.resolve(to) var target = from = path.resolve(from) - if (process.platform !== "win32") { + if (!abs && process.platform !== "win32") { // junctions on windows must be absolute target = path.relative(path.dirname(to), from) // if there is no folder in common, then it will be much diff --git a/deps/npm/lib/utils/map-to-registry.js b/deps/npm/lib/utils/map-to-registry.js index cf665e4f656..bd68a26d42e 100644 --- a/deps/npm/lib/utils/map-to-registry.js +++ b/deps/npm/lib/utils/map-to-registry.js @@ -6,8 +6,8 @@ var log = require("npmlog") module.exports = mapToRegistry function mapToRegistry(name, config, cb) { - var uri - var scopedRegistry + log.silly("mapToRegistry", "name", name) + var registry // the name itself takes precedence var data = npa(name) @@ -15,40 +15,42 @@ function mapToRegistry(name, config, cb) { // the name is definitely scoped, so escape now name = name.replace("/", "%2f") - log.silly("mapToRegistry", "scope", data.scope) + log.silly("mapToRegistry", "scope (from package name)", data.scope) - scopedRegistry = config.get(data.scope + ":registry") - if (scopedRegistry) { - log.silly("mapToRegistry", "scopedRegistry (scoped package)", scopedRegistry) - uri = url.resolve(scopedRegistry, name) - } - else { - log.verbose("mapToRegistry", "no registry URL found for scope", data.scope) + registry = config.get(data.scope + ":registry") + if (!registry) { + log.verbose("mapToRegistry", "no registry URL found in name for scope", data.scope) } } // ...then --scope=@scope or --scope=scope var scope = config.get("scope") - if (!uri && scope) { + if (!registry && scope) { // I'm an enabler, sorry if (scope.charAt(0) !== "@") scope = "@" + scope - scopedRegistry = config.get(scope + ":registry") - if (scopedRegistry) { - log.silly("mapToRegistry", "scopedRegistry (scope in config)", scopedRegistry) - uri = url.resolve(scopedRegistry, name) - } - else { - log.verbose("mapToRegistry", "no registry URL found for scope", scope) + log.silly("mapToRegistry", "scope (from config)", scope) + + registry = config.get(scope + ":registry") + if (!registry) { + log.verbose("mapToRegistry", "no registry URL found in config for scope", scope) } } // ...and finally use the default registry - if (!uri) { - uri = url.resolve(config.get("registry"), name) + if (!registry) { + log.silly("mapToRegistry", "using default registry") + registry = config.get("registry") } - log.verbose("mapToRegistry", "name", name) - log.verbose("mapToRegistry", "uri", uri) - cb(null, uri) + log.silly("mapToRegistry", "registry", registry) + + var auth = config.getCredentialsByURI(registry) + + // normalize registry URL so resolution doesn't drop a piece of registry URL + var normalized = registry.slice(-1) !== "/" ? registry+"/" : registry + var uri = url.resolve(normalized, name) + log.silly("mapToRegistry", "uri", uri) + + cb(null, uri, auth, normalized) } diff --git a/deps/npm/lib/utils/read-local-package.js b/deps/npm/lib/utils/read-local-package.js new file mode 100644 index 00000000000..ca6d613210f --- /dev/null +++ b/deps/npm/lib/utils/read-local-package.js @@ -0,0 +1,12 @@ +exports = module.exports = readLocalPkg + +var npm = require("../npm.js") + , readJson = require("read-package-json") + +function readLocalPkg (cb) { + if (npm.config.get("global")) return cb() + var path = require("path") + readJson(path.resolve(npm.prefix, "package.json"), function (er, d) { + return cb(er, d && d.name) + }) +} diff --git a/deps/npm/lib/utils/spawn.js b/deps/npm/lib/utils/spawn.js new file mode 100644 index 00000000000..74684521f74 --- /dev/null +++ b/deps/npm/lib/utils/spawn.js @@ -0,0 +1,34 @@ +module.exports = spawn + +var _spawn = require("child_process").spawn +var EventEmitter = require("events").EventEmitter + +function spawn (cmd, args, options) { + var raw = _spawn(cmd, args, options) + var cooked = new EventEmitter() + + raw.on("error", function (er) { + er.file = cmd + cooked.emit("error", er) + }).on("close", function (code, signal) { + // Create ENOENT error because Node.js v0.8 will not emit + // an `error` event if the command could not be found. + if (code === 127) { + var er = new Error('spawn ENOENT') + er.code = 'ENOENT' + er.errno = 'ENOENT' + er.syscall = 'spawn' + er.file = cmd + cooked.emit('error', er) + } else { + cooked.emit("close", code, signal) + } + }) + + cooked.stdin = raw.stdin + cooked.stdout = raw.stdout + cooked.stderr = raw.stderr + cooked.kill = function (sig) { return raw.kill(sig) } + + return cooked +} diff --git a/deps/npm/lib/utils/tar.js b/deps/npm/lib/utils/tar.js index ede49a121ed..7656b5d9754 100644 --- a/deps/npm/lib/utils/tar.js +++ b/deps/npm/lib/utils/tar.js @@ -4,6 +4,7 @@ var npm = require("../npm.js") , fs = require("graceful-fs") , writeFileAtomic = require("write-file-atomic") + , writeStreamAtomic = require("fs-write-stream-atomic") , path = require("path") , log = require("npmlog") , uidNumber = require("uid-number") @@ -65,7 +66,7 @@ function pack_ (tarball, folder, pkg, cb) { if (er) log.error("tar.pack", "gzip error "+tarball) cb(er) }) - .pipe(fstream.Writer({ type: "File", path: tarball })) + .pipe(writeStreamAtomic(tarball)) .on("error", function (er) { if (er) log.error("tar.pack", "Could not write "+tarball) cb(er) @@ -228,8 +229,7 @@ function gunzTarPerm (tarball, target, dMode, fMode, uid, gid, cb_) { cb(er) }) .on("close", cb) - } else if (c.toString().match(/^package\//) || - c.toString().match(/^pax_global_header/)) { + } else if (hasTarHeader(c)) { // naked tar fst .pipe(tar.Extract(extractOpts)) @@ -273,3 +273,19 @@ function gunzTarPerm (tarball, target, dMode, fMode, uid, gid, cb_) { fst.emit("data", c) }) } + +function hasTarHeader (c) { + return c[257] === 0x75 && // tar archives have 7573746172 at position + c[258] === 0x73 && // 257 and 003030 or 202000 at position 262 + c[259] === 0x74 && + c[260] === 0x61 && + c[261] === 0x72 && + + ((c[262] === 0x00 && + c[263] === 0x30 && + c[264] === 0x30) || + + (c[262] === 0x20 && + c[263] === 0x20 && + c[264] === 0x00)) +} diff --git a/deps/npm/lib/utils/umask.js b/deps/npm/lib/utils/umask.js new file mode 100644 index 00000000000..6ccb4a1194b --- /dev/null +++ b/deps/npm/lib/utils/umask.js @@ -0,0 +1,17 @@ +var umask = require("umask") +var npmlog = require("npmlog") +var _fromString = umask.fromString + +module.exports = umask + +// fromString with logging callback +umask.fromString = function (val) { + _fromString(val, function (err, result) { + if (err) { + npmlog.warn("invalid umask", err.message) + } + val = result + }) + + return val +} diff --git a/deps/npm/lib/utils/warn-deprecated.js b/deps/npm/lib/utils/warn-deprecated.js new file mode 100644 index 00000000000..ec821b9bd49 --- /dev/null +++ b/deps/npm/lib/utils/warn-deprecated.js @@ -0,0 +1,24 @@ +module.exports = warnDeprecated + +var log = require("npmlog") + +var deprecations = {} + +function warnDeprecated (type) { + return function warn (messages, instance) { + if (!instance) { + if (!deprecations[type]) { + deprecations[type] = {} + messages.forEach(function (m) { log.warn(type, m) }) + } + } + else { + if (!deprecations[type]) deprecations[type] = {} + + if (!deprecations[type][instance]) { + deprecations[type][instance] = true + messages.forEach(function (m) { log.warn(type, m) }) + } + } + } +} diff --git a/deps/npm/lib/version.js b/deps/npm/lib/version.js index a15e2c391c8..f763aad0ad8 100644 --- a/deps/npm/lib/version.js +++ b/deps/npm/lib/version.js @@ -2,16 +2,16 @@ module.exports = version -var exec = require("child_process").execFile - , semver = require("semver") +var semver = require("semver") , path = require("path") , fs = require("graceful-fs") , writeFileAtomic = require("write-file-atomic") , chain = require("slide").chain , log = require("npmlog") - , which = require("which") , npm = require("./npm.js") , git = require("./utils/git.js") + , assert = require("assert") + , lifecycle = require("./utils/lifecycle.js") version.usage = "npm version [ | major | minor | patch | prerelease | preminor | premajor ]\n" + "\n(run in package dir)\n" @@ -24,104 +24,164 @@ version.usage = "npm version [ | major | minor | patch | prerelease function version (args, silent, cb_) { if (typeof cb_ !== "function") cb_ = silent, silent = false if (args.length > 1) return cb_(version.usage) - fs.readFile(path.join(npm.localPrefix, "package.json"), function (er, data) { - if (!args.length) { - var v = {} - Object.keys(process.versions).forEach(function (k) { - v[k] = process.versions[k] - }) - v.npm = npm.version - try { - data = JSON.parse(data.toString()) - } catch (er) { - data = null - } - if (data && data.name && data.version) { - v[data.name] = data.version - } - if (npm.config.get("json")) { - v = JSON.stringify(v, null, 2) - } - console.log(v) - return cb_() + + var packagePath = path.join(npm.localPrefix, "package.json") + fs.readFile(packagePath, function (er, data) { + if (data) data = data.toString() + try { + data = JSON.parse(data) + } + catch (e) { + er = e + data = null } + if (!args.length) return dump(data, cb_) + if (er) { - log.error("version", "No package.json found") + log.error("version", "No valid package.json found") return cb_(er) } + var newVersion = semver.valid(args[0]) + if (!newVersion) newVersion = semver.inc(data.version, args[0]) + if (!newVersion) return cb_(version.usage) + if (data.version === newVersion) return cb_(new Error("Version not changed")) + data.version = newVersion + var lifecycleData = Object.create(data) + lifecycleData._id = data.name + "@" + newVersion + + var where = npm.prefix + chain([ + [lifecycle, lifecycleData, "preversion", where] + , [version_, data, silent] + , [lifecycle, lifecycleData, "version", where] + , [lifecycle, lifecycleData, "postversion", where] ] + , cb_) + }) +} + +function version_ (data, silent, cb_) { + function cb (er) { + if (!er && !silent) console.log("v" + data.version) + cb_(er) + } + + checkGit(function (er, hasGit) { + if (er) return cb(new Error(er)) + + write(data, "package.json", function (er) { + if (er) return cb(new Error(er)) + + updateShrinkwrap(data.version, function (er, hasShrinkwrap) { + if (er || !hasGit) return cb(er) + commit(data.version, hasShrinkwrap, cb) + }) + }) + }) +} + +function updateShrinkwrap (newVersion, cb) { + fs.readFile(path.join(npm.localPrefix, "npm-shrinkwrap.json"), function (er, data) { + if (er && er.code === "ENOENT") return cb(null, false) + try { + data = data.toString() data = JSON.parse(data) - } catch (er) { - log.error("version", "Bad package.json data") - return cb_(er) + } + catch (er) { + log.error("version", "Bad npm-shrinkwrap.json data") + return cb(er) } - var newVer = semver.valid(args[0]) - if (!newVer) newVer = semver.inc(data.version, args[0]) - if (!newVer) return cb_(version.usage) - if (data.version === newVer) return cb_(new Error("Version not changed")) - data.version = newVer - - fs.stat(path.join(npm.localPrefix, ".git"), function (er, s) { - function cb (er) { - if (!er && !silent) console.log("v" + newVer) - cb_(er) + data.version = newVersion + write(data, "npm-shrinkwrap.json", function (er) { + if (er) { + log.error("version", "Bad npm-shrinkwrap.json data") + return cb(er) } - - var tags = npm.config.get('git-tag-version') - var doGit = !er && s.isDirectory() && tags - if (!doGit) return write(data, cb) - else checkGit(data, cb) + cb(null, true) }) }) } -function checkGit (data, cb) { - var args = [ "status", "--porcelain" ] - var options = {env: process.env} - - // check for git - git.whichAndExec(args, options, function (er, stdout) { - if (er && er.code === "ENOGIT") { - log.warn( - "version", - "This is a Git checkout, but the git command was not found.", - "npm could not create a Git tag for this release!" - ) - return write(data, cb) +function dump (data, cb) { + var v = {} + + if (data && data.name && data.version) v[data.name] = data.version + v.npm = npm.version + Object.keys(process.versions).sort().forEach(function (k) { + v[k] = process.versions[k] + }) + + if (npm.config.get("json")) v = JSON.stringify(v, null, 2) + + console.log(v) + cb() +} + +function checkGit (cb) { + fs.stat(path.join(npm.localPrefix, ".git"), function (er, s) { + var doGit = !er && s.isDirectory() && npm.config.get("git-tag-version") + if (!doGit) { + if (er) log.verbose("version", "error checking for .git", er) + log.verbose("version", "not tagging in git") + return cb(null, false) } - var lines = stdout.trim().split("\n").filter(function (line) { - return line.trim() && !line.match(/^\?\? /) - }).map(function (line) { - return line.trim() - }) - if (lines.length) return cb(new Error( - "Git working directory not clean.\n"+lines.join("\n"))) - write(data, function (er) { - if (er) return cb(er) - var message = npm.config.get("message").replace(/%s/g, data.version) - , sign = npm.config.get("sign-git-tag") - , flag = sign ? "-sm" : "-am" - chain - ( [ git.chainableExec([ "add", "package.json" ], {env: process.env}) - , git.chainableExec([ "commit", "-m", message ], {env: process.env}) - , sign && function (cb) { - npm.spinner.stop() - cb() - } - - , git.chainableExec([ "tag", "v" + data.version, flag, message ] - , {env: process.env}) ] - , cb ) - }) + // check for git + git.whichAndExec( + [ "status", "--porcelain" ], + { env : process.env }, + function (er, stdout) { + if (er && er.code === "ENOGIT") { + log.warn( + "version", + "This is a Git checkout, but the git command was not found.", + "npm could not create a Git tag for this release!" + ) + return cb(null, false) + } + + var lines = stdout.trim().split("\n").filter(function (line) { + return line.trim() && !line.match(/^\?\? /) + }).map(function (line) { + return line.trim() + }) + if (lines.length) return cb(new Error( + "Git working directory not clean.\n"+lines.join("\n") + )) + + cb(null, true) + } + ) }) } -function write (data, cb) { - writeFileAtomic( path.join(npm.localPrefix, "package.json") - , new Buffer(JSON.stringify(data, null, 2) + "\n") - , cb ) +function commit (version, hasShrinkwrap, cb) { + var options = { env : process.env } + var message = npm.config.get("message").replace(/%s/g, version) + var sign = npm.config.get("sign-git-tag") + var flag = sign ? "-sm" : "-am" + chain( + [ + git.chainableExec([ "add", "package.json" ], options), + hasShrinkwrap && git.chainableExec([ "add", "npm-shrinkwrap.json" ] , options), + git.chainableExec([ "commit", "-m", message ], options), + git.chainableExec([ "tag", npm.config.get("tag-version-prefix") + version, flag, message ], options) + ], + cb + ) +} + +function write (data, file, cb) { + assert(data && typeof data === "object", "must pass data to version write") + assert(typeof file === "string", "must pass filename to write to version write") + + log.verbose("version.write", "data", data, "to", file) + writeFileAtomic( + path.join(npm.localPrefix, file), + new Buffer(JSON.stringify(data, null, 2) + "\n"), + cb + ) } diff --git a/deps/npm/lib/view.js b/deps/npm/lib/view.js index 6b45cca2ec0..47da39b642c 100644 --- a/deps/npm/lib/view.js +++ b/deps/npm/lib/view.js @@ -3,20 +3,27 @@ module.exports = view view.usage = "npm view pkg[@version] [[.subfield]...]" +var npm = require("./npm.js") + , readJson = require("read-package-json") + , log = require("npmlog") + , util = require("util") + , semver = require("semver") + , mapToRegistry = require("./utils/map-to-registry.js") + , npa = require("npm-package-arg") + , path = require("path") + view.completion = function (opts, cb) { if (opts.conf.argv.remain.length <= 2) { - return mapToRegistry("-/short", npm.config, function (er, uri) { - if (er) return cb(er) - - registry.get(uri, null, cb) - }) + // FIXME: there used to be registry completion here, but it stopped making + // sense somewhere around 50,000 packages on the registry + return cb() } // have the package, get the fields. var tag = npm.config.get("tag") - mapToRegistry(opts.conf.argv.remain[2], npm.config, function (er, uri) { + mapToRegistry(opts.conf.argv.remain[2], npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.get(uri, null, function (er, d) { + npm.registry.get(uri, { auth : auth }, function (er, d) { if (er) return cb(er) var dv = d.versions[d["dist-tags"][tag]] , fields = [] @@ -48,16 +55,6 @@ view.completion = function (opts, cb) { } } -var npm = require("./npm.js") - , readJson = require("read-package-json") - , registry = npm.registry - , log = require("npmlog") - , util = require("util") - , semver = require("semver") - , mapToRegistry = require("./utils/map-to-registry.js") - , npa = require("npm-package-arg") - , path = require("path") - function view (args, silent, cb) { if (typeof cb !== "function") cb = silent, silent = false @@ -97,10 +94,10 @@ function fetchAndRead (nv, args, silent, cb) { var name = nv.name , version = nv.rawSpec || npm.config.get("tag") - mapToRegistry(name, npm.config, function (er, uri) { + mapToRegistry(name, npm.config, function (er, uri, auth) { if (er) return cb(er) - registry.get(uri, null, function (er, data) { + npm.registry.get(uri, { auth : auth }, function (er, data) { if (er) return cb(er) if (data["dist-tags"] && data["dist-tags"].hasOwnProperty(version)) { version = data["dist-tags"][version] diff --git a/deps/npm/lib/whoami.js b/deps/npm/lib/whoami.js index b33f93743d2..d92a6574a18 100644 --- a/deps/npm/lib/whoami.js +++ b/deps/npm/lib/whoami.js @@ -14,15 +14,22 @@ function whoami (args, silent, cb) { var registry = npm.config.get("registry") if (!registry) return cb(new Error("no default registry set")) - var credentials = npm.config.getCredentialsByURI(registry) - if (credentials) { - if (credentials.username) { - if (!silent) console.log(credentials.username) - return process.nextTick(cb.bind(this, null, credentials.username)) + var auth = npm.config.getCredentialsByURI(registry) + if (auth) { + if (auth.username) { + if (!silent) console.log(auth.username) + return process.nextTick(cb.bind(this, null, auth.username)) } - else if (credentials.token) { - return npm.registry.whoami(registry, function (er, username) { + else if (auth.token) { + return npm.registry.whoami(registry, { auth : auth }, function (er, username) { if (er) return cb(er) + if (!username) { + var needNewSession = new Error( + "Your auth token is no longer valid. Please log in again." + ) + needNewSession.code = 'ENEEDAUTH' + return cb(needNewSession) + } if (!silent) console.log(username) cb(null, username) @@ -30,10 +37,11 @@ function whoami (args, silent, cb) { } } - // At this point, if they have a credentials object, it doesn't - // have a token or auth in it. Probably just the default - // registry. - var msg = "Not authed. Run 'npm adduser'" - if (!silent) console.log(msg) - process.nextTick(cb.bind(this, null, msg)) + // At this point, if they have a credentials object, it doesn't have a token + // or auth in it. Probably just the default registry. + var needAuth = new Error( + "'npm whoami' requires you to be logged in." + ) + needAuth.code = 'ENEEDAUTH' + process.nextTick(cb.bind(this, needAuth)) } diff --git a/deps/npm/man/man1/npm-README.1 b/deps/npm/man/man1/npm-README.1 index a7cf1046f0c..7a755a96b0b 100644 --- a/deps/npm/man/man1/npm-README.1 +++ b/deps/npm/man/man1/npm-README.1 @@ -1,6 +1,6 @@ -.TH "NPM" "1" "October 2014" "" "" +.TH "NPM" "1" "June 2015" "" "" .SH "NAME" -\fBnpm\fR \- node package manager +\fBnpm\fR \- a JavaScript package manager .P Build Status \fIhttps://img\.shields\.io/travis/npm/npm/master\.svg\fR \fIhttps://travis\-ci\.org/npm/npm\fR .SH SYNOPSIS @@ -32,13 +32,13 @@ paths, etc\.) then read on\. .SH Fancy Install (Unix) .P There's a pretty robust install script at -https://www\.npmjs\.org/install\.sh\|\. You can download that and run it\. +https://www\.npmjs\.com/install\.sh\|\. You can download that and run it\. .P Here's an example using curl: .P .RS 2 .nf -curl \-L https://npmjs\.org/install\.sh | sh +curl \-L https://www\.npmjs\.com/install\.sh | sh .fi .RE .SS Slightly Fancier @@ -67,47 +67,21 @@ If you've got the npm source code, you can also semi\-permanently set arbitrary config keys using the \fB\|\./configure \-\-key=val \.\.\.\fR, and then run npm commands by doing \fBnode cli\.js \fR\|\. (This is helpful for testing, or running stuff without actually installing npm itself\.) -.SH Fancy Windows Install +.SH Windows Install or Upgrade .P -You can download a zip file from https://npmjs\.org/dist/, and unpack it -in the same folder where node\.exe lives\. +You can download a zip file from https://github\.com/npm/npm/releases, and +unpack it in the \fBnode_modules\\npm\\\fR folder inside node's installation folder\. +.P +To upgrade to npm 2, follow the Windows upgrade instructions in +the npm Troubleshooting Guide: +.P +https://github\.com/npm/npm/wiki/Troubleshooting#upgrading\-on\-windows .P If that's not fancy enough for you, then you can fetch the code with git, and mess with it directly\. .SH Installing on Cygwin .P No\. -.SH Permissions when Using npm to Install Other Stuff -.P -\fBtl;dr\fR -.RS 0 -.IP \(bu 2 -Use \fBsudo\fR for greater safety\. Or don't, if you prefer not to\. -.IP \(bu 2 -npm will downgrade permissions if it's root before running any build -scripts that package authors specified\. - -.RE -.SS More details\.\.\. -.P -As of version 0\.3, it is recommended to run npm as root\. -This allows npm to change the user identifier to the \fBnobody\fR user prior -to running any package build or test commands\. -.P -If you are not the root user, or if you are on a platform that does not -support uid switching, then npm will not attempt to change the userid\. -.P -If you would like to ensure that npm \fBalways\fR runs scripts as the -"nobody" user, and have it fail if it cannot downgrade permissions, then -set the following configuration param: -.P -.RS 2 -.nf -npm config set unsafe\-perm false -.fi -.RE -.P -This will prevent running in unsafe mode, even as non\-root users\. .SH Uninstalling .P So sad to see you go\. @@ -159,16 +133,23 @@ this means that future npm installs will not remember the settings that you have chosen\. .SH Using npm Programmatically .P -If you would like to use npm programmatically, you can do that\. -It's not very well documented, but it \fIis\fR rather simple\. +Although npm can be used programmatically, its API is meant for use by the CLI +\fIonly\fR, and no guarantees are made regarding its fitness for any other purpose\. +If you want to use npm to reliably perform some task, the safest thing to do is +to invoke the desired \fBnpm\fR command with appropriate arguments\. .P -Most of the time, unless you actually want to do all the things that -npm does, you should try using one of npm's dependencies rather than -using npm itself, if possible\. +The semantic version of npm refers to the CLI itself, rather than the +underlying API\. \fIThe internal API is not guaranteed to remain stable even when +npm's version indicates no breaking changes have been made according to +semver\.\fR .P -Eventually, npm will be just a thin cli wrapper around the modules -that it depends on, but for now, there are some things that you must -use npm itself to do\. +If you \fIstill\fR would like to use npm programmatically, it's \fIpossible\fR\|\. The API +isn't very well documented, but it \fIis\fR rather simple\. +.P +Eventually, npm will be just a thin CLI wrapper around the modules that it +depends on, but for now, there are some things that only the CLI can do\. You +should try using one of npm's dependencies first, and only use the API if what +you're trying to do is only supported by npm itself\. .P .RS 2 .nf @@ -199,13 +180,13 @@ command line arguments using nopt\. You may also want to check out \fBnpm help config\fR to learn about all the options you can set there\. .SH More Docs .P -Check out the docs \fIhttps://www\.npmjs\.org/doc/\fR, -especially the faq \fIhttps://www\.npmjs\.org/doc/faq\.html\fR\|\. +Check out the docs \fIhttps://docs\.npmjs\.com/\fR, +especially the faq \fIhttps://docs\.npmjs\.com/misc/faq\fR\|\. .P You can use the \fBnpm help\fR command to read any of them\. .P If you're a developer, and you want to use npm to publish your program, -you should read this \fIhttps://www\.npmjs\.org/doc/developers\.html\fR +you should read this \fIhttps://docs\.npmjs\.com/misc/developers\fR .SH Legal Stuff .P "npm" and "The npm Registry" are owned by npm, Inc\. @@ -218,13 +199,13 @@ npm, Inc\. or the Node\.js project\. .P Data published to the npm registry is not part of npm itself, and is the sole property of the publisher\. While every effort is made to -ensure accountability, there is absolutely no guarantee, warrantee, or +ensure accountability, there is absolutely no guarantee, warranty, or assertion expressed or implied as to the quality, fitness for a specific purpose, or lack of malice in any given npm package\. .P If you have a complaint about a package in the public npm registry, and cannot resolve it with the package -owner \fIhttps://www\.npmjs\.org/doc/misc/npm\-disputes\.html\fR, please email +owner \fIhttps://docs\.npmjs\.com/misc/disputes\fR, please email support@npmjs\.com and explain the situation\. .P Any data published to The npm Registry (including user account @@ -252,9 +233,6 @@ When you find issues, please report them: .IP \(bu 2 web: https://github\.com/npm/npm/issues -.IP \(bu 2 -email: -npm\-@googlegroups\.com .RE .P diff --git a/deps/npm/man/man1/npm-access.1 b/deps/npm/man/man1/npm-access.1 new file mode 100644 index 00000000000..6e0caff8338 --- /dev/null +++ b/deps/npm/man/man1/npm-access.1 @@ -0,0 +1,78 @@ +.TH "NPM\-ACCESS" "1" "June 2015" "" "" +.SH "NAME" +\fBnpm-access\fR \- Set access level on published packages +.SH SYNOPSIS +.P +.RS 2 +.nf +npm access public [] +npm access restricted [] + +npm access add [] +npm access rm [] + +npm access ls [] +npm access edit [] +.fi +.RE +.SH DESCRIPTION +.P +Used to set access controls on private packages\. +.P +For all of the subcommands, \fBnpm access\fR will perform actions on the packages +in the current working directory if no package name is passed to the +subcommand\. +.RS 0 +.IP \(bu 2 +public / restricted: +Set a package to be either publicly accessible or restricted\. +.IP \(bu 2 +add / rm: +Add or remove the ability of users and teams to have read\-only or read\-write +access to a package\. +.IP \(bu 2 +ls: +Show all of the access privileges for a package\. Will only show permissions +for packages to which you have at least read access\. +.IP \(bu 2 +edit: +Set the access privileges for a package at once using \fB$EDITOR\fR\|\. + +.RE +.SH DETAILS +.P +\fBnpm access\fR always operates directly on the current registry, configurable +from the command line using \fB\-\-registry=\fR\|\. +.P +Unscoped packages are \fIalways public\fR\|\. +.P +Scoped packages \fIdefault to restricted\fR, but you can either publish them as +public using \fBnpm publish \-\-access=public\fR, or set their access as public using +\fBnpm access public\fR after the initial publish\. +.P +You must have privileges to set the access of a package: +.RS 0 +.IP \(bu 2 +You are an owner of an unscoped or scoped package\. +.IP \(bu 2 +You are a member of the team that owns a scope\. +.IP \(bu 2 +You have been given read\-write privileges for a package, either as a member +of a team or directly as an owner\. + +.RE +.P +If your account is not paid, then attempts to publish scoped packages will fail +with an HTTP 402 status code (logically enough), unless you use +\fB\-\-access=public\fR\|\. +.SH SEE ALSO +.RS 0 +.IP \(bu 2 +npm help publish +.IP \(bu 2 +npm help 7 config +.IP \(bu 2 +npm help 7 registry + +.RE + diff --git a/deps/npm/man/man1/npm-adduser.1 b/deps/npm/man/man1/npm-adduser.1 index 6b85986e02e..4c8015eff37 100644 --- a/deps/npm/man/man1/npm-adduser.1 +++ b/deps/npm/man/man1/npm-adduser.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ADDUSER" "1" "October 2014" "" "" +.TH "NPM\-ADDUSER" "1" "June 2015" "" "" .SH "NAME" \fBnpm-adduser\fR \- Add a registry user account .SH SYNOPSIS @@ -16,13 +16,14 @@ the default registry will be used (see npm help 7 \fBnpm\-config\fR)\. .P The username, password, and email are read in from prompts\. .P -You may use this command to change your email address, but not username -or password\. +To reset your password, go to https://www\.npmjs\.com/forgot .P -To reset your password, go to https://www\.npmjs\.org/forgot +To change your email address, go to https://www\.npmjs\.com/email\-edit .P You may use this command multiple times with the same user account to -authorize on a new machine\. +authorize on a new machine\. When authenticating on a new machine, +the username, password and email address must all match with +your existing record\. .P \fBnpm login\fR is an alias to \fBadduser\fR and behaves exactly the same way\. .SH CONFIGURATION @@ -64,7 +65,7 @@ npm adduser \-\-registry=http://private\-registry\.example\.com \-\-always\-auth .P This will ensure that all requests to that registry (including for tarballs) include an authorization header\. See \fBalways\-auth\fR in npm help 7 \fBnpm\-config\fR for more -details on always\-auth\. Registry\-specific configuaration of \fBalways\-auth\fR takes +details on always\-auth\. Registry\-specific configuration of \fBalways\-auth\fR takes precedence over any global configuration\. .SH SEE ALSO .RS 0 diff --git a/deps/npm/man/man1/npm-bin.1 b/deps/npm/man/man1/npm-bin.1 index 6552d6cf4d5..2ddb41bd109 100644 --- a/deps/npm/man/man1/npm-bin.1 +++ b/deps/npm/man/man1/npm-bin.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BIN" "1" "October 2014" "" "" +.TH "NPM\-BIN" "1" "June 2015" "" "" .SH "NAME" \fBnpm-bin\fR \- Display npm bin folder .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-bugs.1 b/deps/npm/man/man1/npm-bugs.1 index 09c7659c600..d1aa52202bf 100644 --- a/deps/npm/man/man1/npm-bugs.1 +++ b/deps/npm/man/man1/npm-bugs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUGS" "1" "October 2014" "" "" +.TH "NPM\-BUGS" "1" "June 2015" "" "" .SH "NAME" \fBnpm-bugs\fR \- Bugs for a package in a web browser maybe .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-build.1 b/deps/npm/man/man1/npm-build.1 index 0f2184292a7..ed46425c57f 100644 --- a/deps/npm/man/man1/npm-build.1 +++ b/deps/npm/man/man1/npm-build.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUILD" "1" "October 2014" "" "" +.TH "NPM\-BUILD" "1" "June 2015" "" "" .SH "NAME" \fBnpm-build\fR \- Build a package .SH SYNOPSIS @@ -18,7 +18,14 @@ A folder containing a \fBpackage\.json\fR file in its root\. .P This is the plumbing command called by \fBnpm link\fR and \fBnpm install\fR\|\. .P -It should generally not be called directly\. +It should generally be called during installation, but if you need to run it +directly, run: +.P +.RS 2 +.nf +npm run\-script build +.fi +.RE .SH SEE ALSO .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-bundle.1 b/deps/npm/man/man1/npm-bundle.1 index 0748922dae2..68ae0ae9aa6 100644 --- a/deps/npm/man/man1/npm-bundle.1 +++ b/deps/npm/man/man1/npm-bundle.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUNDLE" "1" "October 2014" "" "" +.TH "NPM\-BUNDLE" "1" "June 2015" "" "" .SH "NAME" \fBnpm-bundle\fR \- REMOVED .SH DESCRIPTION diff --git a/deps/npm/man/man1/npm-cache.1 b/deps/npm/man/man1/npm-cache.1 index c49015ae6e7..effe1b30b62 100644 --- a/deps/npm/man/man1/npm-cache.1 +++ b/deps/npm/man/man1/npm-cache.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CACHE" "1" "October 2014" "" "" +.TH "NPM\-CACHE" "1" "June 2015" "" "" .SH "NAME" \fBnpm-cache\fR \- Manipulates packages cache .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-completion.1 b/deps/npm/man/man1/npm-completion.1 index a89cc6fd5ff..5a5d24eafd9 100644 --- a/deps/npm/man/man1/npm-completion.1 +++ b/deps/npm/man/man1/npm-completion.1 @@ -1,4 +1,4 @@ -.TH "NPM\-COMPLETION" "1" "October 2014" "" "" +.TH "NPM\-COMPLETION" "1" "June 2015" "" "" .SH "NAME" \fBnpm-completion\fR \- Tab Completion for npm .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-config.1 b/deps/npm/man/man1/npm-config.1 index a93ebace724..17d74488a15 100644 --- a/deps/npm/man/man1/npm-config.1 +++ b/deps/npm/man/man1/npm-config.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CONFIG" "1" "October 2014" "" "" +.TH "NPM\-CONFIG" "1" "June 2015" "" "" .SH "NAME" \fBnpm-config\fR \- Manage the npm configuration files .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-dedupe.1 b/deps/npm/man/man1/npm-dedupe.1 index 24548077e30..89a3302f639 100644 --- a/deps/npm/man/man1/npm-dedupe.1 +++ b/deps/npm/man/man1/npm-dedupe.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEDUPE" "1" "October 2014" "" "" +.TH "NPM\-DEDUPE" "1" "June 2015" "" "" .SH "NAME" \fBnpm-dedupe\fR \- Reduce duplication .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-deprecate.1 b/deps/npm/man/man1/npm-deprecate.1 index 581a58948f3..c50e7841099 100644 --- a/deps/npm/man/man1/npm-deprecate.1 +++ b/deps/npm/man/man1/npm-deprecate.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEPRECATE" "1" "October 2014" "" "" +.TH "NPM\-DEPRECATE" "1" "June 2015" "" "" .SH "NAME" \fBnpm-deprecate\fR \- Deprecate a version of a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-dist-tag.1 b/deps/npm/man/man1/npm-dist-tag.1 new file mode 100644 index 00000000000..4c8e977ac5d --- /dev/null +++ b/deps/npm/man/man1/npm-dist-tag.1 @@ -0,0 +1,96 @@ +.TH "NPM\-DIST\-TAG" "1" "June 2015" "" "" +.SH "NAME" +\fBnpm-dist-tag\fR \- Modify package distribution tags +.SH SYNOPSIS +.P +.RS 2 +.nf +npm dist\-tag add @ [] +npm dist\-tag rm +npm dist\-tag ls [] +.fi +.RE +.SH DESCRIPTION +.P +Add, remove, and enumerate distribution tags on a package: +.RS 0 +.IP \(bu 2 +add: +Tags the specified version of the package with the specified tag, or the +\fB\-\-tag\fR config if not specified\. +.IP \(bu 2 +rm: +Clear a tag that is no longer in use from the package\. +.IP \(bu 2 +ls: +Show all of the dist\-tags for a package, defaulting to the package in +the current prefix\. + +.RE +.P +A tag can be used when installing packages as a reference to a version instead +of using a specific version number: +.P +.RS 2 +.nf +npm install @ +.fi +.RE +.P +When installing dependencies, a preferred tagged version may be specified: +.P +.RS 2 +.nf +npm install \-\-tag +.fi +.RE +.P +This also applies to \fBnpm dedupe\fR\|\. +.P +Publishing a package sets the "latest" tag to the published version unless the +\fB\-\-tag\fR option is used\. For example, \fBnpm publish \-\-tag=beta\fR\|\. +.SH PURPOSE +.P +Tags can be used to provide an alias instead of version numbers\. For +example, \fBnpm\fR currently uses the tag "next" to identify the upcoming +version, and the tag "latest" to identify the current version\. +.P +A project might choose to have multiple streams of development, e\.g\., +"stable", "canary"\. +.SH CAVEATS +.P +This command used to be known as \fBnpm tag\fR, which only created new tags, and so +had a different syntax\. +.P +Tags must share a namespace with version numbers, because they are specified in +the same slot: \fBnpm install @\fR vs \fBnpm install @\fR\|\. +.P +Tags that can be interpreted as valid semver ranges will be rejected\. For +example, \fBv1\.4\fR cannot be used as a tag, because it is interpreted by semver as +\fB>=1\.4\.0 <1\.5\.0\fR\|\. See https://github\.com/npm/npm/issues/6082\|\. +.P +The simplest way to avoid semver problems with tags is to use tags that do not +begin with a number or the letter \fBv\fR\|\. +.SH SEE ALSO +.RS 0 +.IP \(bu 2 +npm help tag +.IP \(bu 2 +npm help publish +.IP \(bu 2 +npm help install +.IP \(bu 2 +npm help dedupe +.IP \(bu 2 +npm help 7 registry +.IP \(bu 2 +npm help config +.IP \(bu 2 +npm help 7 config +.IP \(bu 2 +npm apihelp tag +.IP \(bu 2 +npm help 5 npmrc + +.RE + diff --git a/deps/npm/man/man1/npm-docs.1 b/deps/npm/man/man1/npm-docs.1 index 1e9e5c19901..8e986706717 100644 --- a/deps/npm/man/man1/npm-docs.1 +++ b/deps/npm/man/man1/npm-docs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DOCS" "1" "October 2014" "" "" +.TH "NPM\-DOCS" "1" "June 2015" "" "" .SH "NAME" \fBnpm-docs\fR \- Docs for a package in a web browser maybe .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-edit.1 b/deps/npm/man/man1/npm-edit.1 index 8a19d125788..14787f50739 100644 --- a/deps/npm/man/man1/npm-edit.1 +++ b/deps/npm/man/man1/npm-edit.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EDIT" "1" "October 2014" "" "" +.TH "NPM\-EDIT" "1" "June 2015" "" "" .SH "NAME" \fBnpm-edit\fR \- Edit an installed package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-explore.1 b/deps/npm/man/man1/npm-explore.1 index 0211aef43e9..a90a66ac9aa 100644 --- a/deps/npm/man/man1/npm-explore.1 +++ b/deps/npm/man/man1/npm-explore.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EXPLORE" "1" "October 2014" "" "" +.TH "NPM\-EXPLORE" "1" "June 2015" "" "" .SH "NAME" \fBnpm-explore\fR \- Browse an installed package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-help-search.1 b/deps/npm/man/man1/npm-help-search.1 index a18a8e97a68..1dae614a2f2 100644 --- a/deps/npm/man/man1/npm-help-search.1 +++ b/deps/npm/man/man1/npm-help-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP\-SEARCH" "1" "October 2014" "" "" +.TH "NPM\-HELP\-SEARCH" "1" "June 2015" "" "" .SH "NAME" \fBnpm-help-search\fR \- Search npm help documentation .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-help.1 b/deps/npm/man/man1/npm-help.1 index 556eeb52ee8..e8cd06d8c43 100644 --- a/deps/npm/man/man1/npm-help.1 +++ b/deps/npm/man/man1/npm-help.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP" "1" "October 2014" "" "" +.TH "NPM\-HELP" "1" "June 2015" "" "" .SH "NAME" \fBnpm-help\fR \- Get help on npm .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-init.1 b/deps/npm/man/man1/npm-init.1 index 3d4ed0957f5..e91ef4acf75 100644 --- a/deps/npm/man/man1/npm-init.1 +++ b/deps/npm/man/man1/npm-init.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INIT" "1" "October 2014" "" "" +.TH "NPM\-INIT" "1" "June 2015" "" "" .SH "NAME" \fBnpm-init\fR \- Interactively create a package\.json file .SH SYNOPSIS @@ -23,6 +23,17 @@ without a really good reason to do so\. .P If you invoke it with \fB\-f\fR, \fB\-\-force\fR, \fB\-y\fR, or \fB\-\-yes\fR, it will use only defaults and not prompt you for any options\. +.SH CONFIGURATION +.SS scope +.RS 0 +.IP \(bu 2 +Default: none +.IP \(bu 2 +Type: String + +.RE +.P +The scope under which the new module should be created\. .SH SEE ALSO .RS 0 .IP \(bu 2 @@ -31,6 +42,8 @@ https://github\.com/isaacs/init\-package\-json npm help 5 package\.json .IP \(bu 2 npm help version +.IP \(bu 2 +npm help 7 scope .RE diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1 index 0df0197b0c5..aae70eb8b08 100644 --- a/deps/npm/man/man1/npm-install.1 +++ b/deps/npm/man/man1/npm-install.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INSTALL" "1" "October 2014" "" "" +.TH "NPM\-INSTALL" "1" "June 2015" "" "" .SH "NAME" \fBnpm-install\fR \- Install a package .SH SYNOPSIS @@ -52,9 +52,10 @@ after packing it up into a tarball (b)\. In global mode (ie, with \fB\-g\fR or \fB\-\-global\fR appended to the command), it installs the current package context (ie, the current working directory) as a global package\. - By default, \fBnpm install\fR will install all modules listed as - dependencies\. With the \fB\-\-production\fR flag, - npm will not install modules listed in \fBdevDependencies\fR\|\. + By default, \fBnpm install\fR will install all modules listed as dependencies\. + With the \fB\-\-production\fR flag (or when the \fBNODE_ENV\fR environment variable + is set to \fBproduction\fR), npm will not install modules listed in + \fBdevDependencies\fR\|\. .IP \(bu 2 \fBnpm install \fR: Install a package that is sitting in a folder on the filesystem\. @@ -180,26 +181,13 @@ fetch the package by name if it is not valid\. .fi .RE .IP \(bu 2 -\fBnpm install /\fR: - Install the package at \fBhttps://github\.com/githubname/githubrepo" by - attempting to clone it using\fRgit`\. - Example: -.P -.RS 2 -.nf - npm install mygithubuser/myproject -.fi -.RE - To reference a package in a git repo that is not on GitHub, see git - remote urls below\. -.IP \(bu 2 \fBnpm install \fR: Install a package by cloning a git remote url\. The format of the git url is: .P .RS 2 .nf - ://[@][#] + ://[[:]@][:][:/][#] .fi .RE \fB\fR is one of \fBgit\fR, \fBgit+ssh\fR, \fBgit+http\fR, or @@ -214,6 +202,58 @@ fetch the package by name if it is not valid\. git://github\.com/npm/npm\.git#v1\.0\.27 .fi .RE +.IP \(bu 2 +\fBnpm install /[#]\fR: +.IP \(bu 2 +\fBnpm install github:/[#]\fR: + Install the package at \fBhttps://github\.com/githubname/githubrepo\fR by + attempting to clone it using \fBgit\fR\|\. + If you don't specify a \fIcommit\-ish\fR then \fBmaster\fR will be used\. + Examples: +.P +.RS 2 +.nf + npm install mygithubuser/myproject + npm install github:mygithubuser/myproject +.fi +.RE +.IP \(bu 2 +\fBnpm install gist:[/][#]\fR: + Install the package at \fBhttps://gist\.github\.com/gistID\fR by attempting to + clone it using \fBgit\fR\|\. The GitHub username associated with the gist is + optional and will not be saved in \fBpackage\.json\fR if \fB\-\-save\fR is used\. + If you don't specify a \fIcommit\-ish\fR then \fBmaster\fR will be used\. + Example: +.P +.RS 2 +.nf + npm install gist:101a11beef +.fi +.RE +.IP \(bu 2 +\fBnpm install bitbucket:/[#]\fR: + Install the package at \fBhttps://bitbucket\.org/bitbucketname/bitbucketrepo\fR + by attempting to clone it using \fBgit\fR\|\. + If you don't specify a \fIcommit\-ish\fR then \fBmaster\fR will be used\. + Example: +.P +.RS 2 +.nf + npm install bitbucket:mybitbucketuser/myproject +.fi +.RE +.IP \(bu 2 +\fBnpm install gitlab:/[#]\fR: + Install the package at \fBhttps://gitlab\.com/gitlabname/gitlabrepo\fR + by attempting to clone it using \fBgit\fR\|\. + If you don't specify a \fIcommit\-ish\fR then \fBmaster\fR will be used\. + Example: +.P +.RS 2 +.nf + npm install gitlab:mygitlabuser/myproject +.fi +.RE .RE .P diff --git a/deps/npm/man/man1/npm-link.1 b/deps/npm/man/man1/npm-link.1 index 62d76503f6a..9aa054dea25 100644 --- a/deps/npm/man/man1/npm-link.1 +++ b/deps/npm/man/man1/npm-link.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LINK" "1" "October 2014" "" "" +.TH "NPM\-LINK" "1" "June 2015" "" "" .SH "NAME" \fBnpm-link\fR \- Symlink a package folder .SH SYNOPSIS @@ -25,7 +25,7 @@ Note that \fBpackage\-name\fR is taken from \fBpackage\.json\fR, not from directory name\. .P The package name can be optionally prefixed with a scope\. See npm help 7 \fBnpm\-scope\fR\|\. -The scope must by preceded by an @\-symbol and followed by a slash\. +The scope must be preceded by an @\-symbol and followed by a slash\. .P When creating tarballs for \fBnpm publish\fR, the linked packages are "snapshotted" to their current state by resolving the symbolic links\. @@ -45,7 +45,8 @@ npm link redis # link\-install the package .RE .P Now, any changes to ~/projects/node\-redis will be reflected in -~/projects/node\-bloggy/node_modules/redis/ +~/projects/node\-bloggy/node_modules/node\-redis/\. Note that the link should +be to the package name, not the directory name for that package\. .P You may also shortcut the two steps in one\. For example, to do the above use\-case in a shorter way: @@ -62,7 +63,7 @@ The second line is the equivalent of doing: .RS 2 .nf (cd \.\./node\-redis; npm link) -npm link redis +npm link node\-redis .fi .RE .P diff --git a/deps/npm/man/man1/npm-logout.1 b/deps/npm/man/man1/npm-logout.1 new file mode 100644 index 00000000000..a4c21651e1d --- /dev/null +++ b/deps/npm/man/man1/npm-logout.1 @@ -0,0 +1,62 @@ +.TH "NPM\-LOGOUT" "1" "June 2015" "" "" +.SH "NAME" +\fBnpm-logout\fR \- Log out of the registry +.SH SYNOPSIS +.P +.RS 2 +.nf +npm logout [\-\-registry=url] [\-\-scope=@orgname] +.fi +.RE +.SH DESCRIPTION +.P +When logged into a registry that supports token\-based authentication, tell the +server to end this token's session\. This will invalidate the token everywhere +you're using it, not just for the current environment\. +.P +When logged into a legacy registry that uses username and password authentication, this will +clear the credentials in your user configuration\. In this case, it will \fIonly\fR affect +the current environment\. +.P +If \fB\-\-scope\fR is provided, this will find the credentials for the registry +connected to that scope, if set\. +.SH CONFIGURATION +.SS registry +.P +Default: http://registry\.npmjs\.org/ +.P +The base URL of the npm package registry\. If \fBscope\fR is also specified, +it takes precedence\. +.SS scope +.P +Default: none +.P +If specified, the user and login credentials given will be associated +with the specified scope\. See npm help 7 \fBnpm\-scope\fR\|\. You can use both at the same time, +e\.g\. +.P +.RS 2 +.nf +npm adduser \-\-registry=http://myregistry\.example\.com \-\-scope=@myco +.fi +.RE +.P +This will set a registry for the given scope and login or create a user for +that registry at the same time\. +.SH SEE ALSO +.RS 0 +.IP \(bu 2 +npm help adduser +.IP \(bu 2 +npm help 7 registry +.IP \(bu 2 +npm help config +.IP \(bu 2 +npm help 7 config +.IP \(bu 2 +npm help 5 npmrc +.IP \(bu 2 +npm help whoami + +.RE + diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index 9cf4823c9a6..31d93d17b4a 100644 --- a/deps/npm/man/man1/npm-ls.1 +++ b/deps/npm/man/man1/npm-ls.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LS" "1" "October 2014" "" "" +.TH "NPM\-LS" "1" "June 2015" "" "" .SH "NAME" \fBnpm-ls\fR \- List installed packages .SH SYNOPSIS @@ -23,7 +23,7 @@ For example, running \fBnpm ls promzard\fR in npm's source tree will show: .P .RS 2 .nf -npm@2.1.6 /path/to/npm +npm@2.11.3 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi @@ -86,6 +86,26 @@ Type: Int .RE .P Max display depth of the dependency tree\. +.SS prod / production +.RS 0 +.IP \(bu 2 +Type: Boolean +.IP \(bu 2 +Default: false + +.RE +.P +Display only the dependency tree for packages in \fBdependencies\fR\|\. +.SS dev +.RS 0 +.IP \(bu 2 +Type: Boolean +.IP \(bu 2 +Default: false + +.RE +.P +Display only the dependency tree for packages in \fBdevDependencies\fR\|\. .SH SEE ALSO .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-outdated.1 b/deps/npm/man/man1/npm-outdated.1 index 45433a814e2..e9998f4a7f7 100644 --- a/deps/npm/man/man1/npm-outdated.1 +++ b/deps/npm/man/man1/npm-outdated.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OUTDATED" "1" "October 2014" "" "" +.TH "NPM\-OUTDATED" "1" "June 2015" "" "" .SH "NAME" \fBnpm-outdated\fR \- Check for outdated packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-owner.1 b/deps/npm/man/man1/npm-owner.1 index 3ed5549f71c..ee291a46bbb 100644 --- a/deps/npm/man/man1/npm-owner.1 +++ b/deps/npm/man/man1/npm-owner.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OWNER" "1" "October 2014" "" "" +.TH "NPM\-OWNER" "1" "June 2015" "" "" .SH "NAME" \fBnpm-owner\fR \- Manage package owners .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-pack.1 b/deps/npm/man/man1/npm-pack.1 index 8b9408abb27..16d56c949f8 100644 --- a/deps/npm/man/man1/npm-pack.1 +++ b/deps/npm/man/man1/npm-pack.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PACK" "1" "October 2014" "" "" +.TH "NPM\-PACK" "1" "June 2015" "" "" .SH "NAME" \fBnpm-pack\fR \- Create a tarball from a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-prefix.1 b/deps/npm/man/man1/npm-prefix.1 index b7bcac63956..308b8be08e6 100644 --- a/deps/npm/man/man1/npm-prefix.1 +++ b/deps/npm/man/man1/npm-prefix.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PREFIX" "1" "October 2014" "" "" +.TH "NPM\-PREFIX" "1" "June 2015" "" "" .SH "NAME" \fBnpm-prefix\fR \- Display prefix .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-prune.1 b/deps/npm/man/man1/npm-prune.1 index 1a8cc952156..a6178226e85 100644 --- a/deps/npm/man/man1/npm-prune.1 +++ b/deps/npm/man/man1/npm-prune.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PRUNE" "1" "October 2014" "" "" +.TH "NPM\-PRUNE" "1" "June 2015" "" "" .SH "NAME" \fBnpm-prune\fR \- Remove extraneous packages .SH SYNOPSIS @@ -18,8 +18,10 @@ removed\. Extraneous packages are packages that are not listed on the parent package's dependencies list\. .P -If the \fB\-\-production\fR flag is specified, this command will remove the -packages specified in your \fBdevDependencies\fR\|\. +If the \fB\-\-production\fR flag is specified or the \fBNODE_ENV\fR environment +variable is set to \fBproduction\fR, this command will remove the packages +specified in your \fBdevDependencies\fR\|\. Setting \fB\-\-production=false\fR will +negate \fBNODE_ENV\fR being set to \fBproduction\fR\|\. .SH SEE ALSO .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-publish.1 b/deps/npm/man/man1/npm-publish.1 index 66572102864..5a092c16d73 100644 --- a/deps/npm/man/man1/npm-publish.1 +++ b/deps/npm/man/man1/npm-publish.1 @@ -1,12 +1,12 @@ -.TH "NPM\-PUBLISH" "1" "October 2014" "" "" +.TH "NPM\-PUBLISH" "1" "June 2015" "" "" .SH "NAME" \fBnpm-publish\fR \- Publish a package .SH SYNOPSIS .P .RS 2 .nf -npm publish [\-\-tag ] -npm publish [\-\-tag ] +npm publish [\-\-tag ] [\-\-access ] +npm publish [\-\-tag ] [\-\-access ] .fi .RE .SH DESCRIPTION @@ -31,6 +31,12 @@ with a package\.json file inside\. Registers the published package with the given tag, such that \fBnpm install @\fR will install this version\. By default, \fBnpm publish\fR updates and \fBnpm install\fR installs the \fBlatest\fR tag\. +.IP \(bu 2 +\fB[\-\-access ]\fR +Tells the registry whether this package should be published as public or +restricted\. Only applies to scoped packages, which default to \fBrestricted\fR\|\. +If you don't have a paid account, you must publish with \fB\-\-access public\fR +to publish scoped packages\. .RE .P @@ -45,6 +51,8 @@ it is removed with npm help unpublish\. .IP \(bu 2 npm help 7 registry .IP \(bu 2 +npm help 7 scope +.IP \(bu 2 npm help adduser .IP \(bu 2 npm help owner diff --git a/deps/npm/man/man1/npm-rebuild.1 b/deps/npm/man/man1/npm-rebuild.1 index 0e04b9cfbe1..e8347ea552e 100644 --- a/deps/npm/man/man1/npm-rebuild.1 +++ b/deps/npm/man/man1/npm-rebuild.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REBUILD" "1" "October 2014" "" "" +.TH "NPM\-REBUILD" "1" "June 2015" "" "" .SH "NAME" \fBnpm-rebuild\fR \- Rebuild a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-repo.1 b/deps/npm/man/man1/npm-repo.1 index dc8428d0242..bbbc8b1282b 100644 --- a/deps/npm/man/man1/npm-repo.1 +++ b/deps/npm/man/man1/npm-repo.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REPO" "1" "October 2014" "" "" +.TH "NPM\-REPO" "1" "June 2015" "" "" .SH "NAME" \fBnpm-repo\fR \- Open package repository page in the browser .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-restart.1 b/deps/npm/man/man1/npm-restart.1 index 234d0aa76e9..f45e6411439 100644 --- a/deps/npm/man/man1/npm-restart.1 +++ b/deps/npm/man/man1/npm-restart.1 @@ -1,6 +1,6 @@ -.TH "NPM\-RESTART" "1" "October 2014" "" "" +.TH "NPM\-RESTART" "1" "June 2015" "" "" .SH "NAME" -\fBnpm-restart\fR \- Start a package +\fBnpm-restart\fR \- Restart a package .SH SYNOPSIS .P .RS 2 @@ -10,8 +10,38 @@ npm restart [\-\- ] .RE .SH DESCRIPTION .P -This runs a package's "restart" script, if one was provided\. Otherwise it runs -package's "stop" script, if one was provided, and then the "start" script\. +This restarts a package\. +.P +This runs a package's "stop", "restart", and "start" scripts, and associated +pre\- and post\- scripts, in the order given below: +.RS 0 +.IP 1. 3 +prerestart +.IP 2. 3 +prestop +.IP 3. 3 +stop +.IP 4. 3 +poststop +.IP 5. 3 +restart +.IP 6. 3 +prestart +.IP 7. 3 +start +.IP 8. 3 +poststart +.IP 9. 3 +postrestart + +.RE +.SH NOTE +.P +Note that the "restart" script is run \fBin addition to\fR the "stop" +and "start" scripts, not instead of them\. +.P +This is the behavior as of \fBnpm\fR major version 2\. A change in this +behavior will be accompanied by an increase in major version number .SH SEE ALSO .RS 0 .IP \(bu 2 @@ -24,6 +54,8 @@ npm help test npm help start .IP \(bu 2 npm help stop +.IP \(bu 2 +npm apihelp restart .RE diff --git a/deps/npm/man/man1/npm-rm.1 b/deps/npm/man/man1/npm-rm.1 index c7f92fb52bf..548a870f21e 100644 --- a/deps/npm/man/man1/npm-rm.1 +++ b/deps/npm/man/man1/npm-rm.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RM" "1" "October 2014" "" "" +.TH "NPM\-RM" "1" "June 2015" "" "" .SH "NAME" \fBnpm-rm\fR \- Remove a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-root.1 b/deps/npm/man/man1/npm-root.1 index f85ebb97085..7e0eeacb3be 100644 --- a/deps/npm/man/man1/npm-root.1 +++ b/deps/npm/man/man1/npm-root.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ROOT" "1" "October 2014" "" "" +.TH "NPM\-ROOT" "1" "June 2015" "" "" .SH "NAME" \fBnpm-root\fR \- Display npm root .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-run-script.1 b/deps/npm/man/man1/npm-run-script.1 index 905908a7a10..351800eb59a 100644 --- a/deps/npm/man/man1/npm-run-script.1 +++ b/deps/npm/man/man1/npm-run-script.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RUN\-SCRIPT" "1" "October 2014" "" "" +.TH "NPM\-RUN\-SCRIPT" "1" "June 2015" "" "" .SH "NAME" \fBnpm-run-script\fR \- Run arbitrary package scripts .SH SYNOPSIS @@ -11,13 +11,11 @@ npm run [command] [\-\- ] .RE .SH DESCRIPTION .P -This runs an arbitrary command from a package's \fB"scripts"\fR object\. -If no package name is provided, it will search for a \fBpackage\.json\fR -in the current folder and use its \fB"scripts"\fR object\. If no \fB"command"\fR -is provided, it will list the available top level scripts\. -.P -It is used by the test, start, restart, and stop commands, but can be -called directly, as well\. +This runs an arbitrary command from a package's \fB"scripts"\fR object\. If no +\fB"command"\fR is provided, it will list the available scripts\. \fBrun[\-script]\fR is +used by the test, start, restart, and stop commands, but can be called +directly, as well\. When the scripts in the package are printed out, they're +separated into lifecycle (test, start, restart) and directly\-run scripts\. .P As of \fBnpm@2\.0\.0\fR \fIhttp://blog\.npmjs\.org/post/98131109725/npm\-2\-0\-0\fR, you can use custom arguments when executing scripts\. The special option \fB\-\-\fR is used by @@ -32,6 +30,18 @@ npm run test \-\- \-\-grep="pattern" .P The arguments will only be passed to the script specified after \fBnpm run\fR and not to any pre or post script\. +.P +The \fBenv\fR script is a special built\-in command that can be used to list +environment variables that will be available to the script at runtime\. If an +"env" command is defined in your package it will take precedence over the +built\-in\. +.P +In addition to the shell's pre\-existing \fBPATH\fR, \fBnpm run\fR adds +\fBnode_modules/\.bin\fR to the \fBPATH\fR provided to scripts\. Any binaries provided by +locally\-installed dependencies can be used without the \fBnode_modules/\.bin\fR +prefix\. For example, if there is a \fBdevDependency\fR on \fBtap\fR in your package, +you should write \fB"scripts": {"test": "tap test/\\*\.js"}\fR instead of \fB"scripts": +{"test": "node_modules/\.bin/tap test/\\*\.js"}\fR to run your tests\. .SH SEE ALSO .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man1/npm-search.1 b/deps/npm/man/man1/npm-search.1 index 4ad5a67b8c9..b617bbbe703 100644 --- a/deps/npm/man/man1/npm-search.1 +++ b/deps/npm/man/man1/npm-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SEARCH" "1" "October 2014" "" "" +.TH "NPM\-SEARCH" "1" "June 2015" "" "" .SH "NAME" \fBnpm-search\fR \- Search for packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-shrinkwrap.1 b/deps/npm/man/man1/npm-shrinkwrap.1 index fa2b313ab2b..521634d13b3 100644 --- a/deps/npm/man/man1/npm-shrinkwrap.1 +++ b/deps/npm/man/man1/npm-shrinkwrap.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SHRINKWRAP" "1" "October 2014" "" "" +.TH "NPM\-SHRINKWRAP" "1" "June 2015" "" "" .SH "NAME" \fBnpm-shrinkwrap\fR \- Lock down dependency versions .SH SYNOPSIS @@ -12,18 +12,18 @@ npm shrinkwrap .P This command locks down the versions of a package's dependencies so that you can control exactly which versions of each dependency will be -used when your package is installed\. The "package\.json" file is still -required if you want to use "npm install"\. +used when your package is installed\. The \fBpackage\.json\fR file is still +required if you want to use \fBnpm install\fR\|\. .P -By default, "npm install" recursively installs the target's -dependencies (as specified in package\.json), choosing the latest +By default, \fBnpm install\fR recursively installs the target's +dependencies (as specified in \fBpackage\.json\fR), choosing the latest available version that satisfies the dependency's semver pattern\. In some situations, particularly when shipping software where each change is tightly managed, it's desirable to fully specify each version of each dependency recursively so that subsequent builds and deploys do not inadvertently pick up newer versions of a dependency that satisfy the semver pattern\. Specifying specific semver patterns in each -dependency's package\.json would facilitate this, but that's not always +dependency's \fBpackage\.json\fR would facilitate this, but that's not always possible or desirable, as when another author owns the npm package\. It's also possible to check dependencies directly into source control, but that may be undesirable for other reasons\. @@ -61,14 +61,14 @@ and package C: .RS 2 .nf { - "name": "C, + "name": "C", "version": "0\.0\.1" } .fi .RE .P If these are the only versions of A, B, and C available in the -registry, then a normal "npm install A" will install: +registry, then a normal \fBnpm install A\fR will install: .P .RS 2 .nf @@ -78,7 +78,7 @@ A@0\.1\.0 .fi .RE .P -However, if B@0\.0\.2 is published, then a fresh "npm install A" will +However, if B@0\.0\.2 is published, then a fresh \fBnpm install A\fR will install: .P .RS 2 @@ -105,7 +105,7 @@ npm shrinkwrap .fi .RE .P -This generates npm\-shrinkwrap\.json, which will look something like this: +This generates \fBnpm\-shrinkwrap\.json\fR, which will look something like this: .P .RS 2 .nf @@ -117,7 +117,7 @@ This generates npm\-shrinkwrap\.json, which will look something like this: "version": "0\.0\.1", "dependencies": { "C": { - "version": "0\.1\.0" + "version": "0\.0\.1" } } } @@ -127,30 +127,30 @@ This generates npm\-shrinkwrap\.json, which will look something like this: .RE .P The shrinkwrap command has locked down the dependencies based on -what's currently installed in node_modules\. When "npm install" -installs a package with a npm\-shrinkwrap\.json file in the package -root, the shrinkwrap file (rather than package\.json files) completely +what's currently installed in node_modules\. When \fBnpm install\fR +installs a package with an \fBnpm\-shrinkwrap\.json\fR in the package +root, the shrinkwrap file (rather than \fBpackage\.json\fR files) completely drives the installation of that package and all of its dependencies (recursively)\. So now the author publishes A@0\.1\.0, and subsequent -installs of this package will use B@0\.0\.1 and C@0\.1\.0, regardless the -dependencies and versions listed in A's, B's, and C's package\.json +installs of this package will use B@0\.0\.1 and C@0\.0\.1, regardless the +dependencies and versions listed in A's, B's, and C's \fBpackage\.json\fR files\. .SS Using shrinkwrapped packages .P Using a shrinkwrapped package is no different than using any other -package: you can "npm install" it by hand, or add a dependency to your -package\.json file and "npm install" it\. +package: you can \fBnpm install\fR it by hand, or add a dependency to your +\fBpackage\.json\fR file and \fBnpm install\fR it\. .SS Building shrinkwrapped packages .P To shrinkwrap an existing package: .RS 0 .IP 1. 3 -Run "npm install" in the package root to install the current +Run \fBnpm install\fR in the package root to install the current versions of all dependencies\. .IP 2. 3 Validate that the package works as expected with these versions\. .IP 3. 3 -Run "npm shrinkwrap", add npm\-shrinkwrap\.json to git, and publish +Run \fBnpm shrinkwrap\fR, add \fBnpm\-shrinkwrap\.json\fR to git, and publish your package\. .RE @@ -158,11 +158,11 @@ your package\. To add or update a dependency in a shrinkwrapped package: .RS 0 .IP 1. 3 -Run "npm install" in the package root to install the current +Run \fBnpm install\fR in the package root to install the current versions of all dependencies\. .IP 2. 3 -Add or update dependencies\. "npm install" each new or updated -package individually and then update package\.json\. Note that they +Add or update dependencies\. \fBnpm install\fR each new or updated +package individually and then update \fBpackage\.json\fR\|\. Note that they must be explicitly named in order to be installed: running \fBnpm install\fR with no arguments will merely reproduce the existing shrinkwrap\. @@ -170,7 +170,7 @@ shrinkwrap\. Validate that the package works as expected with the new dependencies\. .IP 4. 3 -Run "npm shrinkwrap", commit the new npm\-shrinkwrap\.json, and +Run \fBnpm shrinkwrap\fR, commit the new \fBnpm\-shrinkwrap\.json\fR, and publish your package\. .RE @@ -179,14 +179,14 @@ You can use npm help outdated to view dependencies with newer versions available\. .SS Other Notes .P -A shrinkwrap file must be consistent with the package's package\.json -file\. "npm shrinkwrap" will fail if required dependencies are not +A shrinkwrap file must be consistent with the package's \fBpackage\.json\fR +file\. \fBnpm shrinkwrap\fR will fail if required dependencies are not already installed, since that would result in a shrinkwrap that wouldn't actually work\. Similarly, the command will fail if there are -extraneous packages (not referenced by package\.json), since that would -indicate that package\.json is not correct\. +extraneous packages (not referenced by \fBpackage\.json\fR), since that would +indicate that \fBpackage\.json\fR is not correct\. .P -Since "npm shrinkwrap" is intended to lock down your dependencies for +Since \fBnpm shrinkwrap\fR is intended to lock down your dependencies for production use, \fBdevDependencies\fR will not be included unless you explicitly set the \fB\-\-dev\fR flag when you run \fBnpm shrinkwrap\fR\|\. If installed \fBdevDependencies\fR are excluded, then npm will print a diff --git a/deps/npm/man/man1/npm-star.1 b/deps/npm/man/man1/npm-star.1 index 8dbc0292ae7..0cbc9ed2e75 100644 --- a/deps/npm/man/man1/npm-star.1 +++ b/deps/npm/man/man1/npm-star.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STAR" "1" "October 2014" "" "" +.TH "NPM\-STAR" "1" "June 2015" "" "" .SH "NAME" \fBnpm-star\fR \- Mark your favorite packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-stars.1 b/deps/npm/man/man1/npm-stars.1 index 1762a0f08bd..88208b575ee 100644 --- a/deps/npm/man/man1/npm-stars.1 +++ b/deps/npm/man/man1/npm-stars.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STARS" "1" "October 2014" "" "" +.TH "NPM\-STARS" "1" "June 2015" "" "" .SH "NAME" \fBnpm-stars\fR \- View packages marked as favorites .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-start.1 b/deps/npm/man/man1/npm-start.1 index 0a342ee1f1d..f8b70dacfb3 100644 --- a/deps/npm/man/man1/npm-start.1 +++ b/deps/npm/man/man1/npm-start.1 @@ -1,4 +1,4 @@ -.TH "NPM\-START" "1" "October 2014" "" "" +.TH "NPM\-START" "1" "June 2015" "" "" .SH "NAME" \fBnpm-start\fR \- Start a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-stop.1 b/deps/npm/man/man1/npm-stop.1 index 8622d18d964..b4d80840414 100644 --- a/deps/npm/man/man1/npm-stop.1 +++ b/deps/npm/man/man1/npm-stop.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STOP" "1" "October 2014" "" "" +.TH "NPM\-STOP" "1" "June 2015" "" "" .SH "NAME" \fBnpm-stop\fR \- Stop a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-submodule.1 b/deps/npm/man/man1/npm-submodule.1 index 4999ac64e91..771f0c0a228 100644 --- a/deps/npm/man/man1/npm-submodule.1 +++ b/deps/npm/man/man1/npm-submodule.1 @@ -1,35 +1,41 @@ -.TH "NPM\-SUBMODULE" "1" "October 2014" "" "" +.\" Generated with Ronnjs 0.3.8 +.\" http://github.com/kapouer/ronnjs/ +. +.TH "NPM\-SUBMODULE" "1" "September 2014" "" "" +. .SH "NAME" -\fBnpm-submodule\fR \- Add a package as a git submodule -.SH SYNOPSIS -.P -.RS 2 +\fBnpm-submodule\fR \-\- Add a package as a git submodule +. +.SH "SYNOPSIS" +. .nf npm submodule +. .fi -.RE -.SH DESCRIPTION -.P +. +.SH "DESCRIPTION" If the specified package has a git repository url in its package\.json -description, then this command will add it as a git submodule at -\fBnode_modules/\fR\|\. +description, then this command will add it as a git submodule at \fBnode_modules/\fR\|\. +. .P -This is a convenience only\. From then on, it's up to you to manage +This is a convenience only\. From then on, it\'s up to you to manage updates by using the appropriate git commands\. npm will stubbornly refuse to update, modify, or remove anything with a \fB\|\.git\fR subfolder in it\. +. .P This command also does not install missing dependencies, if the package does not include them in its git repository\. If \fBnpm ls\fR reports that things are missing, you can either install, link, or submodule them yourself, or you can do \fBnpm explore \-\- npm install\fR to install the dependencies into the submodule folder\. -.SH SEE ALSO -.RS 0 -.IP \(bu 2 +. +.SH "SEE ALSO" +. +.IP "\(bu" 4 npm help 5 package\.json -.IP \(bu 2 +. +.IP "\(bu" 4 git help submodule - -.RE - +. +.IP "" 0 diff --git a/deps/npm/man/man1/npm-tag.1 b/deps/npm/man/man1/npm-tag.1 index 5aace75083f..c0336b2e636 100644 --- a/deps/npm/man/man1/npm-tag.1 +++ b/deps/npm/man/man1/npm-tag.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TAG" "1" "October 2014" "" "" +.TH "NPM\-TAG" "1" "June 2015" "" "" .SH "NAME" \fBnpm-tag\fR \- Tag a published version .SH SYNOPSIS @@ -10,6 +10,8 @@ npm tag @ [] .RE .SH DESCRIPTION .P +THIS COMMAND IS DEPRECATED\. See npm help dist\-tag for details\. +.P Tags the specified version of the package with the specified tag, or the \fB\-\-tag\fR config if not specified\. .P @@ -33,6 +35,27 @@ npm install \-\-tag This also applies to \fBnpm dedupe\fR\|\. .P Publishing a package always sets the "latest" tag to the published version\. +.SH PURPOSE +.P +Tags can be used to provide an alias instead of version numbers\. For +example, \fBnpm\fR currently uses the tag "next" to identify the upcoming +version, and the tag "latest" to identify the current version\. +.P +A project might choose to have multiple streams of development, e\.g\., +"stable", "canary"\. +.SH CAVEATS +.P +Tags must share a namespace with version numbers, because they are +specified in the same slot: \fBnpm install @\fR vs \fBnpm +install @\fR\|\. +.P +Tags that can be interpreted as valid semver ranges will be +rejected\. For example, \fBv1\.4\fR cannot be used as a tag, because it is +interpreted by semver as \fB>=1\.4\.0 <1\.5\.0\fR\|\. See +https://github\.com/npm/npm/issues/6082\|\. +.P +The simplest way to avoid semver problems with tags is to use tags +that do not begin with a number or the letter \fBv\fR\|\. .SH SEE ALSO .RS 0 .IP \(bu 2 @@ -48,6 +71,8 @@ npm help config .IP \(bu 2 npm help 7 config .IP \(bu 2 +npm apihelp tag +.IP \(bu 2 npm help 5 npmrc .RE diff --git a/deps/npm/man/man1/npm-test.1 b/deps/npm/man/man1/npm-test.1 index 0b4a9f4dbb3..f5f409a64ab 100644 --- a/deps/npm/man/man1/npm-test.1 +++ b/deps/npm/man/man1/npm-test.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEST" "1" "October 2014" "" "" +.TH "NPM\-TEST" "1" "June 2015" "" "" .SH "NAME" \fBnpm-test\fR \- Test a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-uninstall.1 b/deps/npm/man/man1/npm-uninstall.1 index a56f8bb9187..d59dcb14baa 100644 --- a/deps/npm/man/man1/npm-uninstall.1 +++ b/deps/npm/man/man1/npm-uninstall.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RM" "1" "October 2014" "" "" +.TH "NPM\-RM" "1" "June 2015" "" "" .SH "NAME" \fBnpm-rm\fR \- Remove a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-unpublish.1 b/deps/npm/man/man1/npm-unpublish.1 index 6cb1df7263c..8094933ab08 100644 --- a/deps/npm/man/man1/npm-unpublish.1 +++ b/deps/npm/man/man1/npm-unpublish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNPUBLISH" "1" "October 2014" "" "" +.TH "NPM\-UNPUBLISH" "1" "June 2015" "" "" .SH "NAME" \fBnpm-unpublish\fR \- Remove a package from the registry .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-update.1 b/deps/npm/man/man1/npm-update.1 index 19adfc92765..7b548a6e13f 100644 --- a/deps/npm/man/man1/npm-update.1 +++ b/deps/npm/man/man1/npm-update.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UPDATE" "1" "October 2014" "" "" +.TH "NPM\-UPDATE" "1" "June 2015" "" "" .SH "NAME" \fBnpm-update\fR \- Update a package .SH SYNOPSIS @@ -11,15 +11,150 @@ npm update [\-g] [ [ \.\.\.]] .SH DESCRIPTION .P This command will update all the packages listed to the latest version -(specified by the \fBtag\fR config)\. +(specified by the \fBtag\fR config), respecting semver\. .P -It will also install missing packages\. +It will also install missing packages\. As with all commands that install +packages, the \fB\-\-dev\fR flag will cause \fBdevDependencies\fR to be processed +as well\. .P If the \fB\-g\fR flag is specified, this command will update globally installed packages\. .P If no package name is specified, all packages in the specified location (global or local) will be updated\. +.P +As of \fBnpm@2\.6\.1\fR, the \fBnpm update\fR will only inspect top\-level packages\. +Prior versions of \fBnpm\fR would also recursively inspect all dependencies\. +To get the old behavior, use \fBnpm \-\-depth 9999 update\fR, but be warned that +simultaneous asynchronous update of all packages, including \fBnpm\fR itself +and packages that \fBnpm\fR depends on, often causes problems up to and including +the uninstallation of \fBnpm\fR itself\. +.P +To restore a missing \fBnpm\fR, use the command: +.P +.RS 2 +.nf +curl \-L https://npmjs\.com/install\.sh | sh +.fi +.RE +.SH EXAMPLES +.P +IMPORTANT VERSION NOTE: these examples assume \fBnpm@2\.6\.1\fR or later\. For +older versions of \fBnpm\fR, you must specify \fB\-\-depth 0\fR to get the behavior +described below\. +.P +For the examples below, assume that the current package is \fBapp\fR and it depends +on dependencies, \fBdep1\fR (\fBdep2\fR, \.\. etc\.)\. The published versions of \fBdep1\fR are: +.P +.RS 2 +.nf +{ + dist\-tags: { latest: "1\.2\.2" }, + versions: { "1\.2\.2", + "1\.2\.1", + "1\.2\.0", + "1\.1\.2", + "1\.1\.1", + "1\.0\.0", + "0\.4\.1", + "0\.4\.0", + "0\.2\.0" + } +} +.fi +.RE +.SS Caret Dependencies +.P +If \fBapp\fR\|'s \fBpackage\.json\fR contains: +.P +.RS 2 +.nf +dependencies: { + dep1: "^1\.1\.1" +} +.fi +.RE +.P +Then \fBnpm update\fR will install \fBdep1@1\.2\.2\fR, because \fB1\.2\.2\fR is \fBlatest\fR and +\fB1\.2\.2\fR satisfies \fB^1\.1\.1\fR\|\. +.SS Tilde Dependencies +.P +However, if \fBapp\fR\|'s \fBpackage\.json\fR contains: +.P +.RS 2 +.nf +dependencies: { + dep1: "~1\.1\.1" +} +.fi +.RE +.P +In this case, running \fBnpm update\fR will install \fBdep1@1\.1\.2\fR\|\. Even though the \fBlatest\fR +tag points to \fB1\.2\.2\fR, this version does not satisfy \fB~1\.1\.1\fR, which is equivalent +to \fB>=1\.1\.1 <1\.2\.0\fR\|\. So the highest\-sorting version that satisfies \fB~1\.1\.1\fR is used, +which is \fB1\.1\.2\fR\|\. +.SS Caret Dependencies below 1\.0\.0 +.P +Suppose \fBapp\fR has a caret dependency on a version below \fB1\.0\.0\fR, for example: +.P +.RS 2 +.nf +dependencies: { + dep1: "^0\.2\.0" +} +.fi +.RE +.P +\fBnpm update\fR will install \fBdep1@0\.2\.0\fR, because there are no other +versions which satisfy \fB^0\.2\.0\fR\|\. +.P +If the dependence were on \fB^0\.4\.0\fR: +.P +.RS 2 +.nf +dependencies: { + dep1: "^0\.4\.0" +} +.fi +.RE +.P +Then \fBnpm update\fR will install \fBdep1@0\.4\.1\fR, because that is the highest\-sorting +version that satisfies \fB^0\.4\.0\fR (\fB>= 0\.4\.0 <0\.5\.0\fR) +.SS Recording Updates with \fB\-\-save\fR +.P +When you want to update a package and save the new version as +the minimum required dependency in \fBpackage\.json\fR, you can use +\fBnpm update \-\-save\fR\|\. For example if \fBpackage\.json\fR contains +.P +.RS 2 +.nf +dependencies: { + dep1: "^1\.1\.1" +} +.fi +.RE +.P +Then \fBnpm update \-\-save\fR will install \fBdep1@1\.2\.2\fR (i\.e\., \fBlatest\fR), +and \fBpackage\.json\fR will be modified: +.P +.RS 2 +.nf +dependencies: { + dep1: "^1\.2\.2" +} +.fi +.RE +.P +Note that \fBnpm\fR will only write an updated version to \fBpackage\.json\fR +if it installs a new package\. +.SS Updating Globally\-Installed Packages +.P +\fBnpm update \-g\fR will apply the \fBupdate\fR action to each globally\- installed +package that is \fBoutdated\fR \-\- that is, has a version that is different from +\fBlatest\fR\|\. +.P +NOTE: If a package has been upgraded to a version newer than \fBlatest\fR, it will +be \fIdowngraded\fR\|\. .SH SEE ALSO .RS 0 .IP \(bu 2 @@ -27,6 +162,8 @@ npm help install .IP \(bu 2 npm help outdated .IP \(bu 2 +npm help shrinkwrap +.IP \(bu 2 npm help 7 registry .IP \(bu 2 npm help 5 folders diff --git a/deps/npm/man/man1/npm-version.1 b/deps/npm/man/man1/npm-version.1 index 21fde3452fa..6c9444ff778 100644 --- a/deps/npm/man/man1/npm-version.1 +++ b/deps/npm/man/man1/npm-version.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VERSION" "1" "October 2014" "" "" +.TH "NPM\-VERSION" "1" "June 2015" "" "" .SH "NAME" \fBnpm-version\fR \- Bump a package version .SH SYNOPSIS @@ -11,15 +11,17 @@ npm version [ | major | minor | patch | premajor | preminor | prepat .SH DESCRIPTION .P Run this in a package directory to bump the version and write the new -data back to the package\.json file\. +data back to \fBpackage\.json\fR and, if present, \fBnpm\-shrinkwrap\.json\fR\|\. .P The \fBnewversion\fR argument should be a valid semver string, \fIor\fR a valid second argument to semver\.inc (one of "patch", "minor", "major", "prepatch", "preminor", "premajor", "prerelease")\. In the second case, the existing version will be incremented by 1 in the specified field\. .P -If run in a git repo, it will also create a version commit and tag, and -fail if the repo is not clean\. +If run in a git repo, it will also create a version commit and tag, and fail if +the repo is not clean\. This behavior is controlled by \fBgit\-tag\-version\fR (see +below), and can be disabled on the command line by running \fBnpm +\-\-no\-git\-tag\-version version\fR .P If supplied with \fB\-\-message\fR (shorthand: \fB\-m\fR) config option, npm will use it as a commit message when creating a version commit\. If the @@ -48,14 +50,43 @@ user: "isaacs (http://blog\.izs\.me/) " Enter passphrase: .fi .RE +.P +If "preversion", "version", "postversion" in the "scripts" property of +the package\.json, it will execute by running \fBnpm version\fR\|\. preversion +and version ware executed before bump the package version, postversion +was executed after bump the package version\. For example to run \fBnpm version\fR +after passed all test: +.P +.RS 2 +.nf +"scripts": { "preversion": "npm test" } +.fi +.RE +.SH CONFIGURATION +.SS git\-tag\-version +.RS 0 +.IP \(bu 2 +Default: true +.IP \(bu 2 +Type: Boolean + +.RE +.P +Commit and tag the version change\. .SH SEE ALSO .RS 0 .IP \(bu 2 npm help init .IP \(bu 2 +npm help run\-script +.IP \(bu 2 +npm help 7 scripts +.IP \(bu 2 npm help 5 package\.json .IP \(bu 2 npm help 7 semver +.IP \(bu 2 +npm help 7 config .RE diff --git a/deps/npm/man/man1/npm-view.1 b/deps/npm/man/man1/npm-view.1 index 35ef045329e..8960067d00d 100644 --- a/deps/npm/man/man1/npm-view.1 +++ b/deps/npm/man/man1/npm-view.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VIEW" "1" "October 2014" "" "" +.TH "NPM\-VIEW" "1" "June 2015" "" "" .SH "NAME" \fBnpm-view\fR \- View registry info .SH SYNOPSIS @@ -35,7 +35,7 @@ npm view ronn@0\.3\.5 dependencies .fi .RE .P -You can view child field by separating them with a period\. +You can view child fields by separating them with a period\. To view the git repository URL for the latest version of npm, you could do this: .P diff --git a/deps/npm/man/man1/npm-whoami.1 b/deps/npm/man/man1/npm-whoami.1 index 34a3f04ac35..812bbf87a7d 100644 --- a/deps/npm/man/man1/npm-whoami.1 +++ b/deps/npm/man/man1/npm-whoami.1 @@ -1,4 +1,4 @@ -.TH "NPM\-WHOAMI" "1" "October 2014" "" "" +.TH "NPM\-WHOAMI" "1" "June 2015" "" "" .SH "NAME" \fBnpm-whoami\fR \- Display npm username .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index a275e4728d5..b38102a3f9b 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -1,6 +1,6 @@ -.TH "NPM" "1" "October 2014" "" "" +.TH "NPM" "1" "June 2015" "" "" .SH "NAME" -\fBnpm\fR \- node package manager +\fBnpm\fR \- javascript package manager .SH SYNOPSIS .P .RS 2 @@ -10,7 +10,7 @@ npm [args] .RE .SH VERSION .P -2.1.6 +2.11.3 .SH DESCRIPTION .P npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man3/npm-bin.3 b/deps/npm/man/man3/npm-bin.3 index 4c76b8a0cdb..12f03b262ac 100644 --- a/deps/npm/man/man3/npm-bin.3 +++ b/deps/npm/man/man3/npm-bin.3 @@ -1,4 +1,4 @@ -.TH "NPM\-BIN" "3" "October 2014" "" "" +.TH "NPM\-BIN" "3" "June 2015" "" "" .SH "NAME" \fBnpm-bin\fR \- Display npm bin folder .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-bugs.3 b/deps/npm/man/man3/npm-bugs.3 index cd8dda6ea5e..f04fdf2afa1 100644 --- a/deps/npm/man/man3/npm-bugs.3 +++ b/deps/npm/man/man3/npm-bugs.3 @@ -1,4 +1,4 @@ -.TH "NPM\-BUGS" "3" "October 2014" "" "" +.TH "NPM\-BUGS" "3" "June 2015" "" "" .SH "NAME" \fBnpm-bugs\fR \- Bugs for a package in a web browser maybe .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-cache.3 b/deps/npm/man/man3/npm-cache.3 index 1dccd8fd0c1..bcfb6138b5b 100644 --- a/deps/npm/man/man3/npm-cache.3 +++ b/deps/npm/man/man3/npm-cache.3 @@ -1,4 +1,4 @@ -.TH "NPM\-CACHE" "3" "October 2014" "" "" +.TH "NPM\-CACHE" "3" "June 2015" "" "" .SH "NAME" \fBnpm-cache\fR \- manage the npm cache programmatically .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-commands.3 b/deps/npm/man/man3/npm-commands.3 index 87ad3253b12..0dca71c8c78 100644 --- a/deps/npm/man/man3/npm-commands.3 +++ b/deps/npm/man/man3/npm-commands.3 @@ -1,4 +1,4 @@ -.TH "NPM\-COMMANDS" "3" "October 2014" "" "" +.TH "NPM\-COMMANDS" "3" "June 2015" "" "" .SH "NAME" \fBnpm-commands\fR \- npm commands .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-config.3 b/deps/npm/man/man3/npm-config.3 index 763e2252548..0c92c3a2819 100644 --- a/deps/npm/man/man3/npm-config.3 +++ b/deps/npm/man/man3/npm-config.3 @@ -1,4 +1,4 @@ -.TH "NPM\-CONFIG" "3" "October 2014" "" "" +.TH "NPM\-CONFIG" "3" "June 2015" "" "" .SH "NAME" \fBnpm-config\fR \- Manage the npm configuration files .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-deprecate.3 b/deps/npm/man/man3/npm-deprecate.3 index 9b543d36d5a..54237fce684 100644 --- a/deps/npm/man/man3/npm-deprecate.3 +++ b/deps/npm/man/man3/npm-deprecate.3 @@ -1,4 +1,4 @@ -.TH "NPM\-DEPRECATE" "3" "October 2014" "" "" +.TH "NPM\-DEPRECATE" "3" "June 2015" "" "" .SH "NAME" \fBnpm-deprecate\fR \- Deprecate a version of a package .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-docs.3 b/deps/npm/man/man3/npm-docs.3 index ad93e305bd5..e23f1dcad33 100644 --- a/deps/npm/man/man3/npm-docs.3 +++ b/deps/npm/man/man3/npm-docs.3 @@ -1,4 +1,4 @@ -.TH "NPM\-DOCS" "3" "October 2014" "" "" +.TH "NPM\-DOCS" "3" "June 2015" "" "" .SH "NAME" \fBnpm-docs\fR \- Docs for a package in a web browser maybe .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-edit.3 b/deps/npm/man/man3/npm-edit.3 index 82767c8b7e1..ceb99ec01f6 100644 --- a/deps/npm/man/man3/npm-edit.3 +++ b/deps/npm/man/man3/npm-edit.3 @@ -1,4 +1,4 @@ -.TH "NPM\-EDIT" "3" "October 2014" "" "" +.TH "NPM\-EDIT" "3" "June 2015" "" "" .SH "NAME" \fBnpm-edit\fR \- Edit an installed package .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-explore.3 b/deps/npm/man/man3/npm-explore.3 index 54948eadc17..d9887378d2d 100644 --- a/deps/npm/man/man3/npm-explore.3 +++ b/deps/npm/man/man3/npm-explore.3 @@ -1,4 +1,4 @@ -.TH "NPM\-EXPLORE" "3" "October 2014" "" "" +.TH "NPM\-EXPLORE" "3" "June 2015" "" "" .SH "NAME" \fBnpm-explore\fR \- Browse an installed package .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-help-search.3 b/deps/npm/man/man3/npm-help-search.3 index 8f4f346c260..ae547a52959 100644 --- a/deps/npm/man/man3/npm-help-search.3 +++ b/deps/npm/man/man3/npm-help-search.3 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP\-SEARCH" "3" "October 2014" "" "" +.TH "NPM\-HELP\-SEARCH" "3" "June 2015" "" "" .SH "NAME" \fBnpm-help-search\fR \- Search the help pages .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-init.3 b/deps/npm/man/man3/npm-init.3 index d5da00dd8f6..325e217281b 100644 --- a/deps/npm/man/man3/npm-init.3 +++ b/deps/npm/man/man3/npm-init.3 @@ -1,4 +1,4 @@ -.TH "NPM" "" "October 2014" "" "" +.TH "NPM" "" "June 2015" "" "" .SH "NAME" \fBnpm\fR .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-install.3 b/deps/npm/man/man3/npm-install.3 index ec98278cad9..1d9497e3949 100644 --- a/deps/npm/man/man3/npm-install.3 +++ b/deps/npm/man/man3/npm-install.3 @@ -1,4 +1,4 @@ -.TH "NPM\-INSTALL" "3" "October 2014" "" "" +.TH "NPM\-INSTALL" "3" "June 2015" "" "" .SH "NAME" \fBnpm-install\fR \- install a package programmatically .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-link.3 b/deps/npm/man/man3/npm-link.3 index 0c379a48c59..ab67f393336 100644 --- a/deps/npm/man/man3/npm-link.3 +++ b/deps/npm/man/man3/npm-link.3 @@ -1,4 +1,4 @@ -.TH "NPM\-LINK" "3" "October 2014" "" "" +.TH "NPM\-LINK" "3" "June 2015" "" "" .SH "NAME" \fBnpm-link\fR \- Symlink a package folder .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-load.3 b/deps/npm/man/man3/npm-load.3 index 61fac42ebd1..dd92ce6846a 100644 --- a/deps/npm/man/man3/npm-load.3 +++ b/deps/npm/man/man3/npm-load.3 @@ -1,4 +1,4 @@ -.TH "NPM\-LOAD" "3" "October 2014" "" "" +.TH "NPM\-LOAD" "3" "June 2015" "" "" .SH "NAME" \fBnpm-load\fR \- Load config settings .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-ls.3 b/deps/npm/man/man3/npm-ls.3 index 84558abeb3a..82d3dbd948c 100644 --- a/deps/npm/man/man3/npm-ls.3 +++ b/deps/npm/man/man3/npm-ls.3 @@ -1,4 +1,4 @@ -.TH "NPM\-LS" "3" "October 2014" "" "" +.TH "NPM\-LS" "3" "June 2015" "" "" .SH "NAME" \fBnpm-ls\fR \- List installed packages .SH SYNOPSIS @@ -63,6 +63,6 @@ List packages in the global install prefix instead of in the current project\. .P Note, if parseable is set or long isn't set, then duplicates will be trimmed\. -This means that if a submodule a same dependency as a parent module, then the +This means that if a submodule has the same dependency as a parent module, then the dependency will only be output once\. diff --git a/deps/npm/man/man3/npm-outdated.3 b/deps/npm/man/man3/npm-outdated.3 index 2bba8469fc5..01cdf0c6800 100644 --- a/deps/npm/man/man3/npm-outdated.3 +++ b/deps/npm/man/man3/npm-outdated.3 @@ -1,4 +1,4 @@ -.TH "NPM\-OUTDATED" "3" "October 2014" "" "" +.TH "NPM\-OUTDATED" "3" "June 2015" "" "" .SH "NAME" \fBnpm-outdated\fR \- Check for outdated packages .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-owner.3 b/deps/npm/man/man3/npm-owner.3 index 101b752e9f7..5a82efdae61 100644 --- a/deps/npm/man/man3/npm-owner.3 +++ b/deps/npm/man/man3/npm-owner.3 @@ -1,4 +1,4 @@ -.TH "NPM\-OWNER" "3" "October 2014" "" "" +.TH "NPM\-OWNER" "3" "June 2015" "" "" .SH "NAME" \fBnpm-owner\fR \- Manage package owners .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-pack.3 b/deps/npm/man/man3/npm-pack.3 index d9da93e33c2..f1d65b2d3c0 100644 --- a/deps/npm/man/man3/npm-pack.3 +++ b/deps/npm/man/man3/npm-pack.3 @@ -1,4 +1,4 @@ -.TH "NPM\-PACK" "3" "October 2014" "" "" +.TH "NPM\-PACK" "3" "June 2015" "" "" .SH "NAME" \fBnpm-pack\fR \- Create a tarball from a package .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-prefix.3 b/deps/npm/man/man3/npm-prefix.3 index e2da6d67eda..9bf285db13b 100644 --- a/deps/npm/man/man3/npm-prefix.3 +++ b/deps/npm/man/man3/npm-prefix.3 @@ -1,4 +1,4 @@ -.TH "NPM\-PREFIX" "3" "October 2014" "" "" +.TH "NPM\-PREFIX" "3" "June 2015" "" "" .SH "NAME" \fBnpm-prefix\fR \- Display prefix .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-prune.3 b/deps/npm/man/man3/npm-prune.3 index 48a06c97c7a..4ea94640047 100644 --- a/deps/npm/man/man3/npm-prune.3 +++ b/deps/npm/man/man3/npm-prune.3 @@ -1,4 +1,4 @@ -.TH "NPM\-PRUNE" "3" "October 2014" "" "" +.TH "NPM\-PRUNE" "3" "June 2015" "" "" .SH "NAME" \fBnpm-prune\fR \- Remove extraneous packages .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-publish.3 b/deps/npm/man/man3/npm-publish.3 index 13dbd95f33b..fe3ce639c1d 100644 --- a/deps/npm/man/man3/npm-publish.3 +++ b/deps/npm/man/man3/npm-publish.3 @@ -1,4 +1,4 @@ -.TH "NPM\-PUBLISH" "3" "October 2014" "" "" +.TH "NPM\-PUBLISH" "3" "June 2015" "" "" .SH "NAME" \fBnpm-publish\fR \- Publish a package .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-rebuild.3 b/deps/npm/man/man3/npm-rebuild.3 index 21a5aba1deb..668e2c99ea0 100644 --- a/deps/npm/man/man3/npm-rebuild.3 +++ b/deps/npm/man/man3/npm-rebuild.3 @@ -1,4 +1,4 @@ -.TH "NPM\-REBUILD" "3" "October 2014" "" "" +.TH "NPM\-REBUILD" "3" "June 2015" "" "" .SH "NAME" \fBnpm-rebuild\fR \- Rebuild a package .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-repo.3 b/deps/npm/man/man3/npm-repo.3 index 5638d434aec..c88f5d22a47 100644 --- a/deps/npm/man/man3/npm-repo.3 +++ b/deps/npm/man/man3/npm-repo.3 @@ -1,4 +1,4 @@ -.TH "NPM\-REPO" "3" "October 2014" "" "" +.TH "NPM\-REPO" "3" "June 2015" "" "" .SH "NAME" \fBnpm-repo\fR \- Open package repository page in the browser .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-restart.3 b/deps/npm/man/man3/npm-restart.3 index be948334aa1..f792e500457 100644 --- a/deps/npm/man/man3/npm-restart.3 +++ b/deps/npm/man/man3/npm-restart.3 @@ -1,6 +1,6 @@ -.TH "NPM\-RESTART" "3" "October 2014" "" "" +.TH "NPM\-RESTART" "3" "June 2015" "" "" .SH "NAME" -\fBnpm-restart\fR \- Start a package +\fBnpm-restart\fR \- Restart a package .SH SYNOPSIS .P .RS 2 @@ -10,14 +10,43 @@ npm\.commands\.restart(packages, callback) .RE .SH DESCRIPTION .P -This runs a package's "restart" script, if one was provided\. -Otherwise it runs package's "stop" script, if one was provided, and then -the "start" script\. +This restarts a package (or multiple packages)\. +.P +This runs a package's "stop", "restart", and "start" scripts, and associated +pre\- and post\- scripts, in the order given below: +.RS 0 +.IP 1. 3 +prerestart +.IP 2. 3 +prestop +.IP 3. 3 +stop +.IP 4. 3 +poststop +.IP 5. 3 +restart +.IP 6. 3 +prestart +.IP 7. 3 +start +.IP 8. 3 +poststart +.IP 9. 3 +postrestart + +.RE .P If no version is specified, then it restarts the "active" version\. .P -npm can run tests on multiple packages\. Just specify multiple packages -in the \fBpackages\fR parameter\. +npm can restart multiple packages\. Just specify multiple packages in +the \fBpackages\fR parameter\. +.SH NOTE +.P +Note that the "restart" script is run \fBin addition to\fR the "stop" +and "start" scripts, not instead of them\. +.P +This is the behavior as of \fBnpm\fR major version 2\. A change in this +behavior will be accompanied by an increase in major version number .SH SEE ALSO .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man3/npm-root.3 b/deps/npm/man/man3/npm-root.3 index 68bac79fa03..1bcf8913c43 100644 --- a/deps/npm/man/man3/npm-root.3 +++ b/deps/npm/man/man3/npm-root.3 @@ -1,4 +1,4 @@ -.TH "NPM\-ROOT" "3" "October 2014" "" "" +.TH "NPM\-ROOT" "3" "June 2015" "" "" .SH "NAME" \fBnpm-root\fR \- Display npm root .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-run-script.3 b/deps/npm/man/man3/npm-run-script.3 index 866f1e01f3f..2ec6ff50c29 100644 --- a/deps/npm/man/man3/npm-run-script.3 +++ b/deps/npm/man/man3/npm-run-script.3 @@ -1,4 +1,4 @@ -.TH "NPM\-RUN\-SCRIPT" "3" "October 2014" "" "" +.TH "NPM\-RUN\-SCRIPT" "3" "June 2015" "" "" .SH "NAME" \fBnpm-run-script\fR \- Run arbitrary package scripts .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-search.3 b/deps/npm/man/man3/npm-search.3 index ba0cc5f4c3b..7186d9d318a 100644 --- a/deps/npm/man/man3/npm-search.3 +++ b/deps/npm/man/man3/npm-search.3 @@ -1,4 +1,4 @@ -.TH "NPM\-SEARCH" "3" "October 2014" "" "" +.TH "NPM\-SEARCH" "3" "June 2015" "" "" .SH "NAME" \fBnpm-search\fR \- Search for packages .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-shrinkwrap.3 b/deps/npm/man/man3/npm-shrinkwrap.3 index 0f87c50906c..e4047cde351 100644 --- a/deps/npm/man/man3/npm-shrinkwrap.3 +++ b/deps/npm/man/man3/npm-shrinkwrap.3 @@ -1,4 +1,4 @@ -.TH "NPM\-SHRINKWRAP" "3" "October 2014" "" "" +.TH "NPM\-SHRINKWRAP" "3" "June 2015" "" "" .SH "NAME" \fBnpm-shrinkwrap\fR \- programmatically generate package shrinkwrap file .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-start.3 b/deps/npm/man/man3/npm-start.3 index 4eabb36c444..ef2c760c3f7 100644 --- a/deps/npm/man/man3/npm-start.3 +++ b/deps/npm/man/man3/npm-start.3 @@ -1,4 +1,4 @@ -.TH "NPM\-START" "3" "October 2014" "" "" +.TH "NPM\-START" "3" "June 2015" "" "" .SH "NAME" \fBnpm-start\fR \- Start a package .SH SYNOPSIS @@ -12,6 +12,6 @@ npm\.commands\.start(packages, callback) .P This runs a package's "start" script, if one was provided\. .P -npm can run tests on multiple packages\. Just specify multiple packages -in the \fBpackages\fR parameter\. +npm can start multiple packages\. Just specify multiple packages in the +\fBpackages\fR parameter\. diff --git a/deps/npm/man/man3/npm-stop.3 b/deps/npm/man/man3/npm-stop.3 index aa55b84736b..ed4b4c64cea 100644 --- a/deps/npm/man/man3/npm-stop.3 +++ b/deps/npm/man/man3/npm-stop.3 @@ -1,4 +1,4 @@ -.TH "NPM\-STOP" "3" "October 2014" "" "" +.TH "NPM\-STOP" "3" "June 2015" "" "" .SH "NAME" \fBnpm-stop\fR \- Stop a package .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-submodule.3 b/deps/npm/man/man3/npm-submodule.3 index 378862a563a..d2e23d7e8fc 100644 --- a/deps/npm/man/man3/npm-submodule.3 +++ b/deps/npm/man/man3/npm-submodule.3 @@ -1,35 +1,41 @@ -.TH "NPM\-SUBMODULE" "3" "October 2014" "" "" +.\" Generated with Ronnjs 0.3.8 +.\" http://github.com/kapouer/ronnjs/ +. +.TH "NPM\-SUBMODULE" "3" "September 2014" "" "" +. .SH "NAME" -\fBnpm-submodule\fR \- Add a package as a git submodule -.SH SYNOPSIS -.P -.RS 2 +\fBnpm-submodule\fR \-\- Add a package as a git submodule +. +.SH "SYNOPSIS" +. .nf npm\.commands\.submodule(packages, callback) +. .fi -.RE -.SH DESCRIPTION -.P +. +.SH "DESCRIPTION" For each package specified, npm will check if it has a git repository url -in its package\.json description then add it as a git submodule at -\fBnode_modules/\fR\|\. +in its package\.json description then add it as a git submodule at \fBnode_modules/\fR\|\. +. .P -This is a convenience only\. From then on, it's up to you to manage +This is a convenience only\. From then on, it\'s up to you to manage updates by using the appropriate git commands\. npm will stubbornly refuse to update, modify, or remove anything with a \fB\|\.git\fR subfolder in it\. +. .P This command also does not install missing dependencies, if the package does not include them in its git repository\. If \fBnpm ls\fR reports that things are missing, you can either install, link, or submodule them yourself, or you can do \fBnpm explore \-\- npm install\fR to install the dependencies into the submodule folder\. -.SH SEE ALSO -.RS 0 -.IP \(bu 2 +. +.SH "SEE ALSO" +. +.IP "\(bu" 4 npm help json -.IP \(bu 2 +. +.IP "\(bu" 4 git help submodule - -.RE - +. +.IP "" 0 diff --git a/deps/npm/man/man3/npm-tag.3 b/deps/npm/man/man3/npm-tag.3 index 4da13767f93..c60b49fc8ed 100644 --- a/deps/npm/man/man3/npm-tag.3 +++ b/deps/npm/man/man3/npm-tag.3 @@ -1,4 +1,4 @@ -.TH "NPM\-TAG" "3" "October 2014" "" "" +.TH "NPM\-TAG" "3" "June 2015" "" "" .SH "NAME" \fBnpm-tag\fR \- Tag a published version .SH SYNOPSIS @@ -21,7 +21,7 @@ is the package name and version is the version number (much like installing a specific version)\. .P The second element is the name of the tag to tag this version with\. If this -parameter is missing or falsey (empty), the default froom the config will be +parameter is missing or falsey (empty), the default from the config will be used\. For more information about how to set this config, check \fBman 3 npm\-config\fR for programmatic usage or \fBman npm\-config\fR for cli usage\. diff --git a/deps/npm/man/man3/npm-test.3 b/deps/npm/man/man3/npm-test.3 index f6d0f6d3f11..1cde98cb3a1 100644 --- a/deps/npm/man/man3/npm-test.3 +++ b/deps/npm/man/man3/npm-test.3 @@ -1,4 +1,4 @@ -.TH "NPM\-TEST" "3" "October 2014" "" "" +.TH "NPM\-TEST" "3" "June 2015" "" "" .SH "NAME" \fBnpm-test\fR \- Test a package .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-uninstall.3 b/deps/npm/man/man3/npm-uninstall.3 index 8505f399559..0bd8ec3023c 100644 --- a/deps/npm/man/man3/npm-uninstall.3 +++ b/deps/npm/man/man3/npm-uninstall.3 @@ -1,4 +1,4 @@ -.TH "NPM\-UNINSTALL" "3" "October 2014" "" "" +.TH "NPM\-UNINSTALL" "3" "June 2015" "" "" .SH "NAME" \fBnpm-uninstall\fR \- uninstall a package programmatically .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-unpublish.3 b/deps/npm/man/man3/npm-unpublish.3 index 9b4ab467d2f..5cbc92dc306 100644 --- a/deps/npm/man/man3/npm-unpublish.3 +++ b/deps/npm/man/man3/npm-unpublish.3 @@ -1,4 +1,4 @@ -.TH "NPM\-UNPUBLISH" "3" "October 2014" "" "" +.TH "NPM\-UNPUBLISH" "3" "June 2015" "" "" .SH "NAME" \fBnpm-unpublish\fR \- Remove a package from the registry .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-update.3 b/deps/npm/man/man3/npm-update.3 index 3f40eb0db2d..4ac31fe1508 100644 --- a/deps/npm/man/man3/npm-update.3 +++ b/deps/npm/man/man3/npm-update.3 @@ -1,4 +1,4 @@ -.TH "NPM\-UPDATE" "3" "October 2014" "" "" +.TH "NPM\-UPDATE" "3" "June 2015" "" "" .SH "NAME" \fBnpm-update\fR \- Update a package .SH SYNOPSIS @@ -8,11 +8,19 @@ npm\.commands\.update(packages, callback) .fi .RE -.TH "DESCRIPTION" "" "October 2014" "" "" +.TH "DESCRIPTION" "" "June 2015" "" "" .SH "NAME" \fBDESCRIPTION\fR .P -Updates a package, upgrading it to the latest version\. It also installs any missing packages\. +Updates a package, upgrading it to the latest version\. It also installs any +missing packages\. .P -The 'packages' argument is an array of packages to update\. The 'callback' parameter will be called when done or when an error occurs\. +The \fBpackages\fR argument is an array of packages to update\. The \fBcallback\fR +parameter will be called when done or when an error occurs\. +.SH SEE ALSO +.RS 0 +.IP \(bu 2 +npm help update + +.RE diff --git a/deps/npm/man/man3/npm-version.3 b/deps/npm/man/man3/npm-version.3 index 16979247fe4..61ed5d174a0 100644 --- a/deps/npm/man/man3/npm-version.3 +++ b/deps/npm/man/man3/npm-version.3 @@ -1,4 +1,4 @@ -.TH "NPM\-VERSION" "3" "October 2014" "" "" +.TH "NPM\-VERSION" "3" "June 2015" "" "" .SH "NAME" \fBnpm-version\fR \- Bump a package version .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-view.3 b/deps/npm/man/man3/npm-view.3 index e49f28d7edc..2b8645ee80b 100644 --- a/deps/npm/man/man3/npm-view.3 +++ b/deps/npm/man/man3/npm-view.3 @@ -1,4 +1,4 @@ -.TH "NPM\-VIEW" "3" "October 2014" "" "" +.TH "NPM\-VIEW" "3" "June 2015" "" "" .SH "NAME" \fBnpm-view\fR \- View registry info .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm-whoami.3 b/deps/npm/man/man3/npm-whoami.3 index 2d32507f513..6f0fc323fd6 100644 --- a/deps/npm/man/man3/npm-whoami.3 +++ b/deps/npm/man/man3/npm-whoami.3 @@ -1,4 +1,4 @@ -.TH "NPM\-WHOAMI" "3" "October 2014" "" "" +.TH "NPM\-WHOAMI" "3" "June 2015" "" "" .SH "NAME" \fBnpm-whoami\fR \- Display npm username .SH SYNOPSIS diff --git a/deps/npm/man/man3/npm.3 b/deps/npm/man/man3/npm.3 index 71bbc58ad09..a27078deb1c 100644 --- a/deps/npm/man/man3/npm.3 +++ b/deps/npm/man/man3/npm.3 @@ -1,6 +1,6 @@ -.TH "NPM" "3" "October 2014" "" "" +.TH "NPM" "3" "June 2015" "" "" .SH "NAME" -\fBnpm\fR \- node package manager +\fBnpm\fR \- javascript package manager .SH SYNOPSIS .P .RS 2 @@ -20,7 +20,7 @@ npm\.load([configObject, ]function (er, npm) { .RE .SH VERSION .P -2.1.6 +2.11.3 .SH DESCRIPTION .P This is the API documentation for npm\. diff --git a/deps/npm/man/man5/npm-folders.5 b/deps/npm/man/man5/npm-folders.5 index 9cd3436f894..71816580cff 100644 --- a/deps/npm/man/man5/npm-folders.5 +++ b/deps/npm/man/man5/npm-folders.5 @@ -1,4 +1,4 @@ -.TH "NPM\-FOLDERS" "5" "October 2014" "" "" +.TH "NPM\-FOLDERS" "5" "June 2015" "" "" .SH "NAME" \fBnpm-folders\fR \- Folder Structures Used by npm .SH DESCRIPTION diff --git a/deps/npm/man/man5/npm-global.5 b/deps/npm/man/man5/npm-global.5 index 9cd3436f894..71816580cff 100644 --- a/deps/npm/man/man5/npm-global.5 +++ b/deps/npm/man/man5/npm-global.5 @@ -1,4 +1,4 @@ -.TH "NPM\-FOLDERS" "5" "October 2014" "" "" +.TH "NPM\-FOLDERS" "5" "June 2015" "" "" .SH "NAME" \fBnpm-folders\fR \- Folder Structures Used by npm .SH DESCRIPTION diff --git a/deps/npm/man/man5/npm-json.5 b/deps/npm/man/man5/npm-json.5 index fa9ef95c4ba..ed3ee7c241a 100644 --- a/deps/npm/man/man5/npm-json.5 +++ b/deps/npm/man/man5/npm-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\.JSON" "5" "October 2014" "" "" +.TH "PACKAGE\.JSON" "5" "June 2015" "" "" .SH "NAME" \fBpackage.json\fR \- Specifics of npm's package\.json handling .SH DESCRIPTION @@ -16,22 +16,37 @@ them\. The name and version together form an identifier that is assumed to be completely unique\. Changes to the package should come along with changes to the version\. .P -The name is what your thing is called\. Some tips: +The name is what your thing is called\. +.P +Some rules: +.RS 0 +.IP \(bu 2 +The name must be shorter than 214 characters\. This includes the scope for +scoped packages\. +.IP \(bu 2 +The name can't start with a dot or an underscore\. +.IP \(bu 2 +New packages must not have uppercase letters in the name\. +.IP \(bu 2 +The name ends up being part of a URL, an argument on the command line, and a +folder name\. Therefore, the name can't contain any non\-URL\-safe characters\. + +.RE +.P +Some tips: .RS 0 .IP \(bu 2 +Don't use the same name as a core Node module\. +.IP \(bu 2 Don't put "js" or "node" in the name\. It's assumed that it's js, since you're writing a package\.json file, and you can specify the engine using the "engines" field\. (See below\.) .IP \(bu 2 -The name ends up being part of a URL, an argument on the command line, and a -folder name\. Any name with non\-url\-safe characters will be rejected\. -Also, it can't start with a dot or an underscore\. -.IP \(bu 2 The name will probably be passed as an argument to require(), so it should be something short, but also reasonably descriptive\. .IP \(bu 2 You may want to check the npm registry to see if there's something by that name -already, before you get too attached to it\. http://registry\.npmjs\.org/ +already, before you get too attached to it\. https://www\.npmjs\.com/ .RE .P @@ -77,7 +92,7 @@ It should look like this: .P .RS 2 .nf -{ "url" : "http://github\.com/owner/project/issues" +{ "url" : "https://github\.com/owner/project/issues" , "email" : "project@hostname\.com" } .fi @@ -92,9 +107,8 @@ If a url is provided, it will be used by the \fBnpm bugs\fR command\. You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you're placing on it\. .P -The simplest way, assuming you're using a common license such as BSD\-3\-Clause -or MIT, is to just specify the standard SPDX ID of the license you're using, -like this: +If you're using a common license such as BSD\-2\-Clause or MIT, add a +current SPDX license identifier for the license you're using, like this: .P .RS 2 .nf @@ -106,8 +120,61 @@ You can check the full list of SPDX license IDs \fIhttps://spdx\.org/licenses/\f Ideally you should pick one that is OSI \fIhttp://opensource\.org/licenses/alphabetical\fR approved\. .P -It's also a good idea to include a LICENSE file at the top level in -your package\. +If your package is licensed under multiple common licenses, use an SPDX license +expression syntax version 2\.0 string \fIhttp://npmjs\.com/package/spdx\fR, like this: +.P +.RS 2 +.nf +{ "license" : "(ISC OR GPL\-3\.0)" } +.fi +.RE +.P +If you are using a license that hasn't been assigned an SPDX identifier, or if +you are using a custom license, use the following valid SPDX expression: +.P +.RS 2 +.nf +{ "license" : "LicenseRef\-LICENSE" } +.fi +.RE +.P +Then include a LICENSE file at the top level of the package\. +.P +Some old packages used license objects or a "licenses" property containing an +array of license objects: +.P +.RS 2 +.nf +// Not valid metadata +{ "license" : + { "type" : "ISC" + , "url" : "http://opensource\.org/licenses/ISC" + } +} + +// Not valid metadata +{ "licenses" : + [ + { "type": "MIT" + , "url": "http://www\.opensource\.org/licenses/mit\-license\.php" + } + , { "type": "Apache\-2\.0" + , "url": "http://opensource\.org/licenses/apache2\.0\.php" + } + ] +} +.fi +.RE +.P +Those styles are now deprecated\. Instead, use SPDX expressions, like this: +.P +.RS 2 +.nf +{ "license": "ISC" } + +{ "license": "(MIT OR Apache\-2\.0)" } +.fi +.RE .SH people fields: author, contributors .P The "author" is one person\. "contributors" is an array of people\. A "person" @@ -126,7 +193,7 @@ Or you can shorten that all into a single string, and npm will parse it for you: .P .RS 2 .nf -"Barney Rubble (http://barnyrubble\.tumblr\.com/) +"Barney Rubble (http://barnyrubble\.tumblr\.com/)" .fi .RE .P @@ -164,16 +231,16 @@ command name to local file name\. On install, npm will symlink that file into \fBprefix/bin\fR for global installs, or \fB\|\./node_modules/\.bin/\fR for local installs\. .P -For example, npm has this: +For example, myapp could have this: .P .RS 2 .nf -{ "bin" : { "npm" : "\./cli\.js" } } +{ "bin" : { "myapp" : "\./cli\.js" } } .fi .RE .P -So, when you install npm, it'll create a symlink from the \fBcli\.js\fR script to -\fB/usr/local/bin/npm\fR\|\. +So, when you install myapp, it'll create a symlink from the \fBcli\.js\fR script to +\fB/usr/local/bin/myapp\fR\|\. .P If you have a single executable, and its name should be the name of the package, then you can just supply it as a string\. For example: @@ -251,7 +318,7 @@ will create entries for \fBman foo\fR and \fBman 2 foo\fR .P The CommonJS Packages \fIhttp://wiki\.commonjs\.org/wiki/Packages/1\.0\fR spec details a few ways that you can indicate the structure of your package using a \fBdirectories\fR -object\. If you look at npm's package\.json \fIhttp://registry\.npmjs\.org/npm/latest\fR, +object\. If you look at npm's package\.json \fIhttps://registry\.npmjs\.org/npm/latest\fR, you'll see that it has directories for doc, lib, and man\. .P In the future, this information may be used in other creative ways\. @@ -279,7 +346,7 @@ Put example scripts in here\. Someday, it might be exposed in some clever way\. .SH repository .P Specify the place where your code lives\. This is helpful for people who -want to contribute\. If the git repo is on github, then the \fBnpm docs\fR +want to contribute\. If the git repo is on GitHub, then the \fBnpm docs\fR command will be able to find you\. .P Do it like this: @@ -288,12 +355,12 @@ Do it like this: .nf "repository" : { "type" : "git" - , "url" : "http://github\.com/npm/npm\.git" + , "url" : "https://github\.com/npm/npm\.git" } "repository" : { "type" : "svn" - , "url" : "http://v8\.googlecode\.com/svn/trunk/" + , "url" : "https://v8\.googlecode\.com/svn/trunk/" } .fi .RE @@ -301,6 +368,21 @@ Do it like this: The URL should be a publicly available (perhaps read\-only) url that can be handed directly to a VCS program without any modification\. It should not be a url to an html project page that you put in your browser\. It's for computers\. +.P +For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same +shortcut syntax you use for \fBnpm install\fR: +.P +.RS 2 +.nf +"repository": "npm/npm" + +"repository": "gist:11081aaa281" + +"repository": "bitbucket:example/repo" + +"repository": "gitlab:another/repo" +.fi +.RE .SH scripts .P The "scripts" property is a dictionary containing script commands that are run @@ -421,7 +503,9 @@ The \fBcommit\-ish\fR can be any tag, sha, or branch which can be supplied as an argument to \fBgit checkout\fR\|\. The default is \fBmaster\fR\|\. .SH GitHub URLs .P -As of version 1\.1\.65, you can refer to GitHub urls as just "foo": "user/foo\-project"\. For example: +As of version 1\.1\.65, you can refer to GitHub urls as just "foo": +"user/foo\-project"\. Just as with git URLs, a \fBcommit\-ish\fR suffix can be +included\. For example: .P .RS 2 .nf @@ -429,7 +513,8 @@ As of version 1\.1\.65, you can refer to GitHub urls as just "foo": "user/foo\-p "name": "foo", "version": "0\.0\.0", "dependencies": { - "express": "visionmedia/express" + "express": "visionmedia/express", + "mocha": "visionmedia/mocha#4727d357ea" } } .fi @@ -508,9 +593,9 @@ themselves\. In dev mode (ie, locally running \fBnpm install\fR), it'll run this script as well, so that you can test it easily\. .SH peerDependencies .P -In some cases, you want to express the compatibility of your package with an +In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a \fBrequire\fR of this host\. -This is usually refered to as a \fIplugin\fR\|\. Notably, your module may be exposing +This is usually referred to as a \fIplugin\fR\|\. Notably, your module may be exposing a specific interface, expected and specified by the host documentation\. .P For example: @@ -519,7 +604,7 @@ For example: .nf { "name": "tea\-latte", - "version": "1\.3\.5" + "version": "1\.3\.5", "peerDependencies": { "tea": "2\.x" } @@ -528,9 +613,8 @@ For example: .RE .P This ensures your package \fBtea\-latte\fR can be installed \fIalong\fR with the second -major version of the host package \fBtea\fR only\. The host package is automatically -installed if needed\. \fBnpm install tea\-latte\fR could possibly yield the following -dependency graph: +major version of the host package \fBtea\fR only\. \fBnpm install tea\-latte\fR could +possibly yield the following dependency graph: .P .RS 2 .nf @@ -539,6 +623,13 @@ dependency graph: .fi .RE .P +\fBNOTE: npm versions 1 and 2 will automatically install \fBpeerDependencies\fR if +they are not explicitly depended upon higher in the dependency tree\. In the +next major version of npm (npm@3), this will no longer be the case\. You will +receive a warning that the peerDependency is not installed instead\.\fR The +behavior in npms 1 & 2 was frequently confusing and could easily put you into +dependency hell, a situation that npm is designed to avoid as much as possible\. +.P Trying to install another plugin with a conflicting requirement will cause an error\. For this reason, make sure your plugin requirement is as broad as possible, and not to lock it down to specific patch versions\. @@ -615,6 +706,8 @@ Note that, unless the user has set the \fBengine\-strict\fR config flag, this field is advisory only\. .SH engineStrict .P +\fBNOTE: This feature is deprecated and will be removed in npm 3\.0\.0\.\fR +.P If you are sure that your module will \fIdefinitely not\fR run properly on versions of Node/npm other than those specified in the \fBengines\fR object, then you can set \fB"engineStrict": true\fR in your package\.json file\. @@ -623,8 +716,7 @@ This will override the user's \fBengine\-strict\fR config setting\. Please do not do this unless you are really very very sure\. If your engines object is something overly restrictive, you can quite easily and inadvertently lock yourself into obscurity and prevent your users from -updating to new versions of Node\. Consider this choice carefully\. If -people abuse it, it will be removed in a future version of npm\. +updating to new versions of Node\. Consider this choice carefully\. .SH os .P You can specify which operating systems your diff --git a/deps/npm/man/man5/npmrc.5 b/deps/npm/man/man5/npmrc.5 index d2846869abf..172b909b824 100644 --- a/deps/npm/man/man5/npmrc.5 +++ b/deps/npm/man/man5/npmrc.5 @@ -1,4 +1,4 @@ -.TH "NPMRC" "5" "October 2014" "" "" +.TH "NPMRC" "5" "June 2015" "" "" .SH "NAME" \fBnpmrc\fR \- The npm config files .SH DESCRIPTION @@ -19,7 +19,7 @@ per\-project config file (/path/to/my/project/\.npmrc) .IP \(bu 2 per\-user config file (~/\.npmrc) .IP \(bu 2 -global config file ($PREFIX/npmrc) +global config file ($PREFIX/etc/npmrc) .IP \(bu 2 npm builtin config file (/path/to/npm/npmrc) @@ -38,6 +38,21 @@ prefix = ${HOME}/\.npm\-packages Each of these files is loaded, and config options are resolved in priority order\. For example, a setting in the userconfig file would override the setting in the globalconfig file\. +.P +Array values are specified by adding "[]" after the key name\. For +example: +.P +.RS 2 +.nf +key[] = "first value" +key[] = "second value" +.fi +.RE +.P +\fBNOTE:\fR Because local (per\-project or per\-user) \fB\|\.npmrc\fR files can contain +sensitive credentials, they must be readable and writable \fIonly\fR by your user +account (i\.e\. must have a mode of \fB0600\fR), otherwise they \fIwill be ignored by +npm!\fR .SS Per\-project config file .P When working locally in a project, a \fB\|\.npmrc\fR file in the root of the diff --git a/deps/npm/man/man5/package.json.5 b/deps/npm/man/man5/package.json.5 index fa9ef95c4ba..ed3ee7c241a 100644 --- a/deps/npm/man/man5/package.json.5 +++ b/deps/npm/man/man5/package.json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\.JSON" "5" "October 2014" "" "" +.TH "PACKAGE\.JSON" "5" "June 2015" "" "" .SH "NAME" \fBpackage.json\fR \- Specifics of npm's package\.json handling .SH DESCRIPTION @@ -16,22 +16,37 @@ them\. The name and version together form an identifier that is assumed to be completely unique\. Changes to the package should come along with changes to the version\. .P -The name is what your thing is called\. Some tips: +The name is what your thing is called\. +.P +Some rules: +.RS 0 +.IP \(bu 2 +The name must be shorter than 214 characters\. This includes the scope for +scoped packages\. +.IP \(bu 2 +The name can't start with a dot or an underscore\. +.IP \(bu 2 +New packages must not have uppercase letters in the name\. +.IP \(bu 2 +The name ends up being part of a URL, an argument on the command line, and a +folder name\. Therefore, the name can't contain any non\-URL\-safe characters\. + +.RE +.P +Some tips: .RS 0 .IP \(bu 2 +Don't use the same name as a core Node module\. +.IP \(bu 2 Don't put "js" or "node" in the name\. It's assumed that it's js, since you're writing a package\.json file, and you can specify the engine using the "engines" field\. (See below\.) .IP \(bu 2 -The name ends up being part of a URL, an argument on the command line, and a -folder name\. Any name with non\-url\-safe characters will be rejected\. -Also, it can't start with a dot or an underscore\. -.IP \(bu 2 The name will probably be passed as an argument to require(), so it should be something short, but also reasonably descriptive\. .IP \(bu 2 You may want to check the npm registry to see if there's something by that name -already, before you get too attached to it\. http://registry\.npmjs\.org/ +already, before you get too attached to it\. https://www\.npmjs\.com/ .RE .P @@ -77,7 +92,7 @@ It should look like this: .P .RS 2 .nf -{ "url" : "http://github\.com/owner/project/issues" +{ "url" : "https://github\.com/owner/project/issues" , "email" : "project@hostname\.com" } .fi @@ -92,9 +107,8 @@ If a url is provided, it will be used by the \fBnpm bugs\fR command\. You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you're placing on it\. .P -The simplest way, assuming you're using a common license such as BSD\-3\-Clause -or MIT, is to just specify the standard SPDX ID of the license you're using, -like this: +If you're using a common license such as BSD\-2\-Clause or MIT, add a +current SPDX license identifier for the license you're using, like this: .P .RS 2 .nf @@ -106,8 +120,61 @@ You can check the full list of SPDX license IDs \fIhttps://spdx\.org/licenses/\f Ideally you should pick one that is OSI \fIhttp://opensource\.org/licenses/alphabetical\fR approved\. .P -It's also a good idea to include a LICENSE file at the top level in -your package\. +If your package is licensed under multiple common licenses, use an SPDX license +expression syntax version 2\.0 string \fIhttp://npmjs\.com/package/spdx\fR, like this: +.P +.RS 2 +.nf +{ "license" : "(ISC OR GPL\-3\.0)" } +.fi +.RE +.P +If you are using a license that hasn't been assigned an SPDX identifier, or if +you are using a custom license, use the following valid SPDX expression: +.P +.RS 2 +.nf +{ "license" : "LicenseRef\-LICENSE" } +.fi +.RE +.P +Then include a LICENSE file at the top level of the package\. +.P +Some old packages used license objects or a "licenses" property containing an +array of license objects: +.P +.RS 2 +.nf +// Not valid metadata +{ "license" : + { "type" : "ISC" + , "url" : "http://opensource\.org/licenses/ISC" + } +} + +// Not valid metadata +{ "licenses" : + [ + { "type": "MIT" + , "url": "http://www\.opensource\.org/licenses/mit\-license\.php" + } + , { "type": "Apache\-2\.0" + , "url": "http://opensource\.org/licenses/apache2\.0\.php" + } + ] +} +.fi +.RE +.P +Those styles are now deprecated\. Instead, use SPDX expressions, like this: +.P +.RS 2 +.nf +{ "license": "ISC" } + +{ "license": "(MIT OR Apache\-2\.0)" } +.fi +.RE .SH people fields: author, contributors .P The "author" is one person\. "contributors" is an array of people\. A "person" @@ -126,7 +193,7 @@ Or you can shorten that all into a single string, and npm will parse it for you: .P .RS 2 .nf -"Barney Rubble (http://barnyrubble\.tumblr\.com/) +"Barney Rubble (http://barnyrubble\.tumblr\.com/)" .fi .RE .P @@ -164,16 +231,16 @@ command name to local file name\. On install, npm will symlink that file into \fBprefix/bin\fR for global installs, or \fB\|\./node_modules/\.bin/\fR for local installs\. .P -For example, npm has this: +For example, myapp could have this: .P .RS 2 .nf -{ "bin" : { "npm" : "\./cli\.js" } } +{ "bin" : { "myapp" : "\./cli\.js" } } .fi .RE .P -So, when you install npm, it'll create a symlink from the \fBcli\.js\fR script to -\fB/usr/local/bin/npm\fR\|\. +So, when you install myapp, it'll create a symlink from the \fBcli\.js\fR script to +\fB/usr/local/bin/myapp\fR\|\. .P If you have a single executable, and its name should be the name of the package, then you can just supply it as a string\. For example: @@ -251,7 +318,7 @@ will create entries for \fBman foo\fR and \fBman 2 foo\fR .P The CommonJS Packages \fIhttp://wiki\.commonjs\.org/wiki/Packages/1\.0\fR spec details a few ways that you can indicate the structure of your package using a \fBdirectories\fR -object\. If you look at npm's package\.json \fIhttp://registry\.npmjs\.org/npm/latest\fR, +object\. If you look at npm's package\.json \fIhttps://registry\.npmjs\.org/npm/latest\fR, you'll see that it has directories for doc, lib, and man\. .P In the future, this information may be used in other creative ways\. @@ -279,7 +346,7 @@ Put example scripts in here\. Someday, it might be exposed in some clever way\. .SH repository .P Specify the place where your code lives\. This is helpful for people who -want to contribute\. If the git repo is on github, then the \fBnpm docs\fR +want to contribute\. If the git repo is on GitHub, then the \fBnpm docs\fR command will be able to find you\. .P Do it like this: @@ -288,12 +355,12 @@ Do it like this: .nf "repository" : { "type" : "git" - , "url" : "http://github\.com/npm/npm\.git" + , "url" : "https://github\.com/npm/npm\.git" } "repository" : { "type" : "svn" - , "url" : "http://v8\.googlecode\.com/svn/trunk/" + , "url" : "https://v8\.googlecode\.com/svn/trunk/" } .fi .RE @@ -301,6 +368,21 @@ Do it like this: The URL should be a publicly available (perhaps read\-only) url that can be handed directly to a VCS program without any modification\. It should not be a url to an html project page that you put in your browser\. It's for computers\. +.P +For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same +shortcut syntax you use for \fBnpm install\fR: +.P +.RS 2 +.nf +"repository": "npm/npm" + +"repository": "gist:11081aaa281" + +"repository": "bitbucket:example/repo" + +"repository": "gitlab:another/repo" +.fi +.RE .SH scripts .P The "scripts" property is a dictionary containing script commands that are run @@ -421,7 +503,9 @@ The \fBcommit\-ish\fR can be any tag, sha, or branch which can be supplied as an argument to \fBgit checkout\fR\|\. The default is \fBmaster\fR\|\. .SH GitHub URLs .P -As of version 1\.1\.65, you can refer to GitHub urls as just "foo": "user/foo\-project"\. For example: +As of version 1\.1\.65, you can refer to GitHub urls as just "foo": +"user/foo\-project"\. Just as with git URLs, a \fBcommit\-ish\fR suffix can be +included\. For example: .P .RS 2 .nf @@ -429,7 +513,8 @@ As of version 1\.1\.65, you can refer to GitHub urls as just "foo": "user/foo\-p "name": "foo", "version": "0\.0\.0", "dependencies": { - "express": "visionmedia/express" + "express": "visionmedia/express", + "mocha": "visionmedia/mocha#4727d357ea" } } .fi @@ -508,9 +593,9 @@ themselves\. In dev mode (ie, locally running \fBnpm install\fR), it'll run this script as well, so that you can test it easily\. .SH peerDependencies .P -In some cases, you want to express the compatibility of your package with an +In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a \fBrequire\fR of this host\. -This is usually refered to as a \fIplugin\fR\|\. Notably, your module may be exposing +This is usually referred to as a \fIplugin\fR\|\. Notably, your module may be exposing a specific interface, expected and specified by the host documentation\. .P For example: @@ -519,7 +604,7 @@ For example: .nf { "name": "tea\-latte", - "version": "1\.3\.5" + "version": "1\.3\.5", "peerDependencies": { "tea": "2\.x" } @@ -528,9 +613,8 @@ For example: .RE .P This ensures your package \fBtea\-latte\fR can be installed \fIalong\fR with the second -major version of the host package \fBtea\fR only\. The host package is automatically -installed if needed\. \fBnpm install tea\-latte\fR could possibly yield the following -dependency graph: +major version of the host package \fBtea\fR only\. \fBnpm install tea\-latte\fR could +possibly yield the following dependency graph: .P .RS 2 .nf @@ -539,6 +623,13 @@ dependency graph: .fi .RE .P +\fBNOTE: npm versions 1 and 2 will automatically install \fBpeerDependencies\fR if +they are not explicitly depended upon higher in the dependency tree\. In the +next major version of npm (npm@3), this will no longer be the case\. You will +receive a warning that the peerDependency is not installed instead\.\fR The +behavior in npms 1 & 2 was frequently confusing and could easily put you into +dependency hell, a situation that npm is designed to avoid as much as possible\. +.P Trying to install another plugin with a conflicting requirement will cause an error\. For this reason, make sure your plugin requirement is as broad as possible, and not to lock it down to specific patch versions\. @@ -615,6 +706,8 @@ Note that, unless the user has set the \fBengine\-strict\fR config flag, this field is advisory only\. .SH engineStrict .P +\fBNOTE: This feature is deprecated and will be removed in npm 3\.0\.0\.\fR +.P If you are sure that your module will \fIdefinitely not\fR run properly on versions of Node/npm other than those specified in the \fBengines\fR object, then you can set \fB"engineStrict": true\fR in your package\.json file\. @@ -623,8 +716,7 @@ This will override the user's \fBengine\-strict\fR config setting\. Please do not do this unless you are really very very sure\. If your engines object is something overly restrictive, you can quite easily and inadvertently lock yourself into obscurity and prevent your users from -updating to new versions of Node\. Consider this choice carefully\. If -people abuse it, it will be removed in a future version of npm\. +updating to new versions of Node\. Consider this choice carefully\. .SH os .P You can specify which operating systems your diff --git a/deps/npm/man/man7/npm-coding-style.7 b/deps/npm/man/man7/npm-coding-style.7 index 0dc15318ab4..ce9923214e0 100644 --- a/deps/npm/man/man7/npm-coding-style.7 +++ b/deps/npm/man/man7/npm-coding-style.7 @@ -1,4 +1,4 @@ -.TH "NPM\-CODING\-STYLE" "7" "October 2014" "" "" +.TH "NPM\-CODING\-STYLE" "7" "June 2015" "" "" .SH "NAME" \fBnpm-coding-style\fR \- npm's "funny" coding style .SH DESCRIPTION @@ -10,7 +10,7 @@ designed to reduce visual clutter and make bugs more apparent\. If you want to contribute to npm (which is very encouraged), you should make your code conform to npm's style\. .P -Note: this concerns npm's code not the specific packages at npmjs\.org +Note: this concerns npm's code not the specific packages that you can download from the npm registry\. .SH Line Length .P Keep lines shorter than 80 characters\. It's better for lines to be @@ -19,7 +19,7 @@ statements onto multiple lines\. .SH Indentation .P Two\-spaces\. Tabs are better, but they look like hell in web browsers -(and on github), and node uses 2 spaces, so that's that\. +(and on GitHub), and node uses 2 spaces, so that's that\. .P Configure your editor appropriately\. .SH Curly braces diff --git a/deps/npm/man/man7/npm-config.7 b/deps/npm/man/man7/npm-config.7 index e3b4c5c6f63..5e4a9a2af7a 100644 --- a/deps/npm/man/man7/npm-config.7 +++ b/deps/npm/man/man7/npm-config.7 @@ -1,9 +1,9 @@ -.TH "NPM\-CONFIG" "7" "October 2014" "" "" +.TH "NPM\-CONFIG" "7" "June 2015" "" "" .SH "NAME" \fBnpm-config\fR \- More than you probably want to know about npm configuration .SH DESCRIPTION .P -npm gets its configuration values from 6 sources, in this priority: +npm gets its configuration values from the following sources, sorted by priority: .SS Command Line Flags .P Putting \fB\-\-foo bar\fR on the command line sets the \fBfoo\fR configuration @@ -70,8 +70,6 @@ The following shorthands are parsed on the command\-line: .IP \(bu 2 \fB\-reg\fR: \fB\-\-registry\fR .IP \(bu 2 -\fB\-v\fR: \fB\-\-version\fR -.IP \(bu 2 \fB\-f\fR: \fB\-\-force\fR .IP \(bu 2 \fB\-desc\fR: \fB\-\-description\fR @@ -151,6 +149,19 @@ npm config set foo:port 80 .P See npm help 5 package\.json for more information\. .SH Config Settings +.SS access +.RS 0 +.IP \(bu 2 +Default: \fBrestricted\fR +.IP \(bu 2 +Type: Access + +.RE +.P +When publishing scoped packages, the access level defaults to \fBrestricted\fR\|\. If +you want your scoped package to be publicly viewable (and installable) set +\fB\-\-access=public\fR\|\. The only valid values for \fBaccess\fR are \fBpublic\fR and +\fBrestricted\fR\|\. Unscoped packages \fIalways\fR have an access level of \fBpublic\fR\|\. .SS always\-auth .RS 0 .IP \(bu 2 @@ -192,16 +203,32 @@ The browser that is called by the \fBnpm docs\fR command to open websites\. .IP \(bu 2 Default: The npm CA certificate .IP \(bu 2 -Type: String or null +Type: String, Array or null .RE .P The Certificate Authority signing certificate that is trusted for SSL -connections to the registry\. +connections to the registry\. Values should be in PEM format with newlines +replaced by the string "\\n"\. For example: +.P +.RS 2 +.nf +ca="\-\-\-\-\-BEGIN CERTIFICATE\-\-\-\-\-\\nXXXX\\nXXXX\\n\-\-\-\-\-END CERTIFICATE\-\-\-\-\-" +.fi +.RE .P Set to \fBnull\fR to only allow "known" registrars, or to a specific CA cert to trust only that specific signing authority\. .P +Multiple CAs can be trusted by specifying an array of certificates: +.P +.RS 2 +.nf +ca[]="\.\.\." +ca[]="\.\.\." +.fi +.RE +.P See also the \fBstrict\-ssl\fR config\. .SS cafile .RS 0 @@ -313,8 +340,13 @@ Type: Number .RE .P -The depth to go when recursing directories for \fBnpm ls\fR and -\fBnpm cache ls\fR\|\. +The depth to go when recursing directories for \fBnpm ls\fR, +\fBnpm cache ls\fR, and \fBnpm outdated\fR\|\. +.P +For \fBnpm outdated\fR, a setting of \fBInfinity\fR will be treated as \fB0\fR +since that gives more useful information\. To show the outdated status +of all packages and dependents, use a large integer value, +e\.g\., \fBnpm outdated \-\-depth 9999\fR .SS description .RS 0 .IP \(bu 2 @@ -504,14 +536,29 @@ The string that starts all the debugging log output\. .SS https\-proxy .RS 0 .IP \(bu 2 -Default: the \fBHTTPS_PROXY\fR or \fBhttps_proxy\fR or \fBHTTP_PROXY\fR or -\fBhttp_proxy\fR environment variables\. +Default: null .IP \(bu 2 Type: url .RE .P -A proxy to use for outgoing https requests\. +A proxy to use for outgoing https requests\. If the \fBHTTPS_PROXY\fR or +\fBhttps_proxy\fR or \fBHTTP_PROXY\fR or \fBhttp_proxy\fR environment variables are set, +proxy settings will be honored by the underlying \fBrequest\fR library\. +.SS if\-present +.RS 0 +.IP \(bu 2 +Default: false +.IP \(bu 2 +Type: Boolean + +.RE +.P +If true, npm will not exit with an error code when \fBrun\-script\fR is invoked for +a script that isn't defined in the \fBscripts\fR section of \fBpackage\.json\fR\|\. This +option can be used when it's desirable to optionally run a script when it's +present and fail if the script fails\. This is useful, for example, when running +scripts that may only apply for some builds in an otherwise generic CI setup\. .SS ignore\-scripts .RS 0 .IP \(bu 2 @@ -578,7 +625,7 @@ The value \fBnpm init\fR should use by default for the package license\. .SS init\-version .RS 0 .IP \(bu 2 -Default: "0\.0\.0" +Default: "1\.0\.0" .IP \(bu 2 Type: semver @@ -801,13 +848,15 @@ this as true\. .SS proxy .RS 0 .IP \(bu 2 -Default: \fBHTTP_PROXY\fR or \fBhttp_proxy\fR environment variable, or null +Default: null .IP \(bu 2 Type: url .RE .P -A proxy to use for outgoing http requests\. +A proxy to use for outgoing http requests\. If the \fBHTTP_PROXY\fR or +\fBhttp_proxy\fR environment variables are set, proxy settings will be +honored by the underlying \fBrequest\fR library\. .SS rebuild\-bundle .RS 0 .IP \(bu 2 @@ -923,7 +972,7 @@ Type: String Configure how versions of packages installed to a package\.json file via \fB\-\-save\fR or \fB\-\-save\-dev\fR get prefixed\. .P -For example if a package has version \fB1\.2\.3\fR, by default it's version is +For example if a package has version \fB1\.2\.3\fR, by default its version is set to \fB^1\.2\.3\fR which allows minor upgrades for that package, but after \fBnpm config set save\-prefix='~'\fR it would be set to \fB~1\.2\.3\fR which only allows patch upgrades\. @@ -1052,6 +1101,22 @@ it will install the specified tag\. .P Also the tag that is added to the package@version specified by the \fBnpm tag\fR command, if no explicit tag is given\. +.SS tag\-version\-prefix +.RS 0 +.IP \(bu 2 +Default: \fB"v"\fR +.IP \(bu 2 +Type: String + +.RE +.P +If set, alters the prefix used when tagging a new version when performing a +version increment using \fBnpm\-version\fR\|\. To remove the prefix altogether, set it +to the empty string: \fB""\fR\|\. +.P +Because other tools may rely on the convention that npm version tags look like +\fBv1\.0\.0\fR, \fIonly use this property if it is absolutely necessary\fR\|\. In +particular, use care when overriding this setting for public packages\. .SS tmp .RS 0 .IP \(bu 2 @@ -1122,7 +1187,7 @@ The location of user\-level configuration settings\. .IP \(bu 2 Default: 022 .IP \(bu 2 -Type: Octal numeric string +Type: Octal numeric string in range 0000\.\.0777 (0\.\.511) .RE .P @@ -1184,8 +1249,6 @@ Set to \fB"browser"\fR to view html help content in the default web browser\. .IP \(bu 2 npm help config .IP \(bu 2 -npm help 7 config -.IP \(bu 2 npm help 5 npmrc .IP \(bu 2 npm help 7 scripts diff --git a/deps/npm/man/man7/npm-developers.7 b/deps/npm/man/man7/npm-developers.7 index bf8edb29f23..3709946de31 100644 --- a/deps/npm/man/man7/npm-developers.7 +++ b/deps/npm/man/man7/npm-developers.7 @@ -1,4 +1,4 @@ -.TH "NPM\-DEVELOPERS" "7" "October 2014" "" "" +.TH "NPM\-DEVELOPERS" "7" "June 2015" "" "" .SH "NAME" \fBnpm-developers\fR \- Developer Guide .SH DESCRIPTION @@ -112,6 +112,20 @@ ignore the stuff matched by the \fB\|\.gitignore\fR file\. If you \fIwant\fR to include something that is excluded by your \fB\|\.gitignore\fR file, you can create an empty \fB\|\.npmignore\fR file to override it\. .P +\fB\|\.npmignore\fR files follow the same pattern rules \fIhttp://git\-scm\.com/book/en/v2/Git\-Basics\-Recording\-Changes\-to\-the\-Repository#Ignoring\-Files\fR +as \fB\|\.gitignore\fR files: +.RS 0 +.IP \(bu 2 +Blank lines or lines starting with \fB#\fR are ignored\. +.IP \(bu 2 +Standard glob patterns work\. +.IP \(bu 2 +You can end patterns with a forward slash \fB/\fR to specify a directory\. +.IP \(bu 2 +You can negate a pattern by starting it with an exclamation point \fB!\fR\|\. + +.RE +.P By default, the following paths and files are ignored, so there's no need to add them to \fB\|\.npmignore\fR explicitly: .RS 0 diff --git a/deps/npm/man/man7/npm-disputes.7 b/deps/npm/man/man7/npm-disputes.7 index 9cf7009f620..a740f66d574 100644 --- a/deps/npm/man/man7/npm-disputes.7 +++ b/deps/npm/man/man7/npm-disputes.7 @@ -1,4 +1,4 @@ -.TH "NPM\-DISPUTES" "7" "October 2014" "" "" +.TH "NPM\-DISPUTES" "7" "June 2015" "" "" .SH "NAME" \fBnpm-disputes\fR \- Handling Module Name Disputes .SH SYNOPSIS diff --git a/deps/npm/man/man7/npm-faq.7 b/deps/npm/man/man7/npm-faq.7 index 563509a8728..1ee30f51634 100644 --- a/deps/npm/man/man7/npm-faq.7 +++ b/deps/npm/man/man7/npm-faq.7 @@ -1,9 +1,9 @@ -.TH "NPM\-FAQ" "7" "October 2014" "" "" +.TH "NPM\-FAQ" "7" "June 2015" "" "" .SH "NAME" \fBnpm-faq\fR \- Frequently Asked Questions .SH Where can I find these docs in HTML? .P -https://www\.npmjs\.org/doc/, or run: +https://docs\.npmjs\.com/, or run: .P .RS 2 .nf @@ -80,7 +80,7 @@ Usually, no\. Allow npm to resolve dependencies for your packages\. For packages you \fBdeploy\fR, such as websites and apps, you should use npm shrinkwrap to lock down your full dependency tree: .P -https://www\.npmjs\.org/doc/cli/npm\-shrinkwrap\.html +https://docs\.npmjs\.com/cli/shrinkwrap .P If you are paranoid about depending on the npm ecosystem, you should run a private npm mirror or a private cache\. @@ -148,7 +148,7 @@ In those cases, you can do this: .P .RS 2 .nf -curl https://www\.npmjs\.org/install\.sh | sh +curl https://www\.npmjs\.com/install\.sh | sh .fi .RE .SH What is a \fBpackage\fR? @@ -332,7 +332,7 @@ See npm help \fBnpm\-link\fR See npm help 7 \fBnpm\-registry\fR\|\. .SH I forgot my password, and can't publish\. How do I reset it? .P -Go to https://npmjs\.org/forgot\|\. +Go to https://npmjs\.com/forgot\|\. .SH I get ECONNREFUSED a lot\. What's up? .P Either the registry is down, or node's DNS isn't able to reach out\. @@ -350,20 +350,48 @@ You can also often get a faster response by visiting the #npm channel on Freenode IRC\. .SH Why no namespaces? .P -Please see this discussion: https://github\.com/npm/npm/issues/798 +npm has only one global namespace\. If you want to namespace your own packages, +you may: simply use the \fB\-\fR character to separate the names or use scoped +packages\. npm is a mostly anarchic system\. There is not sufficient need to +impose namespace rules on everyone\. .P -tl;dr \- It doesn't actually make things better, and can make them worse\. +As of 2\.0, npm supports scoped packages, which allow you to publish a group of +related modules without worrying about name collisions\. .P -If you want to namespace your own packages, you may: simply use the -\fB\-\fR character to separate the names\. npm is a mostly anarchic system\. -There is not sufficient need to impose namespace rules on everyone\. +Every npm user owns the scope associated with their username\. For example, the +user named \fBnpm\fR owns the scope \fB@npm\fR\|\. Scoped packages are published inside a +scope by naming them as if they were files under the scope directory, e\.g\., by +setting \fBname\fR in \fBpackage\.json\fR to \fB@npm/npm\fR\|\. +.P +Scoped packages are supported by the public npm registry\. The npm client is +backwards\-compatible with un\-scoped registries, so it can be used to work with +scoped and un\-scoped registries at the same time\. +.P +Unscoped packages can only depend on other unscoped packages\. Scoped packages +can depend on packages from their own scope, a different scope, or the public +registry (unscoped)\. +.P +For the current documentation of scoped packages, see +https://docs\.npmjs\.com/misc/scope +.P +References: +.RS 0 +.IP 1. 3 +For the reasoning behind the "one global namespace", please see this +discussion: https://github\.com/npm/npm/issues/798 (TL;DR: It doesn't +actually make things better, and can make them worse\.) +.IP 2. 3 +For the pre\-implementation discussion of the scoped package feature, see +this discussion: https://github\.com/npm/npm/issues/5239 + +.RE .SH Who does npm? .P npm was originally written by Isaac Z\. Schlueter, and many others have contributed to it, some of them quite substantially\. .P The npm open source project, The npm Registry, and the community -website \fIhttps://www\.npmjs\.org\fR are maintained and operated by the +website \fIhttps://www\.npmjs\.com\fR are maintained and operated by the good folks at npm, Inc\. \fIhttp://www\.npmjs\.com\fR .SH I have a question or request not addressed here\. Where should I put it? .P diff --git a/deps/npm/man/man7/npm-index.7 b/deps/npm/man/man7/npm-index.7 index 442815a2e52..413e94b66eb 100644 --- a/deps/npm/man/man7/npm-index.7 +++ b/deps/npm/man/man7/npm-index.7 @@ -1,15 +1,18 @@ -.TH "NPM\-INDEX" "7" "October 2014" "" "" +.TH "NPM\-INDEX" "7" "June 2015" "" "" .SH "NAME" \fBnpm-index\fR \- Index of all npm documentation .SS npm help README .P -node package manager +a JavaScript package manager .SH Command Line Documentation .P Using npm on the command line .SS npm help npm .P -node package manager +javascript package manager +.SS npm help access +.P +Set access level on published packages .SS npm help adduser .P Add a registry user account @@ -40,6 +43,9 @@ Reduce duplication .SS npm help deprecate .P Deprecate a version of a package +.SS npm help dist\-tag +.P +Modify package distribution tags .SS npm help docs .P Docs for a package in a web browser maybe @@ -64,6 +70,9 @@ Install a package .SS npm help link .P Symlink a package folder +.SS npm help logout +.P +Log out of the registry .SS npm help ls .P List installed packages @@ -93,7 +102,7 @@ Rebuild a package Open package repository page in the browser .SS npm help restart .P -Start a package +Restart a package .SS npm help rm .P Remove a package @@ -150,7 +159,7 @@ Display npm username Using npm in your Node programs .SS npm apihelp npm .P -node package manager +javascript package manager .SS npm apihelp bin .P Display npm bin folder @@ -222,7 +231,7 @@ Rebuild a package Open package repository page in the browser .SS npm apihelp restart .P -Start a package +Restart a package .SS npm apihelp root .P Display npm root diff --git a/deps/npm/man/man7/npm-registry.7 b/deps/npm/man/man7/npm-registry.7 index 9de209d468f..7a52caced21 100644 --- a/deps/npm/man/man7/npm-registry.7 +++ b/deps/npm/man/man7/npm-registry.7 @@ -1,4 +1,4 @@ -.TH "NPM\-REGISTRY" "7" "October 2014" "" "" +.TH "NPM\-REGISTRY" "7" "June 2015" "" "" .SH "NAME" \fBnpm-registry\fR \- The JavaScript Package Registry .SH DESCRIPTION @@ -30,9 +30,10 @@ similar) design doc to implement the APIs\. If you set up continuous replication from the official CouchDB, and then set your internal CouchDB as the registry config, then you'll be able to read any published packages, in addition to your private ones, and by -default will only publish internally\. If you then want to publish a -package for the whole world to see, you can simply override the -\fB\-\-registry\fR config for that command\. +default will only publish internally\. +.P +If you then want to publish a package for the whole world to see, you can +simply override the \fB\-\-registry\fR option for that \fBpublish\fR command\. .SH I don't want my package published in the official registry\. It's private\. .P Set \fB"private": true\fR in your package\.json to prevent it from being @@ -52,7 +53,7 @@ No, but it's way easier\. Basically, yes, you do, or you have to effectively implement the entire CouchDB API anyway\. .SH Is there a website or something to see package docs and such? .P -Yes, head over to https://npmjs\.org/ +Yes, head over to https://npmjs\.com/ .SH SEE ALSO .RS 0 .IP \(bu 2 diff --git a/deps/npm/man/man7/npm-scope.7 b/deps/npm/man/man7/npm-scope.7 index f876e4eaaa6..29586c7a739 100644 --- a/deps/npm/man/man7/npm-scope.7 +++ b/deps/npm/man/man7/npm-scope.7 @@ -1,4 +1,4 @@ -.TH "NPM\-SCOPE" "7" "October 2014" "" "" +.TH "NPM\-SCOPE" "7" "June 2015" "" "" .SH "NAME" \fBnpm-scope\fR \- Scoped packages .SH DESCRIPTION @@ -17,9 +17,9 @@ followed by a slash, e\.g\. Scopes are a way of grouping related packages together, and also affect a few things about the way npm treats the package\. .P -\fBAs of 2014\-09\-03, scoped packages are not supported by the public npm registry\fR\|\. -However, the npm client is backwards\-compatible with un\-scoped registries, so -it can be used to work with scoped and un\-scoped registries at the same time\. +Scoped packages are supported by the public npm registry\. The npm +client is backwards\-compatible with un\-scoped registries, so it can be +used to work with scoped and un\-scoped registries at the same time\. .SH Installing scoped packages .P Scoped packages are installed to a sub\-folder of the regular installation @@ -64,10 +64,27 @@ There is nothing special about the way Node treats scope folders, this is just specifying to require the module \fBmypackage\fR in the folder called \fB@myorg\fR\|\. .SH Publishing scoped packages .P -Scoped packages can be published to any registry that supports them\. -\fIAs of 2014\-09\-03, the public npm registry does not support scoped packages\fR, -so attempting to publish a scoped package to the registry will fail unless -you have associated that scope with a different registry, see below\. +Scoped packages can be published to any registry that supports them, including +the public npm registry\. +.P +(As of 2015\-04\-19, the public npm registry \fBdoes\fR support scoped packages) +.P +If you wish, you may associate a scope with a registry; see below\. +.SS Publishing public scoped packages to the public npm registry +.P +To publish a public scoped package, you must specify \fB\-\-access public\fR with +the initial publication\. This will publish the package and set access +to \fBpublic\fR as if you had run \fBnpm access public\fR after publishing\. +.SS Publishing private scoped packages to the npm registry +.P +To publish a private scoped package to the npm registry, you must have +an npm Private Modules \fIhttps://www\.npmjs\.com/private\-modules\fR +account\. +.P +You can then publish the module with \fBnpm publish\fR or \fBnpm publish +\-\-access restricted\fR, and it will be present in the npm registry, with +restricted access\. You can then change the access permissions, if +desired, with \fBnpm access\fR or on the npmjs\.com website\. .SH Associating a scope with a registry .P Scopes can be associated with a separate registry\. This allows you to @@ -103,6 +120,8 @@ that registry instead\. npm help install .IP \(bu 2 npm help publish +.IP \(bu 2 +npm help access .RE diff --git a/deps/npm/man/man7/npm-scripts.7 b/deps/npm/man/man7/npm-scripts.7 index 9d11f4626cb..cdd740396e8 100644 --- a/deps/npm/man/man7/npm-scripts.7 +++ b/deps/npm/man/man7/npm-scripts.7 @@ -1,4 +1,4 @@ -.TH "NPM\-SCRIPTS" "7" "October 2014" "" "" +.TH "NPM\-SCRIPTS" "7" "June 2015" "" "" .SH "NAME" \fBnpm-scripts\fR \- How npm handles the "scripts" field .SH DESCRIPTION @@ -26,11 +26,11 @@ Run BEFORE the package is uninstalled\. postuninstall: Run AFTER the package is uninstalled\. .IP \(bu 2 -preupdate: -Run BEFORE the package is updated with the update command\. +preversion, version: +Run BEFORE bump the package version\. .IP \(bu 2 -update, postupdate: -Run AFTER the package is updated with the update command\. +postversion: +Run AFTER bump the package version\. .IP \(bu 2 pretest, test, posttest: Run by the \fBnpm test\fR command\. @@ -51,53 +51,31 @@ Additionally, arbitrary scripts can be executed by running \fBnpm run\-script \fR\|\. \fIPre\fR and \fIpost\fR commands with matching names will be run for those as well (e\.g\. \fBpremyscript\fR, \fBmyscript\fR, \fBpostmyscript\fR)\. -.SH NOTE: INSTALL SCRIPTS ARE AN ANTIPATTERN -.P -\fBtl;dr\fR Don't use \fBinstall\fR\|\. Use a \fB\|\.gyp\fR file for compilation, and -\fBprepublish\fR for anything else\. -.P -You should almost never have to explicitly set a \fBpreinstall\fR or -\fBinstall\fR script\. If you are doing this, please consider if there is -another option\. -.P -The only valid use of \fBinstall\fR or \fBpreinstall\fR scripts is for -compilation which must be done on the target architecture\. In early -versions of node, this was often done using the \fBnode\-waf\fR scripts, or -a standalone \fBMakefile\fR, and early versions of npm required that it be -explicitly set in package\.json\. This was not portable, and harder to -do properly\. -.P -In the current version of node, the standard way to do this is using a -\fB\|\.gyp\fR file\. If you have a file with a \fB\|\.gyp\fR extension in the root -of your package, then npm will run the appropriate \fBnode\-gyp\fR commands -automatically at install time\. This is the only officially supported -method for compiling binary addons, and does not require that you add -anything to your package\.json file\. -.P -If you have to do other things before your package is used, in a way +.SH COMMON USES +.P +If you need to perform operations on your package before it is used, in a way that is not dependent on the operating system or architecture of the -target system, then use a \fBprepublish\fR script instead\. This includes +target system, use a \fBprepublish\fR script\. This includes tasks such as: .RS 0 .IP \(bu 2 -Compile CoffeeScript source code into JavaScript\. +Compiling CoffeeScript source code into JavaScript\. .IP \(bu 2 -Create minified versions of JavaScript source code\. +Creating minified versions of JavaScript source code\. .IP \(bu 2 Fetching remote resources that your package will use\. .RE .P -The advantage of doing these things at \fBprepublish\fR time instead of -\fBpreinstall\fR or \fBinstall\fR time is that they can be done once, in a -single place, and thus greatly reduce complexity and variability\. +The advantage of doing these things at \fBprepublish\fR time is that they can be done once, in a +single place, thus reducing complexity and variability\. Additionally, this means that: .RS 0 .IP \(bu 2 You can depend on \fBcoffee\-script\fR as a \fBdevDependency\fR, and thus your users don't need to have it installed\. .IP \(bu 2 -You don't need to include the minifiers in your package, reducing +You don't need to include minifiers in your package, reducing the size for your users\. .IP \(bu 2 You don't need to rely on your users having \fBcurl\fR or \fBwget\fR or @@ -281,6 +259,12 @@ probably set it up that way for a reason\. Don't prefix your script commands with "sudo"\. If root permissions are required for some reason, then it'll fail with that error, and the user will sudo the npm command in question\. +.IP \(bu 2 +Don't use \fBinstall\fR\|\. Use a \fB\|\.gyp\fR file for compilation, and \fBprepublish\fR +for anything else\. You should almost never have to explicitly set a +preinstall or install script\. If you are doing this, please consider if +there is another option\. The only valid use of \fBinstall\fR or \fBpreinstall\fR +scripts is for compilation which must be done on the target architecture\. .RE .SH SEE ALSO diff --git a/deps/npm/man/man7/removing-npm.7 b/deps/npm/man/man7/removing-npm.7 index b0a4fca5d7c..61426f8b9fe 100644 --- a/deps/npm/man/man7/removing-npm.7 +++ b/deps/npm/man/man7/removing-npm.7 @@ -1,4 +1,4 @@ -.TH "NPM\-REMOVAL" "1" "October 2014" "" "" +.TH "NPM\-REMOVAL" "1" "June 2015" "" "" .SH "NAME" \fBnpm-removal\fR \- Cleaning the Slate .SH SYNOPSIS diff --git a/deps/npm/man/man7/semver.7 b/deps/npm/man/man7/semver.7 index a6be932b474..cac3ad61719 100644 --- a/deps/npm/man/man7/semver.7 +++ b/deps/npm/man/man7/semver.7 @@ -1,4 +1,4 @@ -.TH "SEMVER" "7" "October 2014" "" "" +.TH "SEMVER" "7" "June 2015" "" "" .SH "NAME" \fBsemver\fR \- The semantic versioner for npm .SH Usage @@ -22,12 +22,12 @@ As a command\-line utility: .nf $ semver \-h -Usage: semver [ [\.\.\.]] [\-r | \-i | \-d ] +Usage: semver [ [\.\.\.]] [\-r | \-i | \-\-preid | \-l | \-rv] Test if version(s) satisfy the supplied range(s), and sort them\. Multiple versions or ranges may be supplied, unless increment -or decrement options are specified\. In that case, only a single -version may be used, and it is incremented by the specified level +option is specified\. In that case, only a single version may +be used, and it is incremented by the specified level Program exits successfully if any valid version satisfies all supplied ranges, and prints all satisfying versions\. @@ -112,6 +112,35 @@ alpha/beta/rc versions\. By including a prerelease tag in the range, the user is indicating that they are aware of the risk\. However, it is still not appropriate to assume that they have opted into taking a similar risk on the \fInext\fR set of prerelease versions\. +.SS Prerelease Identifiers +.P +The method \fB\|\.inc\fR takes an additional \fBidentifier\fR string argument that +will append the value of the string as a prerelease identifier: +.P +.RS 2 +.nf +> semver\.inc('1\.2\.3', 'pre', 'beta') +\|'1\.2\.4\-beta\.0' +.fi +.RE +.P +command\-line example: +.P +.RS 2 +.nf +$ semver 1\.2\.3 \-i prerelease \-\-preid beta +1\.2\.4\-beta\.0 +.fi +.RE +.P +Which then can be used to increment further: +.P +.RS 2 +.nf +$ semver 1\.2\.4\-beta\.0 \-i prerelease +1\.2\.4\-beta\.1 +.fi +.RE .SS Advanced Range Syntax .P Advanced range syntax desugars to primitive comparators in @@ -197,8 +226,6 @@ equal to \fBbeta\.2\fR\|\. So, \fB1\.2\.3\-beta\.4\fR would be allowed, but different \fB[major, minor, patch]\fR tuple\. .RE -.P -Note: this is the same as the \fB~>\fR operator in rubygems\. .SS Caret Ranges \fB^1\.2\.3\fR \fB^0\.2\.5\fR \fB^0\.0\.4\fR .P Allows changes that do not modify the left\-most non\-zero digit in the @@ -284,6 +311,12 @@ prerelease\. If the input version is already a prerelease it simply increments it\. .RE +.IP \(bu 2 +\fBmajor(v)\fR: Return the major version number\. +.IP \(bu 2 +\fBminor(v)\fR: Return the minor version number\. +.IP \(bu 2 +\fBpatch(v)\fR: Return the patch version number\. .RE .SS Comparison @@ -313,6 +346,10 @@ invalid comparison string is provided\. .IP \(bu 2 \fBrcompare(v1, v2)\fR: The reverse of compare\. Sorts an array of versions in descending order when passed to \fBArray\.sort()\fR\|\. +.IP \(bu 2 +\fBdiff(v1, v2)\fR: Returns difference between two versions by the release type +(\fBmajor\fR, \fBpremajor\fR, \fBminor\fR, \fBpreminor\fR, \fBpatch\fR, \fBprepatch\fR, or \fBprerelease\fR), +or null if the versions are the same\. .RE .SS Ranges diff --git a/deps/npm/node_modules/abbrev/.npmignore b/deps/npm/node_modules/abbrev/.npmignore new file mode 100644 index 00000000000..9d6cd2f025d --- /dev/null +++ b/deps/npm/node_modules/abbrev/.npmignore @@ -0,0 +1,4 @@ +.nyc_output +nyc_output +node_modules +coverage diff --git a/deps/npm/node_modules/abbrev/.travis.yml b/deps/npm/node_modules/abbrev/.travis.yml new file mode 100644 index 00000000000..991d04b6e22 --- /dev/null +++ b/deps/npm/node_modules/abbrev/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - '0.10' + - '0.12' + - 'iojs' diff --git a/deps/npm/node_modules/abbrev/LICENSE b/deps/npm/node_modules/abbrev/LICENSE index 05a4010949c..19129e315fe 100644 --- a/deps/npm/node_modules/abbrev/LICENSE +++ b/deps/npm/node_modules/abbrev/LICENSE @@ -1,23 +1,15 @@ -Copyright 2009, 2010, 2011 Isaac Z. Schlueter. -All rights reserved. +The ISC License -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: +Copyright (c) Isaac Z. Schlueter and Contributors -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/abbrev/package.json b/deps/npm/node_modules/abbrev/package.json index bac363a1888..9b71f630b71 100644 --- a/deps/npm/node_modules/abbrev/package.json +++ b/deps/npm/node_modules/abbrev/package.json @@ -1,6 +1,6 @@ { "name": "abbrev", - "version": "1.0.5", + "version": "1.0.7", "description": "Like ruby's abbrev module, but in js", "author": { "name": "Isaac Z. Schlueter", @@ -8,27 +8,33 @@ }, "main": "abbrev.js", "scripts": { - "test": "node test.js" + "test": "tap test.js --cov" }, "repository": { "type": "git", - "url": "http://github.com/isaacs/abbrev-js" + "url": "git+ssh://git@github.com/isaacs/abbrev-js.git" }, - "license": { - "type": "MIT", - "url": "https://github.com/isaacs/abbrev-js/raw/master/LICENSE" + "license": "ISC", + "devDependencies": { + "tap": "^1.2.0" }, + "gitHead": "821d09ce7da33627f91bbd8ed631497ed6f760c2", "bugs": { "url": "https://github.com/isaacs/abbrev-js/issues" }, - "homepage": "https://github.com/isaacs/abbrev-js", - "_id": "abbrev@1.0.5", - "_shasum": "5d8257bd9ebe435e698b2fa431afde4fe7b10b03", - "_from": "abbrev@latest", - "_npmVersion": "1.4.7", + "homepage": "https://github.com/isaacs/abbrev-js#readme", + "_id": "abbrev@1.0.7", + "_shasum": "5b6035b2ee9d4fb5cf859f08a9be81b208491843", + "_from": "abbrev@>=1.0.7 <1.1.0", + "_npmVersion": "2.10.1", + "_nodeVersion": "2.0.1", "_npmUser": { "name": "isaacs", - "email": "i@izs.me" + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "5b6035b2ee9d4fb5cf859f08a9be81b208491843", + "tarball": "http://registry.npmjs.org/abbrev/-/abbrev-1.0.7.tgz" }, "maintainers": [ { @@ -36,10 +42,6 @@ "email": "i@izs.me" } ], - "dist": { - "shasum": "5d8257bd9ebe435e698b2fa431afde4fe7b10b03", - "tarball": "http://registry.npmjs.org/abbrev/-/abbrev-1.0.5.tgz" - }, "directories": {}, - "_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.5.tgz" + "_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.7.tgz" } diff --git a/deps/npm/node_modules/abbrev/test.js b/deps/npm/node_modules/abbrev/test.js index d5a7303ed69..eb30e421cb9 100644 --- a/deps/npm/node_modules/abbrev/test.js +++ b/deps/npm/node_modules/abbrev/test.js @@ -2,7 +2,7 @@ var abbrev = require('./abbrev.js') var assert = require("assert") var util = require("util") -console.log("TAP Version 13") +console.log("TAP version 13") var count = 0 function test (list, expect) { @@ -44,4 +44,4 @@ test(["a", "ab", "abc", "abcd", "abcde", "acde"], , acde: 'acde' }) -console.log("0..%d", count) +console.log("1..%d", count) diff --git a/deps/npm/node_modules/ansi-regex/index.js b/deps/npm/node_modules/ansi-regex/index.js new file mode 100644 index 00000000000..2fcdd1e472f --- /dev/null +++ b/deps/npm/node_modules/ansi-regex/index.js @@ -0,0 +1,4 @@ +'use strict'; +module.exports = function () { + return /(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/g; +}; diff --git a/deps/npm/node_modules/ansi-regex/license b/deps/npm/node_modules/ansi-regex/license new file mode 100644 index 00000000000..654d0bfe943 --- /dev/null +++ b/deps/npm/node_modules/ansi-regex/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.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/deps/npm/node_modules/ansi-regex/package.json b/deps/npm/node_modules/ansi-regex/package.json new file mode 100644 index 00000000000..68962d0f16a --- /dev/null +++ b/deps/npm/node_modules/ansi-regex/package.json @@ -0,0 +1,86 @@ +{ + "name": "ansi-regex", + "version": "1.1.1", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/ansi-regex" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha test/test.js", + "view-supported": "node test/viewCodes.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "mocha": "*" + }, + "gitHead": "47fb974630af70998157b30fad6eb5e5bd7c7cd6", + "bugs": { + "url": "https://github.com/sindresorhus/ansi-regex/issues" + }, + "homepage": "https://github.com/sindresorhus/ansi-regex", + "_id": "ansi-regex@1.1.1", + "_shasum": "41c847194646375e6a1a5d10c3ca054ef9fc980d", + "_from": "ansi-regex@>=1.1.1 <1.2.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + }, + "dist": { + "shasum": "41c847194646375e6a1a5d10c3ca054ef9fc980d", + "tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/readme.md b/deps/npm/node_modules/ansi-regex/readme.md similarity index 100% rename from deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/readme.md rename to deps/npm/node_modules/ansi-regex/readme.md diff --git a/deps/npm/node_modules/async-some/LICENSE b/deps/npm/node_modules/async-some/LICENSE new file mode 100644 index 00000000000..d21147bf196 --- /dev/null +++ b/deps/npm/node_modules/async-some/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2014-2015, Forrest L Norvell + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/async-some/package.json b/deps/npm/node_modules/async-some/package.json index d32ae73fb2a..b7d5521e58d 100644 --- a/deps/npm/node_modules/async-some/package.json +++ b/deps/npm/node_modules/async-some/package.json @@ -1,6 +1,6 @@ { "name": "async-some", - "version": "1.0.1", + "version": "1.0.2", "description": "short-circuited, asynchronous version of Array.protototype.some", "main": "some.js", "scripts": { @@ -8,7 +8,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/othiym23/async-some.git" + "url": "git+https://github.com/othiym23/async-some.git" }, "keywords": [ "async", @@ -27,31 +27,15 @@ }, "homepage": "https://github.com/othiym23/async-some", "dependencies": { - "dezalgo": "^1.0.0" + "dezalgo": "^1.0.2" }, "devDependencies": { - "tap": "^0.4.11" - }, - "gitHead": "e73d6d1fbc03cca5a0d54f456f39bab294a4c7b7", - "_id": "async-some@1.0.1", - "_shasum": "8b54f08d46f0f9babc72ea9d646c245d23a4d9e5", - "_from": "async-some@>=1.0.1-0 <2.0.0-0", - "_npmVersion": "1.5.0-pre", - "_npmUser": { - "name": "othiym23", - "email": "ogd@aoaioxxysz.net" - }, - "maintainers": [ - { - "name": "othiym23", - "email": "ogd@aoaioxxysz.net" - } - ], - "dist": { - "shasum": "8b54f08d46f0f9babc72ea9d646c245d23a4d9e5", - "tarball": "http://registry.npmjs.org/async-some/-/async-some-1.0.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/async-some/-/async-some-1.0.1.tgz", - "readme": "ERROR: No README data found!" + "tap": "^1.1.0" + }, + "readme": "# some\n\nShort-circuited async Array.prototype.some implementation.\n\nSerially evaluates a list of values from a JS array or arraylike\nagainst an asynchronous predicate, terminating on the first truthy\nvalue. If the predicate encounters an error, pass it to the completion\ncallback. Otherwise, pass the truthy value passed by the predicate, or\n`false` if no truthy value was passed.\n\nIs\n[Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony)-proof,\nbrowser-safe, and pretty efficient.\n\n## Usage\n\n```javascript\nvar some = require(\"async-some\");\nvar resolve = require(\"path\").resolve;\nvar stat = require(\"fs\").stat;\nvar readFileSync = require(\"fs\").readFileSync;\n\nsome([\"apple\", \"seaweed\", \"ham\", \"quince\"], porkDetector, function (error, match) {\n if (error) return console.error(error);\n\n if (match) return console.dir(JSON.parse(readFileSync(match)));\n\n console.error(\"time to buy more Sporkle™!\");\n});\n\nvar PREFIX = resolve(__dirname, \"../pork_store\");\nfunction porkDetector(value, cb) {\n var path = resolve(PREFIX, value + \".json\");\n stat(path, function (er, stat) {\n if (er) {\n if (er.code === \"ENOENT\") return cb(null, false);\n\n return cb(er);\n }\n\n cb(er, path);\n });\n}\n```\n\n### some(list, test, callback)\n\n* `list` {Object} An arraylike (either an Array or the arguments arraylike) to\n be checked.\n* `test` {Function} The predicate against which the elements of `list` will be\n tested. Takes two parameters:\n * `element` {any} The element of the list to be tested.\n * `callback` {Function} The continuation to be called once the test is\n complete. Takes (again) two values:\n * `error` {Error} Any errors that the predicate encountered.\n * `value` {any} A truthy value. A non-falsy result terminates checking the\n entire list.\n* `callback` {Function} The callback to invoke when either a value has been\n found or the entire input list has been processed with no result. Is invoked\n with the traditional two parameters:\n * `error` {Error} Errors that were encountered during the evaluation of some().\n * `match` {any} Value successfully matched by `test`, if any.\n", + "readmeFilename": "README.md", + "gitHead": "3a5086ad54739c48b2bbf073f23bcc95658199e3", + "_id": "async-some@1.0.2", + "_shasum": "4d8a81620d5958791b5b98f802d3207776e95509", + "_from": "async-some@>=1.0.2 <1.1.0" } diff --git a/deps/npm/node_modules/block-stream/LICENSE b/deps/npm/node_modules/block-stream/LICENSE new file mode 100644 index 00000000000..19129e315fe --- /dev/null +++ b/deps/npm/node_modules/block-stream/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/block-stream/package.json b/deps/npm/node_modules/block-stream/package.json index ef011677285..80227bb69ed 100644 --- a/deps/npm/node_modules/block-stream/package.json +++ b/deps/npm/node_modules/block-stream/package.json @@ -6,7 +6,7 @@ }, "name": "block-stream", "description": "a stream of blocks", - "version": "0.0.7", + "version": "0.0.8", "repository": { "type": "git", "url": "git://github.com/isaacs/block-stream.git" @@ -24,12 +24,31 @@ "scripts": { "test": "tap test/" }, - "license": "BSD", - "readme": "# block-stream\n\nA stream of blocks.\n\nWrite data into it, and it'll output data in buffer blocks the size you\nspecify, padding with zeroes if necessary.\n\n```javascript\nvar block = new BlockStream(512)\nfs.createReadStream(\"some-file\").pipe(block)\nblock.pipe(fs.createWriteStream(\"block-file\"))\n```\n\nWhen `.end()` or `.flush()` is called, it'll pad the block with zeroes.\n", - "readmeFilename": "README.md", + "license": "ISC", + "gitHead": "b35520314f4763af0788d65a846bb43d9c0a8f02", "bugs": { "url": "https://github.com/isaacs/block-stream/issues" }, - "_id": "block-stream@0.0.7", - "_from": "block-stream@latest" + "homepage": "https://github.com/isaacs/block-stream#readme", + "_id": "block-stream@0.0.8", + "_shasum": "0688f46da2bbf9cff0c4f68225a0cb95cbe8a46b", + "_from": "block-stream@0.0.8", + "_npmVersion": "2.10.0", + "_nodeVersion": "2.0.1", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "0688f46da2bbf9cff0c4f68225a0cb95cbe8a46b", + "tarball": "http://registry.npmjs.org/block-stream/-/block-stream-0.0.8.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.8.tgz" } diff --git a/deps/npm/node_modules/child-process-close/README.md b/deps/npm/node_modules/child-process-close/README.md deleted file mode 100644 index ac6c1840f04..00000000000 --- a/deps/npm/node_modules/child-process-close/README.md +++ /dev/null @@ -1,45 +0,0 @@ - -# child-process-close - -This module makes child process objects, (created with `spawn`, `fork`, `exec` -or `execFile`) emit the `close` event in node v0.6 like they do in node v0.8. -This makes it easier to write code that works correctly on both version of -node. - - -## Usage - -Just make sure to `require('child-process-close')` anywhere. It will patch the `child_process` module. - -```js -require('child-process-close'); -var spawn = require('child_process').spawn; - -var cp = spawn('foo'); -cp.on('close', function(exitCode, signal) { - // This now works on all node versions. -}); -``` - - -## License - -Copyright (C) 2012 Bert Belder - -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/deps/npm/node_modules/child-process-close/index.js b/deps/npm/node_modules/child-process-close/index.js deleted file mode 100644 index 562516a323d..00000000000 --- a/deps/npm/node_modules/child-process-close/index.js +++ /dev/null @@ -1,48 +0,0 @@ - -var child_process = require('child_process'); - -// Re-export the child_process module. -module.exports = child_process; - -// Only node versions up to v0.7.6 need this hook. -if (!/^v0\.([0-6]\.|7\.[0-6](\D|$))/.test(process.version)) - return; - -// Do not add the hook if already hooked. -if (child_process.hasOwnProperty('_exit_hook')) - return; - -// Version the hook in case there is ever the need to release a 0.2.0. -child_process._exit_hook = 1; - - -function hook(name) { - var orig = child_process[name]; - - // Older node versions may not have all functions, e.g. fork(). - if (!orig) - return; - - // Store the unhooked version. - child_process['_original_' + name] = orig; - - // Do the actual hooking. - child_process[name] = function() { - var child = orig.apply(this, arguments); - - child.once('exit', function(code, signal) { - process.nextTick(function() { - child.emit('close', code, signal); - }); - }); - - return child; - } -} - -hook('spawn'); -hook('fork'); -hook('execFile'); - -// Don't hook 'exec': it calls `exports.execFile` internally, so hooking it -// would trigger the close event twice. diff --git a/deps/npm/node_modules/child-process-close/package.json b/deps/npm/node_modules/child-process-close/package.json deleted file mode 100644 index 23b19e0104d..00000000000 --- a/deps/npm/node_modules/child-process-close/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "child-process-close", - "version": "0.1.1", - "description": "Make child_process objects emit 'close' events in node v0.6 like they do in v0.8. This makes it easier to write code that works correctly on both version of node.", - "main": "index.js", - "scripts": { - "test": "node test/test.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/piscisaureus/child-process-close.git" - }, - "keywords": [ - "child_process", - "spawn", - "fork", - "exec", - "execFile", - "close", - "exit" - ], - "author": { - "name": "Bert Belder" - }, - "license": "MIT", - "readme": "\n# child-process-close\n\nThis module makes child process objects, (created with `spawn`, `fork`, `exec`\nor `execFile`) emit the `close` event in node v0.6 like they do in node v0.8.\nThis makes it easier to write code that works correctly on both version of\nnode.\n\n\n## Usage\n\nJust make sure to `require('child-process-close')` anywhere. It will patch the `child_process` module.\n\n```js\nrequire('child-process-close');\nvar spawn = require('child_process').spawn;\n\nvar cp = spawn('foo');\ncp.on('close', function(exitCode, signal) {\n // This now works on all node versions.\n});\n```\n\n\n## License\n\nCopyright (C) 2012 Bert Belder\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies 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\nTHE SOFTWARE.\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/piscisaureus/child-process-close/issues" - }, - "_id": "child-process-close@0.1.1", - "dist": { - "shasum": "c1909c6c3bbcea623e3bd74493ddb1c94c47c500" - }, - "_from": "child-process-close@", - "_resolved": "https://registry.npmjs.org/child-process-close/-/child-process-close-0.1.1.tgz" -} diff --git a/deps/npm/node_modules/child-process-close/test/test-exec.js b/deps/npm/node_modules/child-process-close/test/test-exec.js deleted file mode 100644 index 5072d02951c..00000000000 --- a/deps/npm/node_modules/child-process-close/test/test-exec.js +++ /dev/null @@ -1,50 +0,0 @@ - -require('../index'); - -var assert = require('assert'), - exec = require('child_process').exec; - -var cp = exec('echo hello', function(err) { - assert(!err); -}); - -var stdoutData = '', - stdoutEnd = false, - gotExit = false, - gotClose = false; - -cp.stdout.setEncoding('ascii'); - -cp.stdout.on('data', function(data) { - assert(!stdoutEnd); - stdoutData += data; -}); - -cp.stdout.on('end', function() { - assert(!stdoutEnd); - assert(/^hello/.test(stdoutData)); - stdoutEnd = true; -}); - -cp.on('exit', function(code, signal) { - assert.strictEqual(code, 0); - assert(!signal); - assert(!gotExit); - assert(!gotClose); - gotExit = true; -}); - -cp.on('close', function(code, signal) { - assert.strictEqual(code, 0); - assert(!signal); - assert(gotExit); - assert(stdoutEnd); - assert(!gotClose); - gotClose = true; -}); - -process.on('exit', function() { - assert(stdoutEnd); - assert(gotExit); - assert(gotClose); -}); diff --git a/deps/npm/node_modules/child-process-close/test/test-fork.js b/deps/npm/node_modules/child-process-close/test/test-fork.js deleted file mode 100644 index 9743c028e43..00000000000 --- a/deps/npm/node_modules/child-process-close/test/test-fork.js +++ /dev/null @@ -1,41 +0,0 @@ - -require('../index'); - -var assert = require('assert'), - fork = require('child_process').fork; - -var cp = fork('worker-fork'); - -var gotMessage = false, - gotExit = false, - gotClose = false; - -cp.on('message', function(msg) { - assert.strictEqual(msg, 'hello'); - assert(!gotMessage); - assert(!gotClose); - gotMessage = true; -}); - -cp.on('exit', function(code, signal) { - assert.strictEqual(code, 0); - assert(!signal); - assert(!gotExit); - assert(!gotClose); - gotExit = true; -}); - -cp.on('close', function(code, signal) { - assert.strictEqual(code, 0); - assert(!signal); - assert(gotExit); - assert(gotMessage); - assert(!gotClose); - gotClose = true; -}); - -process.on('exit', function() { - assert(gotMessage); - assert(gotExit); - assert(gotClose); -}); diff --git a/deps/npm/node_modules/child-process-close/test/test-spawn-and-execfile.js b/deps/npm/node_modules/child-process-close/test/test-spawn-and-execfile.js deleted file mode 100644 index 82f9fa978b8..00000000000 --- a/deps/npm/node_modules/child-process-close/test/test-spawn-and-execfile.js +++ /dev/null @@ -1,73 +0,0 @@ - -require('../index'); - -var assert = require('assert'), - spawn = require('child_process').spawn; - execFile = require('child_process').execFile; - - -var cp1 = spawn(process.execPath, ['worker-spawn']); -check(cp1); - -var cp2 = execFile(process.execPath, ['worker-spawn'], function(err) { - assert(!err); -}); -check(cp2); - - -function check(cp) { - var gotExit = false, - gotClose = false, - stdoutData = '', - stdoutEnd = false, - stderrData = '', - stderrEnd = false; - - cp.stdout.setEncoding('ascii'); - - cp.stdout.on('data', function(data) { - assert(!stdoutEnd); - stdoutData += data; - }); - - cp.stdout.on('end', function(data) { - assert(!stdoutEnd) - assert.strictEqual(stdoutData.length, 100000); - stdoutEnd = true; - }); - - cp.stderr.setEncoding('ascii'); - - cp.stderr.on('data', function(data) { - stderrData += data; - }); - - cp.stderr.on('end', function(data) { - assert(!stderrEnd) - assert.strictEqual(stderrData.length, 100000); - stderrEnd = true; - }); - - cp.on('exit', function(code, signal) { - assert.strictEqual(code, 0); - assert(!signal); - assert(!gotExit); - assert(!gotClose); - gotExit = true; - }); - - cp.on('close', function(code, signal) { - assert.strictEqual(code, 0); - assert(!signal); - assert(!cp.stdout || stdoutEnd); - assert(!cp.stderr || stderrEnd); - assert(gotExit); - assert(!gotClose); - gotClose = true; - }); - - process.on('exit', function() { - assert(gotExit); - assert(gotClose); - }); -} diff --git a/deps/npm/node_modules/child-process-close/test/test.js b/deps/npm/node_modules/child-process-close/test/test.js deleted file mode 100644 index 99047452dee..00000000000 --- a/deps/npm/node_modules/child-process-close/test/test.js +++ /dev/null @@ -1,41 +0,0 @@ - -var TESTS = [ - 'test-spawn-and-execfile', - 'test-fork', - 'test-exec', -]; - -var execFile = require('child_process').execFile; -var passed = 0, failed = 0; - -function next() { - var test = TESTS.shift(); - if (!test) - done(); - - console.log("Running test: %s", test); - execFile(process.execPath, [test], { cwd: __dirname }, onExit); -} - -function onExit(err, stdout, stderr) { - if (err) { - console.log("... failed:\n%s%s\n", stdout, stderr); - failed++; - } else { - console.log("... pass"); - passed++; - } - - next(); -} - -function done() { - console.log("Tests run: %d. Passed: %d. Failed: %d", - passed + failed, - passed, - failed); - - process.exit(+(failed > 0)); -} - -next(); diff --git a/deps/npm/node_modules/child-process-close/test/worker-fork.js b/deps/npm/node_modules/child-process-close/test/worker-fork.js deleted file mode 100644 index 56e83ce801a..00000000000 --- a/deps/npm/node_modules/child-process-close/test/worker-fork.js +++ /dev/null @@ -1,3 +0,0 @@ - -process.send('hello'); -process.exit(0); diff --git a/deps/npm/node_modules/child-process-close/test/worker-spawn.js b/deps/npm/node_modules/child-process-close/test/worker-spawn.js deleted file mode 100644 index f45d898194c..00000000000 --- a/deps/npm/node_modules/child-process-close/test/worker-spawn.js +++ /dev/null @@ -1,5 +0,0 @@ - -var out = new Array(100000).join('x'); - -console.log(out); -console.error(out); diff --git a/deps/npm/node_modules/chmodr/LICENSE b/deps/npm/node_modules/chmodr/LICENSE index 0c44ae716db..19129e315fe 100644 --- a/deps/npm/node_modules/chmodr/LICENSE +++ b/deps/npm/node_modules/chmodr/LICENSE @@ -1,27 +1,15 @@ -Copyright (c) Isaac Z. Schlueter ("Author") -All rights reserved. +The ISC License -The BSD License +Copyright (c) Isaac Z. Schlueter and Contributors -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/chmodr/package.json b/deps/npm/node_modules/chmodr/package.json index 67334aefba4..e253434ef45 100644 --- a/deps/npm/node_modules/chmodr/package.json +++ b/deps/npm/node_modules/chmodr/package.json @@ -6,7 +6,7 @@ }, "name": "chmodr", "description": "like `chmod -R`", - "version": "0.1.0", + "version": "0.1.1", "repository": { "type": "git", "url": "git://github.com/isaacs/chmodr.git" @@ -20,9 +20,31 @@ "scripts": { "test": "tap test/*.js" }, - "license": "BSD", - "readme": "Like `chmod -R`.\n\nTakes the same arguments as `fs.chmod()`\n", - "readmeFilename": "README.md", - "_id": "chmodr@0.1.0", - "_from": "chmodr@latest" + "license": "ISC", + "gitHead": "2f301476bc6fc93e47d2ba2e3ab0409f0d0c15ba", + "bugs": { + "url": "https://github.com/isaacs/chmodr/issues" + }, + "homepage": "https://github.com/isaacs/chmodr#readme", + "_id": "chmodr@0.1.1", + "_shasum": "115c8f9ec62be3ef019085782c9448e471560261", + "_from": "chmodr@0.1.1", + "_npmVersion": "2.10.0", + "_nodeVersion": "2.0.1", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "115c8f9ec62be3ef019085782c9448e471560261", + "tarball": "http://registry.npmjs.org/chmodr/-/chmodr-0.1.1.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/chmodr/-/chmodr-0.1.1.tgz" } diff --git a/deps/npm/node_modules/chownr/LICENSE b/deps/npm/node_modules/chownr/LICENSE new file mode 100644 index 00000000000..19129e315fe --- /dev/null +++ b/deps/npm/node_modules/chownr/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/chownr/package.json b/deps/npm/node_modules/chownr/package.json index bb321f8ad56..a551c869ec1 100644 --- a/deps/npm/node_modules/chownr/package.json +++ b/deps/npm/node_modules/chownr/package.json @@ -6,7 +6,7 @@ }, "name": "chownr", "description": "like `chown -R`", - "version": "0.0.1", + "version": "0.0.2", "repository": { "type": "git", "url": "git://github.com/isaacs/chownr.git" @@ -20,23 +20,31 @@ "scripts": { "test": "tap test/*.js" }, - "license": "BSD", + "license": "ISC", + "gitHead": "3cafeb70b2c343e893f710750406b3909ec537cb", + "bugs": { + "url": "https://github.com/isaacs/chownr/issues" + }, + "homepage": "https://github.com/isaacs/chownr#readme", + "_id": "chownr@0.0.2", + "_shasum": "2f9aebf746f90808ce00607b72ba73b41604c485", + "_from": "chownr@0.0.2", + "_npmVersion": "2.10.0", + "_nodeVersion": "2.0.1", "_npmUser": { "name": "isaacs", - "email": "i@izs.me" - }, - "_id": "chownr@0.0.1", - "dependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" + "email": "isaacs@npmjs.com" }, - "_engineSupported": true, - "_npmVersion": "1.1.23", - "_nodeVersion": "v0.7.10-pre", - "_defaultsLoaded": true, "dist": { - "shasum": "51d18189d9092d5f8afd623f3288bfd1c6bf1a62" + "shasum": "2f9aebf746f90808ce00607b72ba73b41604c485", + "tarball": "http://registry.npmjs.org/chownr/-/chownr-0.0.2.tgz" }, - "_from": "../chownr" + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/chownr/-/chownr-0.0.2.tgz" } diff --git a/deps/npm/node_modules/chownr/test/basic.js b/deps/npm/node_modules/chownr/test/basic.js new file mode 100644 index 00000000000..9e4f6bde038 --- /dev/null +++ b/deps/npm/node_modules/chownr/test/basic.js @@ -0,0 +1,84 @@ +if (!process.getuid || !process.getgid) { + throw new Error("Tests require getuid/getgid support") +} + +var curUid = +process.getuid() +, curGid = +process.getgid() +, chownr = require("../") +, test = require("tap").test +, mkdirp = require("mkdirp") +, rimraf = require("rimraf") +, fs = require("fs") + +// sniff the 'id' command for other groups that i can legally assign to +var exec = require("child_process").exec +, groups +, dirs = [] + +exec("id", function (code, output) { + if (code) throw new Error("failed to run 'id' command") + groups = output.trim().split("groups=")[1].split(",").map(function (s) { + return parseInt(s, 10) + }).filter(function (g) { + return g !== curGid + }) + + console.error([curUid, groups[0]], "uid, gid") + + rimraf("/tmp/chownr", function (er) { + if (er) throw er + var cnt = 5 + for (var i = 0; i < 5; i ++) { + mkdirp(getDir(), then) + } + function then (er) { + if (er) throw er + if (-- cnt === 0) { + runTest() + } + } + }) +}) + +function getDir () { + var dir = "/tmp/chownr" + + dir += "/" + Math.floor(Math.random() * Math.pow(16,4)).toString(16) + dirs.push(dir) + dir += "/" + Math.floor(Math.random() * Math.pow(16,4)).toString(16) + dirs.push(dir) + dir += "/" + Math.floor(Math.random() * Math.pow(16,4)).toString(16) + dirs.push(dir) + return dir +} + +function runTest () { + test("should complete successfully", function (t) { + console.error("calling chownr", curUid, groups[0], typeof curUid, typeof groups[0]) + chownr("/tmp/chownr", curUid, groups[0], function (er) { + t.ifError(er) + t.end() + }) + }) + + dirs.forEach(function (dir) { + test("verify "+dir, function (t) { + fs.stat(dir, function (er, st) { + if (er) { + t.ifError(er) + return t.end() + } + t.equal(st.uid, curUid, "uid should be " + curUid) + t.equal(st.gid, groups[0], "gid should be "+groups[0]) + t.end() + }) + }) + }) + + test("cleanup", function (t) { + rimraf("/tmp/chownr/", function (er) { + t.ifError(er) + t.end() + }) + }) +} diff --git a/deps/npm/node_modules/chownr/test/sync.js b/deps/npm/node_modules/chownr/test/sync.js new file mode 100644 index 00000000000..2e26c56aafd --- /dev/null +++ b/deps/npm/node_modules/chownr/test/sync.js @@ -0,0 +1,79 @@ +if (!process.getuid || !process.getgid) { + throw new Error("Tests require getuid/getgid support") +} + +var curUid = +process.getuid() +, curGid = +process.getgid() +, chownr = require("../") +, test = require("tap").test +, mkdirp = require("mkdirp") +, rimraf = require("rimraf") +, fs = require("fs") + +// sniff the 'id' command for other groups that i can legally assign to +var exec = require("child_process").exec +, groups +, dirs = [] + +exec("id", function (code, output) { + if (code) throw new Error("failed to run 'id' command") + groups = output.trim().split("groups=")[1].split(",").map(function (s) { + return parseInt(s, 10) + }).filter(function (g) { + return g !== curGid + }) + + console.error([curUid, groups[0]], "uid, gid") + + rimraf("/tmp/chownr", function (er) { + if (er) throw er + var cnt = 5 + for (var i = 0; i < 5; i ++) { + mkdirp(getDir(), then) + } + function then (er) { + if (er) throw er + if (-- cnt === 0) { + runTest() + } + } + }) +}) + +function getDir () { + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var dir = "/tmp/chownr/" + [x,y,z].join("/") + dirs.push(dir) + return dir +} + +function runTest () { + test("should complete successfully", function (t) { + console.error("calling chownr", curUid, groups[0], typeof curUid, typeof groups[0]) + chownr.sync("/tmp/chownr", curUid, groups[0]) + t.end() + }) + + dirs.forEach(function (dir) { + test("verify "+dir, function (t) { + fs.stat(dir, function (er, st) { + if (er) { + t.ifError(er) + return t.end() + } + t.equal(st.uid, curUid, "uid should be " + curUid) + t.equal(st.gid, groups[0], "gid should be "+groups[0]) + t.end() + }) + }) + }) + + test("cleanup", function (t) { + rimraf("/tmp/chownr/", function (er) { + t.ifError(er) + t.end() + }) + }) +} diff --git a/deps/npm/node_modules/columnify/Makefile b/deps/npm/node_modules/columnify/Makefile new file mode 100644 index 00000000000..3a67c57a3b1 --- /dev/null +++ b/deps/npm/node_modules/columnify/Makefile @@ -0,0 +1,9 @@ + +all: columnify.js + +prepublish: all + +columnify.js: index.js package.json + babel index.js > columnify.js + +.PHONY: all prepublish diff --git a/deps/npm/node_modules/columnify/Readme.md b/deps/npm/node_modules/columnify/Readme.md index 43ae36c2c40..4a37928a762 100644 --- a/deps/npm/node_modules/columnify/Readme.md +++ b/deps/npm/node_modules/columnify/Readme.md @@ -1,6 +1,13 @@ # columnify -[![Build Status](https://travis-ci.org/timoxley/columnify.png?branch=master)](https://travis-ci.org/timoxley/columnify) +[![NPM](https://nodei.co/npm/columnify.png?downloads=true&downloadRank=true&stars=true&chrome)](https://nodei.co/npm-dl/columnify/) +[![NPM](https://nodei.co/npm-dl/columnify.png?months=3&height=3&chrome)](https://nodei.co/npm/columnify/) + +[![Build Status](https://img.shields.io/travis/timoxley/columnify.svg?style=flat)](https://travis-ci.org/timoxley/columnify) +[![NPM Version](https://img.shields.io/npm/v/columnify.svg?style=flat)](https://npmjs.org/package/columnify) +[![License](http://img.shields.io/npm/l/columnify.svg?style=flat)](LICENSE) +[![Dependency Status](https://david-dm.org/timoxley/columnify.svg)](https://david-dm.org/timoxley/columnify) +[![devDependency Status](https://david-dm.org/timoxley/columnify/dev-status.svg)](https://david-dm.org/timoxley/columnify#info=devDependencies) Create text-based columns suitable for console output from objects or arrays of objects. @@ -36,7 +43,6 @@ console.log(columns) Objects are converted to a list of key/value pairs: ```javascript - var data = { "commander@0.6.1": 1, "minimatch@0.2.14": 3, @@ -100,15 +106,58 @@ mod1 0.0.1 module2 0.2.0 ``` -### Wrapping Column Cells +### Filtering & Ordering Columns + +By default, all properties are converted into columns, whether or not +they exist on every object or not. -You can define the maximum width before wrapping for individual cells in -columns. Minimum width is also supported. Wrapping will happen at word -boundaries. Empty cells or those which do not fill the max/min width -will be padded with spaces. +To explicitly specify which columns to include, and in which order, +supply a "columns" or "include" array ("include" is just an alias). ```javascript +var data = [{ + name: 'module1', + description: 'some description', + version: '0.0.1', +}, { + name: 'module2', + description: 'another description', + version: '0.2.0', +}] + +var columns = columnify(data, { + columns: ['name', 'version'] +}) + +console.log(columns) +``` +#### Output: +``` +NAME VERSION +module1 0.0.1 +module2 0.2.0 +``` + +## Global and Per Column Options +You can set a number of options at a global level (ie. for all columns) or on a per column basis. + +Set options on a per column basis by using the `config` option to specify individual columns: + +```javascript +var columns = columnify(data, { + optionName: optionValue, + config: { + columnName: {optionName: optionValue}, + columnName: {optionName: optionValue}, + } +}) +``` + +### Maximum and Minimum Column Widths +As with all options, you can define the `maxWidth` and `minWidth` globally, or for specified columns. By default, wrapping will happen at word boundaries. Empty cells or those which do not fill the `minWidth` will be padded with spaces. + +```javascript var columns = columnify([{ name: 'mod1', description: 'some description which happens to be far larger than the max', @@ -117,24 +166,41 @@ var columns = columnify([{ name: 'module-two', description: 'another description larger than the max', version: '0.2.0', +}], { + minWidth: 20, + config: { + description: {maxWidth: 30} + } }) console.log(columns) ``` + #### Output: ``` -NAME DESCRIPTION VERSION -mod1 some description which happens 0.0.1 - to be far larger than the max -module-two another description larger 0.2.0 - than the max +NAME DESCRIPTION VERSION +mod1 some description which happens 0.0.1 + to be far larger than the max +module-two another description larger 0.2.0 + than the max ``` -### Truncating Column Cells +#### Maximum Line Width + +You can set a hard maximum line width using the `maxLineWidth` option. +Beyond this value data is unceremoniously truncated with no truncation +marker. + +This can either be a number or 'auto' to set the value to the width of +stdout. + +Setting this value to 'auto' prevent TTY-imposed line-wrapping when +lines exceed the screen width. + +#### Truncating Column Cells Instead of Wrapping You can disable wrapping and instead truncate content at the maximum -column width. Truncation respects word boundaries. A truncation marker, -`…` will appear next to the last word in any truncated line. +column width by using the `truncate` option. Truncation respects word boundaries. A truncation marker, `…`, will appear next to the last word in any truncated line. ```javascript var columns = columnify(data, { @@ -155,43 +221,9 @@ mod1 some description… 0.0.1 module-two another description… 0.2.0 ``` -### Filtering & Ordering Columns - -By default, all properties are converted into columns, whether or not -they exist on every object or not. - -To explicitly specify which columns to include, and in which order, -supply a "columns" or "include" array ("include" is just an alias). - -```javascript -var data = [{ - name: 'module1', - description: 'some description', - version: '0.0.1', -}, { - name: 'module2', - description: 'another description', - version: '0.2.0', -}] - -var columns = columnify(data, { - columns: ['name', 'version'] // note description not included -}) - -console.log(columns) -``` - -#### Output: -``` -NAME VERSION -module1 0.0.1 -module2 0.2.0 -``` - - -## Other Configuration Options ### Align Right/Center +You can set the alignment of the column data by using the `align` option. ```js var data = { @@ -211,10 +243,12 @@ commander@2.0.0 1 debug@0.8.1 1 ``` -Align Center works in a similar way. +`align: 'center'` works in a similar way. + +### Padding Character -### Padding +Set a character to fill whitespace within columns with the `paddingChr` option. ```js var data = { @@ -232,7 +266,7 @@ shortKey................... veryVeryVeryVeryVeryLongVal veryVeryVeryVeryVeryLongKey shortVal................... ``` -### Preserve existing newlines +### Preserve Existing Newlines By default, `columnify` sanitises text by replacing any occurance of 1 or more whitespace characters with a single space. @@ -284,7 +318,7 @@ runforcover@0.0.2 node_modules/tap/node_modules/runforcover ### Custom Truncation Marker You can change the truncation marker to something other than the default -`…`. +`…` by using the `truncateMarker` option. ```javascript var columns = columnify(data, { @@ -309,10 +343,9 @@ module-two another description> 0.2.0 ### Custom Column Splitter If your columns need some bling, you can split columns with custom -characters. +characters by using the `columnSplitter` option. ```javascript - var columns = columnify(data, { columnSplitter: ' | ' }) @@ -326,6 +359,57 @@ mod1 | some description which happens to be far larger than the max | 0.0. module-two | another description larger than the max | 0.2.0 ``` +### Control Header Display + +Control whether column headers are displayed by using the `showHeaders` option. + +```javascript +var columns = columnify(data, { + showHeaders: false +}) +``` + +This also works well for hiding a single column header, like an `id` column: +```javascript +var columns = columnify(data, { + config: { + id: { showHeaders: false } + } +}) +``` + +### Transforming Column Data and Headers +If you need to modify the presentation of column content or heading content there are two useful options for doing that: `dataTransform` and `headerTransform`. Both of these take a function and need to return a valid string. + +```javascript +var columns = columnify([{ + name: 'mod1', + description: 'SOME DESCRIPTION TEXT.' +}, { + name: 'module-two', + description: 'SOME SLIGHTLY LONGER DESCRIPTION TEXT.' +}], { + dataTransform: function(data) { + return data.toLowerCase() + }, + config: { + name: { + headingTransform: function(heading) { + heading = "module " + heading + return "*" + heading.toUpperCase() + "*" + } + } + } +}) +``` +#### Output: +``` +*MODULE NAME* DESCRIPTION +mod1 some description text. +module-two some slightly longer description text. +``` + + ## Multibyte Character Support `columnify` uses [mycoboco/wcwidth.js](https://github.com/mycoboco/wcwidth.js) to calculate length of multibyte characters: @@ -362,6 +446,25 @@ module-one some description 0.0.1 这是一个很长的名字的模块 这真的是一个描述的内容这个描述很长 0.3.3 ``` +## Contributions + +``` + project : columnify + repo age : 1 year, 2 months + active : 32 days + commits : 120 + files : 54 + authors : + 90 Tim Oxley 75.0% + 8 Tim 6.7% + 7 Arjun Mehta 5.8% + 6 Dany 5.0% + 5 Wei Gao 4.2% + 2 Dany Shaanan 1.7% + 1 Seth Miller 0.8% + 1 Isaac Z. Schlueter 0.8% +``` + ## License MIT diff --git a/deps/npm/node_modules/columnify/columnify.js b/deps/npm/node_modules/columnify/columnify.js new file mode 100644 index 00000000000..db10a011817 --- /dev/null +++ b/deps/npm/node_modules/columnify/columnify.js @@ -0,0 +1,309 @@ +'use strict'; + +var _toConsumableArray = function (arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }; + +var wcwidth = require('./width'); + +var _require = require('./utils'); + +var padRight = _require.padRight; +var padCenter = _require.padCenter; +var padLeft = _require.padLeft; +var splitIntoLines = _require.splitIntoLines; +var splitLongWords = _require.splitLongWords; +var truncateString = _require.truncateString; + +var DEFAULT_HEADING_TRANSFORM = function DEFAULT_HEADING_TRANSFORM(key) { + return key.toUpperCase(); +}; + +var DEFAULT_DATA_TRANSFORM = function DEFAULT_DATA_TRANSFORM(cell, column, index) { + return cell; +}; + +var DEFAULTS = Object.freeze({ + maxWidth: Infinity, + minWidth: 0, + columnSplitter: ' ', + truncate: false, + truncateMarker: '…', + preserveNewLines: false, + paddingChr: ' ', + showHeaders: true, + headingTransform: DEFAULT_HEADING_TRANSFORM, + dataTransform: DEFAULT_DATA_TRANSFORM +}); + +module.exports = function (items) { + var options = arguments[1] === undefined ? {} : arguments[1]; + + var columnConfigs = options.config || {}; + delete options.config; // remove config so doesn't appear on every column. + + var maxLineWidth = options.maxLineWidth || Infinity; + if (maxLineWidth === 'auto') maxLineWidth = process.stdout.columns || Infinity; + delete options.maxLineWidth; // this is a line control option, don't pass it to column + + // Option defaults inheritance: + // options.config[columnName] => options => DEFAULTS + options = mixin({}, DEFAULTS, options); + + options.config = options.config || Object.create(null); + + options.spacing = options.spacing || '\n'; // probably useless + options.preserveNewLines = !!options.preserveNewLines; + options.showHeaders = !!options.showHeaders; + options.columns = options.columns || options.include; // alias include/columns, prefer columns if supplied + var columnNames = options.columns || []; // optional user-supplied columns to include + + items = toArray(items, columnNames); + + // if not suppled column names, automatically determine columns from data keys + if (!columnNames.length) { + items.forEach(function (item) { + for (var columnName in item) { + if (columnNames.indexOf(columnName) === -1) columnNames.push(columnName); + } + }); + } + + // initialize column defaults (each column inherits from options.config) + var columns = columnNames.reduce(function (columns, columnName) { + var column = Object.create(options); + columns[columnName] = mixin(column, columnConfigs[columnName]); + return columns; + }, Object.create(null)); + + // sanitize column settings + columnNames.forEach(function (columnName) { + var column = columns[columnName]; + column.name = columnName; + column.maxWidth = Math.ceil(column.maxWidth); + column.minWidth = Math.ceil(column.minWidth); + column.truncate = !!column.truncate; + column.align = column.align || 'left'; + }); + + // sanitize data + items = items.map(function (item) { + var result = Object.create(null); + columnNames.forEach(function (columnName) { + // null/undefined -> '' + result[columnName] = item[columnName] != null ? item[columnName] : ''; + // toString everything + result[columnName] = '' + result[columnName]; + if (columns[columnName].preserveNewLines) { + // merge non-newline whitespace chars + result[columnName] = result[columnName].replace(/[^\S\n]/gmi, ' '); + } else { + // merge all whitespace chars + result[columnName] = result[columnName].replace(/\s/gmi, ' '); + } + }); + return result; + }); + + // transform data cells + columnNames.forEach(function (columnName) { + var column = columns[columnName]; + items = items.map(function (item, index) { + var col = Object.create(column); + item[columnName] = column.dataTransform(item[columnName], col, index); + + var changedKeys = Object.keys(col); + // disable default heading transform if we wrote to column.name + if (changedKeys.indexOf('name') !== -1) { + if (column.headingTransform !== DEFAULT_HEADING_TRANSFORM) return; + column.headingTransform = function (heading) { + return heading; + }; + } + changedKeys.forEach(function (key) { + return column[key] = col[key]; + }); + return item; + }); + }); + + // add headers + var headers = {}; + if (options.showHeaders) { + columnNames.forEach(function (columnName) { + var column = columns[columnName]; + + if (!column.showHeaders) { + headers[columnName] = ''; + return; + } + + headers[columnName] = column.headingTransform(column.name); + }); + items.unshift(headers); + } + // get actual max-width between min & max + // based on length of data in columns + columnNames.forEach(function (columnName) { + var column = columns[columnName]; + column.width = items.map(function (item) { + return item[columnName]; + }).reduce(function (min, cur) { + return Math.max(min, Math.min(column.maxWidth, Math.max(column.minWidth, wcwidth(cur)))); + }, 0); + }); + + // split long words so they can break onto multiple lines + columnNames.forEach(function (columnName) { + var column = columns[columnName]; + items = items.map(function (item) { + item[columnName] = splitLongWords(item[columnName], column.width, column.truncateMarker); + return item; + }); + }); + + // wrap long lines. each item is now an array of lines. + columnNames.forEach(function (columnName) { + var column = columns[columnName]; + items = items.map(function (item, index) { + var cell = item[columnName]; + item[columnName] = splitIntoLines(cell, column.width); + + // if truncating required, only include first line + add truncation char + if (column.truncate && item[columnName].length > 1) { + item[columnName] = splitIntoLines(cell, column.width - wcwidth(column.truncateMarker)); + var firstLine = item[columnName][0]; + if (!endsWith(firstLine, column.truncateMarker)) item[columnName][0] += column.truncateMarker; + item[columnName] = item[columnName].slice(0, 1); + } + return item; + }); + }); + + // recalculate column widths from truncated output/lines + columnNames.forEach(function (columnName) { + var column = columns[columnName]; + column.width = items.map(function (item) { + return item[columnName].reduce(function (min, cur) { + return Math.max(min, Math.min(column.maxWidth, Math.max(column.minWidth, wcwidth(cur)))); + }, 0); + }).reduce(function (min, cur) { + return Math.max(min, Math.min(column.maxWidth, Math.max(column.minWidth, cur))); + }, 0); + }); + + var rows = createRows(items, columns, columnNames, options.paddingChr); // merge lines into rows + // conceive output + return rows.reduce(function (output, row) { + return output.concat(row.reduce(function (rowOut, line) { + return rowOut.concat(line.join(options.columnSplitter)); + }, [])); + }, []).map(function (line) { + return truncateString(line, maxLineWidth); + }).join(options.spacing); +}; + +/** + * Convert wrapped lines into rows with padded values. + * + * @param Array items data to process + * @param Array columns column width settings for wrapping + * @param Array columnNames column ordering + * @return Array items wrapped in arrays, corresponding to lines + */ + +function createRows(items, columns, columnNames, paddingChr) { + return items.map(function (item) { + var row = []; + var numLines = 0; + columnNames.forEach(function (columnName) { + numLines = Math.max(numLines, item[columnName].length); + }); + + var _loop = function (i) { + row[i] = row[i] || []; + columnNames.forEach(function (columnName) { + var column = columns[columnName]; + var val = item[columnName][i] || ''; // || '' ensures empty columns get padded + if (column.align === 'right') row[i].push(padLeft(val, column.width, paddingChr));else if (column.align === 'center' || column.align === 'centre') row[i].push(padCenter(val, column.width, paddingChr));else row[i].push(padRight(val, column.width, paddingChr)); + }); + }; + + // combine matching lines of each rows + for (var i = 0; i < numLines; i++) { + _loop(i); + } + return row; + }); +} + +/** + * Object.assign + * + * @return Object Object with properties mixed in. + */ + +function mixin() { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if (Object.assign) { + return Object.assign.apply(Object, _toConsumableArray(args)); + }return ObjectAssign.apply(undefined, _toConsumableArray(args)); +} + +function ObjectAssign(target, firstSource) { + 'use strict'; + if (target === undefined || target === null) throw new TypeError('Cannot convert first argument to object'); + + var to = Object(target); + + var hasPendingException = false; + var pendingException; + + for (var i = 1; i < arguments.length; i++) { + var nextSource = arguments[i]; + if (nextSource === undefined || nextSource === null) continue; + + var keysArray = Object.keys(Object(nextSource)); + for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) { + var nextKey = keysArray[nextIndex]; + try { + var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); + if (desc !== undefined && desc.enumerable) to[nextKey] = nextSource[nextKey]; + } catch (e) { + if (!hasPendingException) { + hasPendingException = true; + pendingException = e; + } + } + } + + if (hasPendingException) throw pendingException; + } + return to; +} + +/** + * Adapted from String.prototype.endsWith polyfill. + */ + +function endsWith(target, searchString, position) { + position = position || target.length; + position = position - searchString.length; + var lastIndex = target.lastIndexOf(searchString); + return lastIndex !== -1 && lastIndex === position; +} + +function toArray(items, columnNames) { + if (Array.isArray(items)) { + return items; + }var rows = []; + for (var key in items) { + var item = {}; + item[columnNames[0] || 'key'] = key; + item[columnNames[1] || 'value'] = items[key]; + rows.push(item); + } + return rows; +} + diff --git a/deps/npm/node_modules/columnify/index.js b/deps/npm/node_modules/columnify/index.js index c44b8ca8fa9..227b41efc60 100644 --- a/deps/npm/node_modules/columnify/index.js +++ b/deps/npm/node_modules/columnify/index.js @@ -1,15 +1,20 @@ "use strict" -var wcwidth = require('./width') -var utils = require('./utils') -var padRight = utils.padRight -var padCenter = utils.padCenter -var padLeft = utils.padLeft -var splitIntoLines = utils.splitIntoLines -var splitLongWords = utils.splitLongWords -var truncateString = utils.truncateString - -var DEFAULTS = { +const wcwidth = require('./width') +const { + padRight, + padCenter, + padLeft, + splitIntoLines, + splitLongWords, + truncateString +} = require('./utils') + +const DEFAULT_HEADING_TRANSFORM = key => key.toUpperCase() + +const DEFAULT_DATA_TRANSFORM = (cell, column, index) => cell + +const DEFAULTS = Object.freeze({ maxWidth: Infinity, minWidth: 0, columnSplitter: ' ', @@ -18,65 +23,63 @@ var DEFAULTS = { preserveNewLines: false, paddingChr: ' ', showHeaders: true, - headingTransform: function(key) { - return key.toUpperCase() - }, - dataTransform: function(cell, column, index) { - return cell - } -} - -module.exports = function(items, options) { + headingTransform: DEFAULT_HEADING_TRANSFORM, + dataTransform: DEFAULT_DATA_TRANSFORM +}) - options = options || {} +module.exports = function(items, options = {}) { - var columnConfigs = options.config || {} + let columnConfigs = options.config || {} delete options.config // remove config so doesn't appear on every column. - var maxLineWidth = options.maxLineWidth || Infinity + let maxLineWidth = options.maxLineWidth || Infinity + if (maxLineWidth === 'auto') maxLineWidth = process.stdout.columns || Infinity delete options.maxLineWidth // this is a line control option, don't pass it to column // Option defaults inheritance: // options.config[columnName] => options => DEFAULTS - options = mixin(options, DEFAULTS) + options = mixin({}, DEFAULTS, options) + options.config = options.config || Object.create(null) options.spacing = options.spacing || '\n' // probably useless options.preserveNewLines = !!options.preserveNewLines options.showHeaders = !!options.showHeaders; options.columns = options.columns || options.include // alias include/columns, prefer columns if supplied - var columnNames = options.columns || [] // optional user-supplied columns to include + let columnNames = options.columns || [] // optional user-supplied columns to include items = toArray(items, columnNames) // if not suppled column names, automatically determine columns from data keys if (!columnNames.length) { items.forEach(function(item) { - for (var columnName in item) { + for (let columnName in item) { if (columnNames.indexOf(columnName) === -1) columnNames.push(columnName) } }) } // initialize column defaults (each column inherits from options.config) - var columns = columnNames.reduce(function(columns, columnName) { - var column = Object.create(options) + let columns = columnNames.reduce((columns, columnName) => { + let column = Object.create(options) columns[columnName] = mixin(column, columnConfigs[columnName]) return columns }, Object.create(null)) // sanitize column settings - columnNames.forEach(function(columnName) { - var column = columns[columnName] + columnNames.forEach(columnName => { + let column = columns[columnName] + column.name = columnName column.maxWidth = Math.ceil(column.maxWidth) column.minWidth = Math.ceil(column.minWidth) column.truncate = !!column.truncate + column.align = column.align || 'left' }) // sanitize data - items = items.map(function(item) { - var result = Object.create(null) - columnNames.forEach(function(columnName) { + items = items.map(item => { + let result = Object.create(null) + columnNames.forEach(columnName => { // null/undefined -> '' result[columnName] = item[columnName] != null ? item[columnName] : '' // toString everything @@ -93,83 +96,98 @@ module.exports = function(items, options) { }) // transform data cells - columnNames.forEach(function(columnName) { - var column = columns[columnName] - items = items.map(function(item, index) { - item[columnName] = column.dataTransform(item[columnName], column, index) + columnNames.forEach(columnName => { + let column = columns[columnName] + items = items.map((item, index) => { + let col = Object.create(column) + item[columnName] = column.dataTransform(item[columnName], col, index) + + let changedKeys = Object.keys(col) + // disable default heading transform if we wrote to column.name + if (changedKeys.indexOf('name') !== -1) { + if (column.headingTransform !== DEFAULT_HEADING_TRANSFORM) return + column.headingTransform = heading => heading + } + changedKeys.forEach(key => column[key] = col[key]) return item }) }) // add headers - var headers = {} + let headers = {} if(options.showHeaders) { - columnNames.forEach(function(columnName) { - var column = columns[columnName] - headers[columnName] = column.headingTransform(columnName) + columnNames.forEach(columnName => { + let column = columns[columnName] + + if(!column.showHeaders){ + headers[columnName] = ''; + return; + } + + headers[columnName] = column.headingTransform(column.name) }) items.unshift(headers) } // get actual max-width between min & max // based on length of data in columns - columnNames.forEach(function(columnName) { - var column = columns[columnName] - column.width = items.map(function(item) { - return item[columnName] - }).reduce(function(min, cur) { + columnNames.forEach(columnName => { + let column = columns[columnName] + column.width = items + .map(item => item[columnName]) + .reduce((min, cur) => { return Math.max(min, Math.min(column.maxWidth, Math.max(column.minWidth, wcwidth(cur)))) }, 0) }) // split long words so they can break onto multiple lines - columnNames.forEach(function(columnName) { - var column = columns[columnName] - items = items.map(function(item) { + columnNames.forEach(columnName => { + let column = columns[columnName] + items = items.map(item => { item[columnName] = splitLongWords(item[columnName], column.width, column.truncateMarker) return item }) }) // wrap long lines. each item is now an array of lines. - columnNames.forEach(function(columnName) { - var column = columns[columnName] - items = items.map(function(item, index) { - var cell = item[columnName] + columnNames.forEach(columnName => { + let column = columns[columnName] + items = items.map((item, index) => { + let cell = item[columnName] item[columnName] = splitIntoLines(cell, column.width) // if truncating required, only include first line + add truncation char if (column.truncate && item[columnName].length > 1) { - item[columnName] = splitIntoLines(cell, column.width - wcwidth(column.truncateMarker)) - var firstLine = item[columnName][0] - if (!endsWith(firstLine, column.truncateMarker)) item[columnName][0] += column.truncateMarker - item[columnName] = item[columnName].slice(0, 1) + item[columnName] = splitIntoLines(cell, column.width - wcwidth(column.truncateMarker)) + let firstLine = item[columnName][0] + if (!endsWith(firstLine, column.truncateMarker)) item[columnName][0] += column.truncateMarker + item[columnName] = item[columnName].slice(0, 1) } return item }) }) // recalculate column widths from truncated output/lines - columnNames.forEach(function(columnName) { - var column = columns[columnName] - column.width = items.map(function(item) { - return item[columnName].reduce(function(min, cur) { + columnNames.forEach(columnName => { + let column = columns[columnName] + column.width = items.map(item => { + return item[columnName].reduce((min, cur) => { return Math.max(min, Math.min(column.maxWidth, Math.max(column.minWidth, wcwidth(cur)))) }, 0) - }).reduce(function(min, cur) { + }).reduce((min, cur) => { return Math.max(min, Math.min(column.maxWidth, Math.max(column.minWidth, cur))) }, 0) }) - var rows = createRows(items, columns, columnNames, options.paddingChr) // merge lines into rows + let rows = createRows(items, columns, columnNames, options.paddingChr) // merge lines into rows // conceive output - return rows.reduce(function(output, row) { - return output.concat(row.reduce(function(rowOut, line) { + return rows.reduce((output, row) => { + return output.concat(row.reduce((rowOut, line) => { return rowOut.concat(line.join(options.columnSplitter)) }, [])) - }, []).map(function(line) { - return truncateString(line, maxLineWidth) - }).join(options.spacing) + }, []) + .map(line => truncateString(line, maxLineWidth)) + .join(options.spacing) } /** @@ -182,20 +200,20 @@ module.exports = function(items, options) { */ function createRows(items, columns, columnNames, paddingChr) { - return items.map(function(item) { - var row = [] - var numLines = 0 - columnNames.forEach(function(columnName) { + return items.map(item => { + let row = [] + let numLines = 0 + columnNames.forEach(columnName => { numLines = Math.max(numLines, item[columnName].length) }) // combine matching lines of each rows - for (var i = 0; i < numLines; i++) { + for (let i = 0; i < numLines; i++) { row[i] = row[i] || [] - columnNames.forEach(function(columnName) { - var column = columns[columnName] - var val = item[columnName][i] || '' // || '' ensures empty columns get padded - if (column.align == 'right') row[i].push(padLeft(val, column.width, paddingChr)) - else if (column.align == 'center') row[i].push(padCenter(val, column.width, paddingChr)) + columnNames.forEach(columnName => { + let column = columns[columnName] + let val = item[columnName][i] || '' // || '' ensures empty columns get padded + if (column.align === 'right') row[i].push(padLeft(val, column.width, paddingChr)) + else if (column.align === 'center' || column.align === 'centre') row[i].push(padCenter(val, column.width, paddingChr)) else row[i].push(padRight(val, column.width, paddingChr)) }) } @@ -204,22 +222,50 @@ function createRows(items, columns, columnNames, paddingChr) { } /** - * Generic source->target mixin. - * Copy properties from `source` into `target` if target doesn't have them. - * Destructive. Modifies `target`. + * Object.assign * - * @param target Object target for mixin properties. - * @param source Object source of mixin properties. - * @return Object `target` after mixin applied. + * @return Object Object with properties mixed in. */ -function mixin(target, source) { - source = source || {} - for (var key in source) { - if (target.hasOwnProperty(key)) continue - target[key] = source[key] +function mixin(...args) { + if (Object.assign) return Object.assign(...args) + return ObjectAssign(...args) +} + +function ObjectAssign(target, firstSource) { + "use strict"; + if (target === undefined || target === null) + throw new TypeError("Cannot convert first argument to object"); + + var to = Object(target); + + var hasPendingException = false; + var pendingException; + + for (var i = 1; i < arguments.length; i++) { + var nextSource = arguments[i]; + if (nextSource === undefined || nextSource === null) + continue; + + var keysArray = Object.keys(Object(nextSource)); + for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) { + var nextKey = keysArray[nextIndex]; + try { + var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); + if (desc !== undefined && desc.enumerable) + to[nextKey] = nextSource[nextKey]; + } catch (e) { + if (!hasPendingException) { + hasPendingException = true; + pendingException = e; + } + } + } + + if (hasPendingException) + throw pendingException; } - return target + return to; } /** @@ -229,16 +275,16 @@ function mixin(target, source) { function endsWith(target, searchString, position) { position = position || target.length; position = position - searchString.length; - var lastIndex = target.lastIndexOf(searchString); + let lastIndex = target.lastIndexOf(searchString); return lastIndex !== -1 && lastIndex === position; } function toArray(items, columnNames) { if (Array.isArray(items)) return items - var rows = [] - for (var key in items) { - var item = {} + let rows = [] + for (let key in items) { + let item = {} item[columnNames[0] || 'key'] = key item[columnNames[1] || 'value'] = items[key] rows.push(item) diff --git a/deps/npm/node_modules/columnify/node_modules/strip-ansi/cli.js b/deps/npm/node_modules/columnify/node_modules/strip-ansi/cli.js deleted file mode 100755 index 602ae00e8fc..00000000000 --- a/deps/npm/node_modules/columnify/node_modules/strip-ansi/cli.js +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env node -'use strict'; -var fs = require('fs'); -var pkg = require('./package.json'); -var strip = require('./'); -var input = process.argv[2]; - -function help() { - console.log([ - pkg.description, - '', - 'Usage', - ' $ strip-ansi > ', - ' $ cat | strip-ansi > ', - '', - 'Example', - ' $ strip-ansi unicorn.txt > unicorn-stripped.txt' - ].join('\n')); -} - -if (process.argv.indexOf('--help') !== -1) { - help(); - return; -} - -if (process.argv.indexOf('--version') !== -1) { - console.log(pkg.version); - return; -} - -if (input) { - process.stdout.write(strip(fs.readFileSync(input, 'utf8'))); - return; -} - -process.stdin.setEncoding('utf8'); -process.stdin.on('data', function (data) { - process.stdout.write(strip(data)); -}); diff --git a/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/index.js b/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/index.js deleted file mode 100644 index 783c5c7bb69..00000000000 --- a/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -module.exports = function () { - return /\u001b\[(?:[0-9]{1,3}(?:;[0-9]{1,3})*)?[m|K]/g; -}; diff --git a/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/package.json b/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/package.json deleted file mode 100644 index ca610250c9e..00000000000 --- a/deps/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "name": "ansi-regex", - "version": "0.2.1", - "description": "Regular expression for matching ANSI escape codes", - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/sindresorhus/ansi-regex" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js" - ], - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "devDependencies": { - "mocha": "*" - }, - "bugs": { - "url": "https://github.com/sindresorhus/ansi-regex/issues" - }, - "homepage": "https://github.com/sindresorhus/ansi-regex", - "_id": "ansi-regex@0.2.1", - "_shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9", - "_from": "ansi-regex@0.2.1", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - } - ], - "dist": { - "shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9", - "tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz" -} diff --git a/deps/npm/node_modules/columnify/node_modules/strip-ansi/package.json b/deps/npm/node_modules/columnify/node_modules/strip-ansi/package.json deleted file mode 100644 index 64c4dee52c4..00000000000 --- a/deps/npm/node_modules/columnify/node_modules/strip-ansi/package.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "name": "strip-ansi", - "version": "1.0.0", - "description": "Strip ANSI escape codes", - "license": "MIT", - "bin": { - "strip-ansi": "cli.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/sindresorhus/strip-ansi" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js", - "cli.js" - ], - "keywords": [ - "strip", - "trim", - "remove", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "ansi-regex": "^0.2.1" - }, - "devDependencies": { - "mocha": "*" - }, - "gitHead": "6fea2ef935f1ba10d43e4c4d9814af328803935c", - "bugs": { - "url": "https://github.com/sindresorhus/strip-ansi/issues" - }, - "homepage": "https://github.com/sindresorhus/strip-ansi", - "_id": "strip-ansi@1.0.0", - "_shasum": "6c021321d6ece161a3c608fbab268c7328901c73", - "_from": "strip-ansi@>=1.0.0-0 <2.0.0-0", - "_npmVersion": "1.4.14", - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - { - "name": "jbnicolai", - "email": "jappelman@xebia.com" - } - ], - "dist": { - "shasum": "6c021321d6ece161a3c608fbab268c7328901c73", - "tarball": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-1.0.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-1.0.0.tgz" -} diff --git a/deps/npm/node_modules/columnify/node_modules/strip-ansi/readme.md b/deps/npm/node_modules/columnify/node_modules/strip-ansi/readme.md deleted file mode 100644 index 5477079d00f..00000000000 --- a/deps/npm/node_modules/columnify/node_modules/strip-ansi/readme.md +++ /dev/null @@ -1,43 +0,0 @@ -# strip-ansi [![Build Status](https://travis-ci.org/sindresorhus/strip-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-ansi) - -> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -```sh -$ npm install --save strip-ansi -``` - - -## Usage - -```js -var stripAnsi = require('strip-ansi'); - -stripAnsi('\x1b[4mcake\x1b[0m'); -//=> 'cake' -``` - - -## CLI - -```sh -$ npm install --global strip-ansi -``` - -```sh -$ strip-ansi --help - -Usage - $ strip-ansi > - $ cat | strip-ansi > - -Example - $ strip-ansi unicorn.txt > unicorn-stripped.txt -``` - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/LICENSE b/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/LICENSE new file mode 100644 index 00000000000..d88b0720784 --- /dev/null +++ b/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Elijah Insua + +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/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/README.md b/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/README.md index a75e72e9fb3..1a4a2ea9c91 100644 --- a/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/README.md +++ b/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/README.md @@ -40,4 +40,4 @@ Sidecases: if called with a falsy `options` value, options will be initialized t ## license -MIT \ No newline at end of file +[MIT](LICENSE) diff --git a/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/README.md b/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/README.md index 527743b601f..d7231cfca7d 100644 --- a/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/README.md +++ b/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/README.md @@ -21,7 +21,7 @@ var clone = require('clone'); var a, b; -a = { foo: { bar: 'baz' } }; // inital value of a +a = { foo: { bar: 'baz' } }; // initial value of a b = clone(a); // clone a -> b a.foo.bar = 'foo'; // change a @@ -52,7 +52,7 @@ can clone dates in arrays in objects, for example. Call `clone` with `circular` set to `false` if you are certain that `obj` contains no circular references. This will give better performance if needed. There is no error if `undefined` or `null` is passed as `obj`. - * `depth` -- depth to wich the object is to be cloned (optional, + * `depth` -- depth to which the object is to be cloned (optional, defaults to infinity) `clone.clonePrototype(obj)` diff --git a/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/clone.js b/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/clone.js index 5d402073b36..f8fa3159a7c 100644 --- a/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/clone.js +++ b/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/clone.js @@ -72,6 +72,7 @@ function clone(parent, circular, depth, prototype) { return parent; var child; + var proto; if (typeof parent != 'object') { return parent; } @@ -88,8 +89,14 @@ function clone(parent, circular, depth, prototype) { parent.copy(child); return child; } else { - if (typeof prototype == 'undefined') child = Object.create(Object.getPrototypeOf(parent)); - else child = Object.create(prototype); + if (typeof prototype == 'undefined') { + proto = Object.getPrototypeOf(parent); + child = Object.create(proto); + } + else { + child = Object.create(prototype); + proto = prototype; + } } if (circular) { @@ -103,6 +110,14 @@ function clone(parent, circular, depth, prototype) { } for (var i in parent) { + var attrs; + if (proto) { + attrs = Object.getOwnPropertyDescriptor(proto, i); + } + + if (attrs && attrs.set == null) { + continue; + } child[i] = _clone(parent[i], depth - 1); } diff --git a/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/package.json b/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/package.json index 3c6b7764709..bc8e878a54c 100644 --- a/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/package.json +++ b/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/package.json @@ -8,7 +8,7 @@ "function", "date" ], - "version": "0.1.18", + "version": "0.1.19", "repository": { "type": "git", "url": "git://github.com/pvorb/node-clone.git" @@ -81,6 +81,11 @@ { "name": "Nathan Zadoks", "url": "https://github.com/nathan7" + }, + { + "name": "Róbert Oroszi", + "email": "robert+gh@oroszi.net", + "url": "https://github.com/oroce" } ], "license": "MIT", @@ -96,11 +101,11 @@ "scripts": { "test": "nodeunit test.js" }, - "gitHead": "17eea36140d61d97a9954c53417d0e04a00525d9", + "gitHead": "bb11a43363a0f69e8ac014cb5376ce215ea1f8fd", "homepage": "https://github.com/pvorb/node-clone", - "_id": "clone@0.1.18", - "_shasum": "64a0d5d57eaa85a1a8af380cd1db8c7b3a895f66", - "_from": "clone@>=0.1.5-0 <0.2.0-0", + "_id": "clone@0.1.19", + "_shasum": "613fb68639b26a494ac53253e15b1a6bd88ada85", + "_from": "clone@>=0.1.5 <0.2.0", "_npmVersion": "1.4.14", "_npmUser": { "name": "pvorb", @@ -113,9 +118,9 @@ } ], "dist": { - "shasum": "64a0d5d57eaa85a1a8af380cd1db8c7b3a895f66", - "tarball": "http://registry.npmjs.org/clone/-/clone-0.1.18.tgz" + "shasum": "613fb68639b26a494ac53253e15b1a6bd88ada85", + "tarball": "http://registry.npmjs.org/clone/-/clone-0.1.19.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/clone/-/clone-0.1.18.tgz" + "_resolved": "https://registry.npmjs.org/clone/-/clone-0.1.19.tgz" } diff --git a/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/test.js b/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/test.js index ee49ad893aa..cb3d16631ab 100644 --- a/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/test.js +++ b/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/test.js @@ -269,3 +269,21 @@ exports['clone object with null children'] = function(test) { test.deepEqual(b, a); test.done(); } + +exports['clone instance with getter'] = function(test) { + test.expect(1); + function Ctor() {}; + Object.defineProperty(Ctor.prototype, 'prop', { + configurable: true, + enumerable: true, + get: function() { + return 'value'; + } + }); + + var a = new Ctor(); + var b = clone(a); + + test.strictEqual(b.prop, 'value'); + test.done(); +}; \ No newline at end of file diff --git a/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/package.json b/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/package.json index f9243a12005..fdd074d0f4a 100644 --- a/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/package.json +++ b/deps/npm/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/package.json @@ -1,6 +1,6 @@ { "name": "defaults", - "version": "1.0.0", + "version": "1.0.2", "description": "merge single level defaults over a config object", "main": "index.js", "scripts": { @@ -19,20 +19,21 @@ "email": "tmpvar@gmail.com" }, "license": "MIT", - "readmeFilename": "README.md", "dependencies": { "clone": "~0.1.5" }, "devDependencies": { "tap": "~0.4.0" }, - "readme": "# defaults\n\nA simple one level options merge utility\n\n## install\n\n`npm install defaults`\n\n## use\n\n```javascript\n\nvar defaults = require('defaults');\n\nvar handle = function(options, fn) {\n options = defaults(options, {\n timeout: 100\n });\n\n setTimeout(function() {\n fn(options);\n }, options.timeout);\n}\n\nhandle({ timeout: 1000 }, function() {\n // we're here 1000 ms later\n});\n\nhandle({ timeout: 10000 }, function() {\n // we're here 10s later\n});\n\n```\n\n## summary\n\nthis module exports a function that takes 2 arguments: `options` and `defaults`. When called, it overrides all of `undefined` properties in `options` with the clones of properties defined in `defaults`\n\nSidecases: if called with a falsy `options` value, options will be initialized to a new object before being merged onto.\n\n## license\n\nMIT", - "_id": "defaults@1.0.0", - "dist": { - "shasum": "3ae25f44416c6c01f9809a25fcdd285912d2a6b1", - "tarball": "http://registry.npmjs.org/defaults/-/defaults-1.0.0.tgz" + "gitHead": "22c57d1f87a2f03c1f9d21bd39c67db8553a0064", + "bugs": { + "url": "https://github.com/tmpvar/defaults/issues" }, - "_npmVersion": "1.1.65", + "homepage": "https://github.com/tmpvar/defaults", + "_id": "defaults@1.0.2", + "_shasum": "6902e25aa047649a501e19ef9e98f3e8365c109a", + "_from": "defaults@>=1.0.0 <2.0.0", + "_npmVersion": "1.4.23", "_npmUser": { "name": "tmpvar", "email": "tmpvar@gmail.com" @@ -43,8 +44,10 @@ "email": "tmpvar@gmail.com" } ], + "dist": { + "shasum": "6902e25aa047649a501e19ef9e98f3e8365c109a", + "tarball": "http://registry.npmjs.org/defaults/-/defaults-1.0.2.tgz" + }, "directories": {}, - "_shasum": "3ae25f44416c6c01f9809a25fcdd285912d2a6b1", - "_from": "defaults@>=1.0.0-0 <2.0.0-0", - "_resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.0.tgz" + "_resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.2.tgz" } diff --git a/deps/npm/node_modules/columnify/node_modules/wcwidth/package.json b/deps/npm/node_modules/columnify/node_modules/wcwidth/package.json index f12d49b789e..4744d9dc3f7 100644 --- a/deps/npm/node_modules/columnify/node_modules/wcwidth/package.json +++ b/deps/npm/node_modules/columnify/node_modules/wcwidth/package.json @@ -40,7 +40,7 @@ "gitHead": "5bc3aafd45c89f233c27b9479c18a23ca91ba660", "_id": "wcwidth@1.0.0", "_shasum": "02d059ff7a8fc741e0f6b5da1e69b2b40daeca6f", - "_from": "wcwidth@>=1.0.0-0 <2.0.0-0", + "_from": "wcwidth@>=1.0.0 <2.0.0", "_npmVersion": "1.4.23", "_npmUser": { "name": "timoxley", diff --git a/deps/npm/node_modules/columnify/package.json b/deps/npm/node_modules/columnify/package.json index ef307b50925..195a7f092fe 100644 --- a/deps/npm/node_modules/columnify/package.json +++ b/deps/npm/node_modules/columnify/package.json @@ -1,20 +1,23 @@ { "name": "columnify", - "version": "1.2.1", - "description": "Render data in text columns, supports in-column text-wrap.", - "main": "index.js", + "version": "1.5.1", + "description": "Render data in text columns. supports in-column text-wrap.", + "main": "columnify.js", "scripts": { "pretest": "npm prune", - "test": "faucet" + "test": "make prepublish && tape test/*.js | tap-spec", + "bench": "npm test && node bench", + "prepublish": "make prepublish" }, "author": { "name": "Tim Oxley" }, "license": "MIT", "devDependencies": { - "chalk": "^0.4.0", - "faucet": "0.0.1", - "tape": "~2.12.3" + "babel": "^5.0.10", + "chalk": "^1.0.0", + "tap-spec": "^3.0.0", + "tape": "^4.0.0" }, "repository": { "type": "git", @@ -34,17 +37,18 @@ }, "homepage": "https://github.com/timoxley/columnify", "dependencies": { - "strip-ansi": "^1.0.0", + "strip-ansi": "^2.0.1", "wcwidth": "^1.0.0" }, "directories": { "test": "test" }, - "gitHead": "14e77bef3f57acaa3f390145915a9f2d2a4f882c", - "_id": "columnify@1.2.1", - "_shasum": "921ec51c178f4126d3c07e9acecd67a55c7953e4", - "_from": "columnify@>=1.2.1-0 <2.0.0-0", - "_npmVersion": "1.4.23", + "gitHead": "1e5f5ec9478d7dbd1e3d1d74343b552da7ae01ba", + "_id": "columnify@1.5.1", + "_shasum": "15fdda803a3875f87f9d302b3bc828932d664003", + "_from": "columnify@>=1.5.1 <1.6.0", + "_npmVersion": "2.7.6", + "_nodeVersion": "0.10.36", "_npmUser": { "name": "timoxley", "email": "secoif@gmail.com" @@ -56,8 +60,8 @@ } ], "dist": { - "shasum": "921ec51c178f4126d3c07e9acecd67a55c7953e4", - "tarball": "http://registry.npmjs.org/columnify/-/columnify-1.2.1.tgz" + "shasum": "15fdda803a3875f87f9d302b3bc828932d664003", + "tarball": "http://registry.npmjs.org/columnify/-/columnify-1.5.1.tgz" }, - "_resolved": "https://registry.npmjs.org/columnify/-/columnify-1.2.1.tgz" + "_resolved": "https://registry.npmjs.org/columnify/-/columnify-1.5.1.tgz" } diff --git a/deps/npm/node_modules/config-chain/node_modules/proto-list/LICENSE b/deps/npm/node_modules/config-chain/node_modules/proto-list/LICENSE index 05a4010949c..19129e315fe 100644 --- a/deps/npm/node_modules/config-chain/node_modules/proto-list/LICENSE +++ b/deps/npm/node_modules/config-chain/node_modules/proto-list/LICENSE @@ -1,23 +1,15 @@ -Copyright 2009, 2010, 2011 Isaac Z. Schlueter. -All rights reserved. +The ISC License -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: +Copyright (c) Isaac Z. Schlueter and Contributors -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/config-chain/node_modules/proto-list/package.json b/deps/npm/node_modules/config-chain/node_modules/proto-list/package.json index 2dff2917c05..458621ad892 100644 --- a/deps/npm/node_modules/config-chain/node_modules/proto-list/package.json +++ b/deps/npm/node_modules/config-chain/node_modules/proto-list/package.json @@ -1,6 +1,6 @@ { "name": "proto-list", - "version": "1.2.3", + "version": "1.2.4", "description": "A utility for managing a prototype chain", "main": "./proto-list.js", "author": { @@ -13,27 +13,29 @@ }, "repository": { "type": "git", - "url": "https://github.com/isaacs/proto-list" - }, - "license": { - "type": "MIT", - "url": "https://github.com/isaacs/proto-list/blob/master/LICENSE" + "url": "git+https://github.com/isaacs/proto-list.git" }, + "license": "ISC", "devDependencies": { "tap": "0" }, - "gitHead": "44d76897176861d176a53ed3f3fc5e05cdee7643", + "gitHead": "9e4af12d4dddee2fd531f0fe0c21c9cfacb78ac0", "bugs": { "url": "https://github.com/isaacs/proto-list/issues" }, - "homepage": "https://github.com/isaacs/proto-list", - "_id": "proto-list@1.2.3", - "_shasum": "6235554a1bca1f0d15e3ca12ca7329d5def42bd9", - "_from": "proto-list@~1.2.1", - "_npmVersion": "1.4.14", + "homepage": "https://github.com/isaacs/proto-list#readme", + "_id": "proto-list@1.2.4", + "_shasum": "212d5bfe1318306a420f6402b8e26ff39647a849", + "_from": "proto-list@>=1.2.1 <1.3.0", + "_npmVersion": "2.10.0", + "_nodeVersion": "2.0.1", "_npmUser": { "name": "isaacs", - "email": "i@izs.me" + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "212d5bfe1318306a420f6402b8e26ff39647a849", + "tarball": "http://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz" }, "maintainers": [ { @@ -41,11 +43,6 @@ "email": "i@izs.me" } ], - "dist": { - "shasum": "6235554a1bca1f0d15e3ca12ca7329d5def42bd9", - "tarball": "http://registry.npmjs.org/proto-list/-/proto-list-1.2.3.tgz" - }, "directories": {}, - "_resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.3.tgz", - "readme": "ERROR: No README data found!" + "_resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz" } diff --git a/deps/npm/node_modules/config-chain/package.json b/deps/npm/node_modules/config-chain/package.json index a07f2f41433..b25913cab01 100644 --- a/deps/npm/node_modules/config-chain/package.json +++ b/deps/npm/node_modules/config-chain/package.json @@ -1,6 +1,12 @@ { "name": "config-chain", - "version": "1.1.8", + "version": "1.1.9", + "licenses": [ + { + "type": "MIT", + "url": "https://raw.githubusercontent.com/dominictarr/config-chain/master/LICENCE" + } + ], "description": "HANDLE CONFIGURATION ONCE AND FOR ALL", "homepage": "http://github.com/dominictarr/config-chain", "repository": { @@ -22,18 +28,15 @@ "scripts": { "test": "tap test/" }, - "readme": "#config-chain\n\nUSE THIS MODULE TO LOAD ALL YOUR CONFIGURATIONS\n\n``` js\n\n //npm install config-chain\n\n var cc = require('config-chain')\n , opts = require('optimist').argv //ALWAYS USE OPTIMIST FOR COMMAND LINE OPTIONS.\n , env = opts.env || process.env.YOUR_APP_ENV || 'dev' //SET YOUR ENV LIKE THIS.\n\n // EACH ARG TO CONFIGURATOR IS LOADED INTO CONFIGURATION CHAIN\n // EARLIER ITEMS OVERIDE LATER ITEMS\n // PUTS COMMAND LINE OPTS FIRST, AND DEFAULTS LAST!\n\n //strings are interpereted as filenames.\n //will be loaded synchronously\n\n var conf =\n cc(\n //OVERRIDE SETTINGS WITH COMMAND LINE OPTS\n opts,\n\n //ENV VARS IF PREFIXED WITH 'myApp_'\n\n cc.env('myApp_'), //myApp_foo = 'like this'\n\n //FILE NAMED BY ENV\n path.join(__dirname, 'config.' + env + '.json'),\n\n //IF `env` is PRODUCTION\n env === 'prod'\n ? path.join(__dirname, 'special.json') //load a special file\n : null //NULL IS IGNORED!\n\n //SUBDIR FOR ENV CONFIG\n path.join(__dirname, 'config', env, 'config.json'),\n\n //SEARCH PARENT DIRECTORIES FROM CURRENT DIR FOR FILE\n cc.find('config.json'),\n\n //PUT DEFAULTS LAST\n {\n host: 'localhost'\n port: 8000\n })\n\n var host = conf.get('host')\n\n // or\n\n var host = conf.store.host\n\n```\n\nFINALLY, EASY FLEXIBLE CONFIGURATIONS!\n\n##see also: [proto-list](https://github.com/isaacs/proto-list/)\n\nWHATS THAT YOU SAY?\n\nYOU WANT A \"CLASS\" SO THAT YOU CAN DO CRAYCRAY JQUERY CRAPS?\n\nEXTEND WITH YOUR OWN FUNCTIONALTY!?\n\n## CONFIGCHAIN LIVES TO SERVE ONLY YOU!\n\n```javascript\nvar cc = require('config-chain')\n\n// all the stuff you did before\nvar config = cc({\n some: 'object'\n },\n cc.find('config.json'),\n cc.env('myApp_')\n )\n // CONFIGS AS A SERVICE, aka \"CaaS\", aka EVERY DEVOPS DREAM OMG!\n .addUrl('http://configurator:1234/my-configs')\n // ASYNC FTW!\n .addFile('/path/to/file.json')\n\n // OBJECTS ARE OK TOO, they're SYNC but they still ORDER RIGHT\n // BECAUSE PROMISES ARE USED BUT NO, NOT *THOSE* PROMISES, JUST\n // ACTUAL PROMISES LIKE YOU MAKE TO YOUR MOM, KEPT OUT OF LOVE\n .add({ another: 'object' })\n\n // DIE A THOUSAND DEATHS IF THIS EVER HAPPENS!!\n .on('error', function (er) {\n // IF ONLY THERE WAS SOMETHIGN HARDER THAN THROW\n // MY SORROW COULD BE ADEQUATELY EXPRESSED. /o\\\n throw er\n })\n\n // THROW A PARTY IN YOUR FACE WHEN ITS ALL LOADED!!\n .on('load', function (config) {\n console.awesome('HOLY SHIT!')\n })\n```\n\n# BORING API DOCS\n\n## cc(...args)\n\nMAKE A CHAIN AND ADD ALL THE ARGS.\n\nIf the arg is a STRING, then it shall be a JSON FILENAME.\n\nSYNC I/O!\n\nRETURN THE CHAIN!\n\n## cc.json(...args)\n\nJoin the args INTO A JSON FILENAME!\n\nSYNC I/O!\n\n## cc.find(relativePath)\n\nSEEK the RELATIVE PATH by climbing the TREE OF DIRECTORIES.\n\nRETURN THE FOUND PATH!\n\nSYNC I/O!\n\n## cc.parse(content, file, type)\n\nParse the content string, and guess the type from either the\nspecified type or the filename.\n\nRETURN THE RESULTING OBJECT!\n\nNO I/O!\n\n## cc.env(prefix, env=process.env)\n\nGet all the keys on the provided env object (or process.env) which are\nprefixed by the specified prefix, and put the values on a new object.\n\nRETURN THE RESULTING OBJECT!\n\nNO I/O!\n\n## cc.ConfigChain()\n\nThe ConfigChain class for CRAY CRAY JQUERY STYLE METHOD CHAINING!\n\nOne of these is returned by the main exported function, as well.\n\nIt inherits (prototypically) from\n[ProtoList](https://github.com/isaacs/proto-list/), and also inherits\n(parasitically) from\n[EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter)\n\nIt has all the methods from both, and except where noted, they are\nunchanged.\n\n### LET IT BE KNOWN THAT chain IS AN INSTANCE OF ConfigChain.\n\n## chain.sources\n\nA list of all the places where it got stuff. The keys are the names\npassed to addFile or addUrl etc, and the value is an object with some\ninfo about the data source.\n\n## chain.addFile(filename, type, [name=filename])\n\nFilename is the name of the file. Name is an arbitrary string to be\nused later if you desire. Type is either 'ini' or 'json', and will\ntry to guess intelligently if omitted.\n\nLoaded files can be saved later.\n\n## chain.addUrl(url, type, [name=url])\n\nSame as the filename thing, but with a url.\n\nCan't be saved later.\n\n## chain.addEnv(prefix, env, [name='env'])\n\nAdd all the keys from the env object that start with the prefix.\n\n## chain.addString(data, file, type, [name])\n\nParse the string and add it to the set. (Mainly used internally.)\n\n## chain.add(object, [name])\n\nAdd the object to the set.\n\n## chain.root {Object}\n\nThe root from which all the other config objects in the set descend\nprototypically.\n\nPut your defaults here.\n\n## chain.set(key, value, name)\n\nSet the key to the value on the named config object. If name is\nunset, then set it on the first config object in the set. (That is,\nthe one with the highest priority, which was added first.)\n\n## chain.get(key, [name])\n\nGet the key from the named config object explicitly, or from the\nresolved configs if not specified.\n\n## chain.save(name, type)\n\nWrite the named config object back to its origin.\n\nCurrently only supported for env and file config types.\n\nFor files, encode the data according to the type.\n\n## chain.on('save', function () {})\n\nWhen one or more files are saved, emits `save` event when they're all\nsaved.\n\n## chain.on('load', function (chain) {})\n\nWhen the config chain has loaded all the specified files and urls and\nsuch, the 'load' event fires.\n", - "readmeFilename": "readme.markdown", + "gitHead": "832609897082a0a887c59dadb105f4db6de1ab4c", "bugs": { "url": "https://github.com/dominictarr/config-chain/issues" }, - "_id": "config-chain@1.1.8", - "dist": { - "shasum": "0943d0b7227213a20d4eaff4434f4a1c0a052cad", - "tarball": "http://registry.npmjs.org/config-chain/-/config-chain-1.1.8.tgz" - }, - "_from": "config-chain@^1.1.8", - "_npmVersion": "1.3.6", + "_id": "config-chain@1.1.9", + "_shasum": "39ac7d4dca84faad926124c54cff25a53aa8bf6e", + "_from": "config-chain@>=1.1.9 <1.2.0", + "_npmVersion": "2.11.0", + "_nodeVersion": "0.12.4", "_npmUser": { "name": "dominictarr", "email": "dominic.tarr@gmail.com" @@ -48,7 +51,10 @@ "email": "i@izs.me" } ], + "dist": { + "shasum": "39ac7d4dca84faad926124c54cff25a53aa8bf6e", + "tarball": "http://registry.npmjs.org/config-chain/-/config-chain-1.1.9.tgz" + }, "directories": {}, - "_shasum": "0943d0b7227213a20d4eaff4434f4a1c0a052cad", - "_resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.8.tgz" + "_resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.9.tgz" } diff --git a/deps/npm/node_modules/dezalgo/LICENSE b/deps/npm/node_modules/dezalgo/LICENSE new file mode 100644 index 00000000000..19129e315fe --- /dev/null +++ b/deps/npm/node_modules/dezalgo/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/dezalgo/node_modules/asap/package.json b/deps/npm/node_modules/dezalgo/node_modules/asap/package.json index 311f9fc0c7e..25ffeeb9495 100644 --- a/deps/npm/node_modules/dezalgo/node_modules/asap/package.json +++ b/deps/npm/node_modules/dezalgo/node_modules/asap/package.json @@ -14,8 +14,6 @@ } ], "main": "asap", - "readme": "\n# ASAP\n\nThis `asap` CommonJS package contains a single `asap` module that\nexports a single `asap` function that executes a function **as soon as\npossible**.\n\n```javascript\nasap(function () {\n // ...\n});\n```\n\nMore formally, ASAP provides a fast event queue that will execute tasks\nuntil it is empty before yielding to the JavaScript engine's underlying\nevent-loop. When the event queue becomes non-empty, ASAP schedules a\nflush event, preferring for that event to occur before the JavaScript\nengine has an opportunity to perform IO tasks or rendering, thus making\nthe first task and subsequent tasks semantically indistinguishable.\nASAP uses a variety of techniques to preserve this invariant on\ndifferent versions of browsers and NodeJS.\n\nBy design, ASAP can starve the event loop on the theory that, if there\nis enough work to be done synchronously, albeit in separate events, long\nenough to starve input or output, it is a strong indicator that the\nprogram needs to push back on scheduling more work.\n\nTake care. ASAP can sustain infinite recursive calls indefinitely\nwithout warning. This is behaviorally equivalent to an infinite loop.\nIt will not halt from a stack overflow, but it *will* chew through\nmemory (which is an oddity I cannot explain at this time). Just as with\ninfinite loops, you can monitor a Node process for this behavior with a\nheart-beat signal. As with infinite loops, a very small amount of\ncaution goes a long way to avoiding problems.\n\n```javascript\nfunction loop() {\n asap(loop);\n}\nloop();\n```\n\nASAP is distinct from `setImmediate` in that it does not suffer the\noverhead of returning a handle and being possible to cancel. For a\n`setImmediate` shim, consider [setImmediate][].\n\n[setImmediate]: https://github.com/noblejs/setimmediate\n\nIf a task throws an exception, it will not interrupt the flushing of\nhigh-priority tasks. The exception will be postponed to a later,\nlow-priority event to avoid slow-downs, when the underlying JavaScript\nengine will treat it as it does any unhandled exception.\n\n## Heritage\n\nASAP has been factored out of the [Q][] asynchronous promise library.\nIt originally had a naïve implementation in terms of `setTimeout`, but\n[Malte Ubl][NonBlocking] provided an insight that `postMessage` might be\nuseful for creating a high-priority, no-delay event dispatch hack.\nSince then, Internet Explorer proposed and implemented `setImmediate`.\nRobert Kratić began contributing to Q by measuring the performance of\nthe internal implementation of `asap`, paying particular attention to\nerror recovery. Domenic, Robert, and I collectively settled on the\ncurrent strategy of unrolling the high-priority event queue internally\nregardless of what strategy we used to dispatch the potentially\nlower-priority flush event. Domenic went on to make ASAP cooperate with\nNodeJS domains.\n\n[Q]: https://github.com/kriskowal/q\n[NonBlocking]: http://www.nonblocking.io/2011/06/windownexttick.html\n\nFor further reading, Nicholas Zakas provided a thorough article on [The\nCase for setImmediate][NCZ].\n\n[NCZ]: http://www.nczonline.net/blog/2013/07/09/the-case-for-setimmediate/\n\n## License\n\nCopyright 2009-2013 by Contributors\nMIT License (enclosed)\n\n", - "readmeFilename": "README.md", "_id": "asap@1.0.0", "dist": { "shasum": "b2a45da5fdfa20b0496fc3768cc27c12fa916a7d", @@ -35,5 +33,6 @@ ], "directories": {}, "_shasum": "b2a45da5fdfa20b0496fc3768cc27c12fa916a7d", - "_resolved": "https://registry.npmjs.org/asap/-/asap-1.0.0.tgz" + "_resolved": "https://registry.npmjs.org/asap/-/asap-1.0.0.tgz", + "readme": "ERROR: No README data found!" } diff --git a/deps/npm/node_modules/dezalgo/package.json b/deps/npm/node_modules/dezalgo/package.json index 1f63e83a18a..656dd0c5f85 100644 --- a/deps/npm/node_modules/dezalgo/package.json +++ b/deps/npm/node_modules/dezalgo/package.json @@ -1,6 +1,6 @@ { "name": "dezalgo", - "version": "1.0.1", + "version": "1.0.2", "description": "Contain async insanity so that the dark pony lord doesn't eat souls", "main": "dezalgo.js", "directories": { @@ -18,7 +18,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/dezalgo" + "url": "git+https://github.com/npm/dezalgo.git" }, "keywords": [ "async", @@ -43,25 +43,29 @@ "url": "https://github.com/npm/dezalgo/issues" }, "homepage": "https://github.com/npm/dezalgo", - "gitHead": "0a5eee75c179611f8b67f663015d68bb517e57d2", - "_id": "dezalgo@1.0.1", - "_shasum": "12bde135060807900d5a7aebb607c2abb7c76937", - "_from": "dezalgo@latest", - "_npmVersion": "2.0.0", - "_nodeVersion": "0.10.31", + "gitHead": "fabfd09a9a4ad458d0c801a1dbfff2338b9bc001", + "_id": "dezalgo@1.0.2", + "_shasum": "2bc8b5a1683131764a98def7e4aa22105a688a5a", + "_from": "dezalgo@>=1.0.1 <1.1.0", + "_npmVersion": "2.10.1", + "_nodeVersion": "2.0.2", "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + }, + "dist": { + "shasum": "2bc8b5a1683131764a98def7e4aa22105a688a5a", + "tarball": "http://registry.npmjs.org/dezalgo/-/dezalgo-1.0.2.tgz" }, "maintainers": [ { "name": "isaacs", - "email": "i@izs.me" + "email": "isaacs@npmjs.com" + }, + { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" } ], - "dist": { - "shasum": "12bde135060807900d5a7aebb607c2abb7c76937", - "tarball": "http://registry.npmjs.org/dezalgo/-/dezalgo-1.0.1.tgz" - }, - "_resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.1.tgz" + "_resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.2.tgz" } diff --git a/deps/npm/node_modules/editor/package.json b/deps/npm/node_modules/editor/package.json index 963b5d29bc3..0e5abd3bfb2 100644 --- a/deps/npm/node_modules/editor/package.json +++ b/deps/npm/node_modules/editor/package.json @@ -1,6 +1,6 @@ { "name": "editor", - "version": "0.1.0", + "version": "1.0.0", "description": "launch $EDITOR in your program", "main": "index.js", "directories": { @@ -33,19 +33,22 @@ "engine": { "node": ">=0.6" }, + "gitHead": "15200af2c417c65a4df153f39f32143dcd476375", "bugs": { "url": "https://github.com/substack/node-editor/issues" }, - "_id": "editor@0.1.0", - "dist": { - "shasum": "542f4662c6a8c88e862fc11945e204e51981b9a1", - "tarball": "http://registry.npmjs.org/editor/-/editor-0.1.0.tgz" - }, - "_from": "editor@latest", - "_npmVersion": "1.3.21", + "_id": "editor@1.0.0", + "_shasum": "60c7f87bd62bcc6a894fa8ccd6afb7823a24f742", + "_from": "editor@>=1.0.0 <1.1.0", + "_npmVersion": "2.7.5", + "_nodeVersion": "1.6.3", "_npmUser": { "name": "substack", - "email": "mail@substack.net" + "email": "substack@gmail.com" + }, + "dist": { + "shasum": "60c7f87bd62bcc6a894fa8ccd6afb7823a24f742", + "tarball": "http://registry.npmjs.org/editor/-/editor-1.0.0.tgz" }, "maintainers": [ { @@ -53,6 +56,5 @@ "email": "mail@substack.net" } ], - "_shasum": "542f4662c6a8c88e862fc11945e204e51981b9a1", - "_resolved": "https://registry.npmjs.org/editor/-/editor-0.1.0.tgz" + "_resolved": "https://registry.npmjs.org/editor/-/editor-1.0.0.tgz" } diff --git a/deps/npm/node_modules/fs-vacuum/LICENSE b/deps/npm/node_modules/fs-vacuum/LICENSE new file mode 100644 index 00000000000..d07fa9743a0 --- /dev/null +++ b/deps/npm/node_modules/fs-vacuum/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2015, Forrest L Norvell + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/fs-vacuum/package.json b/deps/npm/node_modules/fs-vacuum/package.json index 140536797f8..3b493545181 100644 --- a/deps/npm/node_modules/fs-vacuum/package.json +++ b/deps/npm/node_modules/fs-vacuum/package.json @@ -1,6 +1,6 @@ { "name": "fs-vacuum", - "version": "1.2.1", + "version": "1.2.6", "description": "recursively remove empty directories -- to a point", "main": "vacuum.js", "scripts": { @@ -8,7 +8,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/fs-vacuum.git" + "url": "git+https://github.com/npm/fs-vacuum.git" }, "keywords": [ "rm", @@ -27,16 +27,33 @@ "devDependencies": { "mkdirp": "^0.5.0", "tap": "^0.4.11", - "tmp": "0.0.23" + "tmp": "0.0.24" }, "dependencies": { "graceful-fs": "^3.0.2", + "path-is-inside": "^1.0.1", "rimraf": "^2.2.8" }, - "readme": "# fs-vacuum\n\nRemove the empty branches of a directory tree, optionally up to (but not\nincluding) a specified base directory. Optionally nukes the leaf directory.\n\n## Usage\n\n```javascript\nvar logger = require(\"npmlog\");\nvar vacuum = require(\"fs-vacuum\");\n\nvar options = {\n base : \"/path/to/my/tree/root\",\n purge : true,\n log : logger.silly.bind(logger, \"myCleanup\")\n};\n\n/* Assuming there are no other files or directories in \"out\", \"to\", or \"my\",\n * the final path will just be \"/path/to/my/tree/root\".\n */\nvacuum(\"/path/to/my/tree/root/out/to/my/files\", function (error) {\n if (error) console.error(\"Unable to cleanly vacuum:\", error.message);\n});\n```\n# vacuum(directory, options, callback)\n\n* `directory` {String} Leaf node to remove. **Must be a directory, symlink, or file.**\n* `options` {Object}\n * `base` {String} No directories at or above this level of the filesystem will be removed.\n * `purge` {Boolean} If set, nuke the whole leaf directory, including its contents.\n * `log` {Function} A logging function that takes `npmlog`-compatible argument lists.\n* `callback` {Function} Function to call once vacuuming is complete.\n * `error` {Error} What went wrong along the way, if anything.\n", - "readmeFilename": "README.md", - "gitHead": "bad24b21c45d86b3da991f2c3d058ef03546d83e", - "_id": "fs-vacuum@1.2.1", - "_shasum": "1bc3c62da30d6272569b8b9089c9811abb0a600b", - "_from": "fs-vacuum@>=1.2.1-0 <1.3.0-0" + "gitHead": "04b5093ac6fbcc4135835fb1c4ed990dfed5a04c", + "_id": "fs-vacuum@1.2.6", + "_shasum": "860c5e4b3e3aa2a6a3cbb327c57534f3a3bff642", + "_from": "fs-vacuum@>=1.2.5 <1.3.0", + "_npmVersion": "2.10.1", + "_nodeVersion": "2.0.2", + "_npmUser": { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + }, + "dist": { + "shasum": "860c5e4b3e3aa2a6a3cbb327c57534f3a3bff642", + "tarball": "http://registry.npmjs.org/fs-vacuum/-/fs-vacuum-1.2.6.tgz" + }, + "maintainers": [ + { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/fs-vacuum/-/fs-vacuum-1.2.6.tgz" } diff --git a/deps/npm/node_modules/fs-vacuum/vacuum.js b/deps/npm/node_modules/fs-vacuum/vacuum.js index f706a4be68c..e55abe9701b 100644 --- a/deps/npm/node_modules/fs-vacuum/vacuum.js +++ b/deps/npm/node_modules/fs-vacuum/vacuum.js @@ -1,6 +1,7 @@ -var assert = require("assert") -var dirname = require("path").dirname -var resolve = require("path").resolve +var assert = require("assert") +var dirname = require("path").dirname +var resolve = require("path").resolve +var isInside = require("path-is-inside") var rimraf = require("rimraf") var lstat = require("graceful-fs").lstat @@ -19,9 +20,10 @@ function vacuum(leaf, options, cb) { var log = options.log ? options.log : function () {} - var base = options.base - if (base && resolve(leaf).indexOf(resolve(base)) !== 0) { - return cb(new Error(resolve(leaf) + " is not a child of " + resolve(base))) + leaf = leaf && resolve(leaf) + var base = options.base && resolve(options.base) + if (base && !isInside(leaf, base)) { + return cb(new Error(leaf + " is not a child of " + base)) } lstat(leaf, function (error, stat) { @@ -59,8 +61,9 @@ function vacuum(leaf, options, cb) { }) function next(branch) { + branch = branch && resolve(branch) // either we've reached the base or we've reached the root - if ((base && resolve(branch) === resolve(base)) || branch === dirname(branch)) { + if ((base && branch === base) || branch === dirname(branch)) { log("finished vacuuming up to", branch) return cb(null) } @@ -90,7 +93,14 @@ function vacuum(leaf, options, cb) { var remove = stat.isDirectory() ? rmdir : unlink remove(branch, function (error) { if (error) { - if (error.code === "ENOENT") return cb(null) + if (error.code === "ENOENT") { + log("quitting because lost the race to remove", branch) + return cb(null) + } + if (error.code === "ENOTEMPTY") { + log("quitting because new (racy) entries in", branch) + return cb(null) + } log("unable to remove", branch, "due to", error.message) return cb(error) diff --git a/deps/npm/node_modules/fs-write-stream-atomic/index.js b/deps/npm/node_modules/fs-write-stream-atomic/index.js index 42a9a8825ec..d86b8c673f2 100644 --- a/deps/npm/node_modules/fs-write-stream-atomic/index.js +++ b/deps/npm/node_modules/fs-write-stream-atomic/index.js @@ -39,18 +39,18 @@ function cleanup (er) { }.bind(this)) } -function cleanupSync (er) { +function cleanupSync () { try { fs.unlinkSync(this.__atomicTmp) } finally { - return fs.WriteStream.prototype.emit.call(this, 'error', er) + return } } // When we *would* emit 'close' or 'finish', instead do our stuff WriteStream.prototype.emit = function (ev) { if (ev === 'error') - return cleanupSync(this) + cleanupSync.call(this) if (ev !== 'close' && ev !== 'finish') return fs.WriteStream.prototype.emit.apply(this, arguments) diff --git a/deps/npm/node_modules/fs-write-stream-atomic/package.json b/deps/npm/node_modules/fs-write-stream-atomic/package.json index 5cdd1a2e0d8..c300228a5d3 100644 --- a/deps/npm/node_modules/fs-write-stream-atomic/package.json +++ b/deps/npm/node_modules/fs-write-stream-atomic/package.json @@ -1,6 +1,6 @@ { "name": "fs-write-stream-atomic", - "version": "1.0.2", + "version": "1.0.3", "description": "Like `fs.createWriteStream(...)`, but atomic.", "main": "index.js", "directories": { @@ -29,25 +29,29 @@ "url": "https://github.com/npm/fs-write-stream-atomic/issues" }, "homepage": "https://github.com/npm/fs-write-stream-atomic", - "gitHead": "86b111ed1d5db84e8a9680986ef7917036b9c97b", - "_id": "fs-write-stream-atomic@1.0.2", - "_shasum": "fe0c6cec75256072b2fef8180d97e309fe3f5efb", - "_from": "fs-write-stream-atomic@>=1.0.2 <1.1.0", - "_npmVersion": "2.1.0", - "_nodeVersion": "0.10.31", + "gitHead": "78573c09271f3ec672740862dad80be3d75e1963", + "_id": "fs-write-stream-atomic@1.0.3", + "_shasum": "c8fe17f66d7d3f50e9aee59195c358e7710372cc", + "_from": "fs-write-stream-atomic@1.0.3", + "_npmVersion": "2.7.6", + "_nodeVersion": "1.6.2", "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" + "name": "iarna", + "email": "me@re-becca.org" + }, + "dist": { + "shasum": "c8fe17f66d7d3f50e9aee59195c358e7710372cc", + "tarball": "http://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.3.tgz" }, "maintainers": [ { "name": "isaacs", "email": "i@izs.me" + }, + { + "name": "iarna", + "email": "me@re-becca.org" } ], - "dist": { - "shasum": "fe0c6cec75256072b2fef8180d97e309fe3f5efb", - "tarball": "http://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.2.tgz" - }, - "_resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.2.tgz" + "_resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.3.tgz" } diff --git a/deps/npm/node_modules/fs-write-stream-atomic/test/toolong.js b/deps/npm/node_modules/fs-write-stream-atomic/test/toolong.js new file mode 100644 index 00000000000..e5b2b05b8c3 --- /dev/null +++ b/deps/npm/node_modules/fs-write-stream-atomic/test/toolong.js @@ -0,0 +1,24 @@ +var path = require('path') +var test = require('tap').test +var writeStream = require('../index.js') + +function repeat(times, string) { + var output = '' + for (var ii = 0; ii < times; ++ii) { + output += string + } + return output +} + +var target = path.resolve(__dirname, repeat(1000,'test')) + +test('name too long', function (t) { + var stream = writeStream(target) + stream.on('error', function (er) { + t.is(er.code, 'ENAMETOOLONG', target.length + " character name results in ENAMETOOLONG") + }) + stream.on('close', function () { + t.end() + }) + stream.end() +}) \ No newline at end of file diff --git a/deps/npm/node_modules/fstream-npm/.npmignore b/deps/npm/node_modules/fstream-npm/.npmignore index 06aea691717..c02f40cee6b 100644 --- a/deps/npm/node_modules/fstream-npm/.npmignore +++ b/deps/npm/node_modules/fstream-npm/.npmignore @@ -1,2 +1,3 @@ # ignore the output junk from the example scripts example/output +node_modules/ diff --git a/deps/npm/node_modules/fstream-npm/example/dir-tar.js b/deps/npm/node_modules/fstream-npm/example/dir-tar.js index f2bad92e0d8..393c796b2e3 100644 --- a/deps/npm/node_modules/fstream-npm/example/dir-tar.js +++ b/deps/npm/node_modules/fstream-npm/example/dir-tar.js @@ -1,18 +1,18 @@ // this will show what ends up in the fstream-npm package -var P = require("fstream").DirReader -var tar = require("tar") +var P = require('fstream').DirReader +var tar = require('tar') function f (entry) { - return entry.basename !== ".git" + return entry.basename !== '.git' } -new P({ path: "./", type: "Directory", Directory: true, filter: f }) - .on("package", function (p) { - console.error("package", p) +new P({ path: './', type: 'Directory', Directory: true, filter: f }) + .on('package', function (p) { + console.error('package', p) }) - .on("ignoreFile", function (e) { - console.error("ignoreFile", e) + .on('ignoreFile', function (e) { + console.error('ignoreFile', e) }) - .on("entry", function (e) { + .on('entry', function (e) { console.error(e.constructor.name, e.path.substr(e.root.path.length + 1)) }) .pipe(tar.Pack()) diff --git a/deps/npm/node_modules/fstream-npm/example/dir.js b/deps/npm/node_modules/fstream-npm/example/dir.js index 75e2eed0ff0..e524a3bfdb8 100644 --- a/deps/npm/node_modules/fstream-npm/example/dir.js +++ b/deps/npm/node_modules/fstream-npm/example/dir.js @@ -1,25 +1,25 @@ // this will show what ends up in the fstream-npm package -var P = require("../") -var DW = require("fstream").DirWriter +var P = require('../') +var DW = require('fstream').DirWriter -var target = new DW({ Directory: true, type: "Directory", - path: __dirname + "/output"}) +var target = new DW({ Directory: true, type: 'Directory', + path: __dirname + '/output'}) function f (entry) { - return entry.basename !== ".git" + return entry.basename !== '.git' } -P({ path: "./", type: "Directory", isDirectory: true, filter: f }) - .on("package", function (p) { - console.error("package", p) +P({ path: './', type: 'Directory', isDirectory: true, filter: f }) + .on('package', function (p) { + console.error('package', p) }) - .on("ignoreFile", function (e) { - console.error("ignoreFile", e) + .on('ignoreFile', function (e) { + console.error('ignoreFile', e) }) - .on("entry", function (e) { + .on('entry', function (e) { console.error(e.constructor.name, e.path) }) .pipe(target) - .on("end", function () { - console.error("ended") + .on('end', function () { + console.error('ended') }) diff --git a/deps/npm/node_modules/fstream-npm/example/example.js b/deps/npm/node_modules/fstream-npm/example/example.js index 0b53931caa6..2c933c44048 100644 --- a/deps/npm/node_modules/fstream-npm/example/example.js +++ b/deps/npm/node_modules/fstream-npm/example/example.js @@ -1,12 +1,12 @@ // this will show what ends up in the fstream-npm package -var P = require("../") -P({ path: "./" }) - .on("package", function (p) { - console.error("package", p) +var P = require('../') +P({ path: './' }) + .on('package', function (p) { + console.error('package', p) }) - .on("ignoreFile", function (e) { - console.error("ignoreFile", e) + .on('ignoreFile', function (e) { + console.error('ignoreFile', e) }) - .on("entry", function (e) { + .on('entry', function (e) { console.error(e.constructor.name, e.path.substr(e.root.dirname.length + 1)) }) diff --git a/deps/npm/node_modules/fstream-npm/example/ig-tar.js b/deps/npm/node_modules/fstream-npm/example/ig-tar.js index c1db81050a6..7a5b61fba65 100644 --- a/deps/npm/node_modules/fstream-npm/example/ig-tar.js +++ b/deps/npm/node_modules/fstream-npm/example/ig-tar.js @@ -1,18 +1,18 @@ // this will show what ends up in the fstream-npm package -var P = require("fstream-ignore") -var tar = require("tar") +var P = require('fstream-ignore') +var tar = require('tar') function f (entry) { - return entry.basename !== ".git" + return entry.basename !== '.git' } -new P({ path: "./", type: "Directory", Directory: true, filter: f }) - .on("package", function (p) { - console.error("package", p) +new P({ path: './', type: 'Directory', Directory: true, filter: f }) + .on('package', function (p) { + console.error('package', p) }) - .on("ignoreFile", function (e) { - console.error("ignoreFile", e) + .on('ignoreFile', function (e) { + console.error('ignoreFile', e) }) - .on("entry", function (e) { + .on('entry', function (e) { console.error(e.constructor.name, e.path.substr(e.root.path.length + 1)) }) .pipe(tar.Pack()) diff --git a/deps/npm/node_modules/fstream-npm/example/tar.js b/deps/npm/node_modules/fstream-npm/example/tar.js index f9bcaea8164..b7f7e5f04d9 100644 --- a/deps/npm/node_modules/fstream-npm/example/tar.js +++ b/deps/npm/node_modules/fstream-npm/example/tar.js @@ -1,6 +1,6 @@ // this will show what ends up in the fstream-npm package -var P = require("../") -var tar = require("tar") +var P = require('../') +var tar = require('tar') function f () { return true } @@ -8,18 +8,18 @@ function f () { // return entry.basename !== ".git" // } -new P({ path: "./", type: "Directory", isDirectory: true, filter: f }) - .on("package", function (p) { - console.error("package", p) +new P({ path: './', type: 'Directory', isDirectory: true, filter: f }) + .on('package', function (p) { + console.error('package', p) }) - .on("ignoreFile", function (e) { - console.error("ignoreFile", e) + .on('ignoreFile', function (e) { + console.error('ignoreFile', e) }) - .on("entry", function (e) { + .on('entry', function (e) { console.error(e.constructor.name, e.path) }) - .on("end", function () { - console.error("ended") + .on('end', function () { + console.error('ended') }) .pipe(tar.Pack()) .pipe(process.stdout) diff --git a/deps/npm/node_modules/fstream-npm/fstream-npm.js b/deps/npm/node_modules/fstream-npm/fstream-npm.js index 863f5884544..7e44072bc98 100644 --- a/deps/npm/node_modules/fstream-npm/fstream-npm.js +++ b/deps/npm/node_modules/fstream-npm/fstream-npm.js @@ -1,7 +1,7 @@ -var Ignore = require("fstream-ignore") -, inherits = require("inherits") -, path = require("path") -, fs = require("fs") +var Ignore = require('fstream-ignore') +var inherits = require('inherits') +var path = require('path') +var fs = require('fs') module.exports = Packer @@ -12,13 +12,13 @@ function Packer (props) { return new Packer(props) } - if (typeof props === "string") { + if (typeof props === 'string') { props = { path: props } } - props.ignoreFiles = props.ignoreFiles || [ ".npmignore", - ".gitignore", - "package.json" ] + props.ignoreFiles = props.ignoreFiles || [ '.npmignore', + '.gitignore', + 'package.json' ] Ignore.call(this, props) @@ -30,7 +30,7 @@ function Packer (props) { // lives right next to a package.json file. this.bundleMagic = this.parent && this.parent.packageRoot && - this.basename === "node_modules" + this.basename === 'node_modules' // in a node_modules folder, resolve symbolic links to // bundled dependencies when creating the package. @@ -40,42 +40,44 @@ function Packer (props) { if (this === this.root || this.parent && this.parent.bundleMagic && - this.basename.charAt(0) !== ".") { + this.basename.charAt(0) !== '.') { this.readBundledLinks() } - - this.on("entryStat", function (entry, props) { + this.on('entryStat', function (entry, props) { // files should *always* get into tarballs // in a user-writable state, even if they're // being installed from some wackey vm-mounted // read-only filesystem. - entry.mode = props.mode = props.mode | 0200 + entry.mode = props.mode = props.mode | parseInt('0200', 8) }) } Packer.prototype.readBundledLinks = function () { if (this._paused) { - this.once("resume", this.addIgnoreFiles) + this.once('resume', this.addIgnoreFiles) return } this.pause() - fs.readdir(this.path + "/node_modules", function (er, list) { + fs.readdir(this.path + '/node_modules', function (er, list) { // no harm if there's no bundle var l = list && list.length if (er || l === 0) return this.resume() var errState = null - , then = function then (er) { + var then = function then (er) { if (errState) return - if (er) return errState = er, this.resume() - if (-- l === 0) return this.resume() + if (er) { + errState = er + return this.resume() + } + if (--l === 0) return this.resume() }.bind(this) list.forEach(function (pkg) { - if (pkg.charAt(0) === ".") return then() - var pd = this.path + "/node_modules/" + pkg + if (pkg.charAt(0) === '.') return then() + var pd = this.path + '/node_modules/' + pkg fs.realpath(pd, function (er, rp) { if (er) return then() this.bundleLinks = this.bundleLinks || {} @@ -88,7 +90,7 @@ Packer.prototype.readBundledLinks = function () { Packer.prototype.applyIgnores = function (entry, partial, entryObj) { // package.json files can never be ignored. - if (entry === "package.json") return true + if (entry === 'package.json') return true // readme files should never be ignored. if (entry.match(/^readme(\.[^\.]*)$/i)) return true @@ -100,19 +102,19 @@ Packer.prototype.applyIgnores = function (entry, partial, entryObj) { if (entry.match(/^(changes|changelog|history)(\.[^\.]*)?$/i)) return true // special rules. see below. - if (entry === "node_modules" && this.packageRoot) return true + if (entry === 'node_modules' && this.packageRoot) return true // some files are *never* allowed under any circumstances - if (entry === ".git" || - entry === ".lock-wscript" || + if (entry === '.git' || + entry === '.lock-wscript' || entry.match(/^\.wafpickle-[0-9]+$/) || - entry === "CVS" || - entry === ".svn" || - entry === ".hg" || + entry === 'CVS' || + entry === '.svn' || + entry === '.hg' || entry.match(/^\..*\.swp$/) || - entry === ".DS_Store" || + entry === '.DS_Store' || entry.match(/^\._/) || - entry === "npm-debug.log" + entry === 'npm-debug.log' ) { return false } @@ -127,13 +129,12 @@ Packer.prototype.applyIgnores = function (entry, partial, entryObj) { // if they're not already present at a higher level. if (this.bundleMagic) { // bubbling up. stop here and allow anything the bundled pkg allows - if (entry.indexOf("/") !== -1) return true + if (entry.indexOf('/') !== -1) return true // never include the .bin. It's typically full of platform-specific // stuff like symlinks and .cmd files anyway. - if (entry === ".bin") return false + if (entry === '.bin') return false - var shouldBundle = false // the package root. var p = this.parent // the package before this one. @@ -149,12 +150,18 @@ Packer.prototype.applyIgnores = function (entry, partial, entryObj) { // since it's *not* a symbolic link, if we're *already* in a bundle, // then we should include everything. - if (pp && pp.package && pp.basename === "node_modules") { + if (pp && pp.package && pp.basename === 'node_modules') { return true } // only include it at this point if it's a bundleDependency var bd = this.package && this.package.bundleDependencies + + if (bd && !Array.isArray(bd)) { + throw new Error(this.package.name + '\'s `bundledDependencies` should ' + + 'be an array') + } + var shouldBundle = bd && bd.indexOf(entry) !== -1 // if we're not going to bundle it, then it doesn't count as a bundleLink // if (this.bundleLinks && !shouldBundle) delete this.bundleLinks[entry] @@ -169,8 +176,8 @@ Packer.prototype.addIgnoreFiles = function () { var entries = this.entries // if there's a .npmignore, then we do *not* want to // read the .gitignore. - if (-1 !== entries.indexOf(".npmignore")) { - var i = entries.indexOf(".gitignore") + if (entries.indexOf('.npmignore') !== -1) { + var i = entries.indexOf('.gitignore') if (i !== -1) { entries.splice(i, 1) } @@ -181,9 +188,8 @@ Packer.prototype.addIgnoreFiles = function () { Ignore.prototype.addIgnoreFiles.call(this) } - Packer.prototype.readRules = function (buf, e) { - if (e !== "package.json") { + if (e !== 'package.json') { return Ignore.prototype.readRules.call(this, buf, e) } @@ -204,7 +210,7 @@ Packer.prototype.readRules = function (buf, e) { } this.packageRoot = true - this.emit("package", p) + this.emit('package', p) // make bundle deps predictable if (p.bundledDependencies && !p.bundleDependencies) { @@ -215,10 +221,10 @@ Packer.prototype.readRules = function (buf, e) { if (!p.files || !Array.isArray(p.files)) return [] // ignore everything except what's in the files array. - return ["*"].concat(p.files.map(function (f) { - return "!" + f + return ['*'].concat(p.files.map(function (f) { + return '!' + f })).concat(p.files.map(function (f) { - return "!" + f.replace(/\/+$/, "") + "/**" + return '!' + f.replace(/\/+$/, '') + '/**' })) } @@ -242,20 +248,20 @@ Packer.prototype.getChildProps = function (stat) { return props } - -var order = - [ "package.json" - , ".npmignore" - , ".gitignore" - , /^README(\.md)?$/ - , "LICENCE" - , "LICENSE" - , /\.js$/ ] +var order = [ + 'package.json', + '.npmignore', + '.gitignore', + /^README(\.md)?$/, + 'LICENCE', + 'LICENSE', + /\.js$/ +] Packer.prototype.sort = function (a, b) { - for (var i = 0, l = order.length; i < l; i ++) { + for (var i = 0, l = order.length; i < l; i++) { var o = order[i] - if (typeof o === "string") { + if (typeof o === 'string') { if (a === o) return -1 if (b === o) return 1 } else { @@ -265,46 +271,44 @@ Packer.prototype.sort = function (a, b) { } // deps go in the back - if (a === "node_modules") return 1 - if (b === "node_modules") return -1 + if (a === 'node_modules') return 1 + if (b === 'node_modules') return -1 return Ignore.prototype.sort.call(this, a, b) } - - Packer.prototype.emitEntry = function (entry) { if (this._paused) { - this.once("resume", this.emitEntry.bind(this, entry)) + this.once('resume', this.emitEntry.bind(this, entry)) return } // if there is a .gitignore, then we're going to // rename it to .npmignore in the output. - if (entry.basename === ".gitignore") { - entry.basename = ".npmignore" + if (entry.basename === '.gitignore') { + entry.basename = '.npmignore' entry.path = path.resolve(entry.dirname, entry.basename) } // all *.gyp files are renamed to binding.gyp for node-gyp // but only when they are in the same folder as a package.json file. if (entry.basename.match(/\.gyp$/) && - this.entries.indexOf("package.json") !== -1) { - entry.basename = "binding.gyp" + this.entries.indexOf('package.json') !== -1) { + entry.basename = 'binding.gyp' entry.path = path.resolve(entry.dirname, entry.basename) } // skip over symbolic links - if (entry.type === "SymbolicLink") { + if (entry.type === 'SymbolicLink') { entry.abort() return } - if (entry.type !== "Directory") { + if (entry.type !== 'Directory') { // make it so that the folder in the tarball is named "package" var h = path.dirname((entry.root || entry).path) - , t = entry.path.substr(h.length + 1).replace(/^[^\/\\]+/, "package") - , p = h + "/" + t + var t = entry.path.substr(h.length + 1).replace(/^[^\/\\]+/, 'package') + var p = h + '/' + t entry.path = p entry.dirname = path.dirname(p) @@ -319,11 +323,11 @@ Packer.prototype.emitEntry = function (entry) { // .pipe() doesn't do anythign special with "child" events, on // with "entry" events. var me = this - entry.on("entry", function (e) { + entry.on('entry', function (e) { if (e.parent === entry) { e.parent = me - me.emit("entry", e) + me.emit('entry', e) } }) - entry.on("package", this.emit.bind(this, "package")) + entry.on('package', this.emit.bind(this, 'package')) } diff --git a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/package.json b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/package.json index 29e508673a5..1a505bd4a2a 100644 --- a/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/package.json +++ b/deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/package.json @@ -6,7 +6,7 @@ }, "name": "fstream-ignore", "description": "A thing for ignoring files based on globs", - "version": "1.0.1", + "version": "1.0.2", "repository": { "type": "git", "url": "git://github.com/isaacs/fstream-ignore.git" @@ -18,7 +18,7 @@ "dependencies": { "fstream": "^1.0.0", "inherits": "2", - "minimatch": "^1.0.0" + "minimatch": "^2.0.1" }, "devDependencies": { "tap": "", @@ -26,15 +26,16 @@ "mkdirp": "" }, "license": "ISC", - "gitHead": "290f2b621fa4f8fe3eec97307d22527fa2065375", + "gitHead": "20363d39660671c0de746bd07a0d07de7090d085", "bugs": { "url": "https://github.com/isaacs/fstream-ignore/issues" }, "homepage": "https://github.com/isaacs/fstream-ignore", - "_id": "fstream-ignore@1.0.1", - "_shasum": "153df36c4fa2cb006fb915dc71ac9d75f6a17c82", + "_id": "fstream-ignore@1.0.2", + "_shasum": "18c891db01b782a74a7bff936a0f24997741c7ab", "_from": "fstream-ignore@>=1.0.0 <2.0.0", - "_npmVersion": "1.4.22", + "_npmVersion": "2.1.11", + "_nodeVersion": "0.10.16", "_npmUser": { "name": "isaacs", "email": "i@izs.me" @@ -46,10 +47,10 @@ } ], "dist": { - "shasum": "153df36c4fa2cb006fb915dc71ac9d75f6a17c82", - "tarball": "http://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.1.tgz" + "shasum": "18c891db01b782a74a7bff936a0f24997741c7ab", + "tarball": "http://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.2.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.1.tgz", + "_resolved": "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.2.tgz", "readme": "ERROR: No README data found!" } diff --git a/deps/npm/node_modules/fstream-npm/package.json b/deps/npm/node_modules/fstream-npm/package.json index e7de77086af..f3c5d3cfce7 100644 --- a/deps/npm/node_modules/fstream-npm/package.json +++ b/deps/npm/node_modules/fstream-npm/package.json @@ -6,42 +6,31 @@ }, "name": "fstream-npm", "description": "fstream class for creating npm packages", - "version": "1.0.1", + "version": "1.0.2", "repository": { "type": "git", "url": "git://github.com/isaacs/fstream-npm.git" }, + "scripts": { + "test": "standard" + }, "main": "./fstream-npm.js", "dependencies": { "fstream-ignore": "^1.0.0", "inherits": "2" }, + "devDependencies": { + "standard": "^2.7.3" + }, "license": "ISC", - "gitHead": "4a95e1903f93dc122320349bb55e367ddd08ad6b", + "readme": "# fstream-npm\n\nThis is an fstream DirReader class that will read a directory and filter\nthings according to the semantics of what goes in an npm package.\n\nFor example:\n\n```javascript\n// This will print out all the files that would be included\n// by 'npm publish' or 'npm install' of this directory.\n\nvar FN = require(\"fstream-npm\")\nFN({ path: \"./\" })\n .on(\"child\", function (e) {\n console.error(e.path.substr(e.root.path.length + 1))\n })\n```\n\n", + "readmeFilename": "README.md", + "gitHead": "d5e26643135522925effa2c112258f1feeec2ba5", "bugs": { "url": "https://github.com/isaacs/fstream-npm/issues" }, "homepage": "https://github.com/isaacs/fstream-npm", - "_id": "fstream-npm@1.0.1", - "scripts": {}, - "_shasum": "1e35c77f0fa24f5d6367e6d447ae7d6ddb482db2", - "_from": "fstream-npm@>=1.0.1 <1.1.0", - "_npmVersion": "2.1.3", - "_nodeVersion": "0.10.31", - "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - } - ], - "dist": { - "shasum": "1e35c77f0fa24f5d6367e6d447ae7d6ddb482db2", - "tarball": "http://registry.npmjs.org/fstream-npm/-/fstream-npm-1.0.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/fstream-npm/-/fstream-npm-1.0.1.tgz" + "_id": "fstream-npm@1.0.2", + "_shasum": "a1d2a4ce6ac2db731f0f66a85b4dddfea9565d77", + "_from": "fstream-npm@>=1.0.2 <1.1.0" } diff --git a/deps/npm/node_modules/fstream/.travis.yml b/deps/npm/node_modules/fstream/.travis.yml index 2d26206d58c..a092c82b26f 100644 --- a/deps/npm/node_modules/fstream/.travis.yml +++ b/deps/npm/node_modules/fstream/.travis.yml @@ -1,3 +1,9 @@ language: node_js node_js: - - 0.6 + - iojs + - 0.12 + - 0.10 + - 0.8 +before_install: + - "npm config set spin false" + - "npm install -g npm/npm" diff --git a/deps/npm/node_modules/fstream/LICENSE b/deps/npm/node_modules/fstream/LICENSE index 0c44ae716db..19129e315fe 100644 --- a/deps/npm/node_modules/fstream/LICENSE +++ b/deps/npm/node_modules/fstream/LICENSE @@ -1,27 +1,15 @@ -Copyright (c) Isaac Z. Schlueter ("Author") -All rights reserved. +The ISC License -The BSD License +Copyright (c) Isaac Z. Schlueter and Contributors -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/fstream/examples/filter-pipe.js b/deps/npm/node_modules/fstream/examples/filter-pipe.js index c6b55b3e02a..fc59cfc7aba 100644 --- a/deps/npm/node_modules/fstream/examples/filter-pipe.js +++ b/deps/npm/node_modules/fstream/examples/filter-pipe.js @@ -1,77 +1,78 @@ -var fstream = require("../fstream.js") -var path = require("path") - -var r = fstream.Reader({ path: path.dirname(__dirname) - , filter: function () { - return !this.basename.match(/^\./) && - !this.basename.match(/^node_modules$/) - !this.basename.match(/^deep-copy$/) - !this.basename.match(/^filter-copy$/) - } - }) +var fstream = require('../fstream.js') +var path = require('path') + +var r = fstream.Reader({ + path: path.dirname(__dirname), + filter: function () { + return !this.basename.match(/^\./) && + !this.basename.match(/^node_modules$/) && + !this.basename.match(/^deep-copy$/) && + !this.basename.match(/^filter-copy$/) + } +}) // this writer will only write directories -var w = fstream.Writer({ path: path.resolve(__dirname, "filter-copy") - , type: "Directory" - , filter: function () { - return this.type === "Directory" - } - }) +var w = fstream.Writer({ + path: path.resolve(__dirname, 'filter-copy'), + type: 'Directory', + filter: function () { + return this.type === 'Directory' + } +}) -var indent = "" -var escape = {} +var indent = '' -r.on("entry", appears) -r.on("ready", function () { - console.error("ready to begin!", r.path) +r.on('entry', appears) +r.on('ready', function () { + console.error('ready to begin!', r.path) }) function appears (entry) { - console.error(indent + "a %s appears!", entry.type, entry.basename, typeof entry.basename) + console.error(indent + 'a %s appears!', entry.type, entry.basename, typeof entry.basename) if (foggy) { - console.error("FOGGY!") + console.error('FOGGY!') var p = entry do { console.error(p.depth, p.path, p._paused) - } while (p = p.parent) + p = p.parent + } while (p) - throw new Error("\033[mshould not have entries while foggy") + throw new Error('\u001b[mshould not have entries while foggy') } - indent += "\t" - entry.on("data", missile(entry)) - entry.on("end", runaway(entry)) - entry.on("entry", appears) + indent += '\t' + entry.on('data', missile(entry)) + entry.on('end', runaway(entry)) + entry.on('entry', appears) } var foggy function missile (entry) { - if (entry.type === "Directory") { + function liftFog (who) { + if (!foggy) return + if (who) { + console.error('%s breaks the spell!', who && who.path) + } else { + console.error('the spell expires!') + } + console.error('\u001b[mthe fog lifts!\n') + clearTimeout(foggy) + foggy = null + if (entry._paused) entry.resume() + } + + if (entry.type === 'Directory') { var ended = false - entry.once("end", function () { ended = true }) + entry.once('end', function () { ended = true }) return function (c) { // throw in some pathological pause()/resume() behavior // just for extra fun. process.nextTick(function () { if (!foggy && !ended) { // && Math.random() < 0.3) { - console.error(indent +"%s casts a spell", entry.basename) - console.error("\na slowing fog comes over the battlefield...\n\033[32m") + console.error(indent + '%s casts a spell', entry.basename) + console.error('\na slowing fog comes over the battlefield...\n\u001b[32m') entry.pause() - entry.once("resume", liftFog) + entry.once('resume', liftFog) foggy = setTimeout(liftFog, 1000) - - function liftFog (who) { - if (!foggy) return - if (who) { - console.error("%s breaks the spell!", who && who.path) - } else { - console.error("the spell expires!") - } - console.error("\033[mthe fog lifts!\n") - clearTimeout(foggy) - foggy = null - if (entry._paused) entry.resume() - } - } }) } @@ -79,53 +80,54 @@ function missile (entry) { return function (c) { var e = Math.random() < 0.5 - console.error(indent + "%s %s for %d damage!", + console.error(indent + '%s %s for %d damage!', entry.basename, - e ? "is struck" : "fires a chunk", + e ? 'is struck' : 'fires a chunk', c.length) } } -function runaway (entry) { return function () { - var e = Math.random() < 0.5 - console.error(indent + "%s %s", - entry.basename, - e ? "turns to flee" : "is vanquished!") - indent = indent.slice(0, -1) -}} - +function runaway (entry) { + return function () { + var e = Math.random() < 0.5 + console.error(indent + '%s %s', + entry.basename, + e ? 'turns to flee' : 'is vanquished!') + indent = indent.slice(0, -1) + } +} -w.on("entry", attacks) -//w.on("ready", function () { attacks(w) }) +w.on('entry', attacks) +// w.on('ready', function () { attacks(w) }) function attacks (entry) { - console.error(indent + "%s %s!", entry.basename, - entry.type === "Directory" ? "calls for backup" : "attacks") - entry.on("entry", attacks) + console.error(indent + '%s %s!', entry.basename, + entry.type === 'Directory' ? 'calls for backup' : 'attacks') + entry.on('entry', attacks) } -ended = false +var ended = false var i = 1 -r.on("end", function () { +r.on('end', function () { if (foggy) clearTimeout(foggy) - console.error("\033[mIT'S OVER!!") - console.error("A WINNAR IS YOU!") + console.error("\u001b[mIT'S OVER!!") + console.error('A WINNAR IS YOU!') - console.log("ok " + (i ++) + " A WINNAR IS YOU") + console.log('ok ' + (i++) + ' A WINNAR IS YOU') ended = true // now go through and verify that everything in there is a dir. - var p = path.resolve(__dirname, "filter-copy") + var p = path.resolve(__dirname, 'filter-copy') var checker = fstream.Reader({ path: p }) checker.checker = true - checker.on("child", function (e) { - var ok = e.type === "Directory" - console.log((ok ? "" : "not ") + "ok " + (i ++) + - " should be a dir: " + + checker.on('child', function (e) { + var ok = e.type === 'Directory' + console.log((ok ? '' : 'not ') + 'ok ' + (i++) + + ' should be a dir: ' + e.path.substr(checker.path.length + 1)) }) }) -process.on("exit", function () { - console.log((ended ? "" : "not ") + "ok " + (i ++) + " ended") +process.on('exit', function () { + console.log((ended ? '' : 'not ') + 'ok ' + (i++) + ' ended') }) r.pipe(w) diff --git a/deps/npm/node_modules/fstream/examples/pipe.js b/deps/npm/node_modules/fstream/examples/pipe.js index 648ec849388..c611dd5c47b 100644 --- a/deps/npm/node_modules/fstream/examples/pipe.js +++ b/deps/npm/node_modules/fstream/examples/pipe.js @@ -1,72 +1,73 @@ -var fstream = require("../fstream.js") -var path = require("path") - -var r = fstream.Reader({ path: path.dirname(__dirname) - , filter: function () { - return !this.basename.match(/^\./) && - !this.basename.match(/^node_modules$/) - !this.basename.match(/^deep-copy$/) - } - }) +var fstream = require('../fstream.js') +var path = require('path') + +var r = fstream.Reader({ + path: path.dirname(__dirname), + filter: function () { + return !this.basename.match(/^\./) && + !this.basename.match(/^node_modules$/) && + !this.basename.match(/^deep-copy$/) + } +}) -var w = fstream.Writer({ path: path.resolve(__dirname, "deep-copy") - , type: "Directory" - }) +var w = fstream.Writer({ + path: path.resolve(__dirname, 'deep-copy'), + type: 'Directory' +}) -var indent = "" -var escape = {} +var indent = '' -r.on("entry", appears) -r.on("ready", function () { - console.error("ready to begin!", r.path) +r.on('entry', appears) +r.on('ready', function () { + console.error('ready to begin!', r.path) }) function appears (entry) { - console.error(indent + "a %s appears!", entry.type, entry.basename, typeof entry.basename, entry) + console.error(indent + 'a %s appears!', entry.type, entry.basename, typeof entry.basename, entry) if (foggy) { - console.error("FOGGY!") + console.error('FOGGY!') var p = entry do { console.error(p.depth, p.path, p._paused) - } while (p = p.parent) + p = p.parent + } while (p) - throw new Error("\033[mshould not have entries while foggy") + throw new Error('\u001b[mshould not have entries while foggy') } - indent += "\t" - entry.on("data", missile(entry)) - entry.on("end", runaway(entry)) - entry.on("entry", appears) + indent += '\t' + entry.on('data', missile(entry)) + entry.on('end', runaway(entry)) + entry.on('entry', appears) } var foggy function missile (entry) { - if (entry.type === "Directory") { + function liftFog (who) { + if (!foggy) return + if (who) { + console.error('%s breaks the spell!', who && who.path) + } else { + console.error('the spell expires!') + } + console.error('\u001b[mthe fog lifts!\n') + clearTimeout(foggy) + foggy = null + if (entry._paused) entry.resume() + } + + if (entry.type === 'Directory') { var ended = false - entry.once("end", function () { ended = true }) + entry.once('end', function () { ended = true }) return function (c) { // throw in some pathological pause()/resume() behavior // just for extra fun. process.nextTick(function () { if (!foggy && !ended) { // && Math.random() < 0.3) { - console.error(indent +"%s casts a spell", entry.basename) - console.error("\na slowing fog comes over the battlefield...\n\033[32m") + console.error(indent + '%s casts a spell', entry.basename) + console.error('\na slowing fog comes over the battlefield...\n\u001b[32m') entry.pause() - entry.once("resume", liftFog) + entry.once('resume', liftFog) foggy = setTimeout(liftFog, 10) - - function liftFog (who) { - if (!foggy) return - if (who) { - console.error("%s breaks the spell!", who && who.path) - } else { - console.error("the spell expires!") - } - console.error("\033[mthe fog lifts!\n") - clearTimeout(foggy) - foggy = null - if (entry._paused) entry.resume() - } - } }) } @@ -74,42 +75,43 @@ function missile (entry) { return function (c) { var e = Math.random() < 0.5 - console.error(indent + "%s %s for %d damage!", + console.error(indent + '%s %s for %d damage!', entry.basename, - e ? "is struck" : "fires a chunk", + e ? 'is struck' : 'fires a chunk', c.length) } } -function runaway (entry) { return function () { - var e = Math.random() < 0.5 - console.error(indent + "%s %s", - entry.basename, - e ? "turns to flee" : "is vanquished!") - indent = indent.slice(0, -1) -}} - +function runaway (entry) { + return function () { + var e = Math.random() < 0.5 + console.error(indent + '%s %s', + entry.basename, + e ? 'turns to flee' : 'is vanquished!') + indent = indent.slice(0, -1) + } +} -w.on("entry", attacks) -//w.on("ready", function () { attacks(w) }) +w.on('entry', attacks) +// w.on('ready', function () { attacks(w) }) function attacks (entry) { - console.error(indent + "%s %s!", entry.basename, - entry.type === "Directory" ? "calls for backup" : "attacks") - entry.on("entry", attacks) + console.error(indent + '%s %s!', entry.basename, + entry.type === 'Directory' ? 'calls for backup' : 'attacks') + entry.on('entry', attacks) } -ended = false -r.on("end", function () { +var ended = false +r.on('end', function () { if (foggy) clearTimeout(foggy) - console.error("\033[mIT'S OVER!!") - console.error("A WINNAR IS YOU!") + console.error("\u001b[mIT'S OVER!!") + console.error('A WINNAR IS YOU!') - console.log("ok 1 A WINNAR IS YOU") + console.log('ok 1 A WINNAR IS YOU') ended = true }) -process.on("exit", function () { - console.log((ended ? "" : "not ") + "ok 2 ended") +process.on('exit', function () { + console.log((ended ? '' : 'not ') + 'ok 2 ended') }) r.pipe(w) diff --git a/deps/npm/node_modules/fstream/examples/reader.js b/deps/npm/node_modules/fstream/examples/reader.js index 9aa1a9538d6..19affbe7e6e 100644 --- a/deps/npm/node_modules/fstream/examples/reader.js +++ b/deps/npm/node_modules/fstream/examples/reader.js @@ -1,54 +1,68 @@ -var fstream = require("../fstream.js") -var tap = require("tap") -var fs = require("fs") -var path = require("path") -var children = -1 +var fstream = require('../fstream.js') +var tap = require('tap') +var fs = require('fs') +var path = require('path') var dir = path.dirname(__dirname) -var gotReady = false -var ended = false +tap.test('reader test', function (t) { + var children = -1 + var gotReady = false + var ended = false -tap.test("reader test", function (t) { - - var r = fstream.Reader({ path: dir - , filter: function () { - // return this.parent === r - return this.parent === r || this === r - } - }) + var r = fstream.Reader({ + path: dir, + filter: function () { + // return this.parent === r + return this.parent === r || this === r + } + }) - r.on("ready", function () { + r.on('ready', function () { gotReady = true children = fs.readdirSync(dir).length - console.error("Setting expected children to "+children) - t.equal(r.type, "Directory", "should be a directory") + console.error('Setting expected children to ' + children) + t.equal(r.type, 'Directory', 'should be a directory') }) - r.on("entry", function (entry) { - children -- + r.on('entry', function (entry) { + children-- if (!gotReady) { - t.fail("children before ready!") + t.fail('children before ready!') } - t.equal(entry.dirname, r.path, "basename is parent dir") + t.equal(entry.dirname, r.path, 'basename is parent dir') }) - r.on("error", function (er) { + r.on('error', function (er) { t.fail(er) t.end() process.exit(1) }) - r.on("end", function () { - t.equal(children, 0, "should have seen all children") + r.on('end', function () { + t.equal(children, 0, 'should have seen all children') ended = true }) var closed = false - r.on("close", function () { - t.ok(ended, "saw end before close") - t.notOk(closed, "close should only happen once") + r.on('close', function () { + t.ok(ended, 'saw end before close') + t.notOk(closed, 'close should only happen once') closed = true t.end() }) +}) + +tap.test('reader error test', function (t) { + // assumes non-root on a *nix system + var r = fstream.Reader({ path: '/etc/shadow' }) + + r.once('error', function (er) { + t.ok(true) + t.end() + }) + r.on('end', function () { + t.fail('reader ended without error') + t.end() + }) }) diff --git a/deps/npm/node_modules/fstream/examples/symlink-write.js b/deps/npm/node_modules/fstream/examples/symlink-write.js index d7816d24ddd..f6f51099bc2 100644 --- a/deps/npm/node_modules/fstream/examples/symlink-write.js +++ b/deps/npm/node_modules/fstream/examples/symlink-write.js @@ -1,24 +1,25 @@ -var fstream = require("../fstream.js") - , closed = false +var fstream = require('../fstream.js') +var notOpen = false fstream - .Writer({ path: "path/to/symlink" - , linkpath: "./file" - , isSymbolicLink: true - , mode: "0755" // octal strings supported - }) - .on("close", function () { - closed = true - var fs = require("fs") - var s = fs.lstatSync("path/to/symlink") + .Writer({ + path: 'path/to/symlink', + linkpath: './file', + isSymbolicLink: true, + mode: '0755' // octal strings supported + }) + .on('close', function () { + notOpen = true + var fs = require('fs') + var s = fs.lstatSync('path/to/symlink') var isSym = s.isSymbolicLink() - console.log((isSym?"":"not ") +"ok 1 should be symlink") - var t = fs.readlinkSync("path/to/symlink") - var isTarget = t === "./file" - console.log((isTarget?"":"not ") +"ok 2 should link to ./file") + console.log((isSym ? '' : 'not ') + 'ok 1 should be symlink') + var t = fs.readlinkSync('path/to/symlink') + var isTarget = t === './file' + console.log((isTarget ? '' : 'not ') + 'ok 2 should link to ./file') }) .end() -process.on("exit", function () { - console.log((closed?"":"not ")+"ok 3 should be closed") +process.on('exit', function () { + console.log((notOpen ? '' : 'not ') + 'ok 3 should be closed') }) diff --git a/deps/npm/node_modules/fstream/fstream.js b/deps/npm/node_modules/fstream/fstream.js index c66d26f519b..c0eb3bea788 100644 --- a/deps/npm/node_modules/fstream/fstream.js +++ b/deps/npm/node_modules/fstream/fstream.js @@ -1,22 +1,26 @@ -exports.Abstract = require("./lib/abstract.js") -exports.Reader = require("./lib/reader.js") -exports.Writer = require("./lib/writer.js") +exports.Abstract = require('./lib/abstract.js') +exports.Reader = require('./lib/reader.js') +exports.Writer = require('./lib/writer.js') -exports.File = - { Reader: require("./lib/file-reader.js") - , Writer: require("./lib/file-writer.js") } +exports.File = { + Reader: require('./lib/file-reader.js'), + Writer: require('./lib/file-writer.js') +} -exports.Dir = - { Reader : require("./lib/dir-reader.js") - , Writer : require("./lib/dir-writer.js") } +exports.Dir = { + Reader: require('./lib/dir-reader.js'), + Writer: require('./lib/dir-writer.js') +} -exports.Link = - { Reader : require("./lib/link-reader.js") - , Writer : require("./lib/link-writer.js") } +exports.Link = { + Reader: require('./lib/link-reader.js'), + Writer: require('./lib/link-writer.js') +} -exports.Proxy = - { Reader : require("./lib/proxy-reader.js") - , Writer : require("./lib/proxy-writer.js") } +exports.Proxy = { + Reader: require('./lib/proxy-reader.js'), + Writer: require('./lib/proxy-writer.js') +} exports.Reader.Dir = exports.DirReader = exports.Dir.Reader exports.Reader.File = exports.FileReader = exports.File.Reader @@ -28,4 +32,4 @@ exports.Writer.File = exports.FileWriter = exports.File.Writer exports.Writer.Link = exports.LinkWriter = exports.Link.Writer exports.Writer.Proxy = exports.ProxyWriter = exports.Proxy.Writer -exports.collect = require("./lib/collect.js") +exports.collect = require('./lib/collect.js') diff --git a/deps/npm/node_modules/fstream/lib/abstract.js b/deps/npm/node_modules/fstream/lib/abstract.js index 11ef0e28fb3..94af1ae0865 100644 --- a/deps/npm/node_modules/fstream/lib/abstract.js +++ b/deps/npm/node_modules/fstream/lib/abstract.js @@ -2,8 +2,8 @@ module.exports = Abstract -var Stream = require("stream").Stream - , inherits = require("inherits") +var Stream = require('stream').Stream +var inherits = require('inherits') function Abstract () { Stream.call(this) @@ -12,7 +12,7 @@ function Abstract () { inherits(Abstract, Stream) Abstract.prototype.on = function (ev, fn) { - if (ev === "ready" && this.ready) { + if (ev === 'ready' && this.ready) { process.nextTick(fn.bind(this)) } else { Stream.prototype.on.call(this, ev, fn) @@ -22,24 +22,24 @@ Abstract.prototype.on = function (ev, fn) { Abstract.prototype.abort = function () { this._aborted = true - this.emit("abort") + this.emit('abort') } Abstract.prototype.destroy = function () {} Abstract.prototype.warn = function (msg, code) { - var me = this - , er = decorate(msg, code, me) - if (!me.listeners("warn")) { - console.error("%s %s\n" + - "path = %s\n" + - "syscall = %s\n" + - "fstream_type = %s\n" + - "fstream_path = %s\n" + - "fstream_unc_path = %s\n" + - "fstream_class = %s\n" + - "fstream_stack =\n%s\n", - code || "UNKNOWN", + var self = this + var er = decorate(msg, code, self) + if (!self.listeners('warn')) { + console.error('%s %s\n' + + 'path = %s\n' + + 'syscall = %s\n' + + 'fstream_type = %s\n' + + 'fstream_path = %s\n' + + 'fstream_unc_path = %s\n' + + 'fstream_class = %s\n' + + 'fstream_stack =\n%s\n', + code || 'UNKNOWN', er.stack, er.path, er.syscall, @@ -47,38 +47,38 @@ Abstract.prototype.warn = function (msg, code) { er.fstream_path, er.fstream_unc_path, er.fstream_class, - er.fstream_stack.join("\n")) + er.fstream_stack.join('\n')) } else { - me.emit("warn", er) + self.emit('warn', er) } } Abstract.prototype.info = function (msg, code) { - this.emit("info", msg, code) + this.emit('info', msg, code) } Abstract.prototype.error = function (msg, code, th) { var er = decorate(msg, code, this) if (th) throw er - else this.emit("error", er) + else this.emit('error', er) } -function decorate (er, code, me) { +function decorate (er, code, self) { if (!(er instanceof Error)) er = new Error(er) er.code = er.code || code - er.path = er.path || me.path - er.fstream_type = er.fstream_type || me.type - er.fstream_path = er.fstream_path || me.path - if (me._path !== me.path) { - er.fstream_unc_path = er.fstream_unc_path || me._path + er.path = er.path || self.path + er.fstream_type = er.fstream_type || self.type + er.fstream_path = er.fstream_path || self.path + if (self._path !== self.path) { + er.fstream_unc_path = er.fstream_unc_path || self._path } - if (me.linkpath) { - er.fstream_linkpath = er.fstream_linkpath || me.linkpath + if (self.linkpath) { + er.fstream_linkpath = er.fstream_linkpath || self.linkpath } - er.fstream_class = er.fstream_class || me.constructor.name + er.fstream_class = er.fstream_class || self.constructor.name er.fstream_stack = er.fstream_stack || new Error().stack.split(/\n/).slice(3).map(function (s) { - return s.replace(/^ at /, "") + return s.replace(/^ {4}at /, '') }) return er diff --git a/deps/npm/node_modules/fstream/lib/collect.js b/deps/npm/node_modules/fstream/lib/collect.js index a36f780eb2c..6245e6ce492 100644 --- a/deps/npm/node_modules/fstream/lib/collect.js +++ b/deps/npm/node_modules/fstream/lib/collect.js @@ -6,62 +6,63 @@ function collect (stream) { stream._collected = true stream.pause() - stream.on("data", save) - stream.on("end", save) + stream.on('data', save) + stream.on('end', save) var buf = [] function save (b) { - if (typeof b === "string") b = new Buffer(b) + if (typeof b === 'string') b = new Buffer(b) if (Buffer.isBuffer(b) && !b.length) return buf.push(b) } - stream.on("entry", saveEntry) + stream.on('entry', saveEntry) var entryBuffer = [] function saveEntry (e) { collect(e) entryBuffer.push(e) } - stream.on("proxy", proxyPause) + stream.on('proxy', proxyPause) function proxyPause (p) { p.pause() } - // replace the pipe method with a new version that will // unlock the buffered stuff. if you just call .pipe() // without a destination, then it'll re-play the events. - stream.pipe = (function (orig) { return function (dest) { - // console.error(" === open the pipes", dest && dest.path) + stream.pipe = (function (orig) { + return function (dest) { + // console.error(' === open the pipes', dest && dest.path) - // let the entries flow through one at a time. - // Once they're all done, then we can resume completely. - var e = 0 - ;(function unblockEntry () { - var entry = entryBuffer[e++] - // console.error(" ==== unblock entry", entry && entry.path) - if (!entry) return resume() - entry.on("end", unblockEntry) - if (dest) dest.add(entry) - else stream.emit("entry", entry) - })() + // let the entries flow through one at a time. + // Once they're all done, then we can resume completely. + var e = 0 + ;(function unblockEntry () { + var entry = entryBuffer[e++] + // console.error(" ==== unblock entry", entry && entry.path) + if (!entry) return resume() + entry.on('end', unblockEntry) + if (dest) dest.add(entry) + else stream.emit('entry', entry) + })() - function resume () { - stream.removeListener("entry", saveEntry) - stream.removeListener("data", save) - stream.removeListener("end", save) + function resume () { + stream.removeListener('entry', saveEntry) + stream.removeListener('data', save) + stream.removeListener('end', save) - stream.pipe = orig - if (dest) stream.pipe(dest) + stream.pipe = orig + if (dest) stream.pipe(dest) - buf.forEach(function (b) { - if (b) stream.emit("data", b) - else stream.emit("end") - }) + buf.forEach(function (b) { + if (b) stream.emit('data', b) + else stream.emit('end') + }) - stream.resume() - } + stream.resume() + } - return dest - }})(stream.pipe) + return dest + } + })(stream.pipe) } diff --git a/deps/npm/node_modules/fstream/lib/dir-reader.js b/deps/npm/node_modules/fstream/lib/dir-reader.js index 346ac2b8317..820cdc85a8e 100644 --- a/deps/npm/node_modules/fstream/lib/dir-reader.js +++ b/deps/npm/node_modules/fstream/lib/dir-reader.js @@ -4,31 +4,29 @@ module.exports = DirReader -var fs = require("graceful-fs") - , fstream = require("../fstream.js") - , Reader = fstream.Reader - , inherits = require("inherits") - , mkdir = require("mkdirp") - , path = require("path") - , Reader = require("./reader.js") - , assert = require("assert").ok +var fs = require('graceful-fs') +var inherits = require('inherits') +var path = require('path') +var Reader = require('./reader.js') +var assert = require('assert').ok inherits(DirReader, Reader) function DirReader (props) { - var me = this - if (!(me instanceof DirReader)) throw new Error( - "DirReader must be called as constructor.") + var self = this + if (!(self instanceof DirReader)) { + throw new Error('DirReader must be called as constructor.') + } // should already be established as a Directory type - if (props.type !== "Directory" || !props.Directory) { - throw new Error("Non-directory type "+ props.type) + if (props.type !== 'Directory' || !props.Directory) { + throw new Error('Non-directory type ' + props.type) } - me.entries = null - me._index = -1 - me._paused = false - me._length = -1 + self.entries = null + self._index = -1 + self._paused = false + self._length = -1 if (props.sort) { this.sort = props.sort @@ -38,49 +36,49 @@ function DirReader (props) { } DirReader.prototype._getEntries = function () { - var me = this + var self = this // race condition. might pause() before calling _getEntries, // and then resume, and try to get them a second time. - if (me._gotEntries) return - me._gotEntries = true + if (self._gotEntries) return + self._gotEntries = true - fs.readdir(me._path, function (er, entries) { - if (er) return me.error(er) + fs.readdir(self._path, function (er, entries) { + if (er) return self.error(er) - me.entries = entries + self.entries = entries - me.emit("entries", entries) - if (me._paused) me.once("resume", processEntries) + self.emit('entries', entries) + if (self._paused) self.once('resume', processEntries) else processEntries() function processEntries () { - me._length = me.entries.length - if (typeof me.sort === "function") { - me.entries = me.entries.sort(me.sort.bind(me)) + self._length = self.entries.length + if (typeof self.sort === 'function') { + self.entries = self.entries.sort(self.sort.bind(self)) } - me._read() + self._read() } }) } // start walking the dir, and emit an "entry" event for each one. DirReader.prototype._read = function () { - var me = this + var self = this - if (!me.entries) return me._getEntries() + if (!self.entries) return self._getEntries() - if (me._paused || me._currentEntry || me._aborted) { - // console.error("DR paused=%j, current=%j, aborted=%j", me._paused, !!me._currentEntry, me._aborted) + if (self._paused || self._currentEntry || self._aborted) { + // console.error('DR paused=%j, current=%j, aborted=%j', self._paused, !!self._currentEntry, self._aborted) return } - me._index ++ - if (me._index >= me.entries.length) { - if (!me._ended) { - me._ended = true - me.emit("end") - me.emit("close") + self._index++ + if (self._index >= self.entries.length) { + if (!self._ended) { + self._ended = true + self.emit('end') + self.emit('close') } return } @@ -88,21 +86,21 @@ DirReader.prototype._read = function () { // ok, handle this one, then. // save creating a proxy, by stat'ing the thing now. - var p = path.resolve(me._path, me.entries[me._index]) - assert(p !== me._path) - assert(me.entries[me._index]) + var p = path.resolve(self._path, self.entries[self._index]) + assert(p !== self._path) + assert(self.entries[self._index]) // set this to prevent trying to _read() again in the stat time. - me._currentEntry = p - fs[ me.props.follow ? "stat" : "lstat" ](p, function (er, stat) { - if (er) return me.error(er) + self._currentEntry = p + fs[ self.props.follow ? 'stat' : 'lstat' ](p, function (er, stat) { + if (er) return self.error(er) - var who = me._proxy || me + var who = self._proxy || self stat.path = p stat.basename = path.basename(p) stat.dirname = path.dirname(p) - var childProps = me.getChildProps.call(who, stat) + var childProps = self.getChildProps.call(who, stat) childProps.path = p childProps.basename = path.basename(p) childProps.dirname = path.dirname(p) @@ -111,141 +109,144 @@ DirReader.prototype._read = function () { // console.error("DR Entry", p, stat.size) - me._currentEntry = entry + self._currentEntry = entry // "entry" events are for direct entries in a specific dir. // "child" events are for any and all children at all levels. // This nomenclature is not completely final. - entry.on("pause", function (who) { - if (!me._paused && !entry._disowned) { - me.pause(who) + entry.on('pause', function (who) { + if (!self._paused && !entry._disowned) { + self.pause(who) } }) - entry.on("resume", function (who) { - if (me._paused && !entry._disowned) { - me.resume(who) + entry.on('resume', function (who) { + if (self._paused && !entry._disowned) { + self.resume(who) } }) - entry.on("stat", function (props) { - me.emit("_entryStat", entry, props) + entry.on('stat', function (props) { + self.emit('_entryStat', entry, props) if (entry._aborted) return - if (entry._paused) entry.once("resume", function () { - me.emit("entryStat", entry, props) - }) - else me.emit("entryStat", entry, props) + if (entry._paused) { + entry.once('resume', function () { + self.emit('entryStat', entry, props) + }) + } else self.emit('entryStat', entry, props) }) - entry.on("ready", function EMITCHILD () { + entry.on('ready', function EMITCHILD () { // console.error("DR emit child", entry._path) - if (me._paused) { + if (self._paused) { // console.error(" DR emit child - try again later") // pause the child, and emit the "entry" event once we drain. // console.error("DR pausing child entry") - entry.pause(me) - return me.once("resume", EMITCHILD) + entry.pause(self) + return self.once('resume', EMITCHILD) } // skip over sockets. they can't be piped around properly, // so there's really no sense even acknowledging them. // if someone really wants to see them, they can listen to // the "socket" events. - if (entry.type === "Socket") { - me.emit("socket", entry) + if (entry.type === 'Socket') { + self.emit('socket', entry) } else { - me.emitEntry(entry) + self.emitEntry(entry) } }) var ended = false - entry.on("close", onend) - entry.on("disown", onend) + entry.on('close', onend) + entry.on('disown', onend) function onend () { if (ended) return ended = true - me.emit("childEnd", entry) - me.emit("entryEnd", entry) - me._currentEntry = null - if (!me._paused) { - me._read() + self.emit('childEnd', entry) + self.emit('entryEnd', entry) + self._currentEntry = null + if (!self._paused) { + self._read() } } // XXX Remove this. Works in node as of 0.6.2 or so. // Long filenames should not break stuff. - entry.on("error", function (er) { + entry.on('error', function (er) { if (entry._swallowErrors) { - me.warn(er) - entry.emit("end") - entry.emit("close") + self.warn(er) + entry.emit('end') + entry.emit('close') } else { - me.emit("error", er) + self.emit('error', er) } }) // proxy up some events. - ; [ "child" - , "childEnd" - , "warn" - ].forEach(function (ev) { - entry.on(ev, me.emit.bind(me, ev)) - }) + ;[ + 'child', + 'childEnd', + 'warn' + ].forEach(function (ev) { + entry.on(ev, self.emit.bind(self, ev)) + }) }) } DirReader.prototype.disown = function (entry) { - entry.emit("beforeDisown") + entry.emit('beforeDisown') entry._disowned = true entry.parent = entry.root = null if (entry === this._currentEntry) { this._currentEntry = null } - entry.emit("disown") + entry.emit('disown') } -DirReader.prototype.getChildProps = function (stat) { - return { depth: this.depth + 1 - , root: this.root || this - , parent: this - , follow: this.follow - , filter: this.filter - , sort: this.props.sort - , hardlinks: this.props.hardlinks - } +DirReader.prototype.getChildProps = function () { + return { + depth: this.depth + 1, + root: this.root || this, + parent: this, + follow: this.follow, + filter: this.filter, + sort: this.props.sort, + hardlinks: this.props.hardlinks + } } DirReader.prototype.pause = function (who) { - var me = this - if (me._paused) return - who = who || me - me._paused = true - if (me._currentEntry && me._currentEntry.pause) { - me._currentEntry.pause(who) + var self = this + if (self._paused) return + who = who || self + self._paused = true + if (self._currentEntry && self._currentEntry.pause) { + self._currentEntry.pause(who) } - me.emit("pause", who) + self.emit('pause', who) } DirReader.prototype.resume = function (who) { - var me = this - if (!me._paused) return - who = who || me - - me._paused = false - // console.error("DR Emit Resume", me._path) - me.emit("resume", who) - if (me._paused) { - // console.error("DR Re-paused", me._path) + var self = this + if (!self._paused) return + who = who || self + + self._paused = false + // console.error('DR Emit Resume', self._path) + self.emit('resume', who) + if (self._paused) { + // console.error('DR Re-paused', self._path) return } - if (me._currentEntry) { - if (me._currentEntry.resume) me._currentEntry.resume(who) - } else me._read() + if (self._currentEntry) { + if (self._currentEntry.resume) self._currentEntry.resume(who) + } else self._read() } DirReader.prototype.emitEntry = function (entry) { - this.emit("entry", entry) - this.emit("child", entry) + this.emit('entry', entry) + this.emit('child', entry) } diff --git a/deps/npm/node_modules/fstream/lib/dir-writer.js b/deps/npm/node_modules/fstream/lib/dir-writer.js index 7073b883ea2..aed9e4db146 100644 --- a/deps/npm/node_modules/fstream/lib/dir-writer.js +++ b/deps/npm/node_modules/fstream/lib/dir-writer.js @@ -6,38 +6,37 @@ module.exports = DirWriter -var fs = require("graceful-fs") - , fstream = require("../fstream.js") - , Writer = require("./writer.js") - , inherits = require("inherits") - , mkdir = require("mkdirp") - , path = require("path") - , collect = require("./collect.js") +var Writer = require('./writer.js') +var inherits = require('inherits') +var mkdir = require('mkdirp') +var path = require('path') +var collect = require('./collect.js') inherits(DirWriter, Writer) function DirWriter (props) { - var me = this - if (!(me instanceof DirWriter)) me.error( - "DirWriter must be called as constructor.", null, true) + var self = this + if (!(self instanceof DirWriter)) { + self.error('DirWriter must be called as constructor.', null, true) + } // should already be established as a Directory type - if (props.type !== "Directory" || !props.Directory) { - me.error("Non-directory type "+ props.type + " " + - JSON.stringify(props), null, true) + if (props.type !== 'Directory' || !props.Directory) { + self.error('Non-directory type ' + props.type + ' ' + + JSON.stringify(props), null, true) } Writer.call(this, props) } DirWriter.prototype._create = function () { - var me = this - mkdir(me._path, Writer.dirmode, function (er) { - if (er) return me.error(er) + var self = this + mkdir(self._path, Writer.dirmode, function (er) { + if (er) return self.error(er) // ready to start getting entries! - me.ready = true - me.emit("ready") - me._process() + self.ready = true + self.emit('ready') + self._process() }) } @@ -55,78 +54,82 @@ DirWriter.prototype.end = function () { } DirWriter.prototype.add = function (entry) { - var me = this + var self = this - // console.error("\tadd", entry._path, "->", me._path) + // console.error('\tadd', entry._path, '->', self._path) collect(entry) - if (!me.ready || me._currentEntry) { - me._buffer.push(entry) + if (!self.ready || self._currentEntry) { + self._buffer.push(entry) return false } // create a new writer, and pipe the incoming entry into it. - if (me._ended) { - return me.error("add after end") + if (self._ended) { + return self.error('add after end') } - me._buffer.push(entry) - me._process() + self._buffer.push(entry) + self._process() - return 0 === this._buffer.length + return this._buffer.length === 0 } DirWriter.prototype._process = function () { - var me = this + var self = this - // console.error("DW Process p=%j", me._processing, me.basename) + // console.error('DW Process p=%j', self._processing, self.basename) - if (me._processing) return + if (self._processing) return - var entry = me._buffer.shift() + var entry = self._buffer.shift() if (!entry) { // console.error("DW Drain") - me.emit("drain") - if (me._ended) me._finish() + self.emit('drain') + if (self._ended) self._finish() return } - me._processing = true + self._processing = true // console.error("DW Entry", entry._path) - me.emit("entry", entry) + self.emit('entry', entry) // ok, add this entry // // don't allow recursive copying var p = entry + var pp do { - var pp = p._path || p.path - if (pp === me.root._path || pp === me._path || - (pp && pp.indexOf(me._path) === 0)) { - // console.error("DW Exit (recursive)", entry.basename, me._path) - me._processing = false + pp = p._path || p.path + if (pp === self.root._path || pp === self._path || + (pp && pp.indexOf(self._path) === 0)) { + // console.error('DW Exit (recursive)', entry.basename, self._path) + self._processing = false if (entry._collected) entry.pipe() - return me._process() + return self._process() } - } while (p = p.parent) + p = p.parent + } while (p) // console.error("DW not recursive") // chop off the entry's root dir, replace with ours - var props = { parent: me - , root: me.root || me - , type: entry.type - , depth: me.depth + 1 } + var props = { + parent: self, + root: self.root || self, + type: entry.type, + depth: self.depth + 1 + } - var p = entry._path || entry.path || entry.props.path + pp = entry._path || entry.path || entry.props.path if (entry.parent) { - p = p.substr(entry.parent._path.length + 1) + pp = pp.substr(entry.parent._path.length + 1) } // get rid of any ../../ shenanigans - props.path = path.join(me.path, path.join("/", p)) + props.path = path.join(self.path, path.join('/', pp)) // if i have a filter, the child should inherit it. - props.filter = me.filter + props.filter = self.filter // all the rest of the stuff, copy over from the source. Object.keys(entry.props).forEach(function (k) { @@ -136,8 +139,8 @@ DirWriter.prototype._process = function () { }) // not sure at this point what kind of writer this is. - var child = me._currentChild = new Writer(props) - child.on("ready", function () { + var child = self._currentChild = new Writer(props) + child.on('ready', function () { // console.error("DW Child Ready", child.type, child._path) // console.error(" resuming", entry._path) entry.pipe(child) @@ -146,26 +149,26 @@ DirWriter.prototype._process = function () { // XXX Make this work in node. // Long filenames should not break stuff. - child.on("error", function (er) { + child.on('error', function (er) { if (child._swallowErrors) { - me.warn(er) - child.emit("end") - child.emit("close") + self.warn(er) + child.emit('end') + child.emit('close') } else { - me.emit("error", er) + self.emit('error', er) } }) // we fire _end internally *after* end, so that we don't move on // until any "end" listeners have had their chance to do stuff. - child.on("close", onend) + child.on('close', onend) var ended = false function onend () { if (ended) return ended = true // console.error("* DW Child end", child.basename) - me._currentChild = null - me._processing = false - me._process() + self._currentChild = null + self._processing = false + self._process() } } diff --git a/deps/npm/node_modules/fstream/lib/file-reader.js b/deps/npm/node_modules/fstream/lib/file-reader.js index b1f9861838a..0757b286b50 100644 --- a/deps/npm/node_modules/fstream/lib/file-reader.js +++ b/deps/npm/node_modules/fstream/lib/file-reader.js @@ -2,146 +2,149 @@ module.exports = FileReader -var fs = require("graceful-fs") - , fstream = require("../fstream.js") - , Reader = fstream.Reader - , inherits = require("inherits") - , mkdir = require("mkdirp") - , Reader = require("./reader.js") - , EOF = {EOF: true} - , CLOSE = {CLOSE: true} +var fs = require('graceful-fs') +var inherits = require('inherits') +var Reader = require('./reader.js') +var EOF = {EOF: true} +var CLOSE = {CLOSE: true} inherits(FileReader, Reader) function FileReader (props) { // console.error(" FR create", props.path, props.size, new Error().stack) - var me = this - if (!(me instanceof FileReader)) throw new Error( - "FileReader must be called as constructor.") + var self = this + if (!(self instanceof FileReader)) { + throw new Error('FileReader must be called as constructor.') + } // should already be established as a File type // XXX Todo: preserve hardlinks by tracking dev+inode+nlink, // with a HardLinkReader class. - if (!((props.type === "Link" && props.Link) || - (props.type === "File" && props.File))) { - throw new Error("Non-file type "+ props.type) + if (!((props.type === 'Link' && props.Link) || + (props.type === 'File' && props.File))) { + throw new Error('Non-file type ' + props.type) } - me._buffer = [] - me._bytesEmitted = 0 - Reader.call(me, props) + self._buffer = [] + self._bytesEmitted = 0 + Reader.call(self, props) } FileReader.prototype._getStream = function () { - var me = this - , stream = me._stream = fs.createReadStream(me._path, me.props) + var self = this + var stream = self._stream = fs.createReadStream(self._path, self.props) - if (me.props.blksize) { - stream.bufferSize = me.props.blksize + if (self.props.blksize) { + stream.bufferSize = self.props.blksize } - stream.on("open", me.emit.bind(me, "open")) + stream.on('open', self.emit.bind(self, 'open')) - stream.on("data", function (c) { - // console.error("\t\t%d %s", c.length, me.basename) - me._bytesEmitted += c.length + stream.on('data', function (c) { + // console.error('\t\t%d %s', c.length, self.basename) + self._bytesEmitted += c.length // no point saving empty chunks - if (!c.length) return - else if (me._paused || me._buffer.length) { - me._buffer.push(c) - me._read() - } else me.emit("data", c) + if (!c.length) { + return + } else if (self._paused || self._buffer.length) { + self._buffer.push(c) + self._read() + } else self.emit('data', c) }) - stream.on("end", function () { - if (me._paused || me._buffer.length) { - // console.error("FR Buffering End", me._path) - me._buffer.push(EOF) - me._read() + stream.on('end', function () { + if (self._paused || self._buffer.length) { + // console.error('FR Buffering End', self._path) + self._buffer.push(EOF) + self._read() } else { - me.emit("end") + self.emit('end') } - if (me._bytesEmitted !== me.props.size) { - me.error("Didn't get expected byte count\n"+ - "expect: "+me.props.size + "\n" + - "actual: "+me._bytesEmitted) + if (self._bytesEmitted !== self.props.size) { + self.error("Didn't get expected byte count\n" + + 'expect: ' + self.props.size + '\n' + + 'actual: ' + self._bytesEmitted) } }) - stream.on("close", function () { - if (me._paused || me._buffer.length) { - // console.error("FR Buffering Close", me._path) - me._buffer.push(CLOSE) - me._read() + stream.on('close', function () { + if (self._paused || self._buffer.length) { + // console.error('FR Buffering Close', self._path) + self._buffer.push(CLOSE) + self._read() } else { - // console.error("FR close 1", me._path) - me.emit("close") + // console.error('FR close 1', self._path) + self.emit('close') } }) - me._read() + stream.on('error', function (e) { + self.emit('error', e) + }) + + self._read() } FileReader.prototype._read = function () { - var me = this - // console.error("FR _read", me._path) - if (me._paused) { - // console.error("FR _read paused", me._path) + var self = this + // console.error('FR _read', self._path) + if (self._paused) { + // console.error('FR _read paused', self._path) return } - if (!me._stream) { - // console.error("FR _getStream calling", me._path) - return me._getStream() + if (!self._stream) { + // console.error('FR _getStream calling', self._path) + return self._getStream() } // clear out the buffer, if there is one. - if (me._buffer.length) { - // console.error("FR _read has buffer", me._buffer.length, me._path) - var buf = me._buffer - for (var i = 0, l = buf.length; i < l; i ++) { + if (self._buffer.length) { + // console.error('FR _read has buffer', self._buffer.length, self._path) + var buf = self._buffer + for (var i = 0, l = buf.length; i < l; i++) { var c = buf[i] if (c === EOF) { - // console.error("FR Read emitting buffered end", me._path) - me.emit("end") + // console.error('FR Read emitting buffered end', self._path) + self.emit('end') } else if (c === CLOSE) { - // console.error("FR Read emitting buffered close", me._path) - me.emit("close") + // console.error('FR Read emitting buffered close', self._path) + self.emit('close') } else { - // console.error("FR Read emitting buffered data", me._path) - me.emit("data", c) + // console.error('FR Read emitting buffered data', self._path) + self.emit('data', c) } - if (me._paused) { - // console.error("FR Read Re-pausing at "+i, me._path) - me._buffer = buf.slice(i) + if (self._paused) { + // console.error('FR Read Re-pausing at '+i, self._path) + self._buffer = buf.slice(i) return } } - me._buffer.length = 0 + self._buffer.length = 0 } // console.error("FR _read done") // that's about all there is to it. } FileReader.prototype.pause = function (who) { - var me = this - // console.error("FR Pause", me._path) - if (me._paused) return - who = who || me - me._paused = true - if (me._stream) me._stream.pause() - me.emit("pause", who) + var self = this + // console.error('FR Pause', self._path) + if (self._paused) return + who = who || self + self._paused = true + if (self._stream) self._stream.pause() + self.emit('pause', who) } FileReader.prototype.resume = function (who) { - var me = this - // console.error("FR Resume", me._path) - if (!me._paused) return - who = who || me - me.emit("resume", who) - me._paused = false - if (me._stream) me._stream.resume() - me._read() + var self = this + // console.error('FR Resume', self._path) + if (!self._paused) return + who = who || self + self.emit('resume', who) + self._paused = false + if (self._stream) self._stream.resume() + self._read() } diff --git a/deps/npm/node_modules/fstream/lib/file-writer.js b/deps/npm/node_modules/fstream/lib/file-writer.js index 5e9902a6316..4c803d8d68d 100644 --- a/deps/npm/node_modules/fstream/lib/file-writer.js +++ b/deps/npm/node_modules/fstream/lib/file-writer.js @@ -1,104 +1,107 @@ module.exports = FileWriter -var fs = require("graceful-fs") - , mkdir = require("mkdirp") - , Writer = require("./writer.js") - , inherits = require("inherits") - , EOF = {} +var fs = require('graceful-fs') +var Writer = require('./writer.js') +var inherits = require('inherits') +var EOF = {} inherits(FileWriter, Writer) function FileWriter (props) { - var me = this - if (!(me instanceof FileWriter)) throw new Error( - "FileWriter must be called as constructor.") + var self = this + if (!(self instanceof FileWriter)) { + throw new Error('FileWriter must be called as constructor.') + } // should already be established as a File type - if (props.type !== "File" || !props.File) { - throw new Error("Non-file type "+ props.type) + if (props.type !== 'File' || !props.File) { + throw new Error('Non-file type ' + props.type) } - me._buffer = [] - me._bytesWritten = 0 + self._buffer = [] + self._bytesWritten = 0 Writer.call(this, props) } FileWriter.prototype._create = function () { - var me = this - if (me._stream) return + var self = this + if (self._stream) return var so = {} - if (me.props.flags) so.flags = me.props.flags + if (self.props.flags) so.flags = self.props.flags so.mode = Writer.filemode - if (me._old && me._old.blksize) so.bufferSize = me._old.blksize + if (self._old && self._old.blksize) so.bufferSize = self._old.blksize - me._stream = fs.createWriteStream(me._path, so) + self._stream = fs.createWriteStream(self._path, so) - me._stream.on("open", function (fd) { - // console.error("FW open", me._buffer, me._path) - me.ready = true - me._buffer.forEach(function (c) { - if (c === EOF) me._stream.end() - else me._stream.write(c) + self._stream.on('open', function () { + // console.error("FW open", self._buffer, self._path) + self.ready = true + self._buffer.forEach(function (c) { + if (c === EOF) self._stream.end() + else self._stream.write(c) }) - me.emit("ready") + self.emit('ready') // give this a kick just in case it needs it. - me.emit("drain") + self.emit('drain') }) - me._stream.on("drain", function () { me.emit("drain") }) + self._stream.on('error', function (er) { self.emit('error', er) }) + + self._stream.on('drain', function () { self.emit('drain') }) - me._stream.on("close", function () { - // console.error("\n\nFW Stream Close", me._path, me.size) - me._finish() + self._stream.on('close', function () { + // console.error('\n\nFW Stream Close', self._path, self.size) + self._finish() }) } FileWriter.prototype.write = function (c) { - var me = this + var self = this - me._bytesWritten += c.length + self._bytesWritten += c.length - if (!me.ready) { - if (!Buffer.isBuffer(c) && typeof c !== 'string') + if (!self.ready) { + if (!Buffer.isBuffer(c) && typeof c !== 'string') { throw new Error('invalid write data') - me._buffer.push(c) + } + self._buffer.push(c) return false } - var ret = me._stream.write(c) - // console.error("\t-- fw wrote, _stream says", ret, me._stream._queue.length) + var ret = self._stream.write(c) + // console.error('\t-- fw wrote, _stream says', ret, self._stream._queue.length) // allow 2 buffered writes, because otherwise there's just too // much stop and go bs. - if (ret === false && me._stream._queue) { - return me._stream._queue.length <= 2; + if (ret === false && self._stream._queue) { + return self._stream._queue.length <= 2 } else { - return ret; + return ret } } FileWriter.prototype.end = function (c) { - var me = this + var self = this - if (c) me.write(c) + if (c) self.write(c) - if (!me.ready) { - me._buffer.push(EOF) + if (!self.ready) { + self._buffer.push(EOF) return false } - return me._stream.end() + return self._stream.end() } FileWriter.prototype._finish = function () { - var me = this - if (typeof me.size === "number" && me._bytesWritten != me.size) { - me.error( - "Did not get expected byte count.\n" + - "expect: " + me.size + "\n" + - "actual: " + me._bytesWritten) + var self = this + if (typeof self.size === 'number' && self._bytesWritten !== self.size) { + self.error( + 'Did not get expected byte count.\n' + + 'expect: ' + self.size + '\n' + + 'actual: ' + self._bytesWritten) } - Writer.prototype._finish.call(me) + Writer.prototype._finish.call(self) } diff --git a/deps/npm/node_modules/fstream/lib/get-type.js b/deps/npm/node_modules/fstream/lib/get-type.js index cd65c41d8bc..19f6a657db8 100644 --- a/deps/npm/node_modules/fstream/lib/get-type.js +++ b/deps/npm/node_modules/fstream/lib/get-type.js @@ -1,26 +1,27 @@ module.exports = getType function getType (st) { - var types = - [ "Directory" - , "File" - , "SymbolicLink" - , "Link" // special for hardlinks from tarballs - , "BlockDevice" - , "CharacterDevice" - , "FIFO" - , "Socket" ] - , type + var types = [ + 'Directory', + 'File', + 'SymbolicLink', + 'Link', // special for hardlinks from tarballs + 'BlockDevice', + 'CharacterDevice', + 'FIFO', + 'Socket' + ] + var type - if (st.type && -1 !== types.indexOf(st.type)) { + if (st.type && types.indexOf(st.type) !== -1) { st[st.type] = true return st.type } - for (var i = 0, l = types.length; i < l; i ++) { + for (var i = 0, l = types.length; i < l; i++) { type = types[i] - var is = st[type] || st["is" + type] - if (typeof is === "function") is = is.call(st) + var is = st[type] || st['is' + type] + if (typeof is === 'function') is = is.call(st) if (is) { st[type] = true st.type = type diff --git a/deps/npm/node_modules/fstream/lib/link-reader.js b/deps/npm/node_modules/fstream/lib/link-reader.js index 7e7ab6ce5c0..a44dd39d7cd 100644 --- a/deps/npm/node_modules/fstream/lib/link-reader.js +++ b/deps/npm/node_modules/fstream/lib/link-reader.js @@ -6,25 +6,24 @@ module.exports = LinkReader -var fs = require("graceful-fs") - , fstream = require("../fstream.js") - , inherits = require("inherits") - , mkdir = require("mkdirp") - , Reader = require("./reader.js") +var fs = require('graceful-fs') +var inherits = require('inherits') +var Reader = require('./reader.js') inherits(LinkReader, Reader) function LinkReader (props) { - var me = this - if (!(me instanceof LinkReader)) throw new Error( - "LinkReader must be called as constructor.") + var self = this + if (!(self instanceof LinkReader)) { + throw new Error('LinkReader must be called as constructor.') + } - if (!((props.type === "Link" && props.Link) || - (props.type === "SymbolicLink" && props.SymbolicLink))) { - throw new Error("Non-link type "+ props.type) + if (!((props.type === 'Link' && props.Link) || + (props.type === 'SymbolicLink' && props.SymbolicLink))) { + throw new Error('Non-link type ' + props.type) } - Reader.call(me, props) + Reader.call(self, props) } // When piping a LinkReader into a LinkWriter, we have to @@ -32,23 +31,23 @@ function LinkReader (props) { // happen *before* the "ready" event, which means we need to // override the _stat method. LinkReader.prototype._stat = function (currentStat) { - var me = this - fs.readlink(me._path, function (er, linkpath) { - if (er) return me.error(er) - me.linkpath = me.props.linkpath = linkpath - me.emit("linkpath", linkpath) - Reader.prototype._stat.call(me, currentStat) + var self = this + fs.readlink(self._path, function (er, linkpath) { + if (er) return self.error(er) + self.linkpath = self.props.linkpath = linkpath + self.emit('linkpath', linkpath) + Reader.prototype._stat.call(self, currentStat) }) } LinkReader.prototype._read = function () { - var me = this - if (me._paused) return + var self = this + if (self._paused) return // basically just a no-op, since we got all the info we need // from the _stat method - if (!me._ended) { - me.emit("end") - me.emit("close") - me._ended = true + if (!self._ended) { + self.emit('end') + self.emit('close') + self._ended = true } } diff --git a/deps/npm/node_modules/fstream/lib/link-writer.js b/deps/npm/node_modules/fstream/lib/link-writer.js index 5c8f1e70128..07a9abf7e6f 100644 --- a/deps/npm/node_modules/fstream/lib/link-writer.js +++ b/deps/npm/node_modules/fstream/lib/link-writer.js @@ -1,28 +1,28 @@ - module.exports = LinkWriter -var fs = require("graceful-fs") - , Writer = require("./writer.js") - , inherits = require("inherits") - , path = require("path") - , rimraf = require("rimraf") +var fs = require('graceful-fs') +var Writer = require('./writer.js') +var inherits = require('inherits') +var path = require('path') +var rimraf = require('rimraf') inherits(LinkWriter, Writer) function LinkWriter (props) { - var me = this - if (!(me instanceof LinkWriter)) throw new Error( - "LinkWriter must be called as constructor.") + var self = this + if (!(self instanceof LinkWriter)) { + throw new Error('LinkWriter must be called as constructor.') + } // should already be established as a Link type - if (!((props.type === "Link" && props.Link) || - (props.type === "SymbolicLink" && props.SymbolicLink))) { - throw new Error("Non-link type "+ props.type) + if (!((props.type === 'Link' && props.Link) || + (props.type === 'SymbolicLink' && props.SymbolicLink))) { + throw new Error('Non-link type ' + props.type) } - if (props.linkpath === "") props.linkpath = "." + if (props.linkpath === '') props.linkpath = '.' if (!props.linkpath) { - me.error("Need linkpath property to create " + props.type) + self.error('Need linkpath property to create ' + props.type) } Writer.call(this, props) @@ -30,32 +30,32 @@ function LinkWriter (props) { LinkWriter.prototype._create = function () { // console.error(" LW _create") - var me = this - , hard = me.type === "Link" || process.platform === "win32" - , link = hard ? "link" : "symlink" - , lp = hard ? path.resolve(me.dirname, me.linkpath) : me.linkpath + var self = this + var hard = self.type === 'Link' || process.platform === 'win32' + var link = hard ? 'link' : 'symlink' + var lp = hard ? path.resolve(self.dirname, self.linkpath) : self.linkpath // can only change the link path by clobbering // For hard links, let's just assume that's always the case, since // there's no good way to read them if we don't already know. - if (hard) return clobber(me, lp, link) + if (hard) return clobber(self, lp, link) - fs.readlink(me._path, function (er, p) { + fs.readlink(self._path, function (er, p) { // only skip creation if it's exactly the same link - if (p && p === lp) return finish(me) - clobber(me, lp, link) + if (p && p === lp) return finish(self) + clobber(self, lp, link) }) } -function clobber (me, lp, link) { - rimraf(me._path, function (er) { - if (er) return me.error(er) - create(me, lp, link) +function clobber (self, lp, link) { + rimraf(self._path, function (er) { + if (er) return self.error(er) + create(self, lp, link) }) } -function create (me, lp, link) { - fs[link](lp, me._path, function (er) { +function create (self, lp, link) { + fs[link](lp, self._path, function (er) { // if this is a hard link, and we're in the process of writing out a // directory, it's very possible that the thing we're linking to // doesn't exist yet (especially if it was intended as a symlink), @@ -65,24 +65,24 @@ function create (me, lp, link) { // A better solution would be to have fs.symlink be supported on // windows in some nice fashion. if (er) { - if ((er.code === "ENOENT" || - er.code === "EACCES" || - er.code === "EPERM" ) && process.platform === "win32") { - me.ready = true - me.emit("ready") - me.emit("end") - me.emit("close") - me.end = me._finish = function () {} - } else return me.error(er) + if ((er.code === 'ENOENT' || + er.code === 'EACCES' || + er.code === 'EPERM') && process.platform === 'win32') { + self.ready = true + self.emit('ready') + self.emit('end') + self.emit('close') + self.end = self._finish = function () {} + } else return self.error(er) } - finish(me) + finish(self) }) } -function finish (me) { - me.ready = true - me.emit("ready") - if (me._ended && !me._finished) me._finish() +function finish (self) { + self.ready = true + self.emit('ready') + if (self._ended && !self._finished) self._finish() } LinkWriter.prototype.end = function () { diff --git a/deps/npm/node_modules/fstream/lib/proxy-reader.js b/deps/npm/node_modules/fstream/lib/proxy-reader.js index a0ece34a268..4f431c9d9e2 100644 --- a/deps/npm/node_modules/fstream/lib/proxy-reader.js +++ b/deps/npm/node_modules/fstream/lib/proxy-reader.js @@ -3,82 +3,84 @@ module.exports = ProxyReader -var Reader = require("./reader.js") - , getType = require("./get-type.js") - , inherits = require("inherits") - , fs = require("graceful-fs") +var Reader = require('./reader.js') +var getType = require('./get-type.js') +var inherits = require('inherits') +var fs = require('graceful-fs') inherits(ProxyReader, Reader) function ProxyReader (props) { - var me = this - if (!(me instanceof ProxyReader)) throw new Error( - "ProxyReader must be called as constructor.") + var self = this + if (!(self instanceof ProxyReader)) { + throw new Error('ProxyReader must be called as constructor.') + } - me.props = props - me._buffer = [] - me.ready = false + self.props = props + self._buffer = [] + self.ready = false - Reader.call(me, props) + Reader.call(self, props) } ProxyReader.prototype._stat = function () { - var me = this - , props = me.props - // stat the thing to see what the proxy should be. - , stat = props.follow ? "stat" : "lstat" + var self = this + var props = self.props + // stat the thing to see what the proxy should be. + var stat = props.follow ? 'stat' : 'lstat' fs[stat](props.path, function (er, current) { var type if (er || !current) { - type = "File" + type = 'File' } else { type = getType(current) } props[type] = true - props.type = me.type = type + props.type = self.type = type - me._old = current - me._addProxy(Reader(props, current)) + self._old = current + self._addProxy(Reader(props, current)) }) } ProxyReader.prototype._addProxy = function (proxy) { - var me = this - if (me._proxyTarget) { - return me.error("proxy already set") + var self = this + if (self._proxyTarget) { + return self.error('proxy already set') } - me._proxyTarget = proxy - proxy._proxy = me - - ; [ "error" - , "data" - , "end" - , "close" - , "linkpath" - , "entry" - , "entryEnd" - , "child" - , "childEnd" - , "warn" - , "stat" - ].forEach(function (ev) { - // console.error("~~ proxy event", ev, me.path) - proxy.on(ev, me.emit.bind(me, ev)) - }) - - me.emit("proxy", proxy) - - proxy.on("ready", function () { - // console.error("~~ proxy is ready!", me.path) - me.ready = true - me.emit("ready") + self._proxyTarget = proxy + proxy._proxy = self + + ;[ + 'error', + 'data', + 'end', + 'close', + 'linkpath', + 'entry', + 'entryEnd', + 'child', + 'childEnd', + 'warn', + 'stat' + ].forEach(function (ev) { + // console.error('~~ proxy event', ev, self.path) + proxy.on(ev, self.emit.bind(self, ev)) + }) + + self.emit('proxy', proxy) + + proxy.on('ready', function () { + // console.error("~~ proxy is ready!", self.path) + self.ready = true + self.emit('ready') }) - var calls = me._buffer - me._buffer.length = 0 + var calls = self._buffer + self._buffer.length = 0 calls.forEach(function (c) { proxy[c[0]].apply(proxy, c[1]) }) diff --git a/deps/npm/node_modules/fstream/lib/proxy-writer.js b/deps/npm/node_modules/fstream/lib/proxy-writer.js index b0476633a3a..a6544621bfb 100644 --- a/deps/npm/node_modules/fstream/lib/proxy-writer.js +++ b/deps/npm/node_modules/fstream/lib/proxy-writer.js @@ -7,74 +7,76 @@ module.exports = ProxyWriter -var Writer = require("./writer.js") - , getType = require("./get-type.js") - , inherits = require("inherits") - , collect = require("./collect.js") - , fs = require("fs") +var Writer = require('./writer.js') +var getType = require('./get-type.js') +var inherits = require('inherits') +var collect = require('./collect.js') +var fs = require('fs') inherits(ProxyWriter, Writer) function ProxyWriter (props) { - var me = this - if (!(me instanceof ProxyWriter)) throw new Error( - "ProxyWriter must be called as constructor.") + var self = this + if (!(self instanceof ProxyWriter)) { + throw new Error('ProxyWriter must be called as constructor.') + } - me.props = props - me._needDrain = false + self.props = props + self._needDrain = false - Writer.call(me, props) + Writer.call(self, props) } ProxyWriter.prototype._stat = function () { - var me = this - , props = me.props - // stat the thing to see what the proxy should be. - , stat = props.follow ? "stat" : "lstat" + var self = this + var props = self.props + // stat the thing to see what the proxy should be. + var stat = props.follow ? 'stat' : 'lstat' fs[stat](props.path, function (er, current) { var type if (er || !current) { - type = "File" + type = 'File' } else { type = getType(current) } props[type] = true - props.type = me.type = type + props.type = self.type = type - me._old = current - me._addProxy(Writer(props, current)) + self._old = current + self._addProxy(Writer(props, current)) }) } ProxyWriter.prototype._addProxy = function (proxy) { // console.error("~~ set proxy", this.path) - var me = this - if (me._proxy) { - return me.error("proxy already set") + var self = this + if (self._proxy) { + return self.error('proxy already set') } - me._proxy = proxy - ; [ "ready" - , "error" - , "close" - , "pipe" - , "drain" - , "warn" - ].forEach(function (ev) { - proxy.on(ev, me.emit.bind(me, ev)) - }) + self._proxy = proxy + ;[ + 'ready', + 'error', + 'close', + 'pipe', + 'drain', + 'warn' + ].forEach(function (ev) { + proxy.on(ev, self.emit.bind(self, ev)) + }) - me.emit("proxy", proxy) + self.emit('proxy', proxy) - var calls = me._buffer + var calls = self._buffer calls.forEach(function (c) { // console.error("~~ ~~ proxy buffered call", c[0], c[1]) proxy[c[0]].apply(proxy, c[1]) }) - me._buffer.length = 0 - if (me._needsDrain) me.emit("drain") + self._buffer.length = 0 + if (self._needsDrain) self.emit('drain') } ProxyWriter.prototype.add = function (entry) { @@ -82,7 +84,7 @@ ProxyWriter.prototype.add = function (entry) { collect(entry) if (!this._proxy) { - this._buffer.push(["add", [entry]]) + this._buffer.push(['add', [entry]]) this._needDrain = true return false } @@ -90,9 +92,9 @@ ProxyWriter.prototype.add = function (entry) { } ProxyWriter.prototype.write = function (c) { - // console.error("~~ proxy write") + // console.error('~~ proxy write') if (!this._proxy) { - this._buffer.push(["write", [c]]) + this._buffer.push(['write', [c]]) this._needDrain = true return false } @@ -100,9 +102,9 @@ ProxyWriter.prototype.write = function (c) { } ProxyWriter.prototype.end = function (c) { - // console.error("~~ proxy end") + // console.error('~~ proxy end') if (!this._proxy) { - this._buffer.push(["end", [c]]) + this._buffer.push(['end', [c]]) return false } return this._proxy.end(c) diff --git a/deps/npm/node_modules/fstream/lib/reader.js b/deps/npm/node_modules/fstream/lib/reader.js index 0edb794d38f..1d007ee211c 100644 --- a/deps/npm/node_modules/fstream/lib/reader.js +++ b/deps/npm/node_modules/fstream/lib/reader.js @@ -1,33 +1,28 @@ - module.exports = Reader -var fs = require("graceful-fs") - , Stream = require("stream").Stream - , inherits = require("inherits") - , path = require("path") - , getType = require("./get-type.js") - , hardLinks = Reader.hardLinks = {} - , Abstract = require("./abstract.js") +var fs = require('graceful-fs') +var Stream = require('stream').Stream +var inherits = require('inherits') +var path = require('path') +var getType = require('./get-type.js') +var hardLinks = Reader.hardLinks = {} +var Abstract = require('./abstract.js') // Must do this *before* loading the child classes inherits(Reader, Abstract) -var DirReader = require("./dir-reader.js") - , FileReader = require("./file-reader.js") - , LinkReader = require("./link-reader.js") - , SocketReader = require("./socket-reader.js") - , ProxyReader = require("./proxy-reader.js") +var LinkReader = require('./link-reader.js') function Reader (props, currentStat) { - var me = this - if (!(me instanceof Reader)) return new Reader(props, currentStat) + var self = this + if (!(self instanceof Reader)) return new Reader(props, currentStat) - if (typeof props === "string") { + if (typeof props === 'string') { props = { path: props } } if (!props.path) { - me.error("Must provide a path", null, true) + self.error('Must provide a path', null, true) } // polymorphism. @@ -36,11 +31,10 @@ function Reader (props, currentStat) { // to be the *normal* state of affairs, since we rarely know // the type of a file prior to reading it. - var type - , ClassType + var ClassType - if (props.type && typeof props.type === "function") { + if (props.type && typeof props.type === 'function') { type = props.type ClassType = type } else { @@ -55,11 +49,11 @@ function Reader (props, currentStat) { } switch (type) { - case "Directory": - ClassType = DirReader + case 'Directory': + ClassType = require('./dir-reader.js') break - case "Link": + case 'Link': // XXX hard links are just files. // However, it would be good to keep track of files' dev+inode // and nlink values, and create a HardLinkReader that emits @@ -68,66 +62,66 @@ function Reader (props, currentStat) { // ClassType = HardLinkReader // break - case "File": - ClassType = FileReader + case 'File': + ClassType = require('./file-reader.js') break - case "SymbolicLink": + case 'SymbolicLink': ClassType = LinkReader break - case "Socket": - ClassType = SocketReader + case 'Socket': + ClassType = require('./socket-reader.js') break case null: - ClassType = ProxyReader + ClassType = require('./proxy-reader.js') break } - if (!(me instanceof ClassType)) { + if (!(self instanceof ClassType)) { return new ClassType(props) } - Abstract.call(me) + Abstract.call(self) - me.readable = true - me.writable = false + self.readable = true + self.writable = false - me.type = type - me.props = props - me.depth = props.depth = props.depth || 0 - me.parent = props.parent || null - me.root = props.root || (props.parent && props.parent.root) || me + self.type = type + self.props = props + self.depth = props.depth = props.depth || 0 + self.parent = props.parent || null + self.root = props.root || (props.parent && props.parent.root) || self - me._path = me.path = path.resolve(props.path) - if (process.platform === "win32") { - me.path = me._path = me.path.replace(/\?/g, "_") - if (me._path.length >= 260) { + self._path = self.path = path.resolve(props.path) + if (process.platform === 'win32') { + self.path = self._path = self.path.replace(/\?/g, '_') + if (self._path.length >= 260) { // how DOES one create files on the moon? // if the path has spaces in it, then UNC will fail. - me._swallowErrors = true - //if (me._path.indexOf(" ") === -1) { - me._path = "\\\\?\\" + me.path.replace(/\//g, "\\") - //} + self._swallowErrors = true + // if (self._path.indexOf(" ") === -1) { + self._path = '\\\\?\\' + self.path.replace(/\//g, '\\') + // } } } - me.basename = props.basename = path.basename(me.path) - me.dirname = props.dirname = path.dirname(me.path) + self.basename = props.basename = path.basename(self.path) + self.dirname = props.dirname = path.dirname(self.path) // these have served their purpose, and are now just noisy clutter props.parent = props.root = null // console.error("\n\n\n%s setting size to", props.path, props.size) - me.size = props.size - me.filter = typeof props.filter === "function" ? props.filter : null - if (props.sort === "alpha") props.sort = alphasort + self.size = props.size + self.filter = typeof props.filter === 'function' ? props.filter : null + if (props.sort === 'alpha') props.sort = alphasort // start the ball rolling. - // this will stat the thing, and then call me._read() + // this will stat the thing, and then call self._read() // to start reading whatever it is. // console.error("calling stat", props.path, currentStat) - me._stat(currentStat) + self._stat(currentStat) } function alphasort (a, b) { @@ -139,100 +133,100 @@ function alphasort (a, b) { } Reader.prototype._stat = function (currentStat) { - var me = this - , props = me.props - , stat = props.follow ? "stat" : "lstat" - // console.error("Reader._stat", me._path, currentStat) + var self = this + var props = self.props + var stat = props.follow ? 'stat' : 'lstat' + // console.error("Reader._stat", self._path, currentStat) if (currentStat) process.nextTick(statCb.bind(null, null, currentStat)) - else fs[stat](me._path, statCb) - + else fs[stat](self._path, statCb) function statCb (er, props_) { - // console.error("Reader._stat, statCb", me._path, props_, props_.nlink) - if (er) return me.error(er) + // console.error("Reader._stat, statCb", self._path, props_, props_.nlink) + if (er) return self.error(er) Object.keys(props_).forEach(function (k) { props[k] = props_[k] }) // if it's not the expected size, then abort here. - if (undefined !== me.size && props.size !== me.size) { - return me.error("incorrect size") + if (undefined !== self.size && props.size !== self.size) { + return self.error('incorrect size') } - me.size = props.size + self.size = props.size var type = getType(props) var handleHardlinks = props.hardlinks !== false - + // special little thing for handling hardlinks. - if (handleHardlinks && type !== "Directory" && props.nlink && props.nlink > 1) { - var k = props.dev + ":" + props.ino - // console.error("Reader has nlink", me._path, k) - if (hardLinks[k] === me._path || !hardLinks[k]) hardLinks[k] = me._path - else { + if (handleHardlinks && type !== 'Directory' && props.nlink && props.nlink > 1) { + var k = props.dev + ':' + props.ino + // console.error("Reader has nlink", self._path, k) + if (hardLinks[k] === self._path || !hardLinks[k]) { + hardLinks[k] = self._path + } else { // switch into hardlink mode. - type = me.type = me.props.type = "Link" - me.Link = me.props.Link = true - me.linkpath = me.props.linkpath = hardLinks[k] - // console.error("Hardlink detected, switching mode", me._path, me.linkpath) + type = self.type = self.props.type = 'Link' + self.Link = self.props.Link = true + self.linkpath = self.props.linkpath = hardLinks[k] + // console.error("Hardlink detected, switching mode", self._path, self.linkpath) // Setting __proto__ would arguably be the "correct" // approach here, but that just seems too wrong. - me._stat = me._read = LinkReader.prototype._read + self._stat = self._read = LinkReader.prototype._read } } - if (me.type && me.type !== type) { - me.error("Unexpected type: " + type) + if (self.type && self.type !== type) { + self.error('Unexpected type: ' + type) } // if the filter doesn't pass, then just skip over this one. // still have to emit end so that dir-walking can move on. - if (me.filter) { - var who = me._proxy || me + if (self.filter) { + var who = self._proxy || self // special handling for ProxyReaders - if (!me.filter.call(who, who, props)) { - if (!me._disowned) { - me.abort() - me.emit("end") - me.emit("close") + if (!self.filter.call(who, who, props)) { + if (!self._disowned) { + self.abort() + self.emit('end') + self.emit('close') } return } } // last chance to abort or disown before the flow starts! - var events = ["_stat", "stat", "ready"] + var events = ['_stat', 'stat', 'ready'] var e = 0 ;(function go () { - if (me._aborted) { - me.emit("end") - me.emit("close") + if (self._aborted) { + self.emit('end') + self.emit('close') return } - if (me._paused && me.type !== "Directory") { - me.once("resume", go) + if (self._paused && self.type !== 'Directory') { + self.once('resume', go) return } - var ev = events[e ++] + var ev = events[e++] if (!ev) { - return me._read() + return self._read() } - me.emit(ev, props) + self.emit(ev, props) go() })() } } -Reader.prototype.pipe = function (dest, opts) { - var me = this - if (typeof dest.add === "function") { +Reader.prototype.pipe = function (dest) { + var self = this + if (typeof dest.add === 'function') { // piping to a multi-compatible, and we've got directory entries. - me.on("entry", function (entry) { + self.on('entry', function (entry) { var ret = dest.add(entry) - if (false === ret) { - me.pause() + if (ret === false) { + self.pause() } }) } @@ -244,19 +238,18 @@ Reader.prototype.pipe = function (dest, opts) { Reader.prototype.pause = function (who) { this._paused = true who = who || this - this.emit("pause", who) + this.emit('pause', who) if (this._stream) this._stream.pause(who) } Reader.prototype.resume = function (who) { this._paused = false who = who || this - this.emit("resume", who) + this.emit('resume', who) if (this._stream) this._stream.resume(who) this._read() } Reader.prototype._read = function () { - this.error("Cannot read unknown type: "+this.type) + this.error('Cannot read unknown type: ' + this.type) } - diff --git a/deps/npm/node_modules/fstream/lib/socket-reader.js b/deps/npm/node_modules/fstream/lib/socket-reader.js index e89c1731aa9..e0456ba890e 100644 --- a/deps/npm/node_modules/fstream/lib/socket-reader.js +++ b/deps/npm/node_modules/fstream/lib/socket-reader.js @@ -5,34 +5,32 @@ module.exports = SocketReader -var fs = require("graceful-fs") - , fstream = require("../fstream.js") - , inherits = require("inherits") - , mkdir = require("mkdirp") - , Reader = require("./reader.js") +var inherits = require('inherits') +var Reader = require('./reader.js') inherits(SocketReader, Reader) function SocketReader (props) { - var me = this - if (!(me instanceof SocketReader)) throw new Error( - "SocketReader must be called as constructor.") + var self = this + if (!(self instanceof SocketReader)) { + throw new Error('SocketReader must be called as constructor.') + } - if (!(props.type === "Socket" && props.Socket)) { - throw new Error("Non-socket type "+ props.type) + if (!(props.type === 'Socket' && props.Socket)) { + throw new Error('Non-socket type ' + props.type) } - Reader.call(me, props) + Reader.call(self, props) } SocketReader.prototype._read = function () { - var me = this - if (me._paused) return + var self = this + if (self._paused) return // basically just a no-op, since we got all the info we have // from the _stat method - if (!me._ended) { - me.emit("end") - me.emit("close") - me._ended = true + if (!self._ended) { + self.emit('end') + self.emit('close') + self._ended = true } } diff --git a/deps/npm/node_modules/fstream/lib/writer.js b/deps/npm/node_modules/fstream/lib/writer.js index 8b1bbf94f0c..25a608def22 100644 --- a/deps/npm/node_modules/fstream/lib/writer.js +++ b/deps/npm/node_modules/fstream/lib/writer.js @@ -1,233 +1,232 @@ - module.exports = Writer -var fs = require("graceful-fs") - , inherits = require("inherits") - , rimraf = require("rimraf") - , mkdir = require("mkdirp") - , path = require("path") - , umask = process.platform === "win32" ? 0 : process.umask() - , getType = require("./get-type.js") - , Abstract = require("./abstract.js") +var fs = require('graceful-fs') +var inherits = require('inherits') +var rimraf = require('rimraf') +var mkdir = require('mkdirp') +var path = require('path') +var umask = process.platform === 'win32' ? 0 : process.umask() +var getType = require('./get-type.js') +var Abstract = require('./abstract.js') // Must do this *before* loading the child classes inherits(Writer, Abstract) -Writer.dirmode = 0777 & (~umask) -Writer.filemode = 0666 & (~umask) +Writer.dirmode = parseInt('0777', 8) & (~umask) +Writer.filemode = parseInt('0666', 8) & (~umask) -var DirWriter = require("./dir-writer.js") - , LinkWriter = require("./link-writer.js") - , FileWriter = require("./file-writer.js") - , ProxyWriter = require("./proxy-writer.js") +var DirWriter = require('./dir-writer.js') +var LinkWriter = require('./link-writer.js') +var FileWriter = require('./file-writer.js') +var ProxyWriter = require('./proxy-writer.js') // props is the desired state. current is optionally the current stat, // provided here so that subclasses can avoid statting the target // more than necessary. function Writer (props, current) { - var me = this + var self = this - if (typeof props === "string") { + if (typeof props === 'string') { props = { path: props } } - if (!props.path) me.error("Must provide a path", null, true) + if (!props.path) self.error('Must provide a path', null, true) // polymorphism. // call fstream.Writer(dir) to get a DirWriter object, etc. var type = getType(props) - , ClassType = Writer + var ClassType = Writer switch (type) { - case "Directory": + case 'Directory': ClassType = DirWriter break - case "File": + case 'File': ClassType = FileWriter break - case "Link": - case "SymbolicLink": + case 'Link': + case 'SymbolicLink': ClassType = LinkWriter break case null: + default: // Don't know yet what type to create, so we wrap in a proxy. ClassType = ProxyWriter break } - if (!(me instanceof ClassType)) return new ClassType(props) + if (!(self instanceof ClassType)) return new ClassType(props) // now get down to business. - Abstract.call(me) + Abstract.call(self) // props is what we want to set. // set some convenience properties as well. - me.type = props.type - me.props = props - me.depth = props.depth || 0 - me.clobber = false === props.clobber ? props.clobber : true - me.parent = props.parent || null - me.root = props.root || (props.parent && props.parent.root) || me - - me._path = me.path = path.resolve(props.path) - if (process.platform === "win32") { - me.path = me._path = me.path.replace(/\?/g, "_") - if (me._path.length >= 260) { - me._swallowErrors = true - me._path = "\\\\?\\" + me.path.replace(/\//g, "\\") + self.type = props.type + self.props = props + self.depth = props.depth || 0 + self.clobber = props.clobber === false ? props.clobber : true + self.parent = props.parent || null + self.root = props.root || (props.parent && props.parent.root) || self + + self._path = self.path = path.resolve(props.path) + if (process.platform === 'win32') { + self.path = self._path = self.path.replace(/\?/g, '_') + if (self._path.length >= 260) { + self._swallowErrors = true + self._path = '\\\\?\\' + self.path.replace(/\//g, '\\') } } - me.basename = path.basename(props.path) - me.dirname = path.dirname(props.path) - me.linkpath = props.linkpath || null + self.basename = path.basename(props.path) + self.dirname = path.dirname(props.path) + self.linkpath = props.linkpath || null props.parent = props.root = null // console.error("\n\n\n%s setting size to", props.path, props.size) - me.size = props.size + self.size = props.size - if (typeof props.mode === "string") { + if (typeof props.mode === 'string') { props.mode = parseInt(props.mode, 8) } - me.readable = false - me.writable = true + self.readable = false + self.writable = true // buffer until ready, or while handling another entry - me._buffer = [] - me.ready = false + self._buffer = [] + self.ready = false - me.filter = typeof props.filter === "function" ? props.filter: null + self.filter = typeof props.filter === 'function' ? props.filter : null // start the ball rolling. // this checks what's there already, and then calls - // me._create() to call the impl-specific creation stuff. - me._stat(current) + // self._create() to call the impl-specific creation stuff. + self._stat(current) } // Calling this means that it's something we can't create. // Just assert that it's already there, otherwise raise a warning. Writer.prototype._create = function () { - var me = this - fs[me.props.follow ? "stat" : "lstat"](me._path, function (er, current) { + var self = this + fs[self.props.follow ? 'stat' : 'lstat'](self._path, function (er) { if (er) { - return me.warn("Cannot create " + me._path + "\n" + - "Unsupported type: "+me.type, "ENOTSUP") + return self.warn('Cannot create ' + self._path + '\n' + + 'Unsupported type: ' + self.type, 'ENOTSUP') } - me._finish() + self._finish() }) } Writer.prototype._stat = function (current) { - var me = this - , props = me.props - , stat = props.follow ? "stat" : "lstat" - , who = me._proxy || me + var self = this + var props = self.props + var stat = props.follow ? 'stat' : 'lstat' + var who = self._proxy || self if (current) statCb(null, current) - else fs[stat](me._path, statCb) + else fs[stat](self._path, statCb) function statCb (er, current) { - if (me.filter && !me.filter.call(who, who, current)) { - me._aborted = true - me.emit("end") - me.emit("close") + if (self.filter && !self.filter.call(who, who, current)) { + self._aborted = true + self.emit('end') + self.emit('close') return } // if it's not there, great. We'll just create it. // if it is there, then we'll need to change whatever differs if (er || !current) { - return create(me) + return create(self) } - me._old = current + self._old = current var currentType = getType(current) // if it's a type change, then we need to clobber or error. // if it's not a type change, then let the impl take care of it. - if (currentType !== me.type) { - return rimraf(me._path, function (er) { - if (er) return me.error(er) - me._old = null - create(me) + if (currentType !== self.type) { + return rimraf(self._path, function (er) { + if (er) return self.error(er) + self._old = null + create(self) }) } // otherwise, just handle in the app-specific way // this creates a fs.WriteStream, or mkdir's, or whatever - create(me) + create(self) } } -function create (me) { - // console.error("W create", me._path, Writer.dirmode) +function create (self) { + // console.error("W create", self._path, Writer.dirmode) // XXX Need to clobber non-dirs that are in the way, // unless { clobber: false } in the props. - mkdir(path.dirname(me._path), Writer.dirmode, function (er, made) { - // console.error("W created", path.dirname(me._path), er) - if (er) return me.error(er) + mkdir(path.dirname(self._path), Writer.dirmode, function (er, made) { + // console.error("W created", path.dirname(self._path), er) + if (er) return self.error(er) // later on, we have to set the mode and owner for these - me._madeDir = made - return me._create() + self._madeDir = made + return self._create() }) } -function endChmod (me, want, current, path, cb) { - var wantMode = want.mode - , chmod = want.follow || me.type !== "SymbolicLink" - ? "chmod" : "lchmod" +function endChmod (self, want, current, path, cb) { + var wantMode = want.mode + var chmod = want.follow || self.type !== 'SymbolicLink' + ? 'chmod' : 'lchmod' if (!fs[chmod]) return cb() - if (typeof wantMode !== "number") return cb() + if (typeof wantMode !== 'number') return cb() - var curMode = current.mode & 0777 - wantMode = wantMode & 0777 + var curMode = current.mode & parseInt('0777', 8) + wantMode = wantMode & parseInt('0777', 8) if (wantMode === curMode) return cb() fs[chmod](path, wantMode, cb) } - -function endChown (me, want, current, path, cb) { +function endChown (self, want, current, path, cb) { // Don't even try it unless root. Too easy to EPERM. - if (process.platform === "win32") return cb() - if (!process.getuid || !process.getuid() === 0) return cb() - if (typeof want.uid !== "number" && - typeof want.gid !== "number" ) return cb() + if (process.platform === 'win32') return cb() + if (!process.getuid || process.getuid() !== 0) return cb() + if (typeof want.uid !== 'number' && + typeof want.gid !== 'number') return cb() if (current.uid === want.uid && current.gid === want.gid) return cb() - var chown = (me.props.follow || me.type !== "SymbolicLink") - ? "chown" : "lchown" + var chown = (self.props.follow || self.type !== 'SymbolicLink') + ? 'chown' : 'lchown' if (!fs[chown]) return cb() - if (typeof want.uid !== "number") want.uid = current.uid - if (typeof want.gid !== "number") want.gid = current.gid + if (typeof want.uid !== 'number') want.uid = current.uid + if (typeof want.gid !== 'number') want.gid = current.gid fs[chown](path, want.uid, want.gid, cb) } -function endUtimes (me, want, current, path, cb) { - if (!fs.utimes || process.platform === "win32") return cb() +function endUtimes (self, want, current, path, cb) { + if (!fs.utimes || process.platform === 'win32') return cb() - var utimes = (want.follow || me.type !== "SymbolicLink") - ? "utimes" : "lutimes" + var utimes = (want.follow || self.type !== 'SymbolicLink') + ? 'utimes' : 'lutimes' - if (utimes === "lutimes" && !fs[utimes]) { - utimes = "utimes" + if (utimes === 'lutimes' && !fs[utimes]) { + utimes = 'utimes' } if (!fs[utimes]) return cb() var curA = current.atime - , curM = current.mtime - , meA = want.atime - , meM = want.mtime + var curM = current.mtime + var meA = want.atime + var meM = want.mtime if (meA === undefined) meA = curA if (meM === undefined) meM = curM @@ -241,15 +240,14 @@ function endUtimes (me, want, current, path, cb) { fs[utimes](path, meA, meM, cb) } - // XXX This function is beastly. Break it up! Writer.prototype._finish = function () { - var me = this + var self = this - if (me._finishing) return - me._finishing = true + if (self._finishing) return + self._finishing = true - // console.error(" W Finish", me._path, me.size) + // console.error(" W Finish", self._path, self.size) // set up all the things. // At this point, we're already done writing whatever we've gotta write, @@ -258,35 +256,35 @@ Writer.prototype._finish = function () { var errState = null var done = false - if (me._old) { + if (self._old) { // the times will almost *certainly* have changed. // adds the utimes syscall, but remove another stat. - me._old.atime = new Date(0) - me._old.mtime = new Date(0) - // console.error(" W Finish Stale Stat", me._path, me.size) - setProps(me._old) + self._old.atime = new Date(0) + self._old.mtime = new Date(0) + // console.error(" W Finish Stale Stat", self._path, self.size) + setProps(self._old) } else { - var stat = me.props.follow ? "stat" : "lstat" - // console.error(" W Finish Stating", me._path, me.size) - fs[stat](me._path, function (er, current) { - // console.error(" W Finish Stated", me._path, me.size, current) + var stat = self.props.follow ? 'stat' : 'lstat' + // console.error(" W Finish Stating", self._path, self.size) + fs[stat](self._path, function (er, current) { + // console.error(" W Finish Stated", self._path, self.size, current) if (er) { // if we're in the process of writing out a // directory, it's very possible that the thing we're linking to // doesn't exist yet (especially if it was intended as a symlink), // so swallow ENOENT errors here and just soldier on. - if (er.code === "ENOENT" && - (me.type === "Link" || me.type === "SymbolicLink") && - process.platform === "win32") { - me.ready = true - me.emit("ready") - me.emit("end") - me.emit("close") - me.end = me._finish = function () {} + if (er.code === 'ENOENT' && + (self.type === 'Link' || self.type === 'SymbolicLink') && + process.platform === 'win32') { + self.ready = true + self.emit('ready') + self.emit('end') + self.emit('close') + self.end = self._finish = function () {} return - } else return me.error(er) + } else return self.error(er) } - setProps(me._old = current) + setProps(self._old = current) }) } @@ -294,9 +292,9 @@ Writer.prototype._finish = function () { function setProps (current) { todo += 3 - endChmod(me, me.props, current, me._path, next("chmod")) - endChown(me, me.props, current, me._path, next("chown")) - endUtimes(me, me.props, current, me._path, next("utimes")) + endChmod(self, self.props, current, self._path, next('chmod')) + endChown(self, self.props, current, self._path, next('chown')) + endUtimes(self, self.props, current, self._path, next('utimes')) } function next (what) { @@ -305,7 +303,7 @@ Writer.prototype._finish = function () { if (errState) return if (er) { er.fstream_finish_call = what - return me.error(errState = er) + return self.error(errState = er) } if (--todo > 0) return if (done) return @@ -313,61 +311,61 @@ Writer.prototype._finish = function () { // we may still need to set the mode/etc. on some parent dirs // that were created previously. delay end/close until then. - if (!me._madeDir) return end() - else endMadeDir(me, me._path, end) + if (!self._madeDir) return end() + else endMadeDir(self, self._path, end) function end (er) { if (er) { - er.fstream_finish_call = "setupMadeDir" - return me.error(er) + er.fstream_finish_call = 'setupMadeDir' + return self.error(er) } // all the props have been set, so we're completely done. - me.emit("end") - me.emit("close") + self.emit('end') + self.emit('close') } } } } -function endMadeDir (me, p, cb) { - var made = me._madeDir - // everything *between* made and path.dirname(me._path) +function endMadeDir (self, p, cb) { + var made = self._madeDir + // everything *between* made and path.dirname(self._path) // needs to be set up. Note that this may just be one dir. var d = path.dirname(p) - endMadeDir_(me, d, function (er) { + endMadeDir_(self, d, function (er) { if (er) return cb(er) if (d === made) { return cb() } - endMadeDir(me, d, cb) + endMadeDir(self, d, cb) }) } -function endMadeDir_ (me, p, cb) { +function endMadeDir_ (self, p, cb) { var dirProps = {} - Object.keys(me.props).forEach(function (k) { - dirProps[k] = me.props[k] + Object.keys(self.props).forEach(function (k) { + dirProps[k] = self.props[k] // only make non-readable dirs if explicitly requested. - if (k === "mode" && me.type !== "Directory") { - dirProps[k] = dirProps[k] | 0111 + if (k === 'mode' && self.type !== 'Directory') { + dirProps[k] = dirProps[k] | parseInt('0111', 8) } }) var todo = 3 - , errState = null + var errState = null fs.stat(p, function (er, current) { if (er) return cb(errState = er) - endChmod(me, dirProps, current, p, next) - endChown(me, dirProps, current, p, next) - endUtimes(me, dirProps, current, p, next) + endChmod(self, dirProps, current, p, next) + endChown(self, dirProps, current, p, next) + endUtimes(self, dirProps, current, p, next) }) function next (er) { if (errState) return if (er) return cb(errState = er) - if (-- todo === 0) return cb() + if (--todo === 0) return cb() } } @@ -376,7 +374,7 @@ Writer.prototype.pipe = function () { } Writer.prototype.add = function () { - this.error("Cannot add to non-Directory type") + this.error("Can't add to non-Directory type") } Writer.prototype.write = function () { @@ -387,6 +385,6 @@ function objectToString (d) { return Object.prototype.toString.call(d) } -function isDate(d) { - return typeof d === 'object' && objectToString(d) === '[object Date]'; +function isDate (d) { + return typeof d === 'object' && objectToString(d) === '[object Date]' } diff --git a/deps/npm/node_modules/fstream/package.json b/deps/npm/node_modules/fstream/package.json index d0ac58243ad..aa6bc1cf3e4 100644 --- a/deps/npm/node_modules/fstream/package.json +++ b/deps/npm/node_modules/fstream/package.json @@ -6,7 +6,7 @@ }, "name": "fstream", "description": "Advanced file system stream things", - "version": "1.0.2", + "version": "1.0.6", "repository": { "type": "git", "url": "git://github.com/isaacs/fstream.git" @@ -22,36 +22,45 @@ "rimraf": "2" }, "devDependencies": { - "tap": "" + "tap": "0", + "standard": "^2.3.2" }, "scripts": { - "test": "tap examples/*.js" + "test": "standard && tap examples/*.js" }, - "license": "BSD", - "gitHead": "b3b74e92ef4a91ae206fab90b7998c7cd2e4290d", + "license": "ISC", + "gitHead": "e0c0024379c5a94ca228d232e2794b6ffb0d3caf", "bugs": { "url": "https://github.com/isaacs/fstream/issues" }, - "homepage": "https://github.com/isaacs/fstream", - "_id": "fstream@1.0.2", - "_shasum": "56930ff1b4d4d7b1a689c8656b3a11e744ab92c6", - "_from": "fstream@1.0.2", - "_npmVersion": "1.4.23", + "homepage": "https://github.com/isaacs/fstream#readme", + "_id": "fstream@1.0.6", + "_shasum": "817e50312fb4ed90da865c8eb5ecd1d1d7aed0ec", + "_from": "fstream@>=1.0.6 <1.1.0", + "_npmVersion": "2.9.0", + "_nodeVersion": "2.0.0", "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" + "name": "iarna", + "email": "me@re-becca.org" }, "maintainers": [ { "name": "isaacs", - "email": "i@izs.me" + "email": "isaacs@npmjs.com" + }, + { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + }, + { + "name": "iarna", + "email": "me@re-becca.org" } ], "dist": { - "shasum": "56930ff1b4d4d7b1a689c8656b3a11e744ab92c6", - "tarball": "http://registry.npmjs.org/fstream/-/fstream-1.0.2.tgz" + "shasum": "817e50312fb4ed90da865c8eb5ecd1d1d7aed0ec", + "tarball": "http://registry.npmjs.org/fstream/-/fstream-1.0.6.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.2.tgz", - "readme": "ERROR: No README data found!" + "_resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.6.tgz" } diff --git a/deps/npm/node_modules/glob/.npmignore b/deps/npm/node_modules/glob/.npmignore deleted file mode 100644 index c34fdd597ee..00000000000 --- a/deps/npm/node_modules/glob/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -.*.swp -test/a/ -node_modules/* diff --git a/deps/npm/node_modules/glob/README.md b/deps/npm/node_modules/glob/README.md index 82b7ef6d61d..fa993dcb6d4 100644 --- a/deps/npm/node_modules/glob/README.md +++ b/deps/npm/node_modules/glob/README.md @@ -1,3 +1,5 @@ +[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Dependency Status](https://david-dm.org/isaacs/node-glob.svg)](https://david-dm.org/isaacs/node-glob) [![devDependency Status](https://david-dm.org/isaacs/node-glob/dev-status.svg)](https://david-dm.org/isaacs/node-glob#info=devDependencies) [![optionalDependency Status](https://david-dm.org/isaacs/node-glob/optional-status.svg)](https://david-dm.org/isaacs/node-glob#info=optionalDependencies) + # Glob Match files using the patterns the shell uses, like stars and stuff. @@ -21,25 +23,95 @@ glob("**/*.js", options, function (er, files) { }) ``` -## Features +## Glob Primer + +"Globs" are the patterns you type when you do stuff like `ls *.js` on +the command line, or put `build/*` in a `.gitignore` file. + +Before parsing the path part patterns, braced sections are expanded +into a set. Braced sections start with `{` and end with `}`, with any +number of comma-delimited sections within. Braced sections may contain +slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`. + +The following characters have special magic meaning when used in a +path portion: + +* `*` Matches 0 or more characters in a single path portion +* `?` Matches 1 character +* `[...]` Matches a range of characters, similar to a RegExp range. + If the first character of the range is `!` or `^` then it matches + any character not in the range. +* `!(pattern|pattern|pattern)` Matches anything that does not match + any of the patterns provided. +* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the + patterns provided. +* `+(pattern|pattern|pattern)` Matches one or more occurrences of the + patterns provided. +* `*(a|b|c)` Matches zero or more occurrences of the patterns provided +* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns + provided +* `**` If a "globstar" is alone in a path portion, then it matches + zero or more directories and subdirectories searching for matches. + It does not crawl symlinked directories. + +### Dots + +If a file or directory path portion has a `.` as the first character, +then it will not match any glob pattern unless that pattern's +corresponding path part also has a `.` as its first character. + +For example, the pattern `a/.*/c` would match the file at `a/.b/c`. +However the pattern `a/*/c` would not, because `*` does not start with +a dot character. + +You can make glob treat dots as normal characters by setting +`dot:true` in the options. -Please see the [minimatch -documentation](https://github.com/isaacs/minimatch) for more details. +### Basename Matching -Supports these glob features: +If you set `matchBase:true` in the options, and the pattern has no +slashes in it, then it will seek for any file anywhere in the tree +with a matching basename. For example, `*.js` would match +`test/simple/basic.js`. -* Brace Expansion -* Extended glob matching -* "Globstar" `**` matching +### Negation -See: +The intent for negation would be for a pattern starting with `!` to +match everything that *doesn't* match the supplied pattern. However, +the implementation is weird, and for the time being, this should be +avoided. The behavior is deprecated in version 5, and will be removed +entirely in version 6. + +### Empty Sets + +If no matching files are found, then an empty array is returned. This +differs from the shell, where the pattern itself is returned. For +example: + + $ echo a*s*d*f + a*s*d*f + +To get the bash-style behavior, set the `nonull:true` in the options. + +### See Also: * `man sh` -* `man bash` +* `man bash` (Search for "Pattern Matching") * `man 3 fnmatch` * `man 5 gitignore` * [minimatch documentation](https://github.com/isaacs/minimatch) +## glob.hasMagic(pattern, [options]) + +Returns `true` if there are any special characters in the pattern, and +`false` otherwise. + +Note that the options affect the results. If `noext:true` is set in +the options object, then `+(a|b)` will not be considered a magic +pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}` +then that is considered magical, unless `nobrace:true` is set in the +options. + ## glob(pattern, [options], cb) * `pattern` {String} Pattern to be matched @@ -60,7 +132,7 @@ Perform a synchronous glob search. ## Class: glob.Glob -Create a Glob object by instanting the `glob.Glob` class. +Create a Glob object by instantiating the `glob.Glob` class. ```javascript var Glob = require("glob").Glob @@ -85,21 +157,24 @@ be immediately available on the `g.found` member. * `minimatch` The minimatch object that the glob uses. * `options` The options object passed in. -* `error` The error encountered. When an error is encountered, the - glob object is in an undefined state, and should be discarded. * `aborted` Boolean which is set to true when calling `abort()`. There is no way at this time to continue a glob search after aborting, but you can re-use the statCache to avoid having to duplicate syscalls. -* `statCache` Collection of all the stat results the glob search - performed. * `cache` Convenience object. Each field has the following possible values: * `false` - Path does not exist * `true` - Path exists - * `1` - Path exists, and is not a directory - * `2` - Path exists, and is a directory + * `'DIR'` - Path exists, and is not a directory + * `'FILE'` - Path exists, and is a directory * `[file, entries, ...]` - Path exists, is a directory, and the array value is the results of `fs.readdir` +* `statCache` Cache of `fs.stat` results, to prevent statting the same + path multiple times. +* `symlinks` A record of which paths are symbolic links, which is + relevant in resolving `**` patterns. +* `realpathCache` An optional object which is passed to `fs.realpath` + to minimize unnecessary syscalls. It is stored on the instantiated + Glob object, and may be re-used. ### Events @@ -114,7 +189,9 @@ be immediately available on the `g.found` member. ### Methods -* `abort` Stop the search. +* `pause` Temporarily stop the search +* `resume` Resume the search +* `abort` Stop the search forever ### Options @@ -124,7 +201,14 @@ or have glob-specific ramifications. All options are false by default, unless otherwise noted. -All options are added to the glob object, as well. +All options are added to the Glob object, as well. + +If you are running many `glob` operations, you can pass a Glob object +as the `options` argument to a subsequent operation to shortcut some +`stat` and `readdir` calls. At the very least, you may pass in shared +`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that +parallel glob operations will be sped up by sharing information about +the filesystem. * `cwd` The current working directory in which to search. Defaults to `process.cwd()`. @@ -142,36 +226,57 @@ All options are added to the glob object, as well. * `nosort` Don't sort the results. * `stat` Set to true to stat *all* results. This reduces performance somewhat, and is completely unnecessary, unless `readdir` is presumed - to be an untrustworthy indicator of file existence. It will cause - ELOOP to be triggered one level sooner in the case of cyclical - symbolic links. -* `silent` When an unusual error is encountered - when attempting to read a directory, a warning will be printed to - stderr. Set the `silent` option to true to suppress these warnings. -* `strict` When an unusual error is encountered - when attempting to read a directory, the process will just continue on - in search of other matches. Set the `strict` option to raise an error - in these cases. + to be an untrustworthy indicator of file existence. +* `silent` When an unusual error is encountered when attempting to + read a directory, a warning will be printed to stderr. Set the + `silent` option to true to suppress these warnings. +* `strict` When an unusual error is encountered when attempting to + read a directory, the process will just continue on in search of + other matches. Set the `strict` option to raise an error in these + cases. * `cache` See `cache` property above. Pass in a previously generated cache object to save some fs calls. * `statCache` A cache of results of filesystem information, to prevent - unnecessary stat calls. While it should not normally be necessary to - set this, you may pass the statCache from one glob() call to the + unnecessary stat calls. While it should not normally be necessary + to set this, you may pass the statCache from one glob() call to the options object of another, if you know that the filesystem will not change between calls. (See "Race Conditions" below.) -* `sync` Perform a synchronous glob search. +* `symlinks` A cache of known symbolic links. You may pass in a + previously generated `symlinks` object to save `lstat` calls when + resolving `**` matches. +* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead. * `nounique` In some cases, brace-expanded patterns can result in the same file showing up multiple times in the result set. By default, - this implementation prevents duplicates in the result set. - Set this flag to disable that behavior. + this implementation prevents duplicates in the result set. Set this + flag to disable that behavior. * `nonull` Set to never return an empty set, instead returning a set containing the pattern itself. This is the default in glob(3). -* `nocase` Perform a case-insensitive match. Note that case-insensitive - filesystems will sometimes result in glob returning results that are - case-insensitively matched anyway, since readdir and stat will not - raise an error. * `debug` Set to enable debug logging in minimatch and glob. -* `globDebug` Set to enable debug logging in glob, but not minimatch. +* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. +* `noglobstar` Do not match `**` against multiple filenames. (Ie, + treat it as a normal `*` instead.) +* `noext` Do not match `+(a|b)` "extglob" patterns. +* `nocase` Perform a case-insensitive match. Note: on + case-insensitive filesystems, non-magic patterns will match by + default, since `stat` and `readdir` will not raise errors. +* `matchBase` Perform a basename-only match if the pattern does not + contain any slash characters. That is, `*.js` would be treated as + equivalent to `**/*.js`, matching all js files in all directories. +* `nonull` Return the pattern when no matches are found. +* `nodir` Do not match directories, only files. (Note: to match + *only* directories, simply put a `/` at the end of the pattern.) +* `ignore` Add a pattern or an array of patterns to exclude matches. +* `follow` Follow symlinked directories when expanding `**` patterns. + Note that this can result in a lot of duplicate references in the + presence of cyclic links. +* `realpath` Set to true to call `fs.realpath` on all of the results. + In the case of a symlink that cannot be resolved, the full absolute + path to the matched entry is returned (though it will usually be a + broken symlink) +* `nonegate` Suppress deprecated `negate` behavior. (See below.) + Default=true +* `nocomment` Suppress deprecated `comment` behavior. (See below.) + Default=true ## Comparisons to other fnmatch/glob implementations @@ -179,23 +284,16 @@ While strict compliance with the existing standards is a worthwhile goal, some discrepancies exist between node-glob and other implementations, and are intentional. -If the pattern starts with a `!` character, then it is negated. Set the -`nonegate` flag to suppress this behavior, and treat leading `!` -characters normally. This is perhaps relevant if you wish to start the -pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` -characters at the start of a pattern will negate the pattern multiple -times. - -If a pattern starts with `#`, then it is treated as a comment, and -will not match anything. Use `\#` to match a literal `#` at the -start of a line, or set the `nocomment` flag to suppress this behavior. - The double-star character `**` is supported by default, unless the `noglobstar` flag is set. This is supported in the manner of bsdglob -and bash 4.1, where `**` only has special significance if it is the only +and bash 4.3, where `**` only has special significance if it is the only thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but `a/**b` will not. +Note that symlinked directories are not crawled as part of a `**`, +though their contents may match against subsequent portions of the +pattern. This prevents infinite loops and duplicates and the like. + If an escaped pattern has no matches, and the `nonull` flag is set, then glob returns the pattern as-provided, rather than interpreting the character escapes. For example, @@ -209,6 +307,25 @@ other interpretation of the glob pattern. Thus, a pattern like **first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are checked for validity. Since those two are valid, matching proceeds. +### Comments and Negation + +**Note**: In version 5 of this module, negation and comments are +**disabled** by default. You can explicitly set `nonegate:false` or +`nocomment:false` to re-enable them. They are going away entirely in +version 6. + +The intent for negation would be for a pattern starting with `!` to +match everything that *doesn't* match the supplied pattern. However, +the implementation is weird. It is better to use the `ignore` option +to set a pattern or set of patterns to exclude from matches. If you +want the "everything except *x*" type of behavior, you can use `**` as +the main pattern, and set an `ignore` for the things to exclude. + +The comments feature is added in minimatch, primarily to more easily +support use cases like ignore files, where a `#` at the start of a +line makes the pattern "empty". However, in the context of a +straightforward filesystem globber, "comments" don't make much sense. + ## Windows **Please only use forward-slashes in glob expressions.** @@ -239,3 +356,23 @@ calls. Users are thus advised not to use a glob result as a guarantee of filesystem state in the face of rapid changes. For the vast majority of operations, this is never a problem. + +## Contributing + +Any change to behavior (including bugfixes) must come with a test. + +Patches that fail tests or reduce performance will be rejected. + +``` +# to run tests +npm test + +# to re-generate test fixtures +npm run test-regen + +# to benchmark against bash/zsh +npm run bench + +# to profile javascript +npm run prof +``` diff --git a/deps/npm/node_modules/glob/common.js b/deps/npm/node_modules/glob/common.js new file mode 100644 index 00000000000..e36a631cab2 --- /dev/null +++ b/deps/npm/node_modules/glob/common.js @@ -0,0 +1,245 @@ +exports.alphasort = alphasort +exports.alphasorti = alphasorti +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored + +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) +} + +var path = require("path") +var minimatch = require("minimatch") +var isAbsolute = require("path-is-absolute") +var Minimatch = minimatch.Minimatch + +function alphasorti (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()) +} + +function alphasort (a, b) { + return a.localeCompare(b) +} + +function setupIgnores (self, options) { + self.ignore = options.ignore || [] + + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] + + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } +} + +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern) + } + + return { + matcher: new Minimatch(pattern), + gmatcher: gmatcher + } +} + +function setopts (self, pattern, options) { + if (!options) + options = {} + + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } + + self.silent = !!options.silent + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) + + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = cwd + else { + self.cwd = options.cwd + self.changedCwd = path.resolve(options.cwd) !== cwd + } + + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + if (process.platform === "win32") + self.root = self.root.replace(/\\/g, "/") + + self.nomount = !!options.nomount + + // disable comments and negation unless the user explicitly + // passes in false as the option. + options.nonegate = options.nonegate === false ? false : true + options.nocomment = options.nocomment === false ? false : true + deprecationWarning(options) + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options +} + +// TODO(isaacs): remove entirely in v6 +// exported to reset in tests +exports.deprecationWarned +function deprecationWarning(options) { + if (!options.nonegate || !options.nocomment) { + if (process.noDeprecation !== true && !exports.deprecationWarned) { + var msg = 'glob WARNING: comments and negation will be disabled in v6' + if (process.throwDeprecation) + throw new Error(msg) + else if (process.traceDeprecation) + console.trace(msg) + else + console.error(msg) + + exports.deprecationWarned = true + } + } +} + +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) + + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) + else + m.forEach(function (m) { + all[m] = true + }) + } + } + + if (!nou) + all = Object.keys(all) + + if (!self.nosort) + all = all.sort(self.nocase ? alphasorti : alphasort) + + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + return !(/\/$/.test(e)) + }) + } + } + + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) + + self.found = all +} + +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' + + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) + + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } + } + + return m +} + +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (isAbsolute(f) || f === '') { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else { + abs = path.resolve(f) + } + return abs +} + + +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} + +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} diff --git a/deps/npm/node_modules/glob/examples/g.js b/deps/npm/node_modules/glob/examples/g.js deleted file mode 100644 index be122df0023..00000000000 --- a/deps/npm/node_modules/glob/examples/g.js +++ /dev/null @@ -1,9 +0,0 @@ -var Glob = require("../").Glob - -var pattern = "test/a/**/[cg]/../[cg]" -console.log(pattern) - -var mg = new Glob(pattern, {mark: true, sync:true}, function (er, matches) { - console.log("matches", matches) -}) -console.log("after") diff --git a/deps/npm/node_modules/glob/examples/usr-local.js b/deps/npm/node_modules/glob/examples/usr-local.js deleted file mode 100644 index 327a425e47b..00000000000 --- a/deps/npm/node_modules/glob/examples/usr-local.js +++ /dev/null @@ -1,9 +0,0 @@ -var Glob = require("../").Glob - -var pattern = "{./*/*,/*,/usr/local/*}" -console.log(pattern) - -var mg = new Glob(pattern, {mark: true}, function (er, matches) { - console.log("matches", matches) -}) -console.log("after") diff --git a/deps/npm/node_modules/glob/glob.js b/deps/npm/node_modules/glob/glob.js index 564f3b1217c..d8ac4eff622 100644 --- a/deps/npm/node_modules/glob/glob.js +++ b/deps/npm/node_modules/glob/glob.js @@ -1,24 +1,30 @@ // Approach: // // 1. Get the minimatch set -// 2. For each pattern in the set, PROCESS(pattern) +// 2. For each pattern in the set, PROCESS(pattern, false) // 3. Store matches per-set, then uniq them // -// PROCESS(pattern) +// PROCESS(pattern, inGlobStar) // Get the first [n] items from pattern that are all strings // Join these together. This is PREFIX. // If there is no more remaining, then stat(PREFIX) and // add to matches if it succeeds. END. -// readdir(PREFIX) as ENTRIES -// If fails, END +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES // If pattern[n] is GLOBSTAR // // handle the case where the globstar match is empty // // by pruning it out, and testing the resulting pattern -// PROCESS(pattern[0..n] + pattern[n+1 .. $]) +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) // // handle other cases. // for ENTRY in ENTRIES (not dotfiles) // // attach globstar + tail onto the entry -// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $]) +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) // // else // not globstar // for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) @@ -32,146 +38,83 @@ // `true` for files, and [children,...] for directories, or `false` for // things that don't exist. - - module.exports = glob -var fs = require("graceful-fs") -, minimatch = require("minimatch") -, Minimatch = minimatch.Minimatch -, inherits = require("inherits") -, EE = require("events").EventEmitter -, path = require("path") -, isDir = {} -, assert = require("assert").ok -, once = require("once") +var fs = require('fs') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var inherits = require('inherits') +var EE = require('events').EventEmitter +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var globSync = require('./sync.js') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = require('inflight') +var util = require('util') +var childrenIgnored = common.childrenIgnored + +var once = require('once') function glob (pattern, options, cb) { - if (typeof options === "function") cb = options, options = {} + if (typeof options === 'function') cb = options, options = {} if (!options) options = {} - if (typeof options === "number") { - deprecated() - return + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) } - var g = new Glob(pattern, options, cb) - return g.sync ? g.found : g + return new Glob(pattern, options, cb) } -glob.fnmatch = deprecated +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync -function deprecated () { - throw new Error("glob's interface has changed. Please see the docs.") -} +// old api surface +glob.glob = glob -glob.sync = globSync -function globSync (pattern, options) { - if (typeof options === "number") { - deprecated() - return +glob.hasMagic = function (pattern, options_) { + var options = util._extend({}, options_) + options.noprocess = true + + var g = new Glob(pattern, options) + var set = g.minimatch.set + if (set.length > 1) + return true + + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true } - options = options || {} - options.sync = true - return glob(pattern, options) + return false } -this._processingEmitQueue = false - glob.Glob = Glob inherits(Glob, EE) function Glob (pattern, options, cb) { - if (!(this instanceof Glob)) { - return new Glob(pattern, options, cb) - } - - if (typeof options === "function") { + if (typeof options === 'function') { cb = options options = null } - if (typeof cb === "function") { - cb = once(cb) - this.on("error", cb) - this.on("end", function (matches) { - cb(null, matches) - }) - } - - options = options || {} - - this._endEmitted = false - this.EOF = {} - this._emitQueue = [] - - this.paused = false - this._processingEmitQueue = false - - this.maxDepth = options.maxDepth || 1000 - this.maxLength = options.maxLength || Infinity - this.cache = options.cache || {} - this.statCache = options.statCache || {} - - this.changedCwd = false - var cwd = process.cwd() - if (!options.hasOwnProperty("cwd")) this.cwd = cwd - else { - this.cwd = options.cwd - this.changedCwd = path.resolve(options.cwd) !== cwd - } - - this.root = options.root || path.resolve(this.cwd, "/") - this.root = path.resolve(this.root) - if (process.platform === "win32") - this.root = this.root.replace(/\\/g, "/") - - this.nomount = !!options.nomount - - if (!pattern) { - throw new Error("must provide pattern") + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) } - // base-matching: just use globstar for that. - if (options.matchBase && -1 === pattern.indexOf("/")) { - if (options.noglobstar) { - throw new Error("base matching requires globstar") - } - pattern = "**/" + pattern - } - - this.strict = options.strict !== false - this.dot = !!options.dot - this.mark = !!options.mark - this.sync = !!options.sync - this.nounique = !!options.nounique - this.nonull = !!options.nonull - this.nosort = !!options.nosort - this.nocase = !!options.nocase - this.stat = !!options.stat - - this.debug = !!options.debug || !!options.globDebug - - if (/\bglob\b/.test(process.env.NODE_DEBUG || '')) - this.debug = true - - if (this.debug) - this.log = console.error - - this.silent = !!options.silent - - var mm = this.minimatch = new Minimatch(pattern, options) - this.options = mm.options - pattern = this.pattern = mm.pattern - - this.error = null - this.aborted = false - - // list of all the patterns that ** has resolved do, so - // we can avoid visiting multiple times. - this._globstars = {} + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) - EE.call(this) + setopts(this, pattern, options) + this._didRealPath = false // process each pattern in the minimatch set var n = this.minimatch.set.length @@ -182,210 +125,168 @@ function Glob (pattern, options, cb) { // Keep them as a list so we can fill in when nonull is set. this.matches = new Array(n) - if (this.minimatch.set.length === 0) { - return process.nextTick(this._finish.bind(this)) - } - - this.minimatch.set.forEach(iterator.bind(this)) - function iterator (pattern, i, set) { - this._process(pattern, 0, i, function (er) { - if (er) this.emit("error", er) - if (-- n <= 0) this._finish() + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) }) } -} -Glob.prototype.log = function () {} + var self = this + var n = this.minimatch.set.length + this._processing = 0 + this.matches = new Array(n) -Glob.prototype._finish = function () { - assert(this instanceof Glob) + this._emitQueue = [] + this._processQueue = [] + this.paused = false - var nou = this.nounique - , all = nou ? [] : {} - - for (var i = 0, l = this.matches.length; i < l; i ++) { - var matches = this.matches[i] - this.log("matches[%d] =", i, matches) - // do like the shell, and spit out the literal glob - if (!matches) { - if (this.nonull) { - var literal = this.minimatch.globSet[i] - if (nou) all.push(literal) - else all[literal] = true - } - } else { - // had matches - var m = Object.keys(matches) - if (nou) all.push.apply(all, m) - else m.forEach(function (m) { - all[m] = true - }) - } - } + if (this.noprocess) + return this - if (!nou) all = Object.keys(all) + if (n === 0) + return done() - if (!this.nosort) { - all = all.sort(this.nocase ? alphasorti : alphasort) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) } - if (this.mark) { - // at *some* point we statted all of these - all = all.map(this._mark, this) + function done () { + --self._processing + if (self._processing <= 0) + self._finish() } +} - this.log("emitting end", all) +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return - this.EOF = this.found = all - this.emitMatch(this.EOF) + if (this.realpath && !this._didRealpath) + return this._realpath() + + common.finish(this) + this.emit('end', this.found) } -function alphasorti (a, b) { - a = a.toLowerCase() - b = b.toLowerCase() - return alphasort(a, b) +Glob.prototype._realpath = function () { + if (this._didRealpath) + return + + this._didRealpath = true + + var n = this.matches.length + if (n === 0) + return this._finish() + + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) + + function next () { + if (--n === 0) + self._finish() + } } -function alphasort (a, b) { - return a > b ? 1 : a < b ? -1 : 0 +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() + + var found = Object.keys(matchset) + var self = this + var n = found.length + + if (n === 0) + return cb() + + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + fs.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + + if (--n === 0) { + self.matches[index] = set + cb() + } + }) + }) } Glob.prototype._mark = function (p) { - var c = this.cache[p] - var m = p - if (c) { - var isDir = c === 2 || Array.isArray(c) - var slash = p.slice(-1) === '/' - - if (isDir && !slash) - m += '/' - else if (!isDir && slash) - m = m.slice(0, -1) - - if (m !== p) { - this.statCache[m] = this.statCache[p] - this.cache[m] = this.cache[p] - } - } + return common.mark(this, p) +} - return m +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) } Glob.prototype.abort = function () { this.aborted = true - this.emit("abort") + this.emit('abort') } Glob.prototype.pause = function () { - if (this.paused) return - if (this.sync) - this.emit("error", new Error("Can't pause/resume sync glob")) - this.paused = true - this.emit("pause") + if (!this.paused) { + this.paused = true + this.emit('pause') + } } Glob.prototype.resume = function () { - if (!this.paused) return - if (this.sync) - this.emit("error", new Error("Can't pause/resume sync glob")) - this.paused = false - this.emit("resume") - this._processEmitQueue() - //process.nextTick(this.emit.bind(this, "resume")) -} - -Glob.prototype.emitMatch = function (m) { - this.log('emitMatch', m) - this._emitQueue.push(m) - this._processEmitQueue() -} - -Glob.prototype._processEmitQueue = function (m) { - this.log("pEQ paused=%j processing=%j m=%j", this.paused, - this._processingEmitQueue, m) - var done = false - while (!this._processingEmitQueue && - !this.paused) { - this._processingEmitQueue = true - var m = this._emitQueue.shift() - this.log(">processEmitQueue", m === this.EOF ? ":EOF:" : m) - if (!m) { - this.log(">processEmitQueue, falsey m") - this._processingEmitQueue = false - break - } - - if (m === this.EOF || !(this.mark && !this.stat)) { - this.log("peq: unmarked, or eof") - next.call(this, 0, false) - } else if (this.statCache[m]) { - var sc = this.statCache[m] - var exists - if (sc) - exists = sc.isDirectory() ? 2 : 1 - this.log("peq: stat cached") - next.call(this, exists, exists === 2) - } else { - this.log("peq: _stat, then next") - this._stat(m, next) + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } } - } - done = true - - function next(exists, isDir) { - this.log("next", m, exists, isDir) - var ev = m === this.EOF ? "end" : "match" - - // "end" can only happen once. - assert(!this._endEmitted) - if (ev === "end") - this._endEmitted = true - - if (exists) { - // Doesn't mean it necessarily doesn't exist, it's possible - // we just didn't check because we don't care that much, or - // this is EOF anyway. - if (isDir && !m.match(/\/$/)) { - m = m + "/" - } else if (!isDir && m.match(/\/$/)) { - m = m.replace(/\/+$/, "") + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) } } - this.log("emit", ev, m) - this.emit(ev, m) - this._processingEmitQueue = false - if (done && m !== this.EOF && !this.paused) - this._processEmitQueue() } } -Glob.prototype._process = function (pattern, depth, index, cb_) { +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { assert(this instanceof Glob) + assert(typeof cb === 'function') - var cb = function cb (er, res) { - assert(this instanceof Glob) - if (this.paused) { - if (!this._processQueue) { - this._processQueue = [] - this.once("resume", function () { - var q = this._processQueue - this._processQueue = null - q.forEach(function (cb) { cb() }) - }) - } - this._processQueue.push(cb_.bind(this, er, res)) - } else { - cb_.call(this, er, res) - } - }.bind(this) + if (this.aborted) + return - if (this.aborted) return cb() + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } - if (depth > this.maxDepth) return cb() + //console.error('PROCESS %d', this._processing, pattern) // Get the first [n] parts of pattern that are all strings. var n = 0 - while (typeof pattern[n] === "string") { + while (typeof pattern[n] === 'string') { n ++ } // now n is the index of the first one that is *not* a string. @@ -395,28 +296,7 @@ Glob.prototype._process = function (pattern, depth, index, cb_) { switch (n) { // if not, then this is rather simple case pattern.length: - prefix = pattern.join("/") - this._stat(prefix, function (exists, isDir) { - // either it's there, or it isn't. - // nothing more to do, either way. - if (exists) { - if (prefix && isAbsolute(prefix) && !this.nomount) { - if (prefix.charAt(0) === "/") { - prefix = path.join(this.root, prefix) - } else { - prefix = path.resolve(this.root, prefix) - } - } - - if (process.platform === "win32") - prefix = prefix.replace(/\\/g, "/") - - this.matches[index] = this.matches[index] || {} - this.matches[index][prefix] = true - this.emitMatch(prefix) - } - return cb() - }) + this._processSimple(pattern.join('/'), index, cb) return case 0: @@ -427,320 +307,441 @@ Glob.prototype._process = function (pattern, depth, index, cb_) { default: // pattern has some string bits in the front. - // whatever it starts with, whether that's "absolute" like /foo/bar, - // or "relative" like "../baz" - prefix = pattern.slice(0, n) - prefix = prefix.join("/") + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') break } + var remain = pattern.slice(n) + // get the list of entries. var read - if (prefix === null) read = "." - else if (isAbsolute(prefix) || isAbsolute(pattern.join("/"))) { - if (!prefix || !isAbsolute(prefix)) { - prefix = "/" + prefix - } + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix read = prefix - - // if (process.platform === "win32") - // read = prefix = prefix.replace(/^[a-zA-Z]:|\\/g, "/") - - this.log('absolute: ', prefix, this.root, pattern, read) - } else { + } else read = prefix - } - this.log('readdir(%j)', read, this.cwd, this.root) + var abs = this._makeAbs(read) - return this._readdir(read, function (er, entries) { - if (er) { - // not a directory! - // this means that, whatever else comes after this, it can never match - return cb() - } + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() - // globstar is special - if (pattern[n] === minimatch.GLOBSTAR) { - // test without the globstar, and with every child both below - // and replacing the globstar. - var s = [ pattern.slice(0, n).concat(pattern.slice(n + 1)) ] - entries.forEach(function (e) { - if (e.charAt(0) === "." && !this.dot) return - // instead of the globstar - s.push(pattern.slice(0, n).concat(e).concat(pattern.slice(n + 1))) - // below the globstar - s.push(pattern.slice(0, n).concat(e).concat(pattern.slice(n))) - }, this) - - s = s.filter(function (pattern) { - var key = gsKey(pattern) - var seen = !this._globstars[key] - this._globstars[key] = true - return seen - }, this) - - if (!s.length) - return cb() + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} - // now asyncForEach over this - var l = s.length - , errState = null - s.forEach(function (gsPattern) { - this._process(gsPattern, depth + 1, index, function (er) { - if (errState) return - if (er) return cb(errState = er) - if (--l <= 0) return cb() - }) - }, this) +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} - return +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) } + } - // not a globstar - // It will only match dot entries if it starts with a dot, or if - // dot is set. Stuff like @(.foo|.bar) isn't allowed. - var pn = pattern[n] - var negate = !!this.minimatch.negate; - var rawGlob = pattern[n]._glob - , dotOk = this.dot || rawGlob.charAt(0) === "." - - entries = entries.filter(function (e) { - if (e.charAt(0) !== "." || dotOk) { - if (negate && n === 0) { - return !e.match(pattern[n]); - } else { - return e.match(pattern[n]); - } + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e } - return null; - }) + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return cb() + } - // If n === pattern.length - 1, then there's no need for the extra stat - // *unless* the user has specified "mark" or "stat" explicitly. - // We know that they exist, since the readdir returned them. - if (n === pattern.length - 1 && - !this.mark && - !this.stat) { - entries.forEach(function (e) { - if (prefix) { - if (prefix !== "/") e = prefix + "/" + e - else e = prefix + e - } - if (e.charAt(0) === "/" && !this.nomount) { - e = path.join(this.root, e) - } - - if (process.platform === "win32") - e = e.replace(/\\/g, "/") - - this.matches[index] = this.matches[index] || {} - this.matches[index][e] = true - this.emitMatch(e) - }, this) - return cb.call(this) + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e } + this._process([e].concat(remain), index, inGlobStar, cb) + } + cb() +} +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return - // now test all the remaining entries as stand-ins for that part - // of the pattern. - var l = entries.length - , errState = null - if (l === 0) return cb() // no matches possible - entries.forEach(function (e) { - var p = pattern.slice(0, n).concat(e).concat(pattern.slice(n + 1)) - this._process(p, depth + 1, index, function (er) { - if (errState) return - if (er) return cb(errState = er) - if (--l === 0) return cb.call(this) - }) - }, this) - }) + if (this.matches[index][e]) + return -} + if (this.paused) { + this._emitQueue.push([index, e]) + return + } + + var abs = this._makeAbs(e) + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + if (this.mark) + e = this._mark(e) -function gsKey (pattern) { - return '**' + pattern.map(function (p) { - return (p === minimatch.GLOBSTAR) ? '**' : (''+p) - }).join('/') + this.matches[index][e] = true + + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) + + this.emit('match', e) } -Glob.prototype._stat = function (f, cb) { - assert(this instanceof Glob) - var abs = f - if (f.charAt(0) === "/") { - abs = path.join(this.root, f) - } else if (this.changedCwd) { - abs = path.resolve(this.cwd, f) +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return + + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) + + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) + + if (lstatcb) + fs.lstat(abs, lstatcb) + + function lstatcb_ (er, lstat) { + if (er) + return cb() + + var isSym = lstat.isSymbolicLink() + self.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) } +} + +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return + + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() - if (f.length > this.maxLength) { - var er = new Error("Path name too long") - er.code = "ENAMETOOLONG" - er.path = f - return this._afterStat(f, abs, cb, er) + if (Array.isArray(c)) + return cb(null, c) } - this.log('stat', [this.cwd, f, '=', abs]) + var self = this + fs.readdir(abs, readdirCb(this, abs, cb)) +} - if (!this.stat && this.cache.hasOwnProperty(f)) { - var exists = this.cache[f] - , isDir = exists && (Array.isArray(exists) || exists === 2) - if (this.sync) return cb.call(this, !!exists, isDir) - return process.nextTick(cb.bind(this, !!exists, isDir)) +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) } +} - var stat = this.statCache[abs] - if (this.sync || stat) { - var er - try { - stat = fs.statSync(abs) - } catch (e) { - er = e +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return + + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true } - this._afterStat(f, abs, cb, er, stat) - } else { - fs.stat(abs, this._afterStat.bind(this, f, abs, cb)) } + + this.cache[abs] = entries + return cb(null, entries) } -Glob.prototype._afterStat = function (f, abs, cb, er, stat) { - var exists - assert(this instanceof Glob) +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return - if (abs.slice(-1) === "/" && stat && !stat.isDirectory()) { - this.log("should be ENOTDIR, fake it") + // handle errors, and cache the information + switch (er.code) { + case 'ENOTDIR': // totally normal. means it *does* exist. + this.cache[this._makeAbs(f)] = 'FILE' + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break - er = new Error("ENOTDIR, not a directory '" + abs + "'") - er.path = abs - er.code = "ENOTDIR" - stat = null + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) { + this.emit('error', er) + // If the error is handled, then we abort + // if not, we threw out of here + this.abort() + } + if (!this.silent) + console.error('glob error', er) + break } - var emit = !this.statCache[abs] - this.statCache[abs] = stat + return cb() +} - if (er || !stat) { - exists = false - } else { - exists = stat.isDirectory() ? 2 : 1 - if (emit) - this.emit('stat', f, stat) - } - this.cache[f] = this.cache[f] || exists - cb.call(this, !!exists, exists === 2) +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) } -Glob.prototype._readdir = function (f, cb) { - assert(this instanceof Glob) - var abs = f - if (f.charAt(0) === "/") { - abs = path.join(this.root, f) - } else if (isAbsolute(f)) { - abs = f - } else if (this.changedCwd) { - abs = path.resolve(this.cwd, f) - } - if (f.length > this.maxLength) { - var er = new Error("Path name too long") - er.code = "ENAMETOOLONG" - er.path = f - return this._afterReaddir(f, abs, cb, er) - } +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) - this.log('readdir', [this.cwd, f, abs]) - if (this.cache.hasOwnProperty(f)) { - var c = this.cache[f] - if (Array.isArray(c)) { - if (this.sync) return cb.call(this, null, c) - return process.nextTick(cb.bind(this, null, c)) - } + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() - if (!c || c === 1) { - // either ENOENT or ENOTDIR - var code = c ? "ENOTDIR" : "ENOENT" - , er = new Error((c ? "Not a directory" : "Not found") + ": " + f) - er.path = f - er.code = code - this.log(f, er) - if (this.sync) return cb.call(this, er) - return process.nextTick(cb.bind(this, er)) - } + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) - // at this point, c === 2, meaning it's a dir, but we haven't - // had to read it yet, or c === true, meaning it's *something* - // but we don't have any idea what. Need to read it, either way. + var isSym = this.symlinks[abs] + var len = entries.length + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) } - if (this.sync) { - var er, entries - try { - entries = fs.readdirSync(abs) - } catch (e) { - er = e + cb() +} + +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' } - return this._afterReaddir(f, abs, cb, er, entries) } - fs.readdir(abs, this._afterReaddir.bind(this, f, abs, cb)) + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) + cb() } -Glob.prototype._afterReaddir = function (f, abs, cb, er, entries) { - assert(this instanceof Glob) - if (entries && !er) { - this.cache[f] = entries - // if we haven't asked to stat everything for suresies, then just - // assume that everything in there exists, so we can avoid - // having to stat it a second time. This also gets us one step - // further into ELOOP territory. - if (!this.mark && !this.stat) { - entries.forEach(function (e) { - if (f === "/") e = f + e - else e = f + "/" + e - this.cache[e] = true - }, this) - } +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return cb() + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' - return cb.call(this, er, entries) + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) + + if (needDir && c === 'FILE') + return cb() + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. } - // now handle errors, and cache the information - if (er) switch (er.code) { - case "ENOTDIR": // totally normal. means it *does* exist. - this.cache[f] = 1 - return cb.call(this, er) - case "ENOENT": // not terribly unusual - case "ELOOP": - case "ENAMETOOLONG": - case "UNKNOWN": - this.cache[f] = false - return cb.call(this, er) - default: // some unusual error. Treat as failure. - this.cache[f] = false - if (this.strict) this.emit("error", er) - if (!this.silent) console.error("glob error", er) - return cb.call(this, er) + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } + + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + fs.lstat(abs, statcb) + + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } } } -var isAbsolute = process.platform === "win32" ? absWin : absUnix +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er) { + this.statCache[abs] = false + return cb() + } + + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat -function absWin (p) { - if (absUnix(p)) return true - // pull off the device/UNC bit from a windows path. - // from node's lib/path.js - var splitDeviceRe = - /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/ - , result = splitDeviceRe.exec(p) - , device = result[1] || '' - , isUnc = device && device.charAt(1) !== ':' - , isAbsolute = !!result[2] || isUnc // UNC paths are always absolute + if (abs.slice(-1) === '/' && !stat.isDirectory()) + return cb(null, false, stat) - return isAbsolute -} + var c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c !== 'DIR') + return cb() -function absUnix (p) { - return p.charAt(0) === "/" || p === "" + return cb(null, c, stat) } diff --git a/deps/npm/node_modules/glob/node_modules/path-is-absolute/index.js b/deps/npm/node_modules/glob/node_modules/path-is-absolute/index.js new file mode 100644 index 00000000000..19f103f908a --- /dev/null +++ b/deps/npm/node_modules/glob/node_modules/path-is-absolute/index.js @@ -0,0 +1,20 @@ +'use strict'; + +function posix(path) { + return path.charAt(0) === '/'; +}; + +function win32(path) { + // https://github.com/joyent/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 + var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + var result = splitDeviceRe.exec(path); + var device = result[1] || ''; + var isUnc = !!device && device.charAt(1) !== ':'; + + // UNC paths are always absolute + return !!result[2] || isUnc; +}; + +module.exports = process.platform === 'win32' ? win32 : posix; +module.exports.posix = posix; +module.exports.win32 = win32; diff --git a/deps/npm/node_modules/glob/node_modules/path-is-absolute/license b/deps/npm/node_modules/glob/node_modules/path-is-absolute/license new file mode 100644 index 00000000000..654d0bfe943 --- /dev/null +++ b/deps/npm/node_modules/glob/node_modules/path-is-absolute/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.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/deps/npm/node_modules/glob/node_modules/path-is-absolute/package.json b/deps/npm/node_modules/glob/node_modules/path-is-absolute/package.json new file mode 100644 index 00000000000..39372636f3f --- /dev/null +++ b/deps/npm/node_modules/glob/node_modules/path-is-absolute/package.json @@ -0,0 +1,70 @@ +{ + "name": "path-is-absolute", + "version": "1.0.0", + "description": "Node.js 0.12 path.isAbsolute() ponyfill", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/path-is-absolute.git" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "node test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "path", + "paths", + "file", + "dir", + "absolute", + "isabsolute", + "is-absolute", + "built-in", + "util", + "utils", + "core", + "ponyfill", + "polyfill", + "shim", + "is", + "detect", + "check" + ], + "gitHead": "7a76a0c9f2263192beedbe0a820e4d0baee5b7a1", + "bugs": { + "url": "https://github.com/sindresorhus/path-is-absolute/issues" + }, + "homepage": "https://github.com/sindresorhus/path-is-absolute", + "_id": "path-is-absolute@1.0.0", + "_shasum": "263dada66ab3f2fb10bf7f9d24dd8f3e570ef912", + "_from": "path-is-absolute@>=1.0.0 <2.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "263dada66ab3f2fb10bf7f9d24dd8f3e570ef912", + "tarball": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/glob/node_modules/path-is-absolute/readme.md b/deps/npm/node_modules/glob/node_modules/path-is-absolute/readme.md new file mode 100644 index 00000000000..cdf94f4309a --- /dev/null +++ b/deps/npm/node_modules/glob/node_modules/path-is-absolute/readme.md @@ -0,0 +1,51 @@ +# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute) + +> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) ponyfill + +> Ponyfill: A polyfill that doesn't overwrite the native method + + +## Install + +``` +$ npm install --save path-is-absolute +``` + + +## Usage + +```js +var pathIsAbsolute = require('path-is-absolute'); + +// Linux +pathIsAbsolute('/home/foo'); +//=> true + +// Windows +pathIsAbsolute('C:/Users/'); +//=> true + +// Any OS +pathIsAbsolute.posix('/home/foo'); +//=> true +``` + + +## API + +See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path). + +### pathIsAbsolute(path) + +### pathIsAbsolute.posix(path) + +The Posix specific version. + +### pathIsAbsolute.win32(path) + +The Windows specific version. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/glob/oh-my-glob.gif b/deps/npm/node_modules/glob/oh-my-glob.gif deleted file mode 100644 index a1568c13ca6..00000000000 Binary files a/deps/npm/node_modules/glob/oh-my-glob.gif and /dev/null differ diff --git a/deps/npm/node_modules/glob/package.json b/deps/npm/node_modules/glob/package.json index 6bf85e8dfeb..a0538e9558d 100644 --- a/deps/npm/node_modules/glob/package.json +++ b/deps/npm/node_modules/glob/package.json @@ -6,44 +6,60 @@ }, "name": "glob", "description": "a little globber", - "version": "4.0.6", + "version": "5.0.10", "repository": { "type": "git", "url": "git://github.com/isaacs/node-glob.git" }, "main": "glob.js", + "files": [ + "glob.js", + "sync.js", + "common.js" + ], "engines": { "node": "*" }, "dependencies": { - "graceful-fs": "^3.0.2", + "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^1.0.0", - "once": "^1.3.0" + "minimatch": "^2.0.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" }, "devDependencies": { - "tap": "~0.4.0", "mkdirp": "0", - "rimraf": "1" + "rimraf": "^2.2.8", + "tap": "^1.1.4", + "tick": "0.0.6" }, "scripts": { - "test": "tap test/*.js", - "test-regen": "TEST_REGEN=1 node test/00-setup.js" + "prepublish": "npm run benchclean", + "profclean": "rm -f v8.log profile.txt", + "test": "tap test/*.js --cov", + "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js", + "bench": "bash benchmark.sh", + "prof": "bash prof.sh && cat profile.txt", + "benchclean": "bash benchclean.sh" }, "license": "ISC", - "gitHead": "6825c425e738eaffa315d8cdb1a4c3255ededcb3", + "gitHead": "e3cdccc0e295c2e1d5f40cf74c73ea17a8319c5c", "bugs": { "url": "https://github.com/isaacs/node-glob/issues" }, - "homepage": "https://github.com/isaacs/node-glob", - "_id": "glob@4.0.6", - "_shasum": "695c50bdd4e2fb5c5d370b091f388d3707e291a7", - "_from": "glob@>=4.0.6 <5.0.0", - "_npmVersion": "2.0.0", - "_nodeVersion": "0.10.31", + "homepage": "https://github.com/isaacs/node-glob#readme", + "_id": "glob@5.0.10", + "_shasum": "3ee350319f31f352cef6899a48f6b6b7834c6899", + "_from": "glob@>=5.0.10 <5.1.0", + "_npmVersion": "2.10.1", + "_nodeVersion": "2.0.1", "_npmUser": { "name": "isaacs", - "email": "i@izs.me" + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "3ee350319f31f352cef6899a48f6b6b7834c6899", + "tarball": "http://registry.npmjs.org/glob/-/glob-5.0.10.tgz" }, "maintainers": [ { @@ -51,11 +67,7 @@ "email": "i@izs.me" } ], - "dist": { - "shasum": "695c50bdd4e2fb5c5d370b091f388d3707e291a7", - "tarball": "http://registry.npmjs.org/glob/-/glob-4.0.6.tgz" - }, "directories": {}, - "_resolved": "https://registry.npmjs.org/glob/-/glob-4.0.6.tgz", + "_resolved": "https://registry.npmjs.org/glob/-/glob-5.0.10.tgz", "readme": "ERROR: No README data found!" } diff --git a/deps/npm/node_modules/glob/sync.js b/deps/npm/node_modules/glob/sync.js new file mode 100644 index 00000000000..78fada2c8b4 --- /dev/null +++ b/deps/npm/node_modules/glob/sync.js @@ -0,0 +1,459 @@ +module.exports = globSync +globSync.GlobSync = GlobSync + +var fs = require('fs') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var Glob = require('./glob.js').Glob +var util = require('util') +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var childrenIgnored = common.childrenIgnored + +function globSync (pattern, options) { + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + return new GlobSync(pattern, options).found +} + +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') + + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) + + setopts(this, pattern, options) + + if (this.noprocess) + return this + + var n = this.minimatch.set.length + this.matches = new Array(n) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false) + } + this._finish() +} + +GlobSync.prototype._finish = function () { + assert(this instanceof GlobSync) + if (this.realpath) { + var self = this + this.matches.forEach(function (matchset, index) { + var set = self.matches[index] = Object.create(null) + for (var p in matchset) { + try { + p = self._makeAbs(p) + var real = fs.realpathSync(p, this.realpathCache) + set[real] = true + } catch (er) { + if (er.syscall === 'stat') + set[self._makeAbs(p)] = true + else + throw er + } + } + }) + } + common.finish(this) +} + + +GlobSync.prototype._process = function (pattern, index, inGlobStar) { + assert(this instanceof GlobSync) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // See if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip processing + if (childrenIgnored(this, read)) + return + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar) +} + + +GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar) + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix.slice(-1) !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this.matches[index][e] = true + } + // This was the last one, and no stats were needed + return + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) + newPattern = [prefix, e] + else + newPattern = [e] + this._process(newPattern.concat(remain), index, inGlobStar) + } +} + + +GlobSync.prototype._emitMatch = function (index, e) { + var abs = this._makeAbs(e) + if (this.mark) + e = this._mark(e) + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[this._makeAbs(e)] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + if (this.stat) + this._stat(e) +} + + +GlobSync.prototype._readdirInGlobStar = function (abs) { + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false) + + var entries + var lstat + var stat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + // lstat failed, doesn't exist + return null + } + + var isSym = lstat.isSymbolicLink() + this.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && !lstat.isDirectory()) + this.cache[abs] = 'FILE' + else + entries = this._readdir(abs, false) + + return entries +} + +GlobSync.prototype._readdir = function (abs, inGlobStar) { + var entries + + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return null + + if (Array.isArray(c)) + return c + } + + try { + return this._readdirEntries(abs, fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er) + return null + } +} + +GlobSync.prototype._readdirEntries = function (abs, entries) { + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + + // mark and cache dir-ness + return entries +} + +GlobSync.prototype._readdirError = function (f, er) { + // handle errors, and cache the information + switch (er.code) { + case 'ENOTDIR': // totally normal. means it *does* exist. + this.cache[this._makeAbs(f)] = 'FILE' + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) + throw er + if (!this.silent) + console.error('glob error', er) + break + } +} + +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { + + var entries = this._readdir(abs, inGlobStar) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false) + + var len = entries.length + var isSym = this.symlinks[abs] + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true) + } +} + +GlobSync.prototype._processSimple = function (prefix, index) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var exists = this._stat(prefix) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this.matches[index][prefix] = true +} + +// Returns either 'DIR', 'FILE', or false +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return false + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return c + + if (needDir && c === 'FILE') + return false + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + return false + } + + if (lstat.isSymbolicLink()) { + try { + stat = fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } + } + + this.statCache[abs] = stat + + var c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c !== 'DIR') + return false + + return c +} + +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} + +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} diff --git a/deps/npm/node_modules/glob/test/00-setup.js b/deps/npm/node_modules/glob/test/00-setup.js deleted file mode 100644 index 245afafda4c..00000000000 --- a/deps/npm/node_modules/glob/test/00-setup.js +++ /dev/null @@ -1,176 +0,0 @@ -// just a little pre-run script to set up the fixtures. -// zz-finish cleans it up - -var mkdirp = require("mkdirp") -var path = require("path") -var i = 0 -var tap = require("tap") -var fs = require("fs") -var rimraf = require("rimraf") - -var files = -[ "a/.abcdef/x/y/z/a" -, "a/abcdef/g/h" -, "a/abcfed/g/h" -, "a/b/c/d" -, "a/bc/e/f" -, "a/c/d/c/b" -, "a/cb/e/f" -] - -var symlinkTo = path.resolve(__dirname, "a/symlink/a/b/c") -var symlinkFrom = "../.." - -files = files.map(function (f) { - return path.resolve(__dirname, f) -}) - -tap.test("remove fixtures", function (t) { - rimraf(path.resolve(__dirname, "a"), function (er) { - t.ifError(er, "remove fixtures") - t.end() - }) -}) - -files.forEach(function (f) { - tap.test(f, function (t) { - var d = path.dirname(f) - mkdirp(d, 0755, function (er) { - if (er) { - t.fail(er) - return t.bailout() - } - fs.writeFile(f, "i like tests", function (er) { - t.ifError(er, "make file") - t.end() - }) - }) - }) -}) - -if (process.platform !== "win32") { - tap.test("symlinky", function (t) { - var d = path.dirname(symlinkTo) - console.error("mkdirp", d) - mkdirp(d, 0755, function (er) { - t.ifError(er) - fs.symlink(symlinkFrom, symlinkTo, "dir", function (er) { - t.ifError(er, "make symlink") - t.end() - }) - }) - }) -} - -;["foo","bar","baz","asdf","quux","qwer","rewq"].forEach(function (w) { - w = "/tmp/glob-test/" + w - tap.test("create " + w, function (t) { - mkdirp(w, function (er) { - if (er) - throw er - t.pass(w) - t.end() - }) - }) -}) - - -// generate the bash pattern test-fixtures if possible -if (process.platform === "win32" || !process.env.TEST_REGEN) { - console.error("Windows, or TEST_REGEN unset. Using cached fixtures.") - return -} - -var spawn = require("child_process").spawn; -var globs = - // put more patterns here. - // anything that would be directly in / should be in /tmp/glob-test - ["test/a/*/+(c|g)/./d" - ,"test/a/**/[cg]/../[cg]" - ,"test/a/{b,c,d,e,f}/**/g" - ,"test/a/b/**" - ,"test/**/g" - ,"test/a/abc{fed,def}/g/h" - ,"test/a/abc{fed/g,def}/**/" - ,"test/a/abc{fed/g,def}/**///**/" - ,"test/**/a/**/" - ,"test/+(a|b|c)/a{/,bc*}/**" - ,"test/*/*/*/f" - ,"test/**/f" - ,"test/a/symlink/a/b/c/a/b/c/a/b/c//a/b/c////a/b/c/**/b/c/**" - ,"{./*/*,/tmp/glob-test/*}" - ,"{/tmp/glob-test/*,*}" // evil owl face! how you taunt me! - ,"test/a/!(symlink)/**" - ] -var bashOutput = {} -var fs = require("fs") - -globs.forEach(function (pattern) { - tap.test("generate fixture " + pattern, function (t) { - var cmd = "shopt -s globstar && " + - "shopt -s extglob && " + - "shopt -s nullglob && " + - // "shopt >&2; " + - "eval \'for i in " + pattern + "; do echo $i; done\'" - var cp = spawn("bash", ["-c", cmd], { cwd: path.dirname(__dirname) }) - var out = [] - cp.stdout.on("data", function (c) { - out.push(c) - }) - cp.stderr.pipe(process.stderr) - cp.on("close", function (code) { - out = flatten(out) - if (!out) - out = [] - else - out = cleanResults(out.split(/\r*\n/)) - - bashOutput[pattern] = out - t.notOk(code, "bash test should finish nicely") - t.end() - }) - }) -}) - -tap.test("save fixtures", function (t) { - var fname = path.resolve(__dirname, "bash-results.json") - var data = JSON.stringify(bashOutput, null, 2) + "\n" - fs.writeFile(fname, data, function (er) { - t.ifError(er) - t.end() - }) -}) - -function cleanResults (m) { - // normalize discrepancies in ordering, duplication, - // and ending slashes. - return m.map(function (m) { - return m.replace(/\/+/g, "/").replace(/\/$/, "") - }).sort(alphasort).reduce(function (set, f) { - if (f !== set[set.length - 1]) set.push(f) - return set - }, []).sort(alphasort).map(function (f) { - // de-windows - return (process.platform !== 'win32') ? f - : f.replace(/^[a-zA-Z]:\\\\/, '/').replace(/\\/g, '/') - }) -} - -function flatten (chunks) { - var s = 0 - chunks.forEach(function (c) { s += c.length }) - var out = new Buffer(s) - s = 0 - chunks.forEach(function (c) { - c.copy(out, s) - s += c.length - }) - - return out.toString().trim() -} - -function alphasort (a, b) { - a = a.toLowerCase() - b = b.toLowerCase() - return a > b ? 1 : a < b ? -1 : 0 -} diff --git a/deps/npm/node_modules/glob/test/bash-comparison.js b/deps/npm/node_modules/glob/test/bash-comparison.js deleted file mode 100644 index 239ed1a9c39..00000000000 --- a/deps/npm/node_modules/glob/test/bash-comparison.js +++ /dev/null @@ -1,63 +0,0 @@ -// basic test -// show that it does the same thing by default as the shell. -var tap = require("tap") -, child_process = require("child_process") -, bashResults = require("./bash-results.json") -, globs = Object.keys(bashResults) -, glob = require("../") -, path = require("path") - -// run from the root of the project -// this is usually where you're at anyway, but be sure. -process.chdir(path.resolve(__dirname, "..")) - -function alphasort (a, b) { - a = a.toLowerCase() - b = b.toLowerCase() - return a > b ? 1 : a < b ? -1 : 0 -} - -globs.forEach(function (pattern) { - var expect = bashResults[pattern] - // anything regarding the symlink thing will fail on windows, so just skip it - if (process.platform === "win32" && - expect.some(function (m) { - return /\/symlink\//.test(m) - })) - return - - tap.test(pattern, function (t) { - glob(pattern, function (er, matches) { - if (er) - throw er - - // sort and unmark, just to match the shell results - matches = cleanResults(matches) - - t.deepEqual(matches, expect, pattern) - t.end() - }) - }) - - tap.test(pattern + " sync", function (t) { - var matches = cleanResults(glob.sync(pattern)) - - t.deepEqual(matches, expect, "should match shell") - t.end() - }) -}) - -function cleanResults (m) { - // normalize discrepancies in ordering, duplication, - // and ending slashes. - return m.map(function (m) { - return m.replace(/\/+/g, "/").replace(/\/$/, "") - }).sort(alphasort).reduce(function (set, f) { - if (f !== set[set.length - 1]) set.push(f) - return set - }, []).sort(alphasort).map(function (f) { - // de-windows - return (process.platform !== 'win32') ? f - : f.replace(/^[a-zA-Z]:[\/\\]+/, '/').replace(/[\\\/]+/g, '/') - }) -} diff --git a/deps/npm/node_modules/glob/test/bash-results.json b/deps/npm/node_modules/glob/test/bash-results.json deleted file mode 100644 index 8223d0675b5..00000000000 --- a/deps/npm/node_modules/glob/test/bash-results.json +++ /dev/null @@ -1,356 +0,0 @@ -{ - "test/a/*/+(c|g)/./d": [ - "test/a/b/c/./d" - ], - "test/a/**/[cg]/../[cg]": [ - "test/a/abcdef/g/../g", - "test/a/abcfed/g/../g", - "test/a/b/c/../c", - "test/a/c/../c", - "test/a/c/d/c/../c", - "test/a/symlink/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/../c" - ], - "test/a/{b,c,d,e,f}/**/g": [], - "test/a/b/**": [ - "test/a/b", - "test/a/b/c", - "test/a/b/c/d" - ], - "test/**/g": [ - "test/a/abcdef/g", - "test/a/abcfed/g" - ], - "test/a/abc{fed,def}/g/h": [ - "test/a/abcdef/g/h", - "test/a/abcfed/g/h" - ], - "test/a/abc{fed/g,def}/**/": [ - "test/a/abcdef", - "test/a/abcdef/g", - "test/a/abcfed/g" - ], - "test/a/abc{fed/g,def}/**///**/": [ - "test/a/abcdef", - "test/a/abcdef/g", - "test/a/abcfed/g" - ], - "test/**/a/**/": [ - "test/a", - "test/a/abcdef", - "test/a/abcdef/g", - "test/a/abcfed", - "test/a/abcfed/g", - "test/a/b", - "test/a/b/c", - "test/a/bc", - "test/a/bc/e", - "test/a/c", - "test/a/c/d", - "test/a/c/d/c", - "test/a/cb", - "test/a/cb/e", - "test/a/symlink", - "test/a/symlink/a", - "test/a/symlink/a/b", - "test/a/symlink/a/b/c", - "test/a/symlink/a/b/c/a", - "test/a/symlink/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b" - ], - "test/+(a|b|c)/a{/,bc*}/**": [ - "test/a/abcdef", - "test/a/abcdef/g", - "test/a/abcdef/g/h", - "test/a/abcfed", - "test/a/abcfed/g", - "test/a/abcfed/g/h" - ], - "test/*/*/*/f": [ - "test/a/bc/e/f", - "test/a/cb/e/f" - ], - "test/**/f": [ - "test/a/bc/e/f", - "test/a/cb/e/f" - ], - "test/a/symlink/a/b/c/a/b/c/a/b/c//a/b/c////a/b/c/**/b/c/**": [ - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b", - "test/a/symlink/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c/a/b/c" - ], - "{./*/*,/tmp/glob-test/*}": [ - "./examples/g.js", - "./examples/usr-local.js", - "./node_modules/graceful-fs", - "./node_modules/inherits", - "./node_modules/minimatch", - "./node_modules/mkdirp", - "./node_modules/once", - "./node_modules/rimraf", - "./node_modules/tap", - "./test/00-setup.js", - "./test/a", - "./test/bash-comparison.js", - "./test/bash-results.json", - "./test/cwd-test.js", - "./test/empty-set.js", - "./test/error-callback.js", - "./test/globstar-match.js", - "./test/mark.js", - "./test/negation-test.js", - "./test/new-glob-optional-options.js", - "./test/nocase-nomagic.js", - "./test/pause-resume.js", - "./test/readme-issue.js", - "./test/root-nomount.js", - "./test/root.js", - "./test/stat.js", - "./test/zz-cleanup.js", - "/tmp/glob-test/asdf", - "/tmp/glob-test/bar", - "/tmp/glob-test/baz", - "/tmp/glob-test/foo", - "/tmp/glob-test/quux", - "/tmp/glob-test/qwer", - "/tmp/glob-test/rewq" - ], - "{/tmp/glob-test/*,*}": [ - "/tmp/glob-test/asdf", - "/tmp/glob-test/bar", - "/tmp/glob-test/baz", - "/tmp/glob-test/foo", - "/tmp/glob-test/quux", - "/tmp/glob-test/qwer", - "/tmp/glob-test/rewq", - "examples", - "glob.js", - "LICENSE", - "node_modules", - "package.json", - "README.md", - "test" - ], - "test/a/!(symlink)/**": [ - "test/a/abcdef", - "test/a/abcdef/g", - "test/a/abcdef/g/h", - "test/a/abcfed", - "test/a/abcfed/g", - "test/a/abcfed/g/h", - "test/a/b", - "test/a/b/c", - "test/a/b/c/d", - "test/a/bc", - "test/a/bc/e", - "test/a/bc/e/f", - "test/a/c", - "test/a/c/d", - "test/a/c/d/c", - "test/a/c/d/c/b", - "test/a/cb", - "test/a/cb/e", - "test/a/cb/e/f" - ] -} diff --git a/deps/npm/node_modules/glob/test/cwd-test.js b/deps/npm/node_modules/glob/test/cwd-test.js deleted file mode 100644 index 352c27efadd..00000000000 --- a/deps/npm/node_modules/glob/test/cwd-test.js +++ /dev/null @@ -1,55 +0,0 @@ -var tap = require("tap") - -var origCwd = process.cwd() -process.chdir(__dirname) - -tap.test("changing cwd and searching for **/d", function (t) { - var glob = require('../') - var path = require('path') - t.test('.', function (t) { - glob('**/d', function (er, matches) { - t.ifError(er) - t.like(matches, [ 'a/b/c/d', 'a/c/d' ]) - t.end() - }) - }) - - t.test('a', function (t) { - glob('**/d', {cwd:path.resolve('a')}, function (er, matches) { - t.ifError(er) - t.like(matches, [ 'b/c/d', 'c/d' ]) - t.end() - }) - }) - - t.test('a/b', function (t) { - glob('**/d', {cwd:path.resolve('a/b')}, function (er, matches) { - t.ifError(er) - t.like(matches, [ 'c/d' ]) - t.end() - }) - }) - - t.test('a/b/', function (t) { - glob('**/d', {cwd:path.resolve('a/b/')}, function (er, matches) { - t.ifError(er) - t.like(matches, [ 'c/d' ]) - t.end() - }) - }) - - t.test('.', function (t) { - glob('**/d', {cwd: process.cwd()}, function (er, matches) { - t.ifError(er) - t.like(matches, [ 'a/b/c/d', 'a/c/d' ]) - t.end() - }) - }) - - t.test('cd -', function (t) { - process.chdir(origCwd) - t.end() - }) - - t.end() -}) diff --git a/deps/npm/node_modules/glob/test/empty-set.js b/deps/npm/node_modules/glob/test/empty-set.js deleted file mode 100644 index 3b627b0ab8a..00000000000 --- a/deps/npm/node_modules/glob/test/empty-set.js +++ /dev/null @@ -1,20 +0,0 @@ -var test = require('tap').test -var glob = require("../glob.js") - -// Patterns that cannot match anything -var patterns = [ - '# comment', - ' ', - '\n', - 'just doesnt happen to match anything so this is a control' -] - -patterns.forEach(function (p) { - test(JSON.stringify(p), function (t) { - glob(p, function (e, f) { - t.equal(e, null, 'no error') - t.same(f, [], 'no returned values') - t.end() - }) - }) -}) diff --git a/deps/npm/node_modules/glob/test/error-callback.js b/deps/npm/node_modules/glob/test/error-callback.js deleted file mode 100644 index 60d3ba1b5fd..00000000000 --- a/deps/npm/node_modules/glob/test/error-callback.js +++ /dev/null @@ -1,21 +0,0 @@ -var fs -try { fs = require('graceful-fs') } catch (e) { fs = require('fs') } -var test = require('tap').test -var glob = require('../') - -test('mock fs', function(t) { - fs.readdir = function(path, cb) { - process.nextTick(function() { - cb(new Error('mock fs.readdir error')) - }) - } - t.pass('mocked') - t.end() -}) - -test('error callback', function(t) { - glob('*', function(err, res) { - t.ok(err, 'expecting mock error') - t.end() - }) -}) diff --git a/deps/npm/node_modules/glob/test/globstar-match.js b/deps/npm/node_modules/glob/test/globstar-match.js deleted file mode 100644 index 9b234fa2a88..00000000000 --- a/deps/npm/node_modules/glob/test/globstar-match.js +++ /dev/null @@ -1,19 +0,0 @@ -var Glob = require("../glob.js").Glob -var test = require('tap').test - -test('globstar should not have dupe matches', function(t) { - var pattern = 'a/**/[gh]' - var g = new Glob(pattern, { cwd: __dirname }) - var matches = [] - g.on('match', function(m) { - console.error('match %j', m) - matches.push(m) - }) - g.on('end', function(set) { - console.error('set', set) - matches = matches.sort() - set = set.sort() - t.same(matches, set, 'should have same set of matches') - t.end() - }) -}) diff --git a/deps/npm/node_modules/glob/test/mark.js b/deps/npm/node_modules/glob/test/mark.js deleted file mode 100644 index bf411c0e550..00000000000 --- a/deps/npm/node_modules/glob/test/mark.js +++ /dev/null @@ -1,118 +0,0 @@ -var test = require("tap").test -var glob = require('../') -process.chdir(__dirname) - -// expose timing issues -var lag = 5 -glob.Glob.prototype._stat = function(o) { return function(f, cb) { - var args = arguments - setTimeout(function() { - o.call(this, f, cb) - }.bind(this), lag += 5) -}}(glob.Glob.prototype._stat) - - -test("mark, with **", function (t) { - glob("a/*b*/**", {mark: true}, function (er, results) { - if (er) - throw er - var expect = - [ 'a/abcdef/', - 'a/abcdef/g/', - 'a/abcdef/g/h', - 'a/abcfed/', - 'a/abcfed/g/', - 'a/abcfed/g/h', - 'a/b/', - 'a/b/c/', - 'a/b/c/d', - 'a/bc/', - 'a/bc/e/', - 'a/bc/e/f', - 'a/cb/', - 'a/cb/e/', - 'a/cb/e/f' ] - - t.same(results, expect) - t.end() - }) -}) - -test("mark, no / on pattern", function (t) { - glob("a/*", {mark: true}, function (er, results) { - if (er) - throw er - var expect = [ 'a/abcdef/', - 'a/abcfed/', - 'a/b/', - 'a/bc/', - 'a/c/', - 'a/cb/' ] - - if (process.platform !== "win32") - expect.push('a/symlink/') - - t.same(results, expect) - t.end() - }).on('match', function(m) { - t.similar(m, /\/$/) - }) -}) - -test("mark=false, no / on pattern", function (t) { - glob("a/*", function (er, results) { - if (er) - throw er - var expect = [ 'a/abcdef', - 'a/abcfed', - 'a/b', - 'a/bc', - 'a/c', - 'a/cb' ] - - if (process.platform !== "win32") - expect.push('a/symlink') - t.same(results, expect) - t.end() - }).on('match', function(m) { - t.similar(m, /[^\/]$/) - }) -}) - -test("mark=true, / on pattern", function (t) { - glob("a/*/", {mark: true}, function (er, results) { - if (er) - throw er - var expect = [ 'a/abcdef/', - 'a/abcfed/', - 'a/b/', - 'a/bc/', - 'a/c/', - 'a/cb/' ] - if (process.platform !== "win32") - expect.push('a/symlink/') - t.same(results, expect) - t.end() - }).on('match', function(m) { - t.similar(m, /\/$/) - }) -}) - -test("mark=false, / on pattern", function (t) { - glob("a/*/", function (er, results) { - if (er) - throw er - var expect = [ 'a/abcdef/', - 'a/abcfed/', - 'a/b/', - 'a/bc/', - 'a/c/', - 'a/cb/' ] - if (process.platform !== "win32") - expect.push('a/symlink/') - t.same(results, expect) - t.end() - }).on('match', function(m) { - t.similar(m, /\/$/) - }) -}) diff --git a/deps/npm/node_modules/glob/test/negation-test.js b/deps/npm/node_modules/glob/test/negation-test.js deleted file mode 100644 index fc679e2cf86..00000000000 --- a/deps/npm/node_modules/glob/test/negation-test.js +++ /dev/null @@ -1,16 +0,0 @@ -// Negation test -// Show that glob respect's minimatch's negate flag - -var glob = require('../glob.js') -var test = require('tap').test - -test('glob respects minimatch negate flag when activated with leading !', function(t) { - var expect = ["abcdef/g", "abcfed/g", "c/d", "cb/e", "symlink/a"] - var results = glob("!b**/*", {cwd: 'a'}, function (er, results) { - if (er) - throw er - - t.same(results, expect) - t.end() - }); -}); diff --git a/deps/npm/node_modules/glob/test/new-glob-optional-options.js b/deps/npm/node_modules/glob/test/new-glob-optional-options.js deleted file mode 100644 index 3e7dc5acbc5..00000000000 --- a/deps/npm/node_modules/glob/test/new-glob-optional-options.js +++ /dev/null @@ -1,10 +0,0 @@ -var Glob = require('../glob.js').Glob; -var test = require('tap').test; - -test('new glob, with cb, and no options', function (t) { - new Glob(__filename, function(er, results) { - if (er) throw er; - t.same(results, [__filename]); - t.end(); - }); -}); diff --git a/deps/npm/node_modules/glob/test/nocase-nomagic.js b/deps/npm/node_modules/glob/test/nocase-nomagic.js deleted file mode 100644 index 5a29b08591f..00000000000 --- a/deps/npm/node_modules/glob/test/nocase-nomagic.js +++ /dev/null @@ -1,125 +0,0 @@ -var fs -try { fs = require('graceful-fs') } catch (e) { fs = require('fs') } -var test = require('tap').test; -var glob = require('../'); - -test('mock fs', function(t) { - var stat = fs.stat - var statSync = fs.statSync - var readdir = fs.readdir - var readdirSync = fs.readdirSync - - function fakeStat(path) { - var ret - switch (path.toLowerCase()) { - case '/tmp': case '/tmp/': case 'c:\\tmp': case 'c:\\tmp\\': - ret = { isDirectory: function() { return true } } - break - case '/tmp/a': case 'c:\\tmp\\a': - ret = { isDirectory: function() { return false } } - break - } - return ret - } - - fs.stat = function(path, cb) { - var f = fakeStat(path); - if (f) { - process.nextTick(function() { - cb(null, f) - }) - } else { - stat.call(fs, path, cb) - } - } - - fs.statSync = function(path) { - return fakeStat(path) || statSync.call(fs, path) - } - - function fakeReaddir(path) { - var ret - switch (path.toLowerCase()) { - case '/tmp': case '/tmp/': case 'c:\\tmp': case 'c:\\tmp\\': - ret = [ 'a', 'A' ] - break - case '/': case 'c:\\': - ret = ['tmp', 'tMp', 'tMP', 'TMP'] - } - return ret - } - - fs.readdir = function(path, cb) { - var f = fakeReaddir(path) - if (f) - process.nextTick(function() { - cb(null, f) - }) - else - readdir.call(fs, path, cb) - } - - fs.readdirSync = function(path) { - return fakeReaddir(path) || readdirSync.call(fs, path) - } - - t.pass('mocked') - t.end() -}) - -test('nocase, nomagic', function(t) { - var n = 2 - var want = [ '/TMP/A', - '/TMP/a', - '/tMP/A', - '/tMP/a', - '/tMp/A', - '/tMp/a', - '/tmp/A', - '/tmp/a' ] - if(process.platform.match(/^win/)) { - want = want.map(function(p) { - return 'C:' + p - }) - } - glob('/tmp/a', { nocase: true }, function(er, res) { - if (er) - throw er - t.same(res.sort(), want) - if (--n === 0) t.end() - }) - glob('/tmp/A', { nocase: true }, function(er, res) { - if (er) - throw er - t.same(res.sort(), want) - if (--n === 0) t.end() - }) -}) - -test('nocase, with some magic', function(t) { - t.plan(2) - var want = [ '/TMP/A', - '/TMP/a', - '/tMP/A', - '/tMP/a', - '/tMp/A', - '/tMp/a', - '/tmp/A', - '/tmp/a' ] - if(process.platform.match(/^win/)) { - want = want.map(function(p) { - return 'C:' + p - }) - } - - glob('/tmp/*', { nocase: true }, function(er, res) { - if (er) - throw er - t.same(res.sort(), want) - }) - glob('/tmp/*', { nocase: true }, function(er, res) { - if (er) - throw er - t.same(res.sort(), want) - }) -}) diff --git a/deps/npm/node_modules/glob/test/pause-resume.js b/deps/npm/node_modules/glob/test/pause-resume.js deleted file mode 100644 index e1ffbab1c5b..00000000000 --- a/deps/npm/node_modules/glob/test/pause-resume.js +++ /dev/null @@ -1,73 +0,0 @@ -// show that no match events happen while paused. -var tap = require("tap") -, child_process = require("child_process") -// just some gnarly pattern with lots of matches -, pattern = "test/a/!(symlink)/**" -, bashResults = require("./bash-results.json") -, patterns = Object.keys(bashResults) -, glob = require("../") -, Glob = glob.Glob -, path = require("path") - -// run from the root of the project -// this is usually where you're at anyway, but be sure. -process.chdir(path.resolve(__dirname, "..")) - -function alphasort (a, b) { - a = a.toLowerCase() - b = b.toLowerCase() - return a > b ? 1 : a < b ? -1 : 0 -} - -function cleanResults (m) { - // normalize discrepancies in ordering, duplication, - // and ending slashes. - return m.map(function (m) { - return m.replace(/\/+/g, "/").replace(/\/$/, "") - }).sort(alphasort).reduce(function (set, f) { - if (f !== set[set.length - 1]) set.push(f) - return set - }, []).sort(alphasort).map(function (f) { - // de-windows - return (process.platform !== 'win32') ? f - : f.replace(/^[a-zA-Z]:\\\\/, '/').replace(/\\/g, '/') - }) -} - -var globResults = [] -tap.test("use a Glob object, and pause/resume it", function (t) { - var g = new Glob(pattern) - , paused = false - , res = [] - , expect = bashResults[pattern] - - g.on("pause", function () { - console.error("pause") - }) - - g.on("resume", function () { - console.error("resume") - }) - - g.on("match", function (m) { - t.notOk(g.paused, "must not be paused") - globResults.push(m) - g.pause() - t.ok(g.paused, "must be paused") - setTimeout(g.resume.bind(g), 10) - }) - - g.on("end", function (matches) { - t.pass("reached glob end") - globResults = cleanResults(globResults) - matches = cleanResults(matches) - t.deepEqual(matches, globResults, - "end event matches should be the same as match events") - - t.deepEqual(matches, expect, - "glob matches should be the same as bash results") - - t.end() - }) -}) - diff --git a/deps/npm/node_modules/glob/test/readme-issue.js b/deps/npm/node_modules/glob/test/readme-issue.js deleted file mode 100644 index 0b4e0be2900..00000000000 --- a/deps/npm/node_modules/glob/test/readme-issue.js +++ /dev/null @@ -1,36 +0,0 @@ -var test = require("tap").test -var glob = require("../") - -var mkdirp = require("mkdirp") -var fs = require("fs") -var rimraf = require("rimraf") -var dir = __dirname + "/package" - -test("setup", function (t) { - mkdirp.sync(dir) - fs.writeFileSync(dir + "/package.json", "{}", "ascii") - fs.writeFileSync(dir + "/README", "x", "ascii") - t.pass("setup done") - t.end() -}) - -test("glob", function (t) { - var opt = { - cwd: dir, - nocase: true, - mark: true - } - - glob("README?(.*)", opt, function (er, files) { - if (er) - throw er - t.same(files, ["README"]) - t.end() - }) -}) - -test("cleanup", function (t) { - rimraf.sync(dir) - t.pass("clean") - t.end() -}) diff --git a/deps/npm/node_modules/glob/test/root-nomount.js b/deps/npm/node_modules/glob/test/root-nomount.js deleted file mode 100644 index 3ac5979b050..00000000000 --- a/deps/npm/node_modules/glob/test/root-nomount.js +++ /dev/null @@ -1,39 +0,0 @@ -var tap = require("tap") - -var origCwd = process.cwd() -process.chdir(__dirname) - -tap.test("changing root and searching for /b*/**", function (t) { - var glob = require('../') - var path = require('path') - t.test('.', function (t) { - glob('/b*/**', { globDebug: true, root: '.', nomount: true }, function (er, matches) { - t.ifError(er) - t.like(matches, []) - t.end() - }) - }) - - t.test('a', function (t) { - glob('/b*/**', { globDebug: true, root: path.resolve('a'), nomount: true }, function (er, matches) { - t.ifError(er) - t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ]) - t.end() - }) - }) - - t.test('root=a, cwd=a/b', function (t) { - glob('/b*/**', { globDebug: true, root: 'a', cwd: path.resolve('a/b'), nomount: true }, function (er, matches) { - t.ifError(er) - t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ]) - t.end() - }) - }) - - t.test('cd -', function (t) { - process.chdir(origCwd) - t.end() - }) - - t.end() -}) diff --git a/deps/npm/node_modules/glob/test/root.js b/deps/npm/node_modules/glob/test/root.js deleted file mode 100644 index 95c23f99cab..00000000000 --- a/deps/npm/node_modules/glob/test/root.js +++ /dev/null @@ -1,46 +0,0 @@ -var t = require("tap") - -var origCwd = process.cwd() -process.chdir(__dirname) - -var glob = require('../') -var path = require('path') - -t.test('.', function (t) { - glob('/b*/**', { globDebug: true, root: '.' }, function (er, matches) { - t.ifError(er) - t.like(matches, []) - t.end() - }) -}) - - -t.test('a', function (t) { - console.error("root=" + path.resolve('a')) - glob('/b*/**', { globDebug: true, root: path.resolve('a') }, function (er, matches) { - t.ifError(er) - var wanted = [ - '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' - ].map(function (m) { - return path.join(path.resolve('a'), m).replace(/\\/g, '/') - }) - - t.like(matches, wanted) - t.end() - }) -}) - -t.test('root=a, cwd=a/b', function (t) { - glob('/b*/**', { globDebug: true, root: 'a', cwd: path.resolve('a/b') }, function (er, matches) { - t.ifError(er) - t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ].map(function (m) { - return path.join(path.resolve('a'), m).replace(/\\/g, '/') - })) - t.end() - }) -}) - -t.test('cd -', function (t) { - process.chdir(origCwd) - t.end() -}) diff --git a/deps/npm/node_modules/glob/test/stat.js b/deps/npm/node_modules/glob/test/stat.js deleted file mode 100644 index f555b39b167..00000000000 --- a/deps/npm/node_modules/glob/test/stat.js +++ /dev/null @@ -1,32 +0,0 @@ -var glob = require('../') -var test = require('tap').test -var path = require('path') - -test('stat all the things', function(t) { - var g = new glob.Glob('a/*abc*/**', { stat: true, cwd: __dirname }) - var matches = [] - g.on('match', function(m) { - matches.push(m) - }) - var stats = [] - g.on('stat', function(m) { - stats.push(m) - }) - g.on('end', function(eof) { - stats = stats.sort() - matches = matches.sort() - eof = eof.sort() - t.same(stats, matches) - t.same(eof, matches) - var cache = Object.keys(this.statCache) - t.same(cache.map(function (f) { - return path.relative(__dirname, f).replace(/\\/g, '/') - }).sort(), matches) - - cache.forEach(function(c) { - t.equal(typeof this.statCache[c], 'object') - }, this) - - t.end() - }) -}) diff --git a/deps/npm/node_modules/glob/test/zz-cleanup.js b/deps/npm/node_modules/glob/test/zz-cleanup.js deleted file mode 100644 index e085f0fa77e..00000000000 --- a/deps/npm/node_modules/glob/test/zz-cleanup.js +++ /dev/null @@ -1,11 +0,0 @@ -// remove the fixtures -var tap = require("tap") -, rimraf = require("rimraf") -, path = require("path") - -tap.test("cleanup fixtures", function (t) { - rimraf(path.resolve(__dirname, "a"), function (er) { - t.ifError(er, "removed") - t.end() - }) -}) diff --git a/deps/npm/node_modules/graceful-fs/LICENSE b/deps/npm/node_modules/graceful-fs/LICENSE index 0c44ae716db..19129e315fe 100644 --- a/deps/npm/node_modules/graceful-fs/LICENSE +++ b/deps/npm/node_modules/graceful-fs/LICENSE @@ -1,27 +1,15 @@ -Copyright (c) Isaac Z. Schlueter ("Author") -All rights reserved. +The ISC License -The BSD License +Copyright (c) Isaac Z. Schlueter and Contributors -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/graceful-fs/fs.js b/deps/npm/node_modules/graceful-fs/fs.js index ae9fd6f61e3..64ad980232e 100644 --- a/deps/npm/node_modules/graceful-fs/fs.js +++ b/deps/npm/node_modules/graceful-fs/fs.js @@ -8,4 +8,4 @@ var post = '});' var src = pre + process.binding('natives').fs + post var vm = require('vm') var fn = vm.runInThisContext(src) -return fn(exports, require, module, __filename, __dirname) +fn(exports, require, module, __filename, __dirname) diff --git a/deps/npm/node_modules/graceful-fs/graceful-fs.js b/deps/npm/node_modules/graceful-fs/graceful-fs.js index 77fc702d802..fb206b83854 100644 --- a/deps/npm/node_modules/graceful-fs/graceful-fs.js +++ b/deps/npm/node_modules/graceful-fs/graceful-fs.js @@ -128,7 +128,7 @@ Req.prototype.done = function (er, result) { var tryAgain = false if (er) { var code = er.code - var tryAgain = code === "EMFILE" + var tryAgain = code === "EMFILE" || code === "ENFILE" if (process.platform === "win32") tryAgain = tryAgain || code === "OK" } diff --git a/deps/npm/node_modules/graceful-fs/package.json b/deps/npm/node_modules/graceful-fs/package.json index 57ce64885ac..c4a98d3264a 100644 --- a/deps/npm/node_modules/graceful-fs/package.json +++ b/deps/npm/node_modules/graceful-fs/package.json @@ -6,7 +6,7 @@ }, "name": "graceful-fs", "description": "A drop-in replacement for fs, making various improvements.", - "version": "3.0.4", + "version": "3.0.8", "repository": { "type": "git", "url": "git://github.com/isaacs/node-graceful-fs.git" @@ -37,24 +37,29 @@ "EPERM", "EACCESS" ], - "license": "BSD", + "license": "ISC", "devDependencies": { "mkdirp": "^0.5.0", "rimraf": "^2.2.8", - "tap": "^0.4.13" + "tap": "^1.2.0" }, - "gitHead": "d3fd03247ccc4fa8a3eee399307fd266c70efb06", + "gitHead": "45c57aa5e323c35a985a525de6f0c9a6ef59e1f8", "bugs": { "url": "https://github.com/isaacs/node-graceful-fs/issues" }, - "homepage": "https://github.com/isaacs/node-graceful-fs", - "_id": "graceful-fs@3.0.4", - "_shasum": "a0306d9b0940e0fc512d33b5df1014e88e0637a3", - "_from": "graceful-fs@>=3.0.4 <4.0.0", - "_npmVersion": "1.4.28", + "homepage": "https://github.com/isaacs/node-graceful-fs#readme", + "_id": "graceful-fs@3.0.8", + "_shasum": "ce813e725fa82f7e6147d51c9a5ca68270551c22", + "_from": "graceful-fs@>=3.0.8 <3.1.0", + "_npmVersion": "2.10.1", + "_nodeVersion": "2.0.1", "_npmUser": { "name": "isaacs", - "email": "i@izs.me" + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "ce813e725fa82f7e6147d51c9a5ca68270551c22", + "tarball": "http://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.8.tgz" }, "maintainers": [ { @@ -62,10 +67,5 @@ "email": "i@izs.me" } ], - "dist": { - "shasum": "a0306d9b0940e0fc512d33b5df1014e88e0637a3", - "tarball": "http://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.4.tgz" - }, - "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.4.tgz", - "readme": "ERROR: No README data found!" + "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.8.tgz" } diff --git a/deps/npm/node_modules/graceful-fs/polyfills.js b/deps/npm/node_modules/graceful-fs/polyfills.js index 9d62af58617..42705391aa9 100644 --- a/deps/npm/node_modules/graceful-fs/polyfills.js +++ b/deps/npm/node_modules/graceful-fs/polyfills.js @@ -214,7 +214,7 @@ if (process.platform === "win32") { && Date.now() - start < 1000) { return rename_(from, to, CB) } - cb(er) + if(cb) cb(er) }) } } diff --git a/deps/npm/node_modules/graceful-fs/test/max-open.js b/deps/npm/node_modules/graceful-fs/test/max-open.js index 44d52679b9b..a6b9ba43d3a 100644 --- a/deps/npm/node_modules/graceful-fs/test/max-open.js +++ b/deps/npm/node_modules/graceful-fs/test/max-open.js @@ -40,13 +40,13 @@ test('open lots of stuff', function (t) { doneCalled++ if (fds.length === 0) { - //console.error('done called %d times', doneCalled) + console.error('done called %d times', doneCalled) // First because of the timeout // Then to close the fd's opened afterwards // Then this time, to complete. // Might take multiple passes, depending on CPU speed // and ulimit, but at least 3 in every case. - t.ok(doneCalled >= 3) + t.ok(doneCalled >= 2) return t.end() } diff --git a/deps/npm/node_modules/graceful-fs/test/write-then-read.js b/deps/npm/node_modules/graceful-fs/test/write-then-read.js index 3a3db54b0c8..21e4c26bf6c 100644 --- a/deps/npm/node_modules/graceful-fs/test/write-then-read.js +++ b/deps/npm/node_modules/graceful-fs/test/write-then-read.js @@ -4,6 +4,8 @@ var mkdirp = require('mkdirp'); var test = require('tap').test; var p = require('path').resolve(__dirname, 'files'); +process.chdir(__dirname) + // Make sure to reserve the stderr fd process.stderr.write(''); diff --git a/deps/npm/node_modules/hosted-git-info/.npmignore b/deps/npm/node_modules/hosted-git-info/.npmignore new file mode 100644 index 00000000000..58e97a78753 --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/.npmignore @@ -0,0 +1,3 @@ +*~ +.# +node_modules diff --git a/deps/npm/node_modules/hosted-git-info/.travis.yml b/deps/npm/node_modules/hosted-git-info/.travis.yml new file mode 100644 index 00000000000..7dc6619174e --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - "0.11" + - "0.10" +script: "npm test" diff --git a/deps/npm/node_modules/hosted-git-info/LICENSE b/deps/npm/node_modules/hosted-git-info/LICENSE new file mode 100644 index 00000000000..45055763dc8 --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2015, Rebecca Turner + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/hosted-git-info/README.md b/deps/npm/node_modules/hosted-git-info/README.md new file mode 100644 index 00000000000..1db47dd656d --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/README.md @@ -0,0 +1,99 @@ +# hosted-git-info + +This will let you identify and transform various git hosts URLs between +protocols. It also can tell you what the URL is for the raw path for +particular file for direct access without git. + +## Usage + +```javascript +var hostedGitInfo = require("hosted-git-info") +var info = hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git") +/* info looks like: +{ + type: "github", + domain: "github.com", + user: "npm", + project: "hosted-git-info" +} +*/ +``` + +If the URL can't be matched with a git host, `null` will be returned. We +can match git, ssh and https urls. Additionally, we can match ssh connect +strings (`git@github.com:npm/hosted-git-info`) and shortcuts (eg, +`github:npm/hosted-git-info`). Github specifically, is detected in the case +of a third, unprefixed, form: `npm/hosted-git-info`. + +If it does match, the returned object has properties of: + +* info.type -- The short name of the service +* info.domain -- The domain for git protocol use +* info.user -- The name of the user/org on the git host +* info.project -- The name of the project on the git host + +And methods of: + +* info.file(path) + +Given the path of a file relative to the repository, returns a URL for +directly fetching it from the githost. If no committish was set then +`master` will be used as the default. + +For example `hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git#v1.0.0").file("package.json")` +would return `https://raw.githubusercontent.com/npm/hosted-git-info/v1.0.0/package.json` + +* info.shortcut() + +eg, `github:npm/hosted-git-info` + +* info.browse() + +eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0` + +* info.bugs() + +eg, `https://github.com/npm/hosted-git-info/issues` + +* info.docs() + +eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0#readme` + +* info.https() + +eg, `git+https://github.com/npm/hosted-git-info.git` + +* info.sshurl() + +eg, `git+ssh://git@github.com/npm/hosted-git-info.git` + +* info.ssh() + +eg, `git@github.com:npm/hosted-git-info.git` + +* info.path() + +eg, `npm/hosted-git-info` + +* info.getDefaultRepresentation() + +Returns the default output type. The default output type is based on the +string you passed in to be parsed + +* info.toString() + +Uses the getDefaultRepresentation to call one of the other methods to get a URL for +this resource. As such `hostedGitInfo.fromUrl(url).toString()` will give +you a normalized version of the URL that still uses the same protocol. + +Shortcuts will still be returned as shortcuts, but the special case github +form of `org/project` will be normalized to `github:org/project`. + +SSH connect strings will be normalized into `git+ssh` URLs. + + +## Supported hosts + +Currently this supports Github, Bitbucket and Gitlab. Pull requests for +additional hosts welcome. + diff --git a/deps/npm/node_modules/hosted-git-info/git-host-info.js b/deps/npm/node_modules/hosted-git-info/git-host-info.js new file mode 100644 index 00000000000..22343335ee5 --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/git-host-info.js @@ -0,0 +1,64 @@ +'use strict' + +var gitHosts = module.exports = { + github: { + // First two are insecure and generally shouldn't be used any more, but + // they are still supported. + 'protocols': [ 'git', 'http', 'git+ssh', 'git+https', 'ssh', 'https' ], + 'domain': 'github.com', + 'treepath': 'tree', + 'filetemplate': 'https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}', + 'bugstemplate': 'https://{domain}/{user}/{project}/issues', + 'gittemplate': 'git://{auth@}{domain}/{user}/{project}.git{#committish}' + }, + bitbucket: { + 'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ], + 'domain': 'bitbucket.org', + 'treepath': 'src' + }, + gitlab: { + 'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ], + 'domain': 'gitlab.com', + 'treepath': 'tree', + 'docstemplate': 'https://{domain}/{user}/{project}{/tree/committish}#README', + 'bugstemplate': 'https://{domain}/{user}/{project}/issues' + }, + gist: { + 'protocols': [ 'git', 'git+ssh', 'git+https', 'ssh', 'https' ], + 'domain': 'gist.github.com', + 'pathmatch': /^[/](?:([^/]+)[/])?([a-z0-9]+)(?:[.]git)?$/, + 'filetemplate': 'https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}', + 'bugstemplate': 'https://{domain}/{project}', + 'gittemplate': 'git://{domain}/{project}.git{#committish}', + 'sshtemplate': 'git@{domain}:/{project}.git{#committish}', + 'sshurltemplate': 'git+ssh://git@{domain}/{project}.git{#committish}', + 'browsetemplate': 'https://{domain}/{project}{/committish}', + 'docstemplate': 'https://{domain}/{project}{/committish}', + 'httpstemplate': 'git+https://{domain}/{project}.git{#committish}', + 'shortcuttemplate': '{type}:{project}{#committish}', + 'pathtemplate': '{project}{#committish}' + } +} + +var gitHostDefaults = { + 'sshtemplate': 'git@{domain}:{user}/{project}.git{#committish}', + 'sshurltemplate': 'git+ssh://git@{domain}/{user}/{project}.git{#committish}', + 'browsetemplate': 'https://{domain}/{user}/{project}{/tree/committish}', + 'docstemplate': 'https://{domain}/{user}/{project}{/tree/committish}#readme', + 'httpstemplate': 'git+https://{auth@}{domain}/{user}/{project}.git{#committish}', + 'filetemplate': 'https://{domain}/{user}/{project}/raw/{committish}/{path}', + 'shortcuttemplate': '{type}:{user}/{project}{#committish}', + 'pathtemplate': '{user}/{project}{#committish}', + 'pathmatch': /^[/]([^/]+)[/]([^/]+?)(?:[.]git)?$/ +} + +Object.keys(gitHosts).forEach(function (name) { + Object.keys(gitHostDefaults).forEach(function (key) { + if (gitHosts[name][key]) return + gitHosts[name][key] = gitHostDefaults[key] + }) + gitHosts[name].protocols_re = RegExp('^(' + + gitHosts[name].protocols.map(function (protocol) { + return protocol.replace(/([\\+*{}()\[\]$^|])/g, '\\$1') + }).join('|') + '):$') +}) diff --git a/deps/npm/node_modules/hosted-git-info/git-host.js b/deps/npm/node_modules/hosted-git-info/git-host.js new file mode 100644 index 00000000000..ea31380a4e4 --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/git-host.js @@ -0,0 +1,96 @@ +'use strict' +var gitHosts = require('./git-host-info.js') + +var GitHost = module.exports = function (type, user, auth, project, committish, defaultRepresentation) { + var gitHostInfo = this + gitHostInfo.type = type + Object.keys(gitHosts[type]).forEach(function (key) { + gitHostInfo[key] = gitHosts[type][key] + }) + gitHostInfo.user = user + gitHostInfo.auth = auth + gitHostInfo.project = project + gitHostInfo.committish = committish + gitHostInfo.default = defaultRepresentation +} +GitHost.prototype = {} + +GitHost.prototype.hash = function () { + return this.committish ? '#' + this.committish : '' +} + +GitHost.prototype._fill = function (template, vars) { + if (!template) return + if (!vars) vars = {} + var self = this + Object.keys(this).forEach(function (key) { + if (self[key] != null && vars[key] == null) vars[key] = self[key] + }) + var rawAuth = vars.auth + var rawComittish = vars.committish + Object.keys(vars).forEach(function (key) { + vars[key] = encodeURIComponent(vars[key]) + }) + vars['auth@'] = rawAuth ? rawAuth + '@' : '' + vars['#committish'] = rawComittish ? '#' + rawComittish : '' + vars['/tree/committish'] = vars.committish + ? '/' + vars.treepath + '/' + vars.committish + : '' + vars['/committish'] = vars.committish ? '/' + vars.committish : '' + vars.committish = vars.committish || 'master' + var res = template + Object.keys(vars).forEach(function (key) { + res = res.replace(new RegExp('[{]' + key + '[}]', 'g'), vars[key]) + }) + return res +} + +GitHost.prototype.ssh = function () { + return this._fill(this.sshtemplate) +} + +GitHost.prototype.sshurl = function () { + return this._fill(this.sshurltemplate) +} + +GitHost.prototype.browse = function () { + return this._fill(this.browsetemplate) +} + +GitHost.prototype.docs = function () { + return this._fill(this.docstemplate) +} + +GitHost.prototype.bugs = function () { + return this._fill(this.bugstemplate) +} + +GitHost.prototype.https = function () { + return this._fill(this.httpstemplate) +} + +GitHost.prototype.git = function () { + return this._fill(this.gittemplate) +} + +GitHost.prototype.shortcut = function () { + return this._fill(this.shortcuttemplate) +} + +GitHost.prototype.path = function () { + return this._fill(this.pathtemplate) +} + +GitHost.prototype.file = function (P) { + return this._fill(this.filetemplate, { + path: P.replace(/^[/]+/g, '') + }) +} + +GitHost.prototype.getDefaultRepresentation = function () { + return this.default +} + +GitHost.prototype.toString = function () { + return (this[this.default] || this.sshurl).call(this) +} diff --git a/deps/npm/node_modules/hosted-git-info/index.js b/deps/npm/node_modules/hosted-git-info/index.js new file mode 100644 index 00000000000..453ce87d38b --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/index.js @@ -0,0 +1,103 @@ +'use strict' +var url = require('url') +var gitHosts = require('./git-host-info.js') +var GitHost = module.exports = require('./git-host.js') + +var protocolToRepresentationMap = { + 'git+ssh': 'sshurl', + 'git+https': 'https', + 'ssh': 'sshurl', + 'git': 'git' +} + +function protocolToRepresentation (protocol) { + if (protocol.substr(-1) === ':') protocol = protocol.slice(0, -1) + return protocolToRepresentationMap[protocol] || protocol +} + +var authProtocols = { + 'git:': true, + 'https:': true, + 'git+https:': true, + 'http:': true, + 'git+http:': true +} + +module.exports.fromUrl = function (giturl) { + if (giturl == null || giturl === '') return + var url = fixupUnqualifiedGist( + isGitHubShorthand(giturl) ? 'github:' + giturl : giturl + ) + var parsed = parseGitUrl(url) + var matches = Object.keys(gitHosts).map(function (gitHostName) { + var gitHostInfo = gitHosts[gitHostName] + var auth = null + if (parsed.auth && authProtocols[parsed.protocol]) { + auth = decodeURIComponent(parsed.auth) + } + var committish = parsed.hash ? decodeURIComponent(parsed.hash.substr(1)) : null + var user = null + var project = null + var defaultRepresentation = null + if (parsed.protocol === gitHostName + ':') { + user = decodeURIComponent(parsed.host) + project = parsed.path && decodeURIComponent(parsed.path.replace(/^[/](.*?)(?:[.]git)?$/, '$1')) + defaultRepresentation = 'shortcut' + } else { + if (parsed.host !== gitHostInfo.domain) return + if (!gitHostInfo.protocols_re.test(parsed.protocol)) return + var pathmatch = gitHostInfo.pathmatch + var matched = parsed.path.match(pathmatch) + if (!matched) return + if (matched[1] != null) user = decodeURIComponent(matched[1]) + if (matched[2] != null) project = decodeURIComponent(matched[2]) + defaultRepresentation = protocolToRepresentation(parsed.protocol) + } + return new GitHost(gitHostName, user, auth, project, committish, defaultRepresentation) + }).filter(function (gitHostInfo) { return gitHostInfo }) + if (matches.length !== 1) return + return matches[0] +} + +function isGitHubShorthand (arg) { + // Note: This does not fully test the git ref format. + // See https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html + // + // The only way to do this properly would be to shell out to + // git-check-ref-format, and as this is a fast sync function, + // we don't want to do that. Just let git fail if it turns + // out that the commit-ish is invalid. + // GH usernames cannot start with . or - + return /^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(arg) +} + +function fixupUnqualifiedGist (giturl) { + // necessary for round-tripping gists + var parsed = url.parse(giturl) + if (parsed.protocol === 'gist:' && parsed.host && !parsed.path) { + return parsed.protocol + '/' + parsed.host + } else { + return giturl + } +} + +function parseGitUrl (giturl) { + if (typeof giturl !== 'string') giturl = '' + giturl + var matched = giturl.match(/^([^@]+)@([^:]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/) + if (!matched) return url.parse(giturl) + return { + protocol: 'git+ssh:', + slashes: true, + auth: matched[1], + host: matched[2], + port: null, + hostname: matched[2], + hash: matched[4], + search: null, + query: null, + pathname: '/' + matched[3], + path: '/' + matched[3], + href: 'git+ssh://' + matched[1] + '@' + matched[2] + + '/' + matched[3] + (matched[4] || '') + } +} diff --git a/deps/npm/node_modules/hosted-git-info/package.json b/deps/npm/node_modules/hosted-git-info/package.json new file mode 100644 index 00000000000..8d34aca2d72 --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/package.json @@ -0,0 +1,59 @@ +{ + "name": "hosted-git-info", + "version": "2.1.4", + "description": "Provides metadata and conversions from repository urls for Github, Bitbucket and Gitlab", + "main": "index.js", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/hosted-git-info.git" + }, + "keywords": [ + "git", + "github", + "bitbucket", + "gitlab" + ], + "author": { + "name": "Rebecca Turner", + "email": "me@re-becca.org", + "url": "http://re-becca.org" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/hosted-git-info/issues" + }, + "homepage": "https://github.com/npm/hosted-git-info", + "scripts": { + "test": "standard && tap test/*.js" + }, + "devDependencies": { + "standard": "^3.3.2", + "tap": "^0.4.13" + }, + "gitHead": "9e1a36df8eb050a663713c79e56d89dadba2bd8d", + "_id": "hosted-git-info@2.1.4", + "_shasum": "d9e953b26988be88096c46e926494d9604c300f8", + "_from": "hosted-git-info@>=2.1.2 <2.2.0", + "_npmVersion": "2.10.1", + "_nodeVersion": "2.0.2", + "_npmUser": { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + }, + "dist": { + "shasum": "d9e953b26988be88096c46e926494d9604c300f8", + "tarball": "http://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.1.4.tgz" + }, + "maintainers": [ + { + "name": "iarna", + "email": "me@re-becca.org" + }, + { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.1.4.tgz" +} diff --git a/deps/npm/node_modules/hosted-git-info/test/basic.js b/deps/npm/node_modules/hosted-git-info/test/basic.js new file mode 100644 index 00000000000..0b93f50e209 --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/test/basic.js @@ -0,0 +1,15 @@ +'use strict' +var HostedGit = require('../index') +var test = require('tap').test + +test('basic', function (t) { + t.is(HostedGit.fromUrl('https://google.com'), undefined, 'null on failure') + t.is(HostedGit.fromUrl('https://github.com/abc/def').getDefaultRepresentation(), 'https', 'match https urls') + t.is(HostedGit.fromUrl('ssh://git@github.com/abc/def').getDefaultRepresentation(), 'sshurl', 'match ssh urls') + t.is(HostedGit.fromUrl('git+ssh://git@github.com/abc/def').getDefaultRepresentation(), 'sshurl', 'match git+ssh urls') + t.is(HostedGit.fromUrl('git+https://github.com/abc/def').getDefaultRepresentation(), 'https', 'match git+https urls') + t.is(HostedGit.fromUrl('git@github.com:abc/def').getDefaultRepresentation(), 'sshurl', 'match ssh connect strings') + t.is(HostedGit.fromUrl('git://github.com/abc/def').getDefaultRepresentation(), 'git', 'match git urls') + t.is(HostedGit.fromUrl('github:abc/def').getDefaultRepresentation(), 'shortcut', 'match shortcuts') + t.end() +}) diff --git a/deps/npm/node_modules/hosted-git-info/test/bitbucket-https-with-embedded-auth.js b/deps/npm/node_modules/hosted-git-info/test/bitbucket-https-with-embedded-auth.js new file mode 100644 index 00000000000..a2feb2f0e18 --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/test/bitbucket-https-with-embedded-auth.js @@ -0,0 +1,27 @@ +'use strict' +var HostedGit = require('../index') +var test = require('tap').test + +test('Bitbucket HTTPS URLs with embedded auth', function (t) { + t.is( + HostedGit.fromUrl('https://user:pass@bitbucket.org/user/repo.git').toString(), + 'git+https://user:pass@bitbucket.org/user/repo.git', + 'credentials were included in URL' + ) + t.is( + HostedGit.fromUrl('https://user:pass@bitbucket.org/user/repo').toString(), + 'git+https://user:pass@bitbucket.org/user/repo.git', + 'credentials were included in URL' + ) + t.is( + HostedGit.fromUrl('git+https://user:pass@bitbucket.org/user/repo.git').toString(), + 'git+https://user:pass@bitbucket.org/user/repo.git', + 'credentials were included in URL' + ) + t.is( + HostedGit.fromUrl('git+https://user:pass@bitbucket.org/user/repo').toString(), + 'git+https://user:pass@bitbucket.org/user/repo.git', + 'credentials were included in URL' + ) + t.end() +}) diff --git a/deps/npm/node_modules/hosted-git-info/test/bitbucket.js b/deps/npm/node_modules/hosted-git-info/test/bitbucket.js new file mode 100644 index 00000000000..72e4ba113dd --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/test/bitbucket.js @@ -0,0 +1,23 @@ +'use strict' +var HostedGit = require('../index') +var test = require('tap').test + +test('fromUrl(bitbucket url)', function (t) { + function verify (host, label, branch) { + var hostinfo = HostedGit.fromUrl(host) + var hash = branch ? '#' + branch : '' + t.ok(hostinfo, label) + if (!hostinfo) return + t.is(hostinfo.https(), 'git+https://bitbucket.org/111/222.git' + hash, label + ' -> https') + t.is(hostinfo.browse(), 'https://bitbucket.org/111/222' + (branch ? '/src/' + branch : ''), label + ' -> browse') + t.is(hostinfo.docs(), 'https://bitbucket.org/111/222' + (branch ? '/src/' + branch : '') + '#readme', label + ' -> docs') + t.is(hostinfo.ssh(), 'git@bitbucket.org:111/222.git' + hash, label + ' -> ssh') + t.is(hostinfo.sshurl(), 'git+ssh://git@bitbucket.org/111/222.git' + hash, label + ' -> sshurl') + t.is(hostinfo.shortcut(), 'bitbucket:111/222' + hash, label + ' -> shortcut') + t.is(hostinfo.file('C'), 'https://bitbucket.org/111/222/raw/' + (branch || 'master') + '/C', label + ' -> file') + } + + require('./lib/standard-tests')(verify, 'bitbucket.org', 'bitbucket') + + t.end() +}) diff --git a/deps/npm/node_modules/hosted-git-info/test/gist.js b/deps/npm/node_modules/hosted-git-info/test/gist.js new file mode 100644 index 00000000000..cf36d3c8ddb --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/test/gist.js @@ -0,0 +1,41 @@ +'use strict' +var HostedGit = require('../index') +var test = require('tap').test + +test('fromUrl(gist url)', function (t) { + function verify (host, label, branch) { + var hostinfo = HostedGit.fromUrl(host) + var hash = branch ? '#' + branch : '' + t.ok(hostinfo, label) + if (!hostinfo) return + t.is(hostinfo.https(), 'git+https://gist.github.com/222.git' + hash, label + ' -> https') + t.is(hostinfo.git(), 'git://gist.github.com/222.git' + hash, label + ' -> git') + t.is(hostinfo.browse(), 'https://gist.github.com/222' + (branch ? '/' + branch : ''), label + ' -> browse') + t.is(hostinfo.bugs(), 'https://gist.github.com/222', label + ' -> bugs') + t.is(hostinfo.docs(), 'https://gist.github.com/222' + (branch ? '/' + branch : ''), label + ' -> docs') + t.is(hostinfo.ssh(), 'git@gist.github.com:/222.git' + hash, label + ' -> ssh') + t.is(hostinfo.sshurl(), 'git+ssh://git@gist.github.com/222.git' + hash, label + ' -> sshurl') + t.is(hostinfo.shortcut(), 'gist:222' + hash, label + ' -> shortcut') + if (hostinfo.user) { + t.is(hostinfo.file('C'), 'https://gist.githubusercontent.com/111/222/raw/' + (branch ? branch + '/' : '') + 'C', label + ' -> file') + } + } + + verify('git@gist.github.com:222.git', 'git@') + var hostinfo = HostedGit.fromUrl('git@gist.github.com:/ef860c7z5e0de3179341.git') + if (t.ok(hostinfo, 'git@hex')) { + t.is(hostinfo.https(), 'git+https://gist.github.com/ef860c7z5e0de3179341.git', 'git@hex -> https') + } + verify('git@gist.github.com:/222.git', 'git@/') + verify('git://gist.github.com/222', 'git') + verify('git://gist.github.com/222.git', 'git.git') + verify('git://gist.github.com/222#branch', 'git#branch', 'branch') + verify('git://gist.github.com/222.git#branch', 'git.git#branch', 'branch') + + require('./lib/standard-tests')(verify, 'gist.github.com', 'gist') + + verify(HostedGit.fromUrl('gist:111/222').toString(), 'round-tripped shortcut') + verify('gist:222', 'shortened shortcut') + + t.end() +}) diff --git a/deps/npm/node_modules/hosted-git-info/test/github.js b/deps/npm/node_modules/hosted-git-info/test/github.js new file mode 100644 index 00000000000..56098a3e391 --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/test/github.js @@ -0,0 +1,40 @@ +'use strict' +var HostedGit = require('../index') +var test = require('tap').test + +test('fromUrl(github url)', function (t) { + function verify (host, label, branch) { + var hostinfo = HostedGit.fromUrl(host) + var hash = branch ? '#' + branch : '' + t.ok(hostinfo, label) + if (!hostinfo) return + t.is(hostinfo.https(), 'git+https://github.com/111/222.git' + hash, label + ' -> https') + t.is(hostinfo.git(), 'git://github.com/111/222.git' + hash, label + ' -> git') + t.is(hostinfo.browse(), 'https://github.com/111/222' + (branch ? '/tree/' + branch : ''), label + ' -> browse') + t.is(hostinfo.bugs(), 'https://github.com/111/222/issues', label + ' -> bugs') + t.is(hostinfo.docs(), 'https://github.com/111/222' + (branch ? '/tree/' + branch : '') + '#readme', label + ' -> docs') + t.is(hostinfo.ssh(), 'git@github.com:111/222.git' + hash, label + ' -> ssh') + t.is(hostinfo.sshurl(), 'git+ssh://git@github.com/111/222.git' + hash, label + ' -> sshurl') + t.is(hostinfo.shortcut(), 'github:111/222' + hash, label + ' -> shortcut') + t.is(hostinfo.file('C'), 'https://raw.githubusercontent.com/111/222/' + (branch || 'master') + '/C', label + ' -> file') + } + + // github shorturls + verify('111/222', 'github-short') + verify('111/222#branch', 'github-short#branch', 'branch') + + // insecure protocols + verify('git://github.com/111/222', 'git') + verify('git://github.com/111/222.git', 'git.git') + verify('git://github.com/111/222#branch', 'git#branch', 'branch') + verify('git://github.com/111/222.git#branch', 'git.git#branch', 'branch') + + verify('http://github.com/111/222', 'http') + verify('http://github.com/111/222.git', 'http.git') + verify('http://github.com/111/222#branch', 'http#branch', 'branch') + verify('http://github.com/111/222.git#branch', 'http.git#branch', 'branch') + + require('./lib/standard-tests')(verify, 'github.com', 'github') + + t.end() +}) diff --git a/deps/npm/node_modules/hosted-git-info/test/gitlab.js b/deps/npm/node_modules/hosted-git-info/test/gitlab.js new file mode 100644 index 00000000000..315c9085bd6 --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/test/gitlab.js @@ -0,0 +1,23 @@ +'use strict' +var HostedGit = require('../index') +var test = require('tap').test + +test('fromUrl(gitlab url)', function (t) { + function verify (host, label, branch) { + var hostinfo = HostedGit.fromUrl(host) + var hash = branch ? '#' + branch : '' + t.ok(hostinfo, label) + if (!hostinfo) return + t.is(hostinfo.https(), 'git+https://gitlab.com/111/222.git' + hash, label + ' -> https') + t.is(hostinfo.browse(), 'https://gitlab.com/111/222' + (branch ? '/tree/' + branch : ''), label + ' -> browse') + t.is(hostinfo.docs(), 'https://gitlab.com/111/222' + (branch ? '/tree/' + branch : '') + '#README', label + ' -> docs') + t.is(hostinfo.ssh(), 'git@gitlab.com:111/222.git' + hash, label + ' -> ssh') + t.is(hostinfo.sshurl(), 'git+ssh://git@gitlab.com/111/222.git' + hash, label + ' -> sshurl') + t.is(hostinfo.shortcut(), 'gitlab:111/222' + hash, label + ' -> shortcut') + t.is(hostinfo.file('C'), 'https://gitlab.com/111/222/raw/' + (branch || 'master') + '/C', label + ' -> file') + } + + require('./lib/standard-tests')(verify, 'gitlab.com', 'gitlab') + + t.end() +}) diff --git a/deps/npm/node_modules/hosted-git-info/test/https-with-inline-auth.js b/deps/npm/node_modules/hosted-git-info/test/https-with-inline-auth.js new file mode 100644 index 00000000000..5e2f5b5a387 --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/test/https-with-inline-auth.js @@ -0,0 +1,39 @@ +'use strict' +var HostedGit = require('../index') +var test = require('tap').test + +test('HTTPS GitHub URL with embedded auth -- generally not a good idea', function (t) { + function verify (host, label, branch) { + var hostinfo = HostedGit.fromUrl(host) + var hash = branch ? '#' + branch : '' + t.ok(hostinfo, label) + if (!hostinfo) return + t.is(hostinfo.https(), 'git+https://user:pass@github.com/111/222.git' + hash, label + ' -> https') + t.is(hostinfo.git(), 'git://user:pass@github.com/111/222.git' + hash, label + ' -> git') + t.is(hostinfo.browse(), 'https://github.com/111/222' + (branch ? '/tree/' + branch : ''), label + ' -> browse') + t.is(hostinfo.bugs(), 'https://github.com/111/222/issues', label + ' -> bugs') + t.is(hostinfo.docs(), 'https://github.com/111/222' + (branch ? '/tree/' + branch : '') + '#readme', label + ' -> docs') + t.is(hostinfo.ssh(), 'git@github.com:111/222.git' + hash, label + ' -> ssh') + t.is(hostinfo.sshurl(), 'git+ssh://git@github.com/111/222.git' + hash, label + ' -> sshurl') + t.is(hostinfo.shortcut(), 'github:111/222' + hash, label + ' -> shortcut') + t.is(hostinfo.file('C'), 'https://user:pass@raw.githubusercontent.com/111/222/' + (branch || 'master') + '/C', label + ' -> file') + } + + // insecure protocols + verify('git://user:pass@github.com/111/222', 'git') + verify('git://user:pass@github.com/111/222.git', 'git.git') + verify('git://user:pass@github.com/111/222#branch', 'git#branch', 'branch') + verify('git://user:pass@github.com/111/222.git#branch', 'git.git#branch', 'branch') + + verify('https://user:pass@github.com/111/222', 'https') + verify('https://user:pass@github.com/111/222.git', 'https.git') + verify('https://user:pass@github.com/111/222#branch', 'https#branch', 'branch') + verify('https://user:pass@github.com/111/222.git#branch', 'https.git#branch', 'branch') + + verify('http://user:pass@github.com/111/222', 'http') + verify('http://user:pass@github.com/111/222.git', 'http.git') + verify('http://user:pass@github.com/111/222#branch', 'http#branch', 'branch') + verify('http://user:pass@github.com/111/222.git#branch', 'http.git#branch', 'branch') + + t.end() +}) diff --git a/deps/npm/node_modules/hosted-git-info/test/lib/standard-tests.js b/deps/npm/node_modules/hosted-git-info/test/lib/standard-tests.js new file mode 100644 index 00000000000..929fcca42ef --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/test/lib/standard-tests.js @@ -0,0 +1,27 @@ +'use strict' +module.exports = function (verify, domain, shortname) { + verify('https://' + domain + '/111/222', 'https') + verify('https://' + domain + '/111/222.git', 'https.git') + verify('https://' + domain + '/111/222#branch', 'https#branch', 'branch') + verify('https://' + domain + '/111/222.git#branch', 'https.git#branch', 'branch') + + verify('git+https://' + domain + '/111/222', 'git+https') + verify('git+https://' + domain + '/111/222.git', 'git+https.git') + verify('git+https://' + domain + '/111/222#branch', 'git+https#branch', 'branch') + verify('git+https://' + domain + '/111/222.git#branch', 'git+https.git#branch', 'branch') + + verify('git@' + domain + ':111/222', 'ssh') + verify('git@' + domain + ':111/222.git', 'ssh.git') + verify('git@' + domain + ':111/222#branch', 'ssh', 'branch') + verify('git@' + domain + ':111/222.git#branch', 'ssh.git', 'branch') + + verify('git+ssh://git@' + domain + '/111/222', 'ssh url') + verify('git+ssh://git@' + domain + '/111/222.git', 'ssh url.git') + verify('git+ssh://git@' + domain + '/111/222#branch', 'ssh url#branch', 'branch') + verify('git+ssh://git@' + domain + '/111/222.git#branch', 'ssh url.git#branch', 'branch') + + verify(shortname + ':111/222', 'shortcut') + verify(shortname + ':111/222.git', 'shortcut.git') + verify(shortname + ':111/222#branch', 'shortcut#branch', 'branch') + verify(shortname + ':111/222.git#branch', 'shortcut.git#branch', 'branch') +} diff --git a/deps/npm/node_modules/inflight/.eslintrc b/deps/npm/node_modules/inflight/.eslintrc deleted file mode 100644 index b7a1550efc2..00000000000 --- a/deps/npm/node_modules/inflight/.eslintrc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "env" : { - "node" : true - }, - "rules" : { - "semi": [2, "never"], - "strict": 0, - "quotes": [1, "single", "avoid-escape"], - "no-use-before-define": 0, - "curly": 0, - "no-underscore-dangle": 0, - "no-lonely-if": 1, - "no-unused-vars": [2, {"vars" : "all", "args" : "after-used"}], - "no-mixed-requires": 0, - "space-infix-ops": 0 - } -} diff --git a/deps/npm/node_modules/ini/LICENSE b/deps/npm/node_modules/ini/LICENSE index 05a4010949c..19129e315fe 100644 --- a/deps/npm/node_modules/ini/LICENSE +++ b/deps/npm/node_modules/ini/LICENSE @@ -1,23 +1,15 @@ -Copyright 2009, 2010, 2011 Isaac Z. Schlueter. -All rights reserved. +The ISC License -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: +Copyright (c) Isaac Z. Schlueter and Contributors -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/ini/ini.js b/deps/npm/node_modules/ini/ini.js index 1e232e74387..ddf5bd9cc6b 100644 --- a/deps/npm/node_modules/ini/ini.js +++ b/deps/npm/node_modules/ini/ini.js @@ -145,7 +145,7 @@ function isQuoted (val) { function safe (val) { return ( typeof val !== "string" - || val.match(/[\r\n]/) + || val.match(/[=\r\n]/) || val.match(/^\[/) || (val.length > 1 && isQuoted(val)) diff --git a/deps/npm/node_modules/ini/package.json b/deps/npm/node_modules/ini/package.json index 3042c406277..e9b9d5396c0 100644 --- a/deps/npm/node_modules/ini/package.json +++ b/deps/npm/node_modules/ini/package.json @@ -6,7 +6,7 @@ }, "name": "ini", "description": "An ini encoder/decoder for node", - "version": "1.3.0", + "version": "1.3.4", "repository": { "type": "git", "url": "git://github.com/isaacs/ini.git" @@ -20,20 +20,29 @@ }, "dependencies": {}, "devDependencies": { - "tap": "~0.4.0" + "tap": "^1.2.0" }, - "gitHead": "6c314944d0201f3199e1189aeb5687d0aaf1c575", + "license": "ISC", + "files": [ + "ini.js" + ], + "gitHead": "4a3001abc4c608e51add9f1d2b2cadf02b8e6dea", "bugs": { "url": "https://github.com/isaacs/ini/issues" }, - "homepage": "https://github.com/isaacs/ini", - "_id": "ini@1.3.0", - "_shasum": "625483e56c643a7721014c76604d3353f44bd429", - "_from": "ini@>=1.3.0 <2.0.0", - "_npmVersion": "2.0.0", + "homepage": "https://github.com/isaacs/ini#readme", + "_id": "ini@1.3.4", + "_shasum": "0537cb79daf59b59a1a517dff706c86ec039162e", + "_from": "ini@latest", + "_npmVersion": "2.10.1", + "_nodeVersion": "2.0.1", "_npmUser": { "name": "isaacs", - "email": "i@izs.me" + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "0537cb79daf59b59a1a517dff706c86ec039162e", + "tarball": "http://registry.npmjs.org/ini/-/ini-1.3.4.tgz" }, "maintainers": [ { @@ -41,11 +50,7 @@ "email": "i@izs.me" } ], - "dist": { - "shasum": "625483e56c643a7721014c76604d3353f44bd429", - "tarball": "http://registry.npmjs.org/ini/-/ini-1.3.0.tgz" - }, "directories": {}, - "_resolved": "https://registry.npmjs.org/ini/-/ini-1.3.0.tgz", + "_resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", "readme": "ERROR: No README data found!" } diff --git a/deps/npm/node_modules/ini/test/bar.js b/deps/npm/node_modules/ini/test/bar.js deleted file mode 100644 index cb16176efa1..00000000000 --- a/deps/npm/node_modules/ini/test/bar.js +++ /dev/null @@ -1,23 +0,0 @@ -//test that parse(stringify(obj) deepEqu - -var ini = require('../') -var test = require('tap').test - -var data = { - 'number': {count: 10}, - 'string': {drink: 'white russian'}, - 'boolean': {isTrue: true}, - 'nested boolean': {theDude: {abides: true, rugCount: 1}} -} - - -test('parse(stringify(x)) deepEqual x', function (t) { - - for (var k in data) { - var s = ini.stringify(data[k]) - console.log(s, data[k]) - t.deepEqual(ini.parse(s), data[k]) - } - - t.end() -}) diff --git a/deps/npm/node_modules/ini/test/fixtures/foo.ini b/deps/npm/node_modules/ini/test/fixtures/foo.ini deleted file mode 100644 index 27555e9d82d..00000000000 --- a/deps/npm/node_modules/ini/test/fixtures/foo.ini +++ /dev/null @@ -1,63 +0,0 @@ -o = p - - a with spaces = b c - -; wrap in quotes to JSON-decode and preserve spaces -" xa n p " = "\"\r\nyoyoyo\r\r\n" - -; wrap in quotes to get a key with a bracket, not a section. -"[disturbing]" = hey you never know - -; Test single quotes -s = 'something' - -; Test mixing quotes - -s1 = "something' - -; Test double quotes -s2 = "something else" - -; Test arrays -zr[] = deedee -ar[] = one -ar[] = three -; This should be included in the array -ar = this is included - -; Test resetting of a value (and not turn it into an array) -br = cold -br = warm - -; a section -[a] -av = a val -e = { o: p, a: { av: a val, b: { c: { e: "this [value]" } } } } -j = "{ o: "p", a: { av: "a val", b: { c: { e: "this [value]" } } } }" -"[]" = a square? - -; Nested array -cr[] = four -cr[] = eight - -; nested child without middle parent -; should create otherwise-empty a.b -[a.b.c] -e = 1 -j = 2 - -; dots in the section name should be literally interpreted -[x\.y\.z] -x.y.z = xyz - -[x\.y\.z.a\.b\.c] -a.b.c = abc - -; this next one is not a comment! it's escaped! -nocomment = this\; this is not a comment - -# Support the use of the number sign (#) as an alternative to the semicolon for indicating comments. -# http://en.wikipedia.org/wiki/INI_file#Comments - -# this next one is not a comment! it's escaped! -noHashComment = this\# this is not a comment diff --git a/deps/npm/node_modules/ini/test/foo.js b/deps/npm/node_modules/ini/test/foo.js deleted file mode 100644 index 9d34aa6fdaf..00000000000 --- a/deps/npm/node_modules/ini/test/foo.js +++ /dev/null @@ -1,105 +0,0 @@ -var i = require("../") - , tap = require("tap") - , test = tap.test - , fs = require("fs") - , path = require("path") - , fixture = path.resolve(__dirname, "./fixtures/foo.ini") - , data = fs.readFileSync(fixture, "utf8") - , d - , expectE = 'o=p\n' - + 'a with spaces=b c\n' - + '" xa n p "="\\"\\r\\nyoyoyo\\r\\r\\n"\n' - + '"[disturbing]"=hey you never know\n' - + 's=something\n' - + 's1=\"something\'\n' - + 's2=something else\n' - + 'zr[]=deedee\n' - + 'ar[]=one\n' - + 'ar[]=three\n' - + 'ar[]=this is included\n' - + 'br=warm\n' - + '\n' - + '[a]\n' - + 'av=a val\n' - + 'e={ o: p, a: ' - + '{ av: a val, b: { c: { e: "this [value]" ' - + '} } } }\nj="\\"{ o: \\"p\\", a: { av:' - + ' \\"a val\\", b: { c: { e: \\"this [value]' - + '\\" } } } }\\""\n"[]"=a square?\n' - + 'cr[]=four\ncr[]=eight\n\n' - +'[a.b.c]\ne=1\n' - + 'j=2\n\n[x\\.y\\.z]\nx.y.z=xyz\n\n' - + '[x\\.y\\.z.a\\.b\\.c]\na.b.c=abc\n' - + 'nocomment=this\\; this is not a comment\n' - + 'noHashComment=this\\# this is not a comment\n' - , expectD = - { o: 'p', - 'a with spaces': 'b c', - " xa n p ":'"\r\nyoyoyo\r\r\n', - '[disturbing]': 'hey you never know', - 's': 'something', - 's1' : '\"something\'', - 's2': 'something else', - 'zr': ['deedee'], - 'ar': ['one', 'three', 'this is included'], - 'br': 'warm', - a: - { av: 'a val', - e: '{ o: p, a: { av: a val, b: { c: { e: "this [value]" } } } }', - j: '"{ o: "p", a: { av: "a val", b: { c: { e: "this [value]" } } } }"', - "[]": "a square?", - cr: ['four', 'eight'], - b: { c: { e: '1', j: '2' } } }, - 'x.y.z': { - 'x.y.z': 'xyz', - 'a.b.c': { - 'a.b.c': 'abc', - 'nocomment': 'this\; this is not a comment', - noHashComment: 'this\# this is not a comment' - } - } - } - , expectF = '[prefix.log]\n' - + 'type=file\n\n' - + '[prefix.log.level]\n' - + 'label=debug\n' - + 'value=10\n' - , expectG = '[log]\n' - + 'type = file\n\n' - + '[log.level]\n' - + 'label = debug\n' - + 'value = 10\n' - -test("decode from file", function (t) { - var d = i.decode(data) - t.deepEqual(d, expectD) - t.end() -}) - -test("encode from data", function (t) { - var e = i.encode(expectD) - t.deepEqual(e, expectE) - - var obj = {log: { type:'file', level: {label:'debug', value:10} } } - e = i.encode(obj) - t.notEqual(e.slice(0, 1), '\n', 'Never a blank first line') - t.notEqual(e.slice(-2), '\n\n', 'Never a blank final line') - - t.end() -}) - -test("encode with option", function (t) { - var obj = {log: { type:'file', level: {label:'debug', value:10} } } - e = i.encode(obj, {section: 'prefix'}) - - t.equal(e, expectF) - t.end() -}) - -test("encode with whitespace", function (t) { - var obj = {log: { type:'file', level: {label:'debug', value:10} } } - e = i.encode(obj, {whitespace: true}) - - t.equal(e, expectG) - t.end() -}) diff --git a/deps/npm/node_modules/init-package-json/.travis.yml b/deps/npm/node_modules/init-package-json/.travis.yml new file mode 100644 index 00000000000..05d299e6764 --- /dev/null +++ b/deps/npm/node_modules/init-package-json/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.10" + - "0.11" diff --git a/deps/npm/node_modules/init-package-json/README.md b/deps/npm/node_modules/init-package-json/README.md index 3bdd35f6aa3..2cc79c4bf78 100644 --- a/deps/npm/node_modules/init-package-json/README.md +++ b/deps/npm/node_modules/init-package-json/README.md @@ -2,6 +2,8 @@ A node module to get your node module started. +[![Build Status](https://secure.travis-ci.org/npm/init-package-json.svg)](http://travis-ci.org/npm/init-package-json) + ## Usage ```javascript diff --git a/deps/npm/node_modules/init-package-json/default-input.js b/deps/npm/node_modules/init-package-json/default-input.js index c86894b26a2..886291dcea6 100644 --- a/deps/npm/node_modules/init-package-json/default-input.js +++ b/deps/npm/node_modules/init-package-json/default-input.js @@ -1,6 +1,10 @@ var fs = require('fs') -var path = require('path') var glob = require('glob') +var path = require('path') +var validateLicense = require('validate-npm-package-license') +var validateName = require('validate-npm-package-name') +var npa = require('npm-package-arg') +var semver = require('semver') // more popular packages should go here, maybe? function isTestPkg (p) { @@ -28,7 +32,7 @@ function readDeps (test) { return function (cb) { try { p = JSON.parse(p) } catch (e) { return next() } if (!p.version) return next() - deps[d] = config.get('save-prefix') + p.version + deps[d] = config.get('save-exact') ? p.version : config.get('save-prefix') + p.version return next() }) }) @@ -39,10 +43,38 @@ function readDeps (test) { return function (cb) { }} var name = package.name || basename -exports.name = yes ? name : prompt('name', name) - -var version = package.version || config.get('init-version') || '1.0.0' -exports.version = yes ? version : prompt('version', version) +var spec = npa(name) +var scope = config.get('scope') +if (scope) { + if (scope.charAt(0) !== '@') scope = '@' + scope + if (spec.scope) { + name = scope + '/' + spec.name.split('/')[1] + } else { + name = scope + '/' + name + } +} +exports.name = yes ? name : prompt('name', name, function (data) { + var its = validateName(data) + if (its.validForNewPackages) return data + var errors = (its.errors || []).concat(its.warnings || []) + var er = new Error('Sorry, ' + errors.join(' and ') + '.') + er.notValid = true + return er +}) + +var version = package.version || + config.get('init.version') || + config.get('init-version') || + '1.0.0' +exports.version = yes ? + version : + prompt('version', version, function (version) { + if (semver.valid(version)) return version + var er = new Error('Invalid version: "' + version + '"') + er.notValid = true + er.again = true + return er + }) if (!package.description) { exports.description = yes ? '' : prompt('description') @@ -177,14 +209,28 @@ if (!package.keywords) { } if (!package.author) { - exports.author = config.get('init-author-name') + exports.author = config.get('init.author.name') || + config.get('init-author-name') ? { - "name" : config.get('init-author-name'), - "email" : config.get('init-author-email'), - "url" : config.get('init-author-url') + "name" : config.get('init.author.name') || + config.get('init-author-name'), + "email" : config.get('init.author.email') || + config.get('init-author-email'), + "url" : config.get('init.author.url') || + config.get('init-author-url') } - : prompt('author') + : yes ? '' : prompt('author') } -var license = package.license || config.get('init-license') || 'ISC' -exports.license = yes ? license : prompt('license', license) +var license = package.license || + config.get('init.license') || + config.get('init-license') || + 'ISC' +exports.license = yes ? license : prompt('license', license, function (data) { + var its = validateLicense(data) + if (its.validForNewPackages) return data + var errors = (its.errors || []).concat(its.warnings || []) + var er = new Error('Sorry, ' + errors.join(' and ') + '.') + er.notValid = true + return er +}) diff --git a/deps/npm/node_modules/init-package-json/example/example-basic.js b/deps/npm/node_modules/init-package-json/example/example-basic.js index 29b0c818d1d..0d13bda064e 100644 --- a/deps/npm/node_modules/init-package-json/example/example-basic.js +++ b/deps/npm/node_modules/init-package-json/example/example-basic.js @@ -1,5 +1,4 @@ var init = require('../init-package-json.js') -var path = require('path') var dir = process.cwd() var initFile = require.resolve('./init/basic-init.js') diff --git a/deps/npm/node_modules/init-package-json/example/example-default.js b/deps/npm/node_modules/init-package-json/example/example-default.js index f3aea518c5b..29a81990688 100644 --- a/deps/npm/node_modules/init-package-json/example/example-default.js +++ b/deps/npm/node_modules/init-package-json/example/example-default.js @@ -1,5 +1,4 @@ var init = require('../init-package-json.js') -var path = require('path') var dir = process.cwd() init(dir, 'file that does not exist', function (err, data) { diff --git a/deps/npm/node_modules/init-package-json/example/example-npm.js b/deps/npm/node_modules/init-package-json/example/example-npm.js index b394eeabc04..292da6a7a7a 100644 --- a/deps/npm/node_modules/init-package-json/example/example-npm.js +++ b/deps/npm/node_modules/init-package-json/example/example-npm.js @@ -1,5 +1,4 @@ var init = require('../init-package-json.js') -var path = require('path') var dir = process.cwd() var npm = require('npm') @@ -10,4 +9,3 @@ npm.load(function (er, npm) { console.log('written successfully') }) }) - diff --git a/deps/npm/node_modules/init-package-json/init-package-json.js b/deps/npm/node_modules/init-package-json/init-package-json.js index cac761c39e0..5e50e712747 100644 --- a/deps/npm/node_modules/init-package-json/init-package-json.js +++ b/deps/npm/node_modules/init-package-json/init-package-json.js @@ -98,6 +98,11 @@ function init (dir, input, config, cb) { if (!pkg.repository) delete pkg.repository + // readJson filters out empty descriptions, but init-package-json + // traditionally leaves them alone + if (!pkg.description) + pkg.description = data.description + var d = JSON.stringify(pkg, null, 2) + '\n' function write (yes) { fs.writeFile(package, d, 'utf8', function (er) { diff --git a/deps/npm/node_modules/init-package-json/node_modules/promzard/example/buffer.js b/deps/npm/node_modules/init-package-json/node_modules/promzard/example/buffer.js new file mode 100644 index 00000000000..828f9d1df9d --- /dev/null +++ b/deps/npm/node_modules/init-package-json/node_modules/promzard/example/buffer.js @@ -0,0 +1,12 @@ +var pz = require('../promzard') + +var path = require('path') +var file = path.resolve(__dirname, 'substack-input.js') +var buf = require('fs').readFileSync(file) +var ctx = { basename: path.basename(path.dirname(file)) } + +pz.fromBuffer(buf, ctx, function (er, res) { + if (er) + throw er + console.error(JSON.stringify(res, null, 2)) +}) diff --git a/deps/npm/node_modules/init-package-json/node_modules/promzard/package.json b/deps/npm/node_modules/init-package-json/node_modules/promzard/package.json index f66857539f6..1007cdde443 100644 --- a/deps/npm/node_modules/init-package-json/node_modules/promzard/package.json +++ b/deps/npm/node_modules/init-package-json/node_modules/promzard/package.json @@ -6,7 +6,7 @@ }, "name": "promzard", "description": "prompting wizardly", - "version": "0.2.2", + "version": "0.3.0", "repository": { "url": "git://github.com/isaacs/promzard" }, @@ -21,14 +21,16 @@ "test": "tap test/*.js" }, "license": "ISC", + "gitHead": "780ead051299aa28be2584199ab6fa503a32d354", "bugs": { "url": "https://github.com/isaacs/promzard/issues" }, "homepage": "https://github.com/isaacs/promzard", - "_id": "promzard@0.2.2", - "_shasum": "918b9f2b29458cb001781a8856502e4a79b016e0", - "_from": "promzard@>=0.2.0 <0.3.0", - "_npmVersion": "1.4.10", + "_id": "promzard@0.3.0", + "_shasum": "26a5d6ee8c7dee4cb12208305acfb93ba382a9ee", + "_from": "promzard@>=0.3.0 <0.4.0", + "_npmVersion": "2.7.1", + "_nodeVersion": "1.4.2", "_npmUser": { "name": "isaacs", "email": "i@izs.me" @@ -40,10 +42,10 @@ } ], "dist": { - "shasum": "918b9f2b29458cb001781a8856502e4a79b016e0", - "tarball": "http://registry.npmjs.org/promzard/-/promzard-0.2.2.tgz" + "shasum": "26a5d6ee8c7dee4cb12208305acfb93ba382a9ee", + "tarball": "http://registry.npmjs.org/promzard/-/promzard-0.3.0.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/promzard/-/promzard-0.2.2.tgz", + "_resolved": "https://registry.npmjs.org/promzard/-/promzard-0.3.0.tgz", "readme": "ERROR: No README data found!" } diff --git a/deps/npm/node_modules/init-package-json/node_modules/promzard/promzard.js b/deps/npm/node_modules/init-package-json/node_modules/promzard/promzard.js index 3afb567f770..da1abca9535 100644 --- a/deps/npm/node_modules/init-package-json/node_modules/promzard/promzard.js +++ b/deps/npm/node_modules/init-package-json/node_modules/promzard/promzard.js @@ -21,6 +21,16 @@ function promzard (file, ctx, cb) { cb(null, data) }) } +promzard.fromBuffer = function (buf, ctx, cb) { + var filename = 0 + do { + filename = '\0' + Math.random(); + } while (files[filename]) + files[filename] = buf + var ret = promzard(filename, ctx, cb) + delete files[filename] + return ret +} function PromZard (file, ctx) { if (!(this instanceof PromZard)) @@ -175,8 +185,14 @@ PromZard.prototype.walk = function (o, cb) { prompt[1] = this.ctx[k] return this.prompt(prompt, function (er, res) { - if (er) - return this.emit('error', this.error = er); + if (er) { + if (!er.notValid) { + return this.emit('error', this.error = er); + } + console.log(er.message) + i -- + return L.call(this) + } o[k] = res L.call(this) }.bind(this)) @@ -206,7 +222,13 @@ PromZard.prototype.prompt = function (pdt, cb) { if (tx) { cb = function (cb) { return function (er, data) { - try { return cb(er, tx(data)) } + try { + var res = tx(data) + if (!er && res instanceof Error && !!res.notValid) { + return cb(res, null) + } + return cb(er, res) + } catch (er) { this.emit('error', er) } }}(cb).bind(this) } diff --git a/deps/npm/node_modules/init-package-json/node_modules/promzard/test/buffer.js b/deps/npm/node_modules/init-package-json/node_modules/promzard/test/buffer.js new file mode 100644 index 00000000000..e1d240e2e4f --- /dev/null +++ b/deps/npm/node_modules/init-package-json/node_modules/promzard/test/buffer.js @@ -0,0 +1,84 @@ +var tap = require('tap') +var pz = require('../promzard.js') +var spawn = require('child_process').spawn + +tap.test('run the example using a buffer', function (t) { + + var example = require.resolve('../example/buffer.js') + var node = process.execPath + + var expect = { + "name": "example", + "version": "0.0.0", + "description": "testing description", + "main": "test-entry.js", + "directories": { + "example": "example", + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "~0.2.5" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/example.git" + }, + "homepage": "https://github.com/substack/example", + "keywords": [ + "fugazi", + "function", + "waiting", + "room" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "engine": { + "node": ">=0.6" + } + } + + var c = spawn(node, [example], { customFds: [-1,-1,-1] }) + var output = '' + c.stdout.on('data', function (d) { + output += d + respond() + }) + + var actual = '' + c.stderr.on('data', function (d) { + actual += d + }) + + function respond () { + if (output.match(/description: $/)) { + c.stdin.write('testing description\n') + return + } + if (output.match(/entry point: \(index\.js\) $/)) { + c.stdin.write('test-entry.js\n') + return + } + if (output.match(/keywords: $/)) { + c.stdin.write('fugazi function waiting room\n') + // "read" module is weird on node >= 0.10 when not a TTY + // requires explicit ending for reasons. + // could dig in, but really just wanna make tests pass, whatever. + c.stdin.end() + return + } + } + + c.on('close', function () { + actual = JSON.parse(actual) + t.deepEqual(actual, expect) + t.end() + }) +}) diff --git a/deps/npm/node_modules/init-package-json/node_modules/promzard/test/validate.input b/deps/npm/node_modules/init-package-json/node_modules/promzard/test/validate.input new file mode 100644 index 00000000000..839c0652294 --- /dev/null +++ b/deps/npm/node_modules/init-package-json/node_modules/promzard/test/validate.input @@ -0,0 +1,8 @@ +module.exports = { + "name": prompt("name", function (data) { + if (data === 'cool') return data + var er = new Error('not cool') + er.notValid = true + return er + }) +} diff --git a/deps/npm/node_modules/init-package-json/node_modules/promzard/test/validate.js b/deps/npm/node_modules/init-package-json/node_modules/promzard/test/validate.js new file mode 100644 index 00000000000..a120681494e --- /dev/null +++ b/deps/npm/node_modules/init-package-json/node_modules/promzard/test/validate.js @@ -0,0 +1,20 @@ + +var promzard = require('../') +var test = require('tap').test + +test('validate', function (t) { + t.plan(2) + var ctx = { tmpdir : '/tmp' } + var file = __dirname + '/validate.input' + promzard(file, ctx, function (er, found) { + t.ok(!er) + var wanted = { name: 'cool' } + t.same(found, wanted) + }) + setTimeout(function () { + process.stdin.emit('data', 'not cool\n') + }, 100) + setTimeout(function () { + process.stdin.emit('data', 'cool\n') + }, 200) +}) diff --git a/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/LICENSE.md b/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/LICENSE.md new file mode 100644 index 00000000000..2180a8c1a36 --- /dev/null +++ b/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/LICENSE.md @@ -0,0 +1,7 @@ +Copyright Kyle E. Mitchell + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/README.md b/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/README.md new file mode 100644 index 00000000000..904f74b9d3b --- /dev/null +++ b/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/README.md @@ -0,0 +1,29 @@ +npm-validate-package-license +============================ + +Give me a string and I'll tell you if it's a valid npm package license. + +*This package is not endorsed or approved by npm. It is part of a proposal to add license field validation to the npm command-line interface.* + + + +```js +var validResult = { + validForNewPackages: true, + validForOldPackages: true +}; + +valid('Apache-2.0'); // => validResult +valid('GPL-3.0 OR BSD-2-Clause'); // => validResult + +var invalidResult = { + validForOldPackages: false, + validForNewPackages: false, + warnings: [ + 'license should be a valid SPDX license expression', + 'license is similar to the valid expression "Apache-2.0"' + ] +}; + +valid('Apache 2.0'); // => invalidResult +``` diff --git a/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/index.js b/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/index.js new file mode 100644 index 00000000000..c8407a52037 --- /dev/null +++ b/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/index.js @@ -0,0 +1,26 @@ +var spdx = require('spdx'); +var correct = require('spdx-correct'); + +module.exports = function(argument) { + if (spdx.valid(argument)) { + return { + validForNewPackages: true, + validForOldPackages: true + }; + } else { + var warnings = [ + 'license should be a valid SPDX license expression' + ]; + var corrected = correct(argument); + if (corrected) { + warnings.push( + 'license is similar to the valid expression "' + corrected + '"' + ); + } + return { + validForOldPackages: false, + validForNewPackages: false, + warnings: warnings + }; + } +}; diff --git a/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/node_modules/spdx-correct/.npmignore b/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/node_modules/spdx-correct/.npmignore new file mode 100644 index 00000000000..5229acdc80b --- /dev/null +++ b/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/node_modules/spdx-correct/.npmignore @@ -0,0 +1,5 @@ +.gitignore +.jscsrc +.jshintrc +test +.travis.yml diff --git a/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/node_modules/spdx-correct/README.md b/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/node_modules/spdx-correct/README.md new file mode 100644 index 00000000000..05cd9947d22 --- /dev/null +++ b/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/node_modules/spdx-correct/README.md @@ -0,0 +1,21 @@ +spdx-correct.js +=============== + +[![npm version](https://img.shields.io/npm/v/spdx-correct.svg)](https://www.npmjs.com/package/spdx-correct) +[![license](https://img.shields.io/badge/license-Apache--2.0-303284.svg)](http://www.apache.org/licenses/LICENSE-2.0) +[![build status](https://img.shields.io/travis/kemitchell/spdx-correct.js.svg)](http://travis-ci.org/kemitchell/spdx-correct.js) + + +Correct invalid SPDX identifiers. + + + +```js +correct('mit'); // => 'MIT' + +correct('Apache 2'); // => 'Apache-2.0' + +correct('No idea what license'); // => null +``` diff --git a/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/node_modules/spdx-correct/package.json b/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/node_modules/spdx-correct/package.json new file mode 100644 index 00000000000..79b09062aef --- /dev/null +++ b/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/node_modules/spdx-correct/package.json @@ -0,0 +1,63 @@ +{ + "name": "spdx-correct", + "description": "correct invalid SPDX identifiers", + "version": "1.0.0-prerelease-3", + "author": { + "name": "Kyle Mitchell", + "email": "kyle@kemitchell.com", + "url": "http://kemitchell.com" + }, + "bugs": { + "url": "https://github.com/kemitchell/spdx-correct/issues" + }, + "dependencies": { + "spdx": "^0.4.0" + }, + "devDependencies": { + "jscs": "^1.13.0", + "jshint": "^2.7.0", + "jsmd": "^0.3.0", + "tap": "^0.7.1" + }, + "homepage": "https://github.com/kemitchell/spdx-correct", + "keywords": [ + "SPDX", + "law", + "legal", + "license", + "metadata" + ], + "license": "Apache-2.0", + "main": "spdx-correct.js", + "repository": { + "type": "git", + "url": "https://github.com/kemitchell/spdx-correct" + }, + "scripts": { + "lint": "jshint spdx-correct.js test && jscs spdx-correct.js test", + "precommit": "npm run lint && npm run test", + "test": "jsmd README.md && tap test" + }, + "gitHead": "0289b9068391d4a1db571137083e0beb18a2faef", + "_id": "spdx-correct@1.0.0-prerelease-3", + "_shasum": "5706cc6ce05b928a65564c76e1d6809ba033ac7e", + "_from": "spdx-correct@1.0.0-prerelease-3", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "kemitchell", + "email": "kyle@kemitchell.com" + }, + "maintainers": [ + { + "name": "kemitchell", + "email": "kyle@kemitchell.com" + } + ], + "dist": { + "shasum": "5706cc6ce05b928a65564c76e1d6809ba033ac7e", + "tarball": "http://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.0-prerelease-3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.0-prerelease-3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/node_modules/spdx-correct/spdx-correct.js b/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/node_modules/spdx-correct/spdx-correct.js new file mode 100644 index 00000000000..094712d6236 --- /dev/null +++ b/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/node_modules/spdx-correct/spdx-correct.js @@ -0,0 +1,235 @@ +var spdx = require('spdx'); + +var valid = spdx.valid.bind(spdx); + +// Common transpositions of license identifier acronyms +var transpositions = [ + ['APGL', 'AGPL'], + ['Gpl', 'GPL'], + ['GLP', 'GPL'], + ['APL', 'Apache'], + ['ISD', 'ISC'], + ['GLP', 'GPL'], + ['IST', 'ISC'], + ['Claude', 'Clause'], + [' or later', '+'], + [' International', ''], + ['GNU', 'GPL'], + ['GUN', 'GPL'], + ['+', ''], + ['GNU GPL', 'GPL'], + ['GNU/GPL', 'GPL'], + ['GNU GLP', 'GPL'], + ['GNU General Public License', 'GPL'], + ['Gnu public license', 'GPL'], + ['GNU Public License', 'GPL'], + ['GNU GENERAL PUBLIC LICENSE', 'GPL'], + ['MTI', 'MIT'], + ['Mozilla Public License', 'MPL'], + ['WTH', 'WTF'], + ['-License', ''] +]; + +var TRANSPOSED = 0; +var CORRECT = 1; + +// Simple corrections to nearly valid identifiers. +var transforms = [ + // e.g. 'mit' + function(argument) { + return argument.toUpperCase(); + }, + // e.g. 'MIT ' + function(argument) { + return argument.trim(); + }, + // e.g. 'M.I.T.' + function(argument) { + return argument.replace(/\./g, ''); + }, + // e.g. 'Apache- 2.0' + function(argument) { + return argument.replace(/\s+/g, ''); + }, + // e.g. 'CC BY 4.0'' + function(argument) { + return argument.replace(/\s+/g, '-'); + }, + // e.g. 'LGPLv2.1' + function(argument) { + return argument.replace('v', '-'); + }, + // e.g. 'Apache 2.0' + function(argument) { + return argument.replace(/,?\s*(\d)/, '-$1'); + }, + // e.g. 'GPL 2' + function(argument) { + return argument.replace(/,?\s*(\d)/, '-$1.0'); + }, + // e.g. 'Apache Version 2.0' + function(argument) { + return argument.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/, '-$2'); + }, + // e.g. 'Apache Version 2' + function(argument) { + return argument.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/, '-$2.0'); + }, + // e.g. 'ZLIB' + function(argument) { + return argument[0].toUpperCase() + argument.slice(1); + }, + // e.g. 'MPL/2.0' + function(argument) { + return argument.replace('/', '-'); + }, + // e.g. 'Apache 2' + function(argument) { + return argument + .replace(/\s*V\s*(\d)/, '-$1') + .replace(/(\d)$/, '$1.0'); + }, + // e.g. 'GPL-2.0-' + function(argument) { + return argument.slice(0, argument.length - 1); + }, + // e.g. 'GPL2' + function(argument) { + return argument.replace(/(\d)$/, '-$1.0'); + }, + // e.g. 'BSD 3' + function(argument) { + return argument.replace(/(-| )?(\d)$/, '-$2-Clause'); + }, + // e.g. 'BSD clause 3' + function(argument) { + return argument.replace(/(-| )clause(-| )(\d)/, '-$3-Clause'); + }, + // e.g. 'BY-NC-4.0' + function(argument) { + return 'CC-' + argument; + }, + // e.g. 'BY-NC' + function(argument) { + return 'CC-' + argument + '-4.0'; + }, + // e.g. 'Attribution-NonCommercial' + function(argument) { + return argument + .replace('Attribution', 'BY') + .replace('NonCommercial', 'NC') + .replace('NoDerivatives', 'ND') + .replace(/ (\d)/, '-$1') + .replace(/ ?International/, ''); + }, + // e.g. 'Attribution-NonCommercial' + function(argument) { + return 'CC-' + + argument + .replace('Attribution', 'BY') + .replace('NonCommercial', 'NC') + .replace('NoDerivatives', 'ND') + .replace(/ (\d)/, '-$1') + .replace(/ ?International/, '') + + '-4.0'; + } +]; + +// If all else fails, guess that strings containing certain substrings +// meant to identify certain licenses. +var lastResorts = [ + ['UNLI', 'Unlicense'], + ['WTF', 'WTFPL'], + ['2 CLAUSE', 'BSD-2-Clause'], + ['2-CLAUSE', 'BSD-2-Clause'], + ['3 CLAUSE', 'BSD-3-Clause'], + ['3-CLAUSE', 'BSD-3-Clause'], + ['AFFERO', 'AGPL-3.0'], + ['AGPL', 'AGPL-3.0'], + ['APACHE', 'Apache-2.0'], + ['ARTISTIC', 'Artistic-2.0'], + ['Affero', 'AGPL-3.0'], + ['BEER', 'Beerware'], + ['BOOST', 'BSL-1.0'], + ['BSD', 'BSD-2-Clause'], + ['ECLIPSE', 'EPL-1.0'], + ['FUCK', 'WTFPL'], + ['GNU', 'GPL-3.0'], + ['LGPL', 'LGPL-3.0'], + ['GPL', 'GPL-3.0'], + ['MIT', 'MIT'], + ['MPL', 'MPL-2.0'], + ['X11', 'X11'], + ['ZLIB', 'Zlib'] +]; + +var SUBSTRING = 0; +var IDENTIFIER = 1; + +var validTransformation = function(identifier) { + for (var i = 0; i < transforms.length; i++) { + var transformed = transforms[i](identifier); + if (transformed !== identifier && valid(transformed)) { + return transformed; + } + } + return null; +}; + +var validLastResort = function(identifier) { + var upperCased = identifier.toUpperCase(); + for (var i = 0; i < lastResorts.length; i++) { + var lastResort = lastResorts[i]; + if (upperCased.indexOf(lastResort[SUBSTRING]) > -1) { + return lastResort[IDENTIFIER]; + } + } + return null; +}; + +var anyCorrection = function(identifier, check) { + for (var i = 0; i < transpositions.length; i++) { + var transposition = transpositions[i]; + var transposed = transposition[TRANSPOSED]; + if (identifier.indexOf(transposed) > -1) { + var corrected = identifier.replace( + transposed, + transposition[CORRECT] + ); + var checked = check(corrected); + if (checked !== null) { + return checked; + } + } + } + return null; +}; + +module.exports = function(identifier) { + identifier = identifier.replace(/\+$/, ''); + if (valid(identifier)) { + return identifier; + } + var transformed = validTransformation(identifier); + if (transformed !== null) { + return transformed; + } + transformed = anyCorrection(identifier, function(argument) { + if (valid(argument)) { + return argument; + } + return validTransformation(argument); + }); + if (transformed !== null) { + return transformed; + } + transformed = validLastResort(identifier); + if (transformed !== null) { + return transformed; + } + transformed = anyCorrection(identifier, validLastResort); + if (transformed !== null) { + return transformed; + } + return null; +}; diff --git a/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/package.json b/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/package.json new file mode 100644 index 00000000000..4483ede9e36 --- /dev/null +++ b/deps/npm/node_modules/init-package-json/node_modules/validate-npm-package-license/package.json @@ -0,0 +1,59 @@ +{ + "name": "validate-npm-package-license", + "description": "Give me a string and I'll tell you if it's a valid npm package license", + "version": "1.0.0-prerelease-2", + "author": { + "name": "Kyle E. Mitchell", + "email": "kyle@kemitchell.com", + "url": "http://kemitchell.com" + }, + "bugs": { + "url": "https://github.com/kemitchell/npm-valid-package-license/issues" + }, + "dependencies": { + "spdx": "^0.4.0", + "spdx-correct": "1.0.0-prerelease-3" + }, + "devDependencies": { + "jsmd": "^0.3.0" + }, + "homepage": "https://github.com/kemitchell/npm-valid-package-license", + "keywords": [ + "license", + "npm", + "package", + "validation" + ], + "license": "Apache-2.0", + "main": "index.js", + "repository": { + "type": "git", + "url": "https://github.com/kemitchell/npm-valid-package-license" + }, + "scripts": { + "precommit": "npm run test", + "test": "jsmd README.md" + }, + "gitHead": "d6043c5bf03a71409daae8d584ba74281e3c55c3", + "_id": "validate-npm-package-license@1.0.0-prerelease-2", + "_shasum": "0f45adce1728091b289597035c1ad25a5ba549be", + "_from": "validate-npm-package-license@1.0.0-prerelease-2", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "kemitchell", + "email": "kyle@kemitchell.com" + }, + "maintainers": [ + { + "name": "kemitchell", + "email": "kyle@kemitchell.com" + } + ], + "dist": { + "shasum": "0f45adce1728091b289597035c1ad25a5ba549be", + "tarball": "http://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-1.0.0-prerelease-2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-1.0.0-prerelease-2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/init-package-json/package.json b/deps/npm/node_modules/init-package-json/package.json index 54aa7cbdf33..62d01c59d55 100644 --- a/deps/npm/node_modules/init-package-json/package.json +++ b/deps/npm/node_modules/init-package-json/package.json @@ -1,6 +1,6 @@ { "name": "init-package-json", - "version": "1.1.1", + "version": "1.6.0", "main": "init-package-json.js", "scripts": { "test": "tap test/*.js" @@ -17,16 +17,19 @@ "license": "ISC", "description": "A node module to get your node module started", "dependencies": { - "glob": "^4.0.2", - "promzard": "~0.2.0", + "glob": "^5.0.3", + "npm-package-arg": "^4.0.0", + "promzard": "^0.3.0", "read": "~1.0.1", - "read-package-json": "1", - "semver": "2.x || 3.x || 4" + "read-package-json": "1 || 2", + "semver": "2.x || 3.x || 4", + "validate-npm-package-license": "1.0.0-prerelease-2", + "validate-npm-package-name": "^2.0.1" }, "devDependencies": { - "npm": "^2.1.4", + "npm": "^2", "rimraf": "^2.1.4", - "tap": "^0.4.13" + "tap": "^0.7.1" }, "keywords": [ "init", @@ -38,14 +41,38 @@ "prompt", "start" ], - "readme": "# init-package-json\n\nA node module to get your node module started.\n\n## Usage\n\n```javascript\nvar init = require('init-package-json')\nvar path = require('path')\n\n// a path to a promzard module. In the event that this file is\n// not found, one will be provided for you.\nvar initFile = path.resolve(process.env.HOME, '.npm-init')\n\n// the dir where we're doin stuff.\nvar dir = process.cwd()\n\n// extra stuff that gets put into the PromZard module's context.\n// In npm, this is the resolved config object. Exposed as 'config'\n// Optional.\nvar configData = { some: 'extra stuff' }\n\n// Any existing stuff from the package.json file is also exposed in the\n// PromZard module as the `package` object. There will also be free\n// vars for:\n// * `filename` path to the package.json file\n// * `basename` the tip of the package dir\n// * `dirname` the parent of the package dir\n\ninit(dir, initFile, configData, function (er, data) {\n // the data's already been written to {dir}/package.json\n // now you can do stuff with it\n})\n```\n\nOr from the command line:\n\n```\n$ npm-init\n```\n\nSee [PromZard](https://github.com/isaacs/promzard) for details about\nwhat can go in the config file.\n", - "readmeFilename": "README.md", - "gitHead": "a4df4e57f9b6a2bf906ad50612dbed7dcb2f2c2b", + "gitHead": "b747e9f71eb65b22bb9139e5252bf8efb23571e1", "bugs": { "url": "https://github.com/isaacs/init-package-json/issues" }, "homepage": "https://github.com/isaacs/init-package-json", - "_id": "init-package-json@1.1.1", - "_shasum": "e09e9f1fb541e0fddc9175c5ce1736fd45ff4bf8", - "_from": "init-package-json@>=1.1.1 <2.0.0" + "_id": "init-package-json@1.6.0", + "_shasum": "8c4c2561abca1ad30d88f5594ddb4159211a36ff", + "_from": "init-package-json@1.6.0", + "_npmVersion": "2.7.6", + "_nodeVersion": "1.6.2", + "_npmUser": { + "name": "iarna", + "email": "me@re-becca.org" + }, + "dist": { + "shasum": "8c4c2561abca1ad30d88f5594ddb4159211a36ff", + "tarball": "http://registry.npmjs.org/init-package-json/-/init-package-json-1.6.0.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + }, + { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + }, + { + "name": "iarna", + "email": "me@re-becca.org" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/init-package-json/-/init-package-json-1.6.0.tgz" } diff --git a/deps/npm/node_modules/init-package-json/test/basic.input b/deps/npm/node_modules/init-package-json/test/basic.input index b41ba5040c7..ca309e92262 100644 --- a/deps/npm/node_modules/init-package-json/test/basic.input +++ b/deps/npm/node_modules/init-package-json/test/basic.input @@ -3,7 +3,7 @@ var assert = require('assert') exports.name = prompt('name', package.name || basename) exports.version = '1.2.5' exports.description = prompt('description', package.description) -exports.author = 'me (http://url)' +exports.author = 'npmbot (http://npm.im)' exports.scripts = package.scripts || {} exports.scripts.test = 'make test' exports.main = package.main || 'main.js' diff --git a/deps/npm/node_modules/init-package-json/test/basic.js b/deps/npm/node_modules/init-package-json/test/basic.js index e1c44865669..f07f435bcd2 100644 --- a/deps/npm/node_modules/init-package-json/test/basic.js +++ b/deps/npm/node_modules/init-package-json/test/basic.js @@ -1,35 +1,33 @@ -var tap = require('tap') +var common = require('./lib/common') var init = require('../') +var path = require('path') var rimraf = require('rimraf') +var test = require('tap').test -tap.test('the basics', function (t) { - var i = __dirname + '/basic.input' - var dir = __dirname - init(dir, i, {foo:'bar'}, function (er, data) { +test('the basics', function (t) { + var i = path.join(__dirname, 'basic.input') + init(__dirname, i, { foo: 'bar' }, function (er, data) { if (er) throw er - var expect = - { name: 'the-name', - version: '1.2.5', - description: 'description', - author: 'me (http://url)', - scripts: { test: 'make test' }, - main: 'main.js', - config: { foo: 'bar' }, - package: {} } + var expect = { + name: 'the-name', + version: '1.2.5', + description: 'description', + author: 'npmbot (http://npm.im)', + scripts: { test: 'make test' }, + main: 'main.js', + config: { foo: 'bar' }, + package: {} + } t.same(data, expect) t.end() }) - setTimeout(function () { - process.stdin.emit('data', 'the-name\n') - }, 50) - setTimeout(function () { - process.stdin.emit('data', 'description\n') - }, 100) - setTimeout(function () { - process.stdin.emit('data', 'yes\n') - }, 150) + common.drive([ + 'the-name\n', + 'description\n', + 'yes\n' + ]) }) -tap.test('teardown', function (t) { +test('teardown', function (t) { rimraf(__dirname + '/package.json', t.end.bind(t)) }) diff --git a/deps/npm/node_modules/init-package-json/test/lib/common.js b/deps/npm/node_modules/init-package-json/test/lib/common.js new file mode 100644 index 00000000000..de45089f9b2 --- /dev/null +++ b/deps/npm/node_modules/init-package-json/test/lib/common.js @@ -0,0 +1,24 @@ +module.exports.drive = drive + +var semver = require('semver') + +function drive (input) { + var stdin = process.stdin + function emit (chunk, ms) { + setTimeout(function () { + stdin.emit('data', chunk) + }, ms) + } + if (semver.gte(process.versions.node, '0.11.0')) { + input.forEach(function (chunk) { + stdin.push(chunk) + }) + } else { + stdin.once('readable', function () { + var ms = 0 + input.forEach(function (chunk) { + emit(chunk, ms += 50) + }) + }) + } +} diff --git a/deps/npm/node_modules/init-package-json/test/license.js b/deps/npm/node_modules/init-package-json/test/license.js new file mode 100644 index 00000000000..87333fbf8f1 --- /dev/null +++ b/deps/npm/node_modules/init-package-json/test/license.js @@ -0,0 +1,38 @@ +var test = require('tap').test +var init = require('../') +var rimraf = require('rimraf') +var common = require('./lib/common') + +test('license', function (t) { + init(__dirname, '', {}, function (er, data) { + t.ok(!er, 'should not error') + var wanted = { + name: 'the-name', + version: '1.0.0', + description: '', + scripts: { test: 'echo "Error: no test specified" && exit 1' }, + license: 'Apache-2.0', + author: '', + main: 'basic.js' + } + t.same(data, wanted) + t.end() + }) + common.drive([ + 'the-name\n', + '\n', + '\n', + '\n', + '\n', + '\n', + '\n', + '\n', + 'Apache\n', + 'Apache-2.0\n', + 'yes\n' + ]) +}) + +test('teardown', function (t) { + rimraf(__dirname + '/package.json', t.end.bind(t)) +}) diff --git a/deps/npm/node_modules/init-package-json/test/name-spaces.js b/deps/npm/node_modules/init-package-json/test/name-spaces.js new file mode 100644 index 00000000000..dee974fc8aa --- /dev/null +++ b/deps/npm/node_modules/init-package-json/test/name-spaces.js @@ -0,0 +1,38 @@ +var test = require('tap').test +var init = require('../') +var rimraf = require('rimraf') +var common = require('./lib/common') + +test('spaces', function (t) { + init(__dirname, '', {}, function (er, data) { + t.ok(!er, 'should not error') + var wanted = { + name: 'the-name', + version: '1.0.0', + description: '', + scripts: { test: 'echo "Error: no test specified" && exit 1' }, + license: 'ISC', + author: '', + main: 'basic.js' + } + t.same(data, wanted) + t.end() + }) + common.drive([ + 'the name\n', + 'the-name\n', + '\n', + '\n', + '\n', + '\n', + '\n', + '\n', + '\n', + '\n', + 'yes\n' + ]) +}) + +test('teardown', function (t) { + rimraf(__dirname + '/package.json', t.end.bind(t)) +}) diff --git a/deps/npm/node_modules/init-package-json/test/name-uppercase.js b/deps/npm/node_modules/init-package-json/test/name-uppercase.js new file mode 100644 index 00000000000..ddedc30e524 --- /dev/null +++ b/deps/npm/node_modules/init-package-json/test/name-uppercase.js @@ -0,0 +1,38 @@ +var test = require('tap').test +var init = require('../') +var rimraf = require('rimraf') +var common = require('./lib/common') + +test('uppercase', function (t) { + init(__dirname, '', {}, function (er, data) { + t.ok(!er, 'should not error') + var wanted = { + name: 'the-name', + version: '1.0.0', + description: '', + scripts: { test: 'echo "Error: no test specified" && exit 1' }, + license: 'ISC', + author: '', + main: 'basic.js' + } + t.same(data, wanted) + t.end() + }) + common.drive([ + 'THE-NAME\n', + 'the-name\n', + '\n', + '\n', + '\n', + '\n', + '\n', + '\n', + '\n', + '\n', + 'yes\n' + ]) +}) + +test('teardown', function (t) { + rimraf(__dirname + '/package.json', t.end.bind(t)) +}) diff --git a/deps/npm/node_modules/init-package-json/test/npm-defaults.js b/deps/npm/node_modules/init-package-json/test/npm-defaults.js index 8229c84a002..292b9623ae9 100644 --- a/deps/npm/node_modules/init-package-json/test/npm-defaults.js +++ b/deps/npm/node_modules/init-package-json/test/npm-defaults.js @@ -1,49 +1,109 @@ -var test = require("tap").test -var rimraf = require("rimraf") -var resolve = require("path").resolve +var test = require('tap').test +var rimraf = require('rimraf') +var resolve = require('path').resolve -var npm = require("npm") -var init = require("../") +var npm = require('npm') +var init = require('../') var EXPECTED = { - name : "test", - version : "3.1.4", - description : "", - main : "basic.js", - scripts : { - test : 'echo "Error: no test specified" && exit 1' + name: 'test', + version: '3.1.4', + description: '', + main: 'basic.js', + scripts: { + test: 'echo "Error: no test specified" && exit 1' }, - keywords : [], - author : "npmbot (http://npm.im)", - license : "WTFPL" + keywords: [], + author: 'npmbot (http://npm.im/)', + license: 'WTFPL' } -test("npm configuration values pulled from environment", function (t) { +test('npm configuration values pulled from environment', function (t) { /*eslint camelcase:0 */ - process.env.npm_config_yes = "yes" + process.env.npm_config_yes = 'yes' - process.env.npm_config_init_author_name = "npmbot" - process.env.npm_config_init_author_email = "n@p.m" - process.env.npm_config_init_author_url = "http://npm.im" + process.env.npm_config_init_author_name = 'npmbot' + process.env.npm_config_init_author_email = 'n@p.m' + process.env.npm_config_init_author_url = 'http://npm.im' process.env.npm_config_init_license = EXPECTED.license process.env.npm_config_init_version = EXPECTED.version npm.load({}, function (err) { - t.ifError(err, "npm loaded successfully") + t.ifError(err, 'npm loaded successfully') + + // clear out dotted names from test environment + npm.config.del('init.author.name') + npm.config.del('init.author.email') + npm.config.del('init.author.url') + // the following have npm defaults, and need to be explicitly overridden + npm.config.set('init.license', '') + npm.config.set('init.version', '') + + process.chdir(resolve(__dirname)) + init(__dirname, __dirname, npm.config, function (er, data) { + t.ifError(err, 'init ran successfully') + + t.same(data, EXPECTED, 'got the package data from the environment') + t.end() + }) + }) +}) + +test('npm configuration values pulled from dotted config', function (t) { + /*eslint camelcase:0 */ + var config = { + yes: 'yes', + + 'init.author.name': 'npmbot', + 'init.author.email': 'n@p.m', + 'init.author.url': 'http://npm.im', + + 'init.license': EXPECTED.license, + 'init.version': EXPECTED.version + } + + npm.load(config, function (err) { + t.ifError(err, 'npm loaded successfully') + + process.chdir(resolve(__dirname)) + init(__dirname, __dirname, npm.config, function (er, data) { + t.ifError(err, 'init ran successfully') + + t.same(data, EXPECTED, 'got the package data from the config') + t.end() + }) + }) +}) + +test('npm configuration values pulled from dashed config', function (t) { + /*eslint camelcase:0 */ + var config = { + yes: 'yes', + + 'init-author-name': 'npmbot', + 'init-author-email': 'n@p.m', + 'init-author-url': 'http://npm.im', + + 'init-license': EXPECTED.license, + 'init-version': EXPECTED.version + } + + npm.load(config, function (err) { + t.ifError(err, 'npm loaded successfully') process.chdir(resolve(__dirname)) init(__dirname, __dirname, npm.config, function (er, data) { - t.ifError(err, "init ran successfully") + t.ifError(err, 'init ran successfully') - t.same(data, EXPECTED, "got the package data from the environment") + t.same(data, EXPECTED, 'got the package data from the config') t.end() }) }) }) -test("cleanup", function (t) { - rimraf.sync(resolve(__dirname, "package.json")) - t.pass("cleaned up") +test('cleanup', function (t) { + rimraf.sync(resolve(__dirname, 'package.json')) + t.pass('cleaned up') t.end() }) diff --git a/deps/npm/node_modules/init-package-json/test/scope-in-config.js b/deps/npm/node_modules/init-package-json/test/scope-in-config.js new file mode 100644 index 00000000000..1fa83d9c13a --- /dev/null +++ b/deps/npm/node_modules/init-package-json/test/scope-in-config.js @@ -0,0 +1,47 @@ +var fs = require('fs') +var path = require('path') + +var rimraf = require('rimraf') +var tap = require('tap') + +var init = require('../') + +var EXPECT = { + name: '@scoped/test', + version: '1.0.0', + description: '', + author: '', + scripts: { test: 'echo \"Error: no test specified\" && exit 1' }, + main: 'basic.js', + keywords: [], + license: 'ISC' +} + +tap.test('--yes with scope', function (t) { + init(__dirname, __dirname, { yes: 'yes', scope: '@scoped' }, function (er, data) { + if (er) throw er + + t.same(EXPECT, data) + t.end() + }) +}) + +var json = { + name: '@already/scoped', + version: '1.0.0' +} + +tap.test('with existing package.json', function (t) { + fs.writeFileSync(path.join(__dirname, 'package.json'), JSON.stringify(json, null, 2)) + init(__dirname, __dirname, { yes: 'yes', scope: '@still' }, function (er, data) { + if (er) throw er + + t.equal(data.name, '@still/scoped', 'new scope is added, basic name is kept') + t.end() + }) +}) + +tap.test('teardown', function (t) { + rimraf.sync(path.join(__dirname, 'package.json')) + t.end() +}) diff --git a/deps/npm/node_modules/init-package-json/test/scope.js b/deps/npm/node_modules/init-package-json/test/scope.js new file mode 100644 index 00000000000..971916f2d86 --- /dev/null +++ b/deps/npm/node_modules/init-package-json/test/scope.js @@ -0,0 +1,38 @@ +var tap = require('tap') +var init = require('../') +var rimraf = require('rimraf') + +var EXPECT = { + name: '@foo/test', + version: '1.2.5', + description: 'description', + author: 'npmbot (http://npm.im)', + scripts: { test: 'make test' }, + main: 'main.js', + config: { scope: '@foo' }, + package: {} +} + +tap.test('the scope', function (t) { + var i = __dirname + '/basic.input' + var dir = __dirname + init(dir, i, {scope: '@foo'}, function (er, data) { + if (er) throw er + + t.same(EXPECT, data) + t.end() + }) + setTimeout(function () { + process.stdin.emit('data', '@foo/test\n') + }, 50) + setTimeout(function () { + process.stdin.emit('data', 'description\n') + }, 100) + setTimeout(function () { + process.stdin.emit('data', 'yes\n') + }, 150) +}) + +tap.test('teardown', function (t) { + rimraf(__dirname + '/package.json', t.end.bind(t)) +}) diff --git a/deps/npm/node_modules/init-package-json/test/yes-defaults.js b/deps/npm/node_modules/init-package-json/test/yes-defaults.js new file mode 100644 index 00000000000..747ab38fdd2 --- /dev/null +++ b/deps/npm/node_modules/init-package-json/test/yes-defaults.js @@ -0,0 +1,27 @@ +var tap = require('tap') +var init = require('../') +var rimraf = require('rimraf') + +var EXPECT = { + name: 'test', + version: '1.0.0', + description: '', + author: '', + scripts: { test: 'echo "Error: no test specified" && exit 1' }, + main: 'basic.js', + keywords: [], + license: 'ISC' +} + +tap.test('--yes defaults', function (t) { + init(__dirname, __dirname, {yes: 'yes'}, function (er, data) { + if (er) throw er + + t.same(EXPECT, data, 'used the default data') + t.end() + }) +}) + +tap.test('teardown', function (t) { + rimraf(__dirname + '/package.json', t.end.bind(t)) +}) diff --git a/deps/npm/node_modules/lockfile/LICENSE b/deps/npm/node_modules/lockfile/LICENSE index 0c44ae716db..19129e315fe 100644 --- a/deps/npm/node_modules/lockfile/LICENSE +++ b/deps/npm/node_modules/lockfile/LICENSE @@ -1,27 +1,15 @@ -Copyright (c) Isaac Z. Schlueter ("Author") -All rights reserved. +The ISC License -The BSD License +Copyright (c) Isaac Z. Schlueter and Contributors -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/lockfile/README.md b/deps/npm/node_modules/lockfile/README.md index b3adccef1a1..3960194f068 100644 --- a/deps/npm/node_modules/lockfile/README.md +++ b/deps/npm/node_modules/lockfile/README.md @@ -51,13 +51,13 @@ Close and unlink the lockfile. Check if the lockfile is locked and not stale. -Returns boolean. +Callback is called with `cb(error, isLocked)`. -### lockFile.checkSync(path, [opts], cb) +### lockFile.checkSync(path, [opts]) Check if the lockfile is locked and not stale. -Callback is called with `cb(error, isLocked)`. +Returns boolean. ## Options diff --git a/deps/npm/node_modules/lockfile/package.json b/deps/npm/node_modules/lockfile/package.json index 27bd23777dc..cd18aa2ed52 100644 --- a/deps/npm/node_modules/lockfile/package.json +++ b/deps/npm/node_modules/lockfile/package.json @@ -1,6 +1,6 @@ { "name": "lockfile", - "version": "1.0.0", + "version": "1.0.1", "main": "lockfile.js", "directories": { "test": "test" @@ -15,7 +15,7 @@ }, "repository": { "type": "git", - "url": "git://github.com/isaacs/lockfile" + "url": "git://github.com/isaacs/lockfile.git" }, "keywords": [ "lockfile", @@ -29,20 +29,25 @@ "email": "i@izs.me", "url": "http://blog.izs.me/" }, - "license": "BSD", + "license": "ISC", "description": "A very polite lock file utility, which endeavors to not litter, and to wait patiently for others.", - "gitHead": "9590c6f02521eb1bb154ddc3ca9a7e84ce770c45", + "gitHead": "9d338ed8e3e3a166955d051f6b5fb6bb1e563ca8", "bugs": { "url": "https://github.com/isaacs/lockfile/issues" }, - "homepage": "https://github.com/isaacs/lockfile", - "_id": "lockfile@1.0.0", - "_shasum": "b3a7609dda6012060083bacb0ab0ecbca58e9203", - "_from": "lockfile@1.0.0", - "_npmVersion": "1.4.23", + "homepage": "https://github.com/isaacs/lockfile#readme", + "_id": "lockfile@1.0.1", + "_shasum": "9d353ecfe3f54d150bb57f89d51746935a39c4f5", + "_from": "lockfile@>=1.0.0 <1.1.0", + "_npmVersion": "2.10.0", + "_nodeVersion": "2.0.1", "_npmUser": { "name": "isaacs", - "email": "i@izs.me" + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "9d353ecfe3f54d150bb57f89d51746935a39c4f5", + "tarball": "http://registry.npmjs.org/lockfile/-/lockfile-1.0.1.tgz" }, "maintainers": [ { @@ -54,10 +59,5 @@ "email": "i@izs.me" } ], - "dist": { - "shasum": "b3a7609dda6012060083bacb0ab0ecbca58e9203", - "tarball": "http://registry.npmjs.org/lockfile/-/lockfile-1.0.0.tgz" - }, - "_resolved": "https://registry.npmjs.org/lockfile/-/lockfile-1.0.0.tgz", - "readme": "ERROR: No README data found!" + "_resolved": "https://registry.npmjs.org/lockfile/-/lockfile-1.0.1.tgz" } diff --git a/deps/npm/node_modules/lru-cache/LICENSE b/deps/npm/node_modules/lru-cache/LICENSE index 05a4010949c..19129e315fe 100644 --- a/deps/npm/node_modules/lru-cache/LICENSE +++ b/deps/npm/node_modules/lru-cache/LICENSE @@ -1,23 +1,15 @@ -Copyright 2009, 2010, 2011 Isaac Z. Schlueter. -All rights reserved. +The ISC License -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: +Copyright (c) Isaac Z. Schlueter and Contributors -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/lru-cache/README.md b/deps/npm/node_modules/lru-cache/README.md index 03ee0f98502..82a6dabd531 100644 --- a/deps/npm/node_modules/lru-cache/README.md +++ b/deps/npm/node_modules/lru-cache/README.md @@ -54,11 +54,12 @@ away. ## API -* `set(key, value)` +* `set(key, value, max)` * `get(key) => value` Both of these will update the "recently used"-ness of the key. - They do what you think. + They do what you think. `max` is optional and overrides the + cache `max` option if provided. * `peek(key)` @@ -95,3 +96,14 @@ away. * `values()` Return an array of the values in the cache. + +* `length()` + + Return total length of objects in cache taking into account + `length` options function. + +* `itemCount()` + + Return total quantity of objects currently in cache. Note, that + `stale` (see options) items are returned as part of this item + count. diff --git a/deps/npm/node_modules/lru-cache/lib/lru-cache.js b/deps/npm/node_modules/lru-cache/lib/lru-cache.js index d1d1381720c..d66e7a2382f 100644 --- a/deps/npm/node_modules/lru-cache/lib/lru-cache.js +++ b/deps/npm/node_modules/lru-cache/lib/lru-cache.js @@ -86,11 +86,13 @@ Object.defineProperty(LRUCache.prototype, "itemCount", LRUCache.prototype.forEach = function (fn, thisp) { thisp = thisp || this - var i = 0; - for (var k = this._mru - 1; k >= 0 && i < this._itemCount; k--) if (this._lruList[k]) { + var i = 0 + var itemCount = this._itemCount + + for (var k = this._mru - 1; k >= 0 && i < itemCount; k--) if (this._lruList[k]) { i++ var hit = this._lruList[k] - if (this._maxAge && (Date.now() - hit.now > this._maxAge)) { + if (isStale(this, hit)) { del(this, hit) if (!this._allowStale) hit = undefined } @@ -145,19 +147,24 @@ LRUCache.prototype.dumpLru = function () { return this._lruList } -LRUCache.prototype.set = function (key, value) { +LRUCache.prototype.set = function (key, value, maxAge) { + maxAge = maxAge || this._maxAge + var now = maxAge ? Date.now() : 0 + if (hOP(this._cache, key)) { // dispose of the old one before overwriting - if (this._dispose) this._dispose(key, this._cache[key].value) - if (this._maxAge) this._cache[key].now = Date.now() + if (this._dispose) + this._dispose(key, this._cache[key].value) + + this._cache[key].now = now + this._cache[key].maxAge = maxAge this._cache[key].value = value this.get(key) return true } var len = this._lengthCalculator(value) - var age = this._maxAge ? Date.now() : 0 - var hit = new Entry(key, value, this._mru++, len, age) + var hit = new Entry(key, value, this._mru++, len, now, maxAge) // oversized objects fall out of cache automatically. if (hit.length > this._max) { @@ -169,14 +176,16 @@ LRUCache.prototype.set = function (key, value) { this._lruList[hit.lu] = this._cache[key] = hit this._itemCount ++ - if (this._length > this._max) trim(this) + if (this._length > this._max) + trim(this) + return true } LRUCache.prototype.has = function (key) { if (!hOP(this._cache, key)) return false var hit = this._cache[key] - if (this._maxAge && (Date.now() - hit.now > this._maxAge)) { + if (isStale(this, hit)) { return false } return true @@ -203,7 +212,7 @@ LRUCache.prototype.del = function (key) { function get (self, key, doUse) { var hit = self._cache[key] if (hit) { - if (self._maxAge && (Date.now() - hit.now > self._maxAge)) { + if (isStale(self, hit)) { del(self, hit) if (!self._allowStale) hit = undefined } else { @@ -214,6 +223,18 @@ function get (self, key, doUse) { return hit } +function isStale(self, hit) { + if (!hit || (!hit.maxAge && !self._maxAge)) return false + var stale = false; + var diff = Date.now() - hit.now + if (hit.maxAge) { + stale = diff > hit.maxAge + } else { + stale = self._maxAge && (diff > self._maxAge) + } + return stale; +} + function use (self, hit) { shiftLU(self, hit) hit.lu = self._mru ++ @@ -241,12 +262,13 @@ function del (self, hit) { } // classy, since V8 prefers predictable objects. -function Entry (key, value, lu, length, now) { +function Entry (key, value, lu, length, now, maxAge) { this.key = key this.value = value this.lu = lu this.length = length this.now = now + if (maxAge) this.maxAge = maxAge } })() diff --git a/deps/npm/node_modules/lru-cache/package.json b/deps/npm/node_modules/lru-cache/package.json index d3fbddbdfd7..b22362cb968 100644 --- a/deps/npm/node_modules/lru-cache/package.json +++ b/deps/npm/node_modules/lru-cache/package.json @@ -1,11 +1,16 @@ { "name": "lru-cache", "description": "A cache object that deletes the least-recently-used items.", - "version": "2.5.0", + "version": "2.6.4", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me" }, + "keywords": [ + "mru", + "lru", + "cache" + ], "scripts": { "test": "tap test --gc" }, @@ -15,19 +20,39 @@ "url": "git://github.com/isaacs/node-lru-cache.git" }, "devDependencies": { - "tap": "", + "tap": "^0.7.1", "weak": "" }, - "license": { - "type": "MIT", - "url": "http://github.com/isaacs/node-lru-cache/raw/master/LICENSE" - }, - "readme": "# lru cache\n\nA cache object that deletes the least-recently-used items.\n\n## Usage:\n\n```javascript\nvar LRU = require(\"lru-cache\")\n , options = { max: 500\n , length: function (n) { return n * 2 }\n , dispose: function (key, n) { n.close() }\n , maxAge: 1000 * 60 * 60 }\n , cache = LRU(options)\n , otherCache = LRU(50) // sets just the max size\n\ncache.set(\"key\", \"value\")\ncache.get(\"key\") // \"value\"\n\ncache.reset() // empty the cache\n```\n\nIf you put more stuff in it, then items will fall out.\n\nIf you try to put an oversized thing in it, then it'll fall out right\naway.\n\n## Options\n\n* `max` The maximum size of the cache, checked by applying the length\n function to all values in the cache. Not setting this is kind of\n silly, since that's the whole purpose of this lib, but it defaults\n to `Infinity`.\n* `maxAge` Maximum age in ms. Items are not pro-actively pruned out\n as they age, but if you try to get an item that is too old, it'll\n drop it and return undefined instead of giving it to you.\n* `length` Function that is used to calculate the length of stored\n items. If you're storing strings or buffers, then you probably want\n to do something like `function(n){return n.length}`. The default is\n `function(n){return 1}`, which is fine if you want to store `n`\n like-sized things.\n* `dispose` Function that is called on items when they are dropped\n from the cache. This can be handy if you want to close file\n descriptors or do other cleanup tasks when items are no longer\n accessible. Called with `key, value`. It's called *before*\n actually removing the item from the internal cache, so if you want\n to immediately put it back in, you'll have to do that in a\n `nextTick` or `setTimeout` callback or it won't do anything.\n* `stale` By default, if you set a `maxAge`, it'll only actually pull\n stale items out of the cache when you `get(key)`. (That is, it's\n not pre-emptively doing a `setTimeout` or anything.) If you set\n `stale:true`, it'll return the stale value before deleting it. If\n you don't set this, then it'll return `undefined` when you try to\n get a stale entry, as if it had already been deleted.\n\n## API\n\n* `set(key, value)`\n* `get(key) => value`\n\n Both of these will update the \"recently used\"-ness of the key.\n They do what you think.\n\n* `peek(key)`\n\n Returns the key value (or `undefined` if not found) without\n updating the \"recently used\"-ness of the key.\n\n (If you find yourself using this a lot, you *might* be using the\n wrong sort of data structure, but there are some use cases where\n it's handy.)\n\n* `del(key)`\n\n Deletes a key out of the cache.\n\n* `reset()`\n\n Clear the cache entirely, throwing away all values.\n\n* `has(key)`\n\n Check if a key is in the cache, without updating the recent-ness\n or deleting it for being stale.\n\n* `forEach(function(value,key,cache), [thisp])`\n\n Just like `Array.prototype.forEach`. Iterates over all the keys\n in the cache, in order of recent-ness. (Ie, more recently used\n items are iterated over first.)\n\n* `keys()`\n\n Return an array of the keys in the cache.\n\n* `values()`\n\n Return an array of the values in the cache.\n", - "readmeFilename": "README.md", + "license": "ISC", + "gitHead": "aea58fc0a12714c6e1422963e7ebea66460ec39e", "bugs": { "url": "https://github.com/isaacs/node-lru-cache/issues" }, - "homepage": "https://github.com/isaacs/node-lru-cache", - "_id": "lru-cache@2.5.0", - "_from": "lru-cache@latest" + "homepage": "https://github.com/isaacs/node-lru-cache#readme", + "_id": "lru-cache@2.6.4", + "_shasum": "2675190ccd1b0701ec2f652a4d0d3d400d76c0dd", + "_from": "lru-cache@>=2.6.4 <2.7.0", + "_npmVersion": "2.10.0", + "_nodeVersion": "2.0.1", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "2675190ccd1b0701ec2f652a4d0d3d400d76c0dd", + "tarball": "http://registry.npmjs.org/lru-cache/-/lru-cache-2.6.4.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.6.4.tgz", + "readme": "ERROR: No README data found!" } diff --git a/deps/npm/node_modules/lru-cache/test/basic.js b/deps/npm/node_modules/lru-cache/test/basic.js index f72697c4611..949113e9ce8 100644 --- a/deps/npm/node_modules/lru-cache/test/basic.js +++ b/deps/npm/node_modules/lru-cache/test/basic.js @@ -215,7 +215,7 @@ test("drop the old items", function(t) { cache.set("c", "C") // timed out t.notOk(cache.get("a")) - }, 60) + }, 60 + 25) setTimeout(function () { t.notOk(cache.get("b")) @@ -228,6 +228,32 @@ test("drop the old items", function(t) { }, 155) }) +test("individual item can have it's own maxAge", function(t) { + var cache = new LRU({ + max: 5, + maxAge: 50 + }) + + cache.set("a", "A", 20) + setTimeout(function () { + t.notOk(cache.get("a")) + t.end() + }, 25) +}) + +test("individual item can have it's own maxAge > cache's", function(t) { + var cache = new LRU({ + max: 5, + maxAge: 20 + }) + + cache.set("a", "A", 50) + setTimeout(function () { + t.equal(cache.get("a"), "A") + t.end() + }, 25) +}) + test("disposal function", function(t) { var disposed = false var cache = new LRU({ diff --git a/deps/npm/node_modules/lru-cache/test/foreach.js b/deps/npm/node_modules/lru-cache/test/foreach.js index eefb80d9d15..429ebc12426 100644 --- a/deps/npm/node_modules/lru-cache/test/foreach.js +++ b/deps/npm/node_modules/lru-cache/test/foreach.js @@ -28,6 +28,7 @@ test('forEach', function (t) { t.equal(key, j.toString()) t.equal(val, j.toString(2)) }) + t.equal(i, order.length); t.end() }) @@ -50,3 +51,71 @@ test('keys() and values()', function (t) { t.end() }) + +test('all entries are iterated over', function(t) { + var l = new LRU(5) + for (var i = 0; i < 10; i ++) { + l.set(i.toString(), i.toString(2)) + } + + var i = 0 + l.forEach(function (val, key, cache) { + if (i > 0) { + cache.del(key) + } + i += 1 + }) + + t.equal(i, 5) + t.equal(l.keys().length, 1) + + t.end() +}) + +test('all stale entries are removed', function(t) { + var l = new LRU({ max: 5, maxAge: -5, stale: true }) + for (var i = 0; i < 10; i ++) { + l.set(i.toString(), i.toString(2)) + } + + var i = 0 + l.forEach(function () { + i += 1 + }) + + t.equal(i, 5) + t.equal(l.keys().length, 0) + + t.end() +}) + +test('expires', function (t) { + var l = new LRU({ + max: 10, + maxAge: 50 + }) + for (var i = 0; i < 10; i++) { + l.set(i.toString(), i.toString(2), ((i % 2) ? 25 : undefined)) + } + + var i = 0 + var order = [ 8, 6, 4, 2, 0 ] + setTimeout(function () { + l.forEach(function (val, key, cache) { + var j = order[i++] + t.equal(cache, l) + t.equal(key, j.toString()) + t.equal(val, j.toString(2)) + }) + t.equal(i, order.length); + t.end() + + setTimeout(function () { + var count = 0; + l.forEach(function (val, key, cache) { count++; }) + t.equal(0, count); + t.end() + }, 25) + + }, 26) +}) diff --git a/deps/npm/node_modules/minimatch/LICENSE b/deps/npm/node_modules/minimatch/LICENSE index 05a4010949c..19129e315fe 100644 --- a/deps/npm/node_modules/minimatch/LICENSE +++ b/deps/npm/node_modules/minimatch/LICENSE @@ -1,23 +1,15 @@ -Copyright 2009, 2010, 2011 Isaac Z. Schlueter. -All rights reserved. +The ISC License -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: +Copyright (c) Isaac Z. Schlueter and Contributors -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/minimatch/README.md b/deps/npm/node_modules/minimatch/README.md index 5b3967ea998..d458bc2e0a6 100644 --- a/deps/npm/node_modules/minimatch/README.md +++ b/deps/npm/node_modules/minimatch/README.md @@ -7,8 +7,6 @@ A minimal matching utility. This is the matching library used internally by npm. -Eventually, it will replace the C binding in node-glob. - It works by converting glob expressions into JavaScript `RegExp` objects. diff --git a/deps/npm/node_modules/minimatch/browser.js b/deps/npm/node_modules/minimatch/browser.js new file mode 100644 index 00000000000..967b45c0d67 --- /dev/null +++ b/deps/npm/node_modules/minimatch/browser.js @@ -0,0 +1,1113 @@ +(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 any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + if (typeof pattern === 'undefined') { + throw new Error('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var plType + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + plType = stateChar + patternListStack.push({ type: plType, start: i - 1, reStart: re.length }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + re += ')' + plType = patternListStack.pop().type + // negation is (?:(?!js)[^/]*) + // The others are (?:) + switch (plType) { + case '!': + re += '[^/]*?)' + break + case '?': + case '+': + case '*': + re += plType + break + case '@': break // the default anyway + } + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (var pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + 3) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) re = '(?=.)' + re + + if (addPatternStart) re = patternStart + re + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + var regExp = new RegExp('^' + re + '$', flags) + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } + + // should be unreachable. + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} + +},{"brace-expansion":2,"path":undefined}],2:[function(require,module,exports){ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + var expansions = expand(escapeBraces(str)); + return expansions.filter(identity).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = /^(.*,)+(.+)?$/.test(m.body); + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0]).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + expansions.push([pre, N[j], post[k]].join('')) + } + } + + return expansions; +} + + +},{"balanced-match":3,"concat-map":4}],3:[function(require,module,exports){ +module.exports = balanced; +function balanced(a, b, str) { + var bal = 0; + var m = {}; + var ended = false; + + for (var i = 0; i < str.length; i++) { + if (a == str.substr(i, a.length)) { + if (!('start' in m)) m.start = i; + bal++; + } + else if (b == str.substr(i, b.length) && 'start' in m) { + ended = true; + bal--; + if (!bal) { + m.end = i; + m.pre = str.substr(0, m.start); + m.body = (m.end - m.start > 1) + ? str.substring(m.start + a.length, m.end) + : ''; + m.post = str.slice(m.end + b.length); + return m; + } + } + } + + // if we opened more than we closed, find the one we closed + if (bal && ended) { + var start = m.start + a.length; + m = balanced(a, b, str.substr(start)); + if (m) { + m.start += start; + m.end += start; + m.pre = str.slice(0, start) + m.pre; + } + return m; + } +} + +},{}],4:[function(require,module,exports){ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (Array.isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +},{}]},{},[1]); diff --git a/deps/npm/node_modules/minimatch/minimatch.js b/deps/npm/node_modules/minimatch/minimatch.js index 47617868b99..5e13d6d5b2e 100644 --- a/deps/npm/node_modules/minimatch/minimatch.js +++ b/deps/npm/node_modules/minimatch/minimatch.js @@ -1,65 +1,36 @@ -;(function (require, exports, module, platform) { - -if (module) module.exports = minimatch -else exports.minimatch = minimatch - -if (!require) { - require = function (id) { - switch (id) { - case "sigmund": return function sigmund (obj) { - return JSON.stringify(obj) - } - case "path": return { basename: function (f) { - f = f.split(/[\/\\]/) - var e = f.pop() - if (!e) e = f.pop() - return e - }} - case "lru-cache": return function LRUCache () { - // not quite an LRU, but still space-limited. - var cache = {} - var cnt = 0 - this.set = function (k, v) { - cnt ++ - if (cnt >= 100) cache = {} - cache[k] = v - } - this.get = function (k) { return cache[k] } - } - } - } -} - +module.exports = minimatch minimatch.Minimatch = Minimatch -var LRU = require("lru-cache") - , cache = minimatch.cache = new LRU({max: 100}) - , GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} - , sigmund = require("sigmund") +var path = { sep: '/' } +try { + path = require('path') +} catch (er) {} -var path = require("path") - // any single thing other than / - // don't need to escape / when using new RegExp() - , qmark = "[^/]" +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = require('brace-expansion') - // * => any number of characters - , star = qmark + "*?" +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' - // ** when dots are allowed. Anything goes, except .. and . - // not (^ or / followed by one or two dots followed by $ or /), - // followed by anything, any number of times. - , twoStarDot = "(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?" +// * => any number of characters +var star = qmark + '*?' - // not a ^ or / followed by a dot, - // followed by anything, any number of times. - , twoStarNoDot = "(?:(?!(?:\\\/|^)\\.).)*?" +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' - // characters that need to be escaped in RegExp. - , reSpecials = charSet("().*{}+?[]^$\\!") +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') // "abc" -> { a:true, b:true, c:true } function charSet (s) { - return s.split("").reduce(function (set, c) { + return s.split('').reduce(function (set, c) { set[c] = true return set }, {}) @@ -110,51 +81,41 @@ Minimatch.defaults = function (def) { return minimatch.defaults(def).Minimatch } - function minimatch (p, pattern, options) { - if (typeof pattern !== "string") { - throw new TypeError("glob pattern string required") + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') } if (!options) options = {} // shortcut: comments match nothing. - if (!options.nocomment && pattern.charAt(0) === "#") { + if (!options.nocomment && pattern.charAt(0) === '#') { return false } // "" only matches "" - if (pattern.trim() === "") return p === "" + if (pattern.trim() === '') return p === '' return new Minimatch(pattern, options).match(p) } function Minimatch (pattern, options) { if (!(this instanceof Minimatch)) { - return new Minimatch(pattern, options, cache) + return new Minimatch(pattern, options) } - if (typeof pattern !== "string") { - throw new TypeError("glob pattern string required") + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') } if (!options) options = {} pattern = pattern.trim() - // windows: need to use /, not \ - // On other platforms, \ is a valid (albeit bad) filename char. - if (platform === "win32") { - pattern = pattern.split("\\").join("/") + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') } - // lru storage. - // these things aren't particularly big, but walking down the string - // and turning it into a regexp can get pretty costly. - var cacheKey = pattern + "\n" + sigmund(options) - var cached = minimatch.cache.get(cacheKey) - if (cached) return cached - minimatch.cache.set(cacheKey, this) - this.options = options this.set = [] this.pattern = pattern @@ -167,7 +128,7 @@ function Minimatch (pattern, options) { this.make() } -Minimatch.prototype.debug = function() {} +Minimatch.prototype.debug = function () {} Minimatch.prototype.make = make function make () { @@ -178,7 +139,7 @@ function make () { var options = this.options // empty patterns and comments match nothing. - if (!options.nocomment && pattern.charAt(0) === "#") { + if (!options.nocomment && pattern.charAt(0) === '#') { this.comment = true return } @@ -217,7 +178,7 @@ function make () { // filter out everything that didn't compile properly. set = set.filter(function (s) { - return -1 === s.indexOf(false) + return s.indexOf(false) === -1 }) this.debug(this.pattern, set) @@ -228,17 +189,17 @@ function make () { Minimatch.prototype.parseNegate = parseNegate function parseNegate () { var pattern = this.pattern - , negate = false - , options = this.options - , negateOffset = 0 + var negate = false + var options = this.options + var negateOffset = 0 if (options.nonegate) return - for ( var i = 0, l = pattern.length - ; i < l && pattern.charAt(i) === "!" - ; i ++) { + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { negate = !negate - negateOffset ++ + negateOffset++ } if (negateOffset) this.pattern = pattern.substr(negateOffset) @@ -256,213 +217,34 @@ function parseNegate () { // a{2..}b -> a{2..}b // a{b}c -> a{b}c minimatch.braceExpand = function (pattern, options) { - return new Minimatch(pattern, options).braceExpand() + return braceExpand(pattern, options) } Minimatch.prototype.braceExpand = braceExpand -function pad(n, width, z) { - z = z || '0'; - n = n + ''; - return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n; -} - function braceExpand (pattern, options) { - options = options || this.options - pattern = typeof pattern === "undefined" + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' ? this.pattern : pattern - if (typeof pattern === "undefined") { - throw new Error("undefined pattern") + if (typeof pattern === 'undefined') { + throw new Error('undefined pattern') } if (options.nobrace || - !pattern.match(/\{.*\}/)) { + !pattern.match(/\{.*\}/)) { // shortcut. no need to expand. return [pattern] } - var escaping = false - - // examples and comments refer to this crazy pattern: - // a{b,c{d,e},{f,g}h}x{y,z} - // expected: - // abxy - // abxz - // acdxy - // acdxz - // acexy - // acexz - // afhxy - // afhxz - // aghxy - // aghxz - - // everything before the first \{ is just a prefix. - // So, we pluck that off, and work with the rest, - // and then prepend it to everything we find. - if (pattern.charAt(0) !== "{") { - this.debug(pattern) - var prefix = null - for (var i = 0, l = pattern.length; i < l; i ++) { - var c = pattern.charAt(i) - this.debug(i, c) - if (c === "\\") { - escaping = !escaping - } else if (c === "{" && !escaping) { - prefix = pattern.substr(0, i) - break - } - } - - // actually no sets, all { were escaped. - if (prefix === null) { - this.debug("no sets") - return [pattern] - } - - var tail = braceExpand.call(this, pattern.substr(i), options) - return tail.map(function (t) { - return prefix + t - }) - } - - // now we have something like: - // {b,c{d,e},{f,g}h}x{y,z} - // walk through the set, expanding each part, until - // the set ends. then, we'll expand the suffix. - // If the set only has a single member, then'll put the {} back - - // first, handle numeric sets, since they're easier - var numset = pattern.match(/^\{(-?[0-9]+)\.\.(-?[0-9]+)\}/) - if (numset) { - this.debug("numset", numset[1], numset[2]) - var suf = braceExpand.call(this, pattern.substr(numset[0].length), options) - , start = +numset[1] - , needPadding = numset[1][0] === '0' - , startWidth = numset[1].length - , padded - , end = +numset[2] - , inc = start > end ? -1 : 1 - , set = [] - - for (var i = start; i != (end + inc); i += inc) { - padded = needPadding ? pad(i, startWidth) : i + '' - // append all the suffixes - for (var ii = 0, ll = suf.length; ii < ll; ii ++) { - set.push(padded + suf[ii]) - } - } - return set - } - - // ok, walk through the set - // We hope, somewhat optimistically, that there - // will be a } at the end. - // If the closing brace isn't found, then the pattern is - // interpreted as braceExpand("\\" + pattern) so that - // the leading \{ will be interpreted literally. - var i = 1 // skip the \{ - , depth = 1 - , set = [] - , member = "" - , sawEnd = false - , escaping = false - - function addMember () { - set.push(member) - member = "" - } - - this.debug("Entering for") - FOR: for (i = 1, l = pattern.length; i < l; i ++) { - var c = pattern.charAt(i) - this.debug("", i, c) - - if (escaping) { - escaping = false - member += "\\" + c - } else { - switch (c) { - case "\\": - escaping = true - continue - - case "{": - depth ++ - member += "{" - continue - - case "}": - depth -- - // if this closes the actual set, then we're done - if (depth === 0) { - addMember() - // pluck off the close-brace - i ++ - break FOR - } else { - member += c - continue - } - - case ",": - if (depth === 1) { - addMember() - } else { - member += c - } - continue - - default: - member += c - continue - } // switch - } // else - } // for - - // now we've either finished the set, and the suffix is - // pattern.substr(i), or we have *not* closed the set, - // and need to escape the leading brace - if (depth !== 0) { - this.debug("didn't close", pattern) - return braceExpand.call(this, "\\" + pattern, options) - } - - // x{y,z} -> ["xy", "xz"] - this.debug("set", set) - this.debug("suffix", pattern.substr(i)) - var suf = braceExpand.call(this, pattern.substr(i), options) - // ["b", "c{d,e}","{f,g}h"] -> - // [["b"], ["cd", "ce"], ["fh", "gh"]] - var addBraces = set.length === 1 - this.debug("set pre-expanded", set) - set = set.map(function (p) { - return braceExpand.call(this, p, options) - }, this) - this.debug("set expanded", set) - - - // [["b"], ["cd", "ce"], ["fh", "gh"]] -> - // ["b", "cd", "ce", "fh", "gh"] - set = set.reduce(function (l, r) { - return l.concat(r) - }) - - if (addBraces) { - set = set.map(function (s) { - return "{" + s + "}" - }) - } - - // now attach the suffixes. - var ret = [] - for (var i = 0, l = set.length; i < l; i ++) { - for (var ii = 0, ll = suf.length; ii < ll; ii ++) { - ret.push(set[i] + suf[ii]) - } - } - return ret + return expand(pattern) } // parse a component of the expanded set. @@ -482,87 +264,86 @@ function parse (pattern, isSub) { var options = this.options // shortcuts - if (!options.noglobstar && pattern === "**") return GLOBSTAR - if (pattern === "") return "" - - var re = "" - , hasMagic = !!options.nocase - , escaping = false - // ? => one single character - , patternListStack = [] - , plType - , stateChar - , inClass = false - , reClassStart = -1 - , classStart = -1 - // . and .. never match anything that doesn't start with ., - // even when options.dot is set. - , patternStart = pattern.charAt(0) === "." ? "" // anything - // not (start or / followed by . or .. followed by / or end) - : options.dot ? "(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))" - : "(?!\\.)" - , self = this + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var plType + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this function clearStateChar () { if (stateChar) { // we had some state-tracking character // that wasn't consumed by this pass. switch (stateChar) { - case "*": + case '*': re += star hasMagic = true - break - case "?": + break + case '?': re += qmark hasMagic = true - break + break default: - re += "\\"+stateChar - break + re += '\\' + stateChar + break } self.debug('clearStateChar %j %j', stateChar, re) stateChar = false } } - for ( var i = 0, len = pattern.length, c - ; (i < len) && (c = pattern.charAt(i)) - ; i ++ ) { - - this.debug("%s\t%s %s %j", pattern, i, re, c) + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) // skip over any that are escaped. if (escaping && reSpecials[c]) { - re += "\\" + c + re += '\\' + c escaping = false continue } - SWITCH: switch (c) { - case "/": + switch (c) { + case '/': // completely not allowed, even escaped. // Should already be path-split by now. return false - case "\\": + case '\\': clearStateChar() escaping = true - continue + continue // the various stateChar values // for the "extglob" stuff. - case "?": - case "*": - case "+": - case "@": - case "!": - this.debug("%s\t%s %s %j <-- stateChar", pattern, i, re, c) + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) // all of those are literals inside a class, except that // the glob [!a] means [^a] in regexp if (inClass) { this.debug(' in class') - if (c === "!" && i === classStart + 1) c = "^" + if (c === '!' && i === classStart + 1) c = '^' re += c continue } @@ -577,70 +358,70 @@ function parse (pattern, isSub) { // just clear the statechar *now*, rather than even diving into // the patternList stuff. if (options.noext) clearStateChar() - continue + continue - case "(": + case '(': if (inClass) { - re += "(" + re += '(' continue } if (!stateChar) { - re += "\\(" + re += '\\(' continue } plType = stateChar - patternListStack.push({ type: plType - , start: i - 1 - , reStart: re.length }) + patternListStack.push({ type: plType, start: i - 1, reStart: re.length }) // negation is (?:(?!js)[^/]*) - re += stateChar === "!" ? "(?:(?!" : "(?:" + re += stateChar === '!' ? '(?:(?!' : '(?:' this.debug('plType %j %j', stateChar, re) stateChar = false - continue + continue - case ")": + case ')': if (inClass || !patternListStack.length) { - re += "\\)" + re += '\\)' continue } clearStateChar() hasMagic = true - re += ")" + re += ')' plType = patternListStack.pop().type // negation is (?:(?!js)[^/]*) // The others are (?:) switch (plType) { - case "!": - re += "[^/]*?)" + case '!': + re += '[^/]*?)' + break + case '?': + case '+': + case '*': + re += plType break - case "?": - case "+": - case "*": re += plType - case "@": break // the default anyway + case '@': break // the default anyway } - continue + continue - case "|": + case '|': if (inClass || !patternListStack.length || escaping) { - re += "\\|" + re += '\\|' escaping = false continue } clearStateChar() - re += "|" - continue + re += '|' + continue // these are mostly the same in regexp and glob - case "[": + case '[': // swallow any state-tracking char before the [ clearStateChar() if (inClass) { - re += "\\" + c + re += '\\' + c continue } @@ -648,24 +429,47 @@ function parse (pattern, isSub) { classStart = i reClassStart = re.length re += c - continue + continue - case "]": + case ']': // a right bracket shall lose its special // meaning and represent itself in // a bracket expression if it occurs // first in the list. -- POSIX.2 2.8.3.2 if (i === classStart + 1 || !inClass) { - re += "\\" + c + re += '\\' + c escaping = false continue } + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } + // finish up the class. hasMagic = true inClass = false re += c - continue + continue default: // swallow any state char that wasn't consumed @@ -675,8 +479,8 @@ function parse (pattern, isSub) { // no need escaping = false } else if (reSpecials[c] - && !(c === "^" && inClass)) { - re += "\\" + && !(c === '^' && inClass)) { + re += '\\' } re += c @@ -684,7 +488,6 @@ function parse (pattern, isSub) { } // switch } // for - // handle the case where we left a class open. // "[abc" is valid, equivalent to "\[abc" if (inClass) { @@ -692,9 +495,9 @@ function parse (pattern, isSub) { // this is a huge pita. We now have to re-walk // the contents of the would-be class to re-translate // any characters that were passed through as-is - var cs = pattern.substr(classStart + 1) - , sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + "\\[" + sp[0] + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] hasMagic = hasMagic || sp[1] } @@ -704,14 +507,13 @@ function parse (pattern, isSub) { // and escape any | chars that were passed through as-is for the regexp. // Go through and escape them, taking care not to double-escape any // | chars that were already escaped. - var pl - while (pl = patternListStack.pop()) { + for (var pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { var tail = re.slice(pl.reStart + 3) // maybe some even number of \, then maybe 1 \, followed by a | tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) { if (!$2) { // the | isn't already escaped, so escape it. - $2 = "\\" + $2 = '\\' } // need to escape all those slashes *again*, without escaping the @@ -720,46 +522,44 @@ function parse (pattern, isSub) { // it exactly after itself. That's why this trick works. // // I am sorry that you have to see this. - return $1 + $1 + $2 + "|" + return $1 + $1 + $2 + '|' }) - this.debug("tail=%j\n %s", tail, tail) - var t = pl.type === "*" ? star - : pl.type === "?" ? qmark - : "\\" + pl.type + this.debug('tail=%j\n %s', tail, tail) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type hasMagic = true - re = re.slice(0, pl.reStart) - + t + "\\(" - + tail + re = re.slice(0, pl.reStart) + t + '\\(' + tail } // handle trailing things that only matter at the very end. clearStateChar() if (escaping) { // trailing \\ - re += "\\\\" + re += '\\\\' } // only need to apply the nodot start if the re starts with // something that could conceivably capture a dot var addPatternStart = false switch (re.charAt(0)) { - case ".": - case "[": - case "(": addPatternStart = true + case '.': + case '[': + case '(': addPatternStart = true } // if the re is not "" at this point, then we need to make sure // it doesn't match against an empty path part. // Otherwise a/* will match a/, which it should not. - if (re !== "" && hasMagic) re = "(?=.)" + re + if (re !== '' && hasMagic) re = '(?=.)' + re if (addPatternStart) re = patternStart + re // parsing just a piece of a larger pattern. if (isSub === SUBPARSE) { - return [ re, hasMagic ] + return [re, hasMagic] } // skip the regexp for non-magical patterns @@ -769,8 +569,8 @@ function parse (pattern, isSub) { return globUnescape(pattern) } - var flags = options.nocase ? "i" : "" - , regExp = new RegExp("^" + re + "$", flags) + var flags = options.nocase ? 'i' : '' + var regExp = new RegExp('^' + re + '$', flags) regExp._glob = pattern regExp._src = re @@ -794,34 +594,38 @@ function makeRe () { // when you just want to work with a regex. var set = this.set - if (!set.length) return this.regexp = false + if (!set.length) { + this.regexp = false + return this.regexp + } var options = this.options var twoStar = options.noglobstar ? star - : options.dot ? twoStarDot - : twoStarNoDot - , flags = options.nocase ? "i" : "" + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' var re = set.map(function (pattern) { return pattern.map(function (p) { return (p === GLOBSTAR) ? twoStar - : (typeof p === "string") ? regExpEscape(p) - : p._src - }).join("\\\/") - }).join("|") + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') // must match entire pattern // ending in a * or ** will make it less strict. - re = "^(?:" + re + ")$" + re = '^(?:' + re + ')$' // can match anything, as long as it's not this. - if (this.negate) re = "^(?!" + re + ").*$" + if (this.negate) re = '^(?!' + re + ').*$' try { - return this.regexp = new RegExp(re, flags) + this.regexp = new RegExp(re, flags) } catch (ex) { - return this.regexp = false + this.regexp = false } + return this.regexp } minimatch.match = function (list, pattern, options) { @@ -838,25 +642,24 @@ minimatch.match = function (list, pattern, options) { Minimatch.prototype.match = match function match (f, partial) { - this.debug("match", f, this.pattern) + this.debug('match', f, this.pattern) // short-circuit in the case of busted things. // comments, etc. if (this.comment) return false - if (this.empty) return f === "" + if (this.empty) return f === '' - if (f === "/" && partial) return true + if (f === '/' && partial) return true var options = this.options // windows: need to use /, not \ - // On other platforms, \ is a valid (albeit bad) filename char. - if (platform === "win32") { - f = f.split("\\").join("/") + if (path.sep !== '/') { + f = f.split(path.sep).join('/') } // treat the test path as a set of pathparts. f = f.split(slashSplit) - this.debug(this.pattern, "split", f) + this.debug(this.pattern, 'split', f) // just ONE of the pattern sets in this.set needs to match // in order for it to be valid. If negating, then just one @@ -864,17 +667,19 @@ function match (f, partial) { // Either way, return on the first hit. var set = this.set - this.debug(this.pattern, "set", set) + this.debug(this.pattern, 'set', set) // Find the basename of the path by looking for the last non-empty segment - var filename; - for (var i = f.length - 1; i >= 0; i--) { + var filename + var i + for (i = f.length - 1; i >= 0; i--) { filename = f[i] if (filename) break } - for (var i = 0, l = set.length; i < l; i ++) { - var pattern = set[i], file = f + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f if (options.matchBase && pattern.length === 1) { file = [filename] } @@ -899,23 +704,20 @@ function match (f, partial) { Minimatch.prototype.matchOne = function (file, pattern, partial) { var options = this.options - this.debug("matchOne", - { "this": this - , file: file - , pattern: pattern }) + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) - this.debug("matchOne", file.length, pattern.length) + this.debug('matchOne', file.length, pattern.length) - for ( var fi = 0 - , pi = 0 - , fl = file.length - , pl = pattern.length + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length ; (fi < fl) && (pi < pl) - ; fi ++, pi ++ ) { - - this.debug("matchOne loop") + ; fi++, pi++) { + this.debug('matchOne loop') var p = pattern[pi] - , f = file[fi] + var f = file[fi] this.debug(pattern, p, f) @@ -949,7 +751,7 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) { // - matchOne(z/c, c) -> no // - matchOne(c, c) yes, hit var fr = fi - , pr = pi + 1 + var pr = pi + 1 if (pr === pl) { this.debug('** at the end') // a ** at the end will just swallow the rest. @@ -958,19 +760,18 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) { // options.dot is set. // . and .. are *never* matched by **, for explosively // exponential reasons. - for ( ; fi < fl; fi ++) { - if (file[fi] === "." || file[fi] === ".." || - (!options.dot && file[fi].charAt(0) === ".")) return false + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false } return true } // ok, let's see if we can swallow whatever we can. - WHILE: while (fr < fl) { + while (fr < fl) { var swallowee = file[fr] - this.debug('\nglobstar while', - file, fr, pattern, pr, swallowee) + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) // XXX remove this slice. Just pass the start index. if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { @@ -980,23 +781,24 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) { } else { // can't swallow "." or ".." ever. // can only swallow ".foo" when explicitly asked. - if (swallowee === "." || swallowee === ".." || - (!options.dot && swallowee.charAt(0) === ".")) { - this.debug("dot detected!", file, fr, pattern, pr) - break WHILE + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break } // ** swallows a segment, and continue. this.debug('globstar swallow a segment, and continue') - fr ++ + fr++ } } + // no match was found. // However, in partial mode, we can't say this is necessarily over. // If there's more *pattern* left, then if (partial) { // ran out of file - this.debug("\n>>> no match, partial?", file, fr, pattern, pr) + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) if (fr === fl) return true } return false @@ -1006,16 +808,16 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) { // non-magic patterns just have to match exactly // patterns with magic have been turned into regexps. var hit - if (typeof p === "string") { + if (typeof p === 'string') { if (options.nocase) { hit = f.toLowerCase() === p.toLowerCase() } else { hit = f === p } - this.debug("string match", p, f, hit) + this.debug('string match', p, f, hit) } else { hit = f.match(p) - this.debug("pattern match", p, f, hit) + this.debug('pattern match', p, f, hit) } if (!hit) return false @@ -1047,27 +849,19 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) { // this is only acceptable if we're on the very last // empty segment of a file with a trailing slash. // a/* should match a/b/ - var emptyFileEnd = (fi === fl - 1) && (file[fi] === "") + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') return emptyFileEnd } // should be unreachable. - throw new Error("wtf?") + throw new Error('wtf?') } - // replace stuff like \* with * function globUnescape (s) { - return s.replace(/\\(.)/g, "$1") + return s.replace(/\\(.)/g, '$1') } - function regExpEscape (s) { - return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') } - -})( typeof require === "function" ? require : null, - this, - typeof module === "object" ? module : null, - typeof process === "object" ? process.platform : "win32" - ) diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/.npmignore b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/.npmignore new file mode 100644 index 00000000000..249bc20eb55 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/.npmignore @@ -0,0 +1,2 @@ +node_modules +*.sw* diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/.travis.yml b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/.travis.yml new file mode 100644 index 00000000000..6e5919de39a --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "0.10" diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/README.md b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/README.md new file mode 100644 index 00000000000..62bc7bae3fe --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/README.md @@ -0,0 +1,121 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma seperated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## 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/deps/npm/node_modules/minimatch/node_modules/brace-expansion/example.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/example.js new file mode 100644 index 00000000000..60ecfc74d41 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/example.js @@ -0,0 +1,8 @@ +var expand = require('./'); + +console.log(expand('http://any.org/archive{1996..1999}/vol{1..4}/part{a,b,c}.html')); +console.log(expand('http://www.numericals.com/file{1..100..10}.txt')); +console.log(expand('http://www.letters.com/file{a..z..2}.txt')); +console.log(expand('mkdir /usr/local/src/bash/{old,new,dist,bugs}')); +console.log(expand('chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}')); + diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/index.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/index.js new file mode 100644 index 00000000000..a23104e9550 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/index.js @@ -0,0 +1,191 @@ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = /^(.*,)+(.+)?$/.test(m.body); + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} + diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore new file mode 100644 index 00000000000..fd4f2b066b3 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore @@ -0,0 +1,2 @@ +node_modules +.DS_Store diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml new file mode 100644 index 00000000000..cc4dba29d95 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile new file mode 100644 index 00000000000..fa5da71a6d0 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile @@ -0,0 +1,6 @@ + +test: + @node_modules/.bin/tape test/*.js + +.PHONY: test + diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md new file mode 100644 index 00000000000..2aff0ebff44 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md @@ -0,0 +1,80 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `` and ``. + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## 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/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js new file mode 100644 index 00000000000..c02ad348e69 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js @@ -0,0 +1,5 @@ +var balanced = require('./'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); + diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js new file mode 100644 index 00000000000..d165ae8174c --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js @@ -0,0 +1,38 @@ +module.exports = balanced; +function balanced(a, b, str) { + var bal = 0; + var m = {}; + var ended = false; + + for (var i = 0; i < str.length; i++) { + if (a == str.substr(i, a.length)) { + if (!('start' in m)) m.start = i; + bal++; + } + else if (b == str.substr(i, b.length) && 'start' in m) { + ended = true; + bal--; + if (!bal) { + m.end = i; + m.pre = str.substr(0, m.start); + m.body = (m.end - m.start > 1) + ? str.substring(m.start + a.length, m.end) + : ''; + m.post = str.slice(m.end + b.length); + return m; + } + } + } + + // if we opened more than we closed, find the one we closed + if (bal && ended) { + var start = m.start + a.length; + m = balanced(a, b, str.substr(start)); + if (m) { + m.start += start; + m.end += start; + m.pre = str.slice(0, start) + m.pre; + } + return m; + } +} diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json new file mode 100644 index 00000000000..ede6efefa07 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json @@ -0,0 +1,73 @@ +{ + "name": "balanced-match", + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "version": "0.2.0", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "main": "index.js", + "scripts": { + "test": "make test" + }, + "dependencies": {}, + "devDependencies": { + "tape": "~1.1.1" + }, + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "gitHead": "ba40ed78e7114a4a67c51da768a100184dead39c", + "bugs": { + "url": "https://github.com/juliangruber/balanced-match/issues" + }, + "_id": "balanced-match@0.2.0", + "_shasum": "38f6730c03aab6d5edbb52bd934885e756d71674", + "_from": "balanced-match@>=0.2.0 <0.3.0", + "_npmVersion": "2.1.8", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + "maintainers": [ + { + "name": "juliangruber", + "email": "julian@juliangruber.com" + } + ], + "dist": { + "shasum": "38f6730c03aab6d5edbb52bd934885e756d71674", + "tarball": "http://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js new file mode 100644 index 00000000000..36bfd399548 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js @@ -0,0 +1,56 @@ +var test = require('tape'); +var balanced = require('..'); + +test('balanced', function(t) { + t.deepEqual(balanced('{', '}', 'pre{in{nest}}post'), { + start: 3, + end: 12, + pre: 'pre', + body: 'in{nest}', + post: 'post' + }); + t.deepEqual(balanced('{', '}', '{{{{{{{{{in}post'), { + start: 8, + end: 11, + pre: '{{{{{{{{', + body: 'in', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre{body{in}post'), { + start: 8, + end: 11, + pre: 'pre{body', + body: 'in', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre}{in{nest}}post'), { + start: 4, + end: 13, + pre: 'pre}', + body: 'in{nest}', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre{body}between{body2}post'), { + start: 3, + end: 8, + pre: 'pre', + body: 'body', + post: 'between{body2}post' + }); + t.notOk(balanced('{', '}', 'nope'), 'should be notOk'); + t.deepEqual(balanced('', '', 'preinnestpost'), { + start: 3, + end: 19, + pre: 'pre', + body: 'innest', + post: 'post' + }); + t.deepEqual(balanced('', '', 'preinnestpost'), { + start: 7, + end: 23, + pre: 'pre', + body: 'innest', + post: 'post' + }); + t.end(); +}); diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml new file mode 100644 index 00000000000..f1d0f13c8a5 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE new file mode 100644 index 00000000000..ee27ba4b441 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +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/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown new file mode 100644 index 00000000000..408f70a1be4 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown @@ -0,0 +1,62 @@ +concat-map +========== + +Concatenative mapdashery. + +[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) + +[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) + +example +======= + +``` js +var concatMap = require('concat-map'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); +``` + +*** + +``` +[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] +``` + +methods +======= + +``` js +var concatMap = require('concat-map') +``` + +concatMap(xs, fn) +----------------- + +Return an array of concatenated elements by calling `fn(x, i)` for each element +`x` and each index `i` in the array `xs`. + +When `fn(x, i)` returns an array, its result will be concatenated with the +result array. If `fn(x, i)` returns anything else, that value will be pushed +onto the end of the result array. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install concat-map +``` + +license +======= + +MIT + +notes +===== + +This module was written while sitting high above the ground in a tree. diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js new file mode 100644 index 00000000000..33656217b61 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js @@ -0,0 +1,6 @@ +var concatMap = require('../'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js new file mode 100644 index 00000000000..b29a7812e50 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js @@ -0,0 +1,13 @@ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json new file mode 100644 index 00000000000..b516138098f --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json @@ -0,0 +1,83 @@ +{ + "name": "concat-map", + "description": "concatenative mapdashery", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "git://github.com/substack/node-concat-map.git" + }, + "main": "index.js", + "keywords": [ + "concat", + "concatMap", + "map", + "functional", + "higher-order" + ], + "directories": { + "example": "example", + "test": "test" + }, + "scripts": { + "test": "tape test/*.js" + }, + "devDependencies": { + "tape": "~2.4.0" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "testling": { + "files": "test/*.js", + "browsers": { + "ie": [ + 6, + 7, + 8, + 9 + ], + "ff": [ + 3.5, + 10, + 15 + ], + "chrome": [ + 10, + 22 + ], + "safari": [ + 5.1 + ], + "opera": [ + 12 + ] + } + }, + "bugs": { + "url": "https://github.com/substack/node-concat-map/issues" + }, + "homepage": "https://github.com/substack/node-concat-map", + "_id": "concat-map@0.0.1", + "dist": { + "shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", + "tarball": "http://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + }, + "_from": "concat-map@0.0.1", + "_npmVersion": "1.3.21", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "_shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", + "_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js new file mode 100644 index 00000000000..fdbd7022f6d --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js @@ -0,0 +1,39 @@ +var concatMap = require('../'); +var test = require('tape'); + +test('empty or not', function (t) { + var xs = [ 1, 2, 3, 4, 5, 6 ]; + var ixes = []; + var ys = concatMap(xs, function (x, ix) { + ixes.push(ix); + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; + }); + t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); + t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); + t.end(); +}); + +test('always something', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('scalars', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : x; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('undefs', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function () {}); + t.same(ys, [ undefined, undefined, undefined, undefined ]); + t.end(); +}); diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/package.json b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/package.json new file mode 100644 index 00000000000..5f1866c8b5a --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/package.json @@ -0,0 +1,75 @@ +{ + "name": "brace-expansion", + "description": "Brace expansion as known from sh/bash", + "version": "1.1.0", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "main": "index.js", + "scripts": { + "test": "tape test/*.js", + "gentest": "bash test/generate.sh" + }, + "dependencies": { + "balanced-match": "^0.2.0", + "concat-map": "0.0.1" + }, + "devDependencies": { + "tape": "^3.0.3" + }, + "keywords": [], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "gitHead": "b5fa3b1c74e5e2dba2d0efa19b28335641bc1164", + "bugs": { + "url": "https://github.com/juliangruber/brace-expansion/issues" + }, + "_id": "brace-expansion@1.1.0", + "_shasum": "c9b7d03c03f37bc704be100e522b40db8f6cfcd9", + "_from": "brace-expansion@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.10", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + "maintainers": [ + { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + { + "name": "isaacs", + "email": "isaacs@npmjs.com" + } + ], + "dist": { + "shasum": "c9b7d03c03f37bc704be100e522b40db8f6cfcd9", + "tarball": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js new file mode 100644 index 00000000000..5fe2b8ad48c --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js @@ -0,0 +1,32 @@ +var test = require('tape'); +var expand = require('..'); +var fs = require('fs'); +var resfile = __dirname + '/bash-results.txt'; +var cases = fs.readFileSync(resfile, 'utf8').split('><><><><'); + +// throw away the EOF marker +cases.pop() + +test('matches bash expansions', function(t) { + cases.forEach(function(testcase) { + var set = testcase.split('\n'); + var pattern = set.shift(); + var actual = expand(pattern); + + // If it expands to the empty string, then it's actually + // just nothing, but Bash is a singly typed language, so + // "nothing" is the same as "". + if (set.length === 1 && set[0] === '') { + set = [] + } else { + // otherwise, strip off the [] that were added so that + // "" expansions would be preserved properly. + set = set.map(function (s) { + return s.replace(/^\[|\]$/g, '') + }) + } + + t.same(actual, set, pattern); + }); + t.end(); +}) diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt new file mode 100644 index 00000000000..958148d26aa --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt @@ -0,0 +1,1075 @@ +A{b,{d,e},{f,g}}Z +[AbZ] +[AdZ] +[AeZ] +[AfZ] +[AgZ]><><><><><><><\{a,b}{{a,b},a,b} +[{a,b}a] +[{a,b}b] +[{a,b}a] +[{a,b}b]><><><><{{a,b} +[{a] +[{b]><><><><{a,b}} +[a}] +[b}]><><><><{,} +><><><><><><><{,}b +[b] +[b]><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><{-01..5} +[-01] +[000] +[001] +[002] +[003] +[004] +[005]><><><><{-05..100..5} +[-05] +[000] +[005] +[010] +[015] +[020] +[025] +[030] +[035] +[040] +[045] +[050] +[055] +[060] +[065] +[070] +[075] +[080] +[085] +[090] +[095] +[100]><><><><{-05..100} +[-05] +[-04] +[-03] +[-02] +[-01] +[000] +[001] +[002] +[003] +[004] +[005] +[006] +[007] +[008] +[009] +[010] +[011] +[012] +[013] +[014] +[015] +[016] +[017] +[018] +[019] +[020] +[021] +[022] +[023] +[024] +[025] +[026] +[027] +[028] +[029] +[030] +[031] +[032] +[033] +[034] +[035] +[036] +[037] +[038] +[039] +[040] +[041] +[042] +[043] +[044] +[045] +[046] +[047] +[048] +[049] +[050] +[051] +[052] +[053] +[054] +[055] +[056] +[057] +[058] +[059] +[060] +[061] +[062] +[063] +[064] +[065] +[066] +[067] +[068] +[069] +[070] +[071] +[072] +[073] +[074] +[075] +[076] +[077] +[078] +[079] +[080] +[081] +[082] +[083] +[084] +[085] +[086] +[087] +[088] +[089] +[090] +[091] +[092] +[093] +[094] +[095] +[096] +[097] +[098] +[099] +[100]><><><><{0..5..2} +[0] +[2] +[4]><><><><{0001..05..2} +[0001] +[0003] +[0005]><><><><{0001..-5..2} +[0001] +[-001] +[-003] +[-005]><><><><{0001..-5..-2} +[0001] +[-001] +[-003] +[-005]><><><><{0001..5..-2} +[0001] +[0003] +[0005]><><><><{01..5} +[01] +[02] +[03] +[04] +[05]><><><><{1..05} +[01] +[02] +[03] +[04] +[05]><><><><{1..05..3} +[01] +[04]><><><><{05..100} +[005] +[006] +[007] +[008] +[009] +[010] +[011] +[012] +[013] +[014] +[015] +[016] +[017] +[018] +[019] +[020] +[021] +[022] +[023] +[024] +[025] +[026] +[027] +[028] +[029] +[030] +[031] +[032] +[033] +[034] +[035] +[036] +[037] +[038] +[039] +[040] +[041] +[042] +[043] +[044] +[045] +[046] +[047] +[048] +[049] +[050] +[051] +[052] +[053] +[054] +[055] +[056] +[057] +[058] +[059] +[060] +[061] +[062] +[063] +[064] +[065] +[066] +[067] +[068] +[069] +[070] +[071] +[072] +[073] +[074] +[075] +[076] +[077] +[078] +[079] +[080] +[081] +[082] +[083] +[084] +[085] +[086] +[087] +[088] +[089] +[090] +[091] +[092] +[093] +[094] +[095] +[096] +[097] +[098] +[099] +[100]><><><><{0a..0z} +[{0a..0z}]><><><><{a,b\}c,d} +[a] +[b}c] +[d]><><><><{a,b{c,d} +[{a,bc] +[{a,bd]><><><><{a,b}c,d} +[ac,d}] +[bc,d}]><><><><{a..F} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F]><><><><{A..f} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a] +[b] +[c] +[d] +[e] +[f]><><><><{a..Z} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z]><><><><{A..z} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a] +[b] +[c] +[d] +[e] +[f] +[g] +[h] +[i] +[j] +[k] +[l] +[m] +[n] +[o] +[p] +[q] +[r] +[s] +[t] +[u] +[v] +[w] +[x] +[y] +[z]><><><><{z..A} +[z] +[y] +[x] +[w] +[v] +[u] +[t] +[s] +[r] +[q] +[p] +[o] +[n] +[m] +[l] +[k] +[j] +[i] +[h] +[g] +[f] +[e] +[d] +[c] +[b] +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F] +[E] +[D] +[C] +[B] +[A]><><><><{Z..a} +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a]><><><><{a..F..2} +[a] +[_] +[]] +[[] +[Y] +[W] +[U] +[S] +[Q] +[O] +[M] +[K] +[I] +[G]><><><><{A..f..02} +[A] +[C] +[E] +[G] +[I] +[K] +[M] +[O] +[Q] +[S] +[U] +[W] +[Y] +[[] +[]] +[_] +[a] +[c] +[e]><><><><{a..Z..5} +[a] +[]><><><><><><><{A..z..10} +[A] +[K] +[U] +[_] +[i] +[s]><><><><{z..A..-2} +[z] +[x] +[v] +[t] +[r] +[p] +[n] +[l] +[j] +[h] +[f] +[d] +[b] +[`] +[^] +[] +[Z] +[X] +[V] +[T] +[R] +[P] +[N] +[L] +[J] +[H] +[F] +[D] +[B]><><><><{Z..a..20} +[Z]><><><><{a{,b} +[{a] +[{ab]><><><><{a},b} +[a}] +[b]><><><><{x,y{,}g} +[x] +[yg] +[yg]><><><><{x,y{}g} +[x] +[y{}g]><><><><{{a,b} +[{a] +[{b]><><><><{{a,b},c} +[a] +[b] +[c]><><><><{{a,b}c} +[{ac}] +[{bc}]><><><><{{a,b},} +[a] +[b]><><><><><><><{{a,b},}c +[ac] +[bc] +[c]><><><><{{a,b}.} +[{a.}] +[{b.}]><><><><{{a,b}} +[{a}] +[{b}]><><><><><><>< +><><><><{-10..00} +[-10] +[-09] +[-08] +[-07] +[-06] +[-05] +[-04] +[-03] +[-02] +[-01] +[000]><><><><{a,\\{a,b}c} +[a] +[\ac] +[\bc]><><><><{a,\{a,b}c} +[ac}] +[{ac}] +[bc}]><><><><><><><{-10.\.00} +[{-10..00}]><><><><><><><><><><{l,n,m}xyz +[lxyz] +[nxyz] +[mxyz]><><><><{abc\,def} +[{abc,def}]><><><><{abc} +[{abc}]><><><><{x\,y,\{abc\},trie} +[x,y] +[{abc}] +[trie]><><><><{} +[{}]><><><><} +[}]><><><><{ +[{]><><><><><><><{1..10} +[1] +[2] +[3] +[4] +[5] +[6] +[7] +[8] +[9] +[10]><><><><{0..10,braces} +[0..10] +[braces]><><><><{{0..10},braces} +[0] +[1] +[2] +[3] +[4] +[5] +[6] +[7] +[8] +[9] +[10] +[braces]><><><><><><><{3..3} +[3]><><><><><><><{10..1} +[10] +[9] +[8] +[7] +[6] +[5] +[4] +[3] +[2] +[1]><><><><{10..1}y +[10y] +[9y] +[8y] +[7y] +[6y] +[5y] +[4y] +[3y] +[2y] +[1y]><><><><><><><{a..f} +[a] +[b] +[c] +[d] +[e] +[f]><><><><{f..a} +[f] +[e] +[d] +[c] +[b] +[a]><><><><{a..A} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F] +[E] +[D] +[C] +[B] +[A]><><><><{A..a} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a]><><><><{f..f} +[f]><><><><{1..f} +[{1..f}]><><><><{f..1} +[{f..1}]><><><><{-1..-10} +[-1] +[-2] +[-3] +[-4] +[-5] +[-6] +[-7] +[-8] +[-9] +[-10]><><><><{-20..0} +[-20] +[-19] +[-18] +[-17] +[-16] +[-15] +[-14] +[-13] +[-12] +[-11] +[-10] +[-9] +[-8] +[-7] +[-6] +[-5] +[-4] +[-3] +[-2] +[-1] +[0]><><><><><><><><><><{klklkl}{1,2,3} +[{klklkl}1] +[{klklkl}2] +[{klklkl}3]><><><><{1..10..2} +[1] +[3] +[5] +[7] +[9]><><><><{-1..-10..2} +[-1] +[-3] +[-5] +[-7] +[-9]><><><><{-1..-10..-2} +[-1] +[-3] +[-5] +[-7] +[-9]><><><><{10..1..-2} +[10] +[8] +[6] +[4] +[2]><><><><{10..1..2} +[10] +[8] +[6] +[4] +[2]><><><><{1..20..2} +[1] +[3] +[5] +[7] +[9] +[11] +[13] +[15] +[17] +[19]><><><><{1..20..20} +[1]><><><><{100..0..5} +[100] +[95] +[90] +[85] +[80] +[75] +[70] +[65] +[60] +[55] +[50] +[45] +[40] +[35] +[30] +[25] +[20] +[15] +[10] +[5] +[0]><><><><{100..0..-5} +[100] +[95] +[90] +[85] +[80] +[75] +[70] +[65] +[60] +[55] +[50] +[45] +[40] +[35] +[30] +[25] +[20] +[15] +[10] +[5] +[0]><><><><{a..z} +[a] +[b] +[c] +[d] +[e] +[f] +[g] +[h] +[i] +[j] +[k] +[l] +[m] +[n] +[o] +[p] +[q] +[r] +[s] +[t] +[u] +[v] +[w] +[x] +[y] +[z]><><><><{a..z..2} +[a] +[c] +[e] +[g] +[i] +[k] +[m] +[o] +[q] +[s] +[u] +[w] +[y]><><><><{z..a..-2} +[z] +[x] +[v] +[t] +[r] +[p] +[n] +[l] +[j] +[h] +[f] +[d] +[b]><><><><{2147483645..2147483649} +[2147483645] +[2147483646] +[2147483647] +[2147483648] +[2147483649]><><><><{10..0..2} +[10] +[8] +[6] +[4] +[2] +[0]><><><><{10..0..-2} +[10] +[8] +[6] +[4] +[2] +[0]><><><><{-50..-0..5} +[-50] +[-45] +[-40] +[-35] +[-30] +[-25] +[-20] +[-15] +[-10] +[-5] +[0]><><><><{1..10.f} +[{1..10.f}]><><><><{1..ff} +[{1..ff}]><><><><{1..10..ff} +[{1..10..ff}]><><><><{1.20..2} +[{1.20..2}]><><><><{1..20..f2} +[{1..20..f2}]><><><><{1..20..2f} +[{1..20..2f}]><><><><{1..2f..2} +[{1..2f..2}]><><><><{1..ff..2} +[{1..ff..2}]><><><><{1..ff} +[{1..ff}]><><><><{1..f} +[{1..f}]><><><><{1..0f} +[{1..0f}]><><><><{1..10f} +[{1..10f}]><><><><{1..10.f} +[{1..10.f}]><><><><{1..10.f} +[{1..10.f}]><><><>< \ No newline at end of file diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt new file mode 100644 index 00000000000..e5161c3da86 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt @@ -0,0 +1,182 @@ +# skip quotes for now +# "{x,x}" +# {"x,x"} +# {x","x} +# '{a,b}{{a,b},a,b}' +A{b,{d,e},{f,g}}Z +PRE-{a,b}{{a,b},a,b}-POST +\\{a,b}{{a,b},a,b} +{{a,b} +{a,b}} +{,} +a{,} +{,}b +a{,}b +a{b}c +a{1..5}b +a{01..5}b +a{-01..5}b +a{-01..5..3}b +a{001..9}b +a{b,c{d,e},{f,g}h}x{y,z +a{b,c{d,e},{f,g}h}x{y,z\\} +a{b,c{d,e},{f,g}h}x{y,z} +a{b{c{d,e}f{x,y{{g}h +a{b{c{d,e}f{x,y{}g}h +a{b{c{d,e}f{x,y}}g}h +a{b{c{d,e}f}g}h +a{{x,y},z}b +f{x,y{g,z}}h +f{x,y{{g,z}}h +f{x,y{{g,z}}h} +f{x,y{{g}h +f{x,y{{g}}h +f{x,y{}g}h +z{a,b{,c}d +z{a,b},c}d +{-01..5} +{-05..100..5} +{-05..100} +{0..5..2} +{0001..05..2} +{0001..-5..2} +{0001..-5..-2} +{0001..5..-2} +{01..5} +{1..05} +{1..05..3} +{05..100} +{0a..0z} +{a,b\\}c,d} +{a,b{c,d} +{a,b}c,d} +{a..F} +{A..f} +{a..Z} +{A..z} +{z..A} +{Z..a} +{a..F..2} +{A..f..02} +{a..Z..5} +d{a..Z..5}b +{A..z..10} +{z..A..-2} +{Z..a..20} +{a{,b} +{a},b} +{x,y{,}g} +{x,y{}g} +{{a,b} +{{a,b},c} +{{a,b}c} +{{a,b},} +X{{a,b},}X +{{a,b},}c +{{a,b}.} +{{a,b}} +X{a..#}X +# this next one is an empty string + +{-10..00} +# Need to escape slashes in here for reasons i guess. +{a,\\\\{a,b}c} +{a,\\{a,b}c} +a,\\{b,c} +{-10.\\.00} +#### bash tests/braces.tests +# Note that some tests are edited out because some features of +# bash are intentionally not supported in this brace expander. +ff{c,b,a} +f{d,e,f}g +{l,n,m}xyz +{abc\\,def} +{abc} +{x\\,y,\\{abc\\},trie} +# not impementing back-ticks obviously +# XXXX\\{`echo a b c | tr ' ' ','`\\} +{} +# We only ever have to worry about parsing a single argument, +# not a command line, so spaces have a different meaning than bash. +# { } +} +{ +abcd{efgh +# spaces +# foo {1,2} bar +# not impementing back-ticks obviously +# `zecho foo {1,2} bar` +# $(zecho foo {1,2} bar) +# ${var} is not a variable here, like it is in bash. omit. +# foo{bar,${var}.} +# foo{bar,${var}} +# isaacs: skip quotes for now +# "${var}"{x,y} +# $var{x,y} +# ${var}{x,y} +# new sequence brace operators +{1..10} +# this doesn't work yet +{0..10,braces} +# but this does +{{0..10},braces} +x{{0..10},braces}y +{3..3} +x{3..3}y +{10..1} +{10..1}y +x{10..1}y +{a..f} +{f..a} +{a..A} +{A..a} +{f..f} +# mixes are incorrectly-formed brace expansions +{1..f} +{f..1} +# spaces +# 0{1..9} {10..20} +# do negative numbers work? +{-1..-10} +{-20..0} +# weirdly-formed brace expansions -- fixed in post-bash-3.1 +a-{b{d,e}}-c +a-{bdef-{g,i}-c +# isaacs: skip quotes for now +# {"klklkl"}{1,2,3} +# isaacs: this is a valid test, though +{klklkl}{1,2,3} +# {"x,x"} +{1..10..2} +{-1..-10..2} +{-1..-10..-2} +{10..1..-2} +{10..1..2} +{1..20..2} +{1..20..20} +{100..0..5} +{100..0..-5} +{a..z} +{a..z..2} +{z..a..-2} +# make sure brace expansion handles ints > 2**31 - 1 using intmax_t +{2147483645..2147483649} +# unwanted zero-padding -- fixed post-bash-4.0 +{10..0..2} +{10..0..-2} +{-50..-0..5} +# bad +{1..10.f} +{1..ff} +{1..10..ff} +{1.20..2} +{1..20..f2} +{1..20..2f} +{1..2f..2} +{1..ff..2} +{1..ff} +{1..f} +{1..0f} +{1..10f} +{1..10.f} +{1..10.f} diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js new file mode 100644 index 00000000000..3fcc185a7d6 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js @@ -0,0 +1,9 @@ +var test = require('tape'); +var expand = require('..'); + +test('ignores ${', function(t) { + t.deepEqual(expand('${1..3}'), ['${1..3}']); + t.deepEqual(expand('${a,b}${c,d}'), ['${a,b}${c,d}']); + t.deepEqual(expand('x${a,b}x${c,d}x'), ['x${a,b}x${c,d}x']); + t.end(); +}); diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js new file mode 100644 index 00000000000..e429121eab8 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js @@ -0,0 +1,10 @@ +var test = require('tape'); +var expand = require('..'); + +test('empty option', function(t) { + t.deepEqual(expand('-v{,,,,}'), [ + '-v', '-v', '-v', '-v', '-v' + ]); + t.end(); +}); + diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh new file mode 100644 index 00000000000..e040e664d9f --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -e + +# Bash 4.3 because of arbitrary need to pick a single standard. + +if [ "${BASH_VERSINFO[0]}" != "4" ] || [ "${BASH_VERSINFO[1]}" != "3" ]; then + echo "this script requires bash 4.3" >&2 + exit 1 +fi + +CDPATH= cd "$(dirname "$0")" + +js='require("./")(process.argv[1]).join(" ")' + +cat cases.txt | \ + while read case; do + if [ "${case:0:1}" = "#" ]; then + continue; + fi; + b="$($BASH -c 'for c in '"$case"'; do echo ["$c"]; done')" + echo "$case" + echo -n "$b><><><><"; + done > bash-results.txt diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js new file mode 100644 index 00000000000..8d434c23d45 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js @@ -0,0 +1,15 @@ +var test = require('tape'); +var expand = require('..'); + +test('negative increment', function(t) { + t.deepEqual(expand('{3..1}'), ['3', '2', '1']); + t.deepEqual(expand('{10..8}'), ['10', '9', '8']); + t.deepEqual(expand('{10..08}'), ['10', '09', '08']); + t.deepEqual(expand('{c..a}'), ['c', 'b', 'a']); + + t.deepEqual(expand('{4..0..2}'), ['4', '2', '0']); + t.deepEqual(expand('{4..0..-2}'), ['4', '2', '0']); + t.deepEqual(expand('{e..a..2}'), ['e', 'c', 'a']); + + t.end(); +}); diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/nested.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/nested.js new file mode 100644 index 00000000000..0862dc51f90 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/nested.js @@ -0,0 +1,16 @@ +var test = require('tape'); +var expand = require('..'); + +test('nested', function(t) { + t.deepEqual(expand('{a,b{1..3},c}'), [ + 'a', 'b1', 'b2', 'b3', 'c' + ]); + t.deepEqual(expand('{{A..Z},{a..z}}'), + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('') + ); + t.deepEqual(expand('ppp{,config,oe{,conf}}'), [ + 'ppp', 'pppconfig', 'pppoe', 'pppoeconf' + ]); + t.end(); +}); + diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/order.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/order.js new file mode 100644 index 00000000000..c00ad155fe6 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/order.js @@ -0,0 +1,10 @@ +var test = require('tape'); +var expand = require('..'); + +test('order', function(t) { + t.deepEqual(expand('a{d,c,b}e'), [ + 'ade', 'ace', 'abe' + ]); + t.end(); +}); + diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/pad.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/pad.js new file mode 100644 index 00000000000..e4158775f1b --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/pad.js @@ -0,0 +1,13 @@ +var test = require('tape'); +var expand = require('..'); + +test('pad', function(t) { + t.deepEqual(expand('{9..11}'), [ + '9', '10', '11' + ]); + t.deepEqual(expand('{09..11}'), [ + '09', '10', '11' + ]); + t.end(); +}); + diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js new file mode 100644 index 00000000000..3038fba7416 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js @@ -0,0 +1,7 @@ +var test = require('tape'); +var expand = require('..'); + +test('x and y of same type', function(t) { + t.deepEqual(expand('{a..9}'), ['{a..9}']); + t.end(); +}); diff --git a/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js new file mode 100644 index 00000000000..f73a9579ab3 --- /dev/null +++ b/deps/npm/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js @@ -0,0 +1,50 @@ +var test = require('tape'); +var expand = require('..'); + +test('numeric sequences', function(t) { + t.deepEqual(expand('a{1..2}b{2..3}c'), [ + 'a1b2c', 'a1b3c', 'a2b2c', 'a2b3c' + ]); + t.deepEqual(expand('{1..2}{2..3}'), [ + '12', '13', '22', '23' + ]); + t.end(); +}); + +test('numeric sequences with step count', function(t) { + t.deepEqual(expand('{0..8..2}'), [ + '0', '2', '4', '6', '8' + ]); + t.deepEqual(expand('{1..8..2}'), [ + '1', '3', '5', '7' + ]); + t.end(); +}); + +test('numeric sequence with negative x / y', function(t) { + t.deepEqual(expand('{3..-2}'), [ + '3', '2', '1', '0', '-1', '-2' + ]); + t.end(); +}); + +test('alphabetic sequences', function(t) { + t.deepEqual(expand('1{a..b}2{b..c}3'), [ + '1a2b3', '1a2c3', '1b2b3', '1b2c3' + ]); + t.deepEqual(expand('{a..b}{b..c}'), [ + 'ab', 'ac', 'bb', 'bc' + ]); + t.end(); +}); + +test('alphabetic sequences with step count', function(t) { + t.deepEqual(expand('{a..k..2}'), [ + 'a', 'c', 'e', 'g', 'i', 'k' + ]); + t.deepEqual(expand('{b..k..2}'), [ + 'b', 'd', 'f', 'h', 'j' + ]); + t.end(); +}); + diff --git a/deps/npm/node_modules/minimatch/node_modules/sigmund/LICENSE b/deps/npm/node_modules/minimatch/node_modules/sigmund/LICENSE deleted file mode 100644 index 0c44ae716db..00000000000 --- a/deps/npm/node_modules/minimatch/node_modules/sigmund/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) Isaac Z. Schlueter ("Author") -All rights reserved. - -The BSD License - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/deps/npm/node_modules/minimatch/node_modules/sigmund/README.md b/deps/npm/node_modules/minimatch/node_modules/sigmund/README.md deleted file mode 100644 index 7e365129e41..00000000000 --- a/deps/npm/node_modules/minimatch/node_modules/sigmund/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# sigmund - -Quick and dirty signatures for Objects. - -This is like a much faster `deepEquals` comparison, which returns a -string key suitable for caches and the like. - -## Usage - -```javascript -function doSomething (someObj) { - var key = sigmund(someObj, maxDepth) // max depth defaults to 10 - var cached = cache.get(key) - if (cached) return cached) - - var result = expensiveCalculation(someObj) - cache.set(key, result) - return result -} -``` - -The resulting key will be as unique and reproducible as calling -`JSON.stringify` or `util.inspect` on the object, but is much faster. -In order to achieve this speed, some differences are glossed over. -For example, the object `{0:'foo'}` will be treated identically to the -array `['foo']`. - -Also, just as there is no way to summon the soul from the scribblings -of a cocain-addled psychoanalyst, there is no way to revive the object -from the signature string that sigmund gives you. In fact, it's -barely even readable. - -As with `sys.inspect` and `JSON.stringify`, larger objects will -produce larger signature strings. - -Because sigmund is a bit less strict than the more thorough -alternatives, the strings will be shorter, and also there is a -slightly higher chance for collisions. For example, these objects -have the same signature: - - var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]} - var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']} - -Like a good Freudian, sigmund is most effective when you already have -some understanding of what you're looking for. It can help you help -yourself, but you must be willing to do some work as well. - -Cycles are handled, and cyclical objects are silently omitted (though -the key is included in the signature output.) - -The second argument is the maximum depth, which defaults to 10, -because that is the maximum object traversal depth covered by most -insurance carriers. diff --git a/deps/npm/node_modules/minimatch/node_modules/sigmund/package.json b/deps/npm/node_modules/minimatch/node_modules/sigmund/package.json deleted file mode 100644 index a1f755a7c75..00000000000 --- a/deps/npm/node_modules/minimatch/node_modules/sigmund/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "sigmund", - "version": "1.0.0", - "description": "Quick and dirty signatures for Objects.", - "main": "sigmund.js", - "directories": { - "test": "test" - }, - "dependencies": {}, - "devDependencies": { - "tap": "~0.3.0" - }, - "scripts": { - "test": "tap test/*.js", - "bench": "node bench.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/isaacs/sigmund" - }, - "keywords": [ - "object", - "signature", - "key", - "data", - "psychoanalysis" - ], - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "license": "BSD", - "readme": "# sigmund\n\nQuick and dirty signatures for Objects.\n\nThis is like a much faster `deepEquals` comparison, which returns a\nstring key suitable for caches and the like.\n\n## Usage\n\n```javascript\nfunction doSomething (someObj) {\n var key = sigmund(someObj, maxDepth) // max depth defaults to 10\n var cached = cache.get(key)\n if (cached) return cached)\n\n var result = expensiveCalculation(someObj)\n cache.set(key, result)\n return result\n}\n```\n\nThe resulting key will be as unique and reproducible as calling\n`JSON.stringify` or `util.inspect` on the object, but is much faster.\nIn order to achieve this speed, some differences are glossed over.\nFor example, the object `{0:'foo'}` will be treated identically to the\narray `['foo']`.\n\nAlso, just as there is no way to summon the soul from the scribblings\nof a cocain-addled psychoanalyst, there is no way to revive the object\nfrom the signature string that sigmund gives you. In fact, it's\nbarely even readable.\n\nAs with `sys.inspect` and `JSON.stringify`, larger objects will\nproduce larger signature strings.\n\nBecause sigmund is a bit less strict than the more thorough\nalternatives, the strings will be shorter, and also there is a\nslightly higher chance for collisions. For example, these objects\nhave the same signature:\n\n var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]}\n var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']}\n\nLike a good Freudian, sigmund is most effective when you already have\nsome understanding of what you're looking for. It can help you help\nyourself, but you must be willing to do some work as well.\n\nCycles are handled, and cyclical objects are silently omitted (though\nthe key is included in the signature output.)\n\nThe second argument is the maximum depth, which defaults to 10,\nbecause that is the maximum object traversal depth covered by most\ninsurance carriers.\n", - "_id": "sigmund@1.0.0", - "dist": { - "shasum": "66a2b3a749ae8b5fb89efd4fcc01dc94fbe02296", - "tarball": "http://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz" - }, - "_npmVersion": "1.1.48", - "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - } - ], - "_shasum": "66a2b3a749ae8b5fb89efd4fcc01dc94fbe02296", - "_from": "sigmund@~1.0.0", - "_resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz", - "bugs": { - "url": "https://github.com/isaacs/sigmund/issues" - }, - "homepage": "https://github.com/isaacs/sigmund" -} diff --git a/deps/npm/node_modules/minimatch/package.json b/deps/npm/node_modules/minimatch/package.json index d96e1d36fc7..2cacae2109e 100644 --- a/deps/npm/node_modules/minimatch/package.json +++ b/deps/npm/node_modules/minimatch/package.json @@ -6,41 +6,50 @@ }, "name": "minimatch", "description": "a glob matcher in javascript", - "version": "1.0.0", + "version": "2.0.8", "repository": { "type": "git", "url": "git://github.com/isaacs/minimatch.git" }, "main": "minimatch.js", "scripts": { - "test": "tap test/*.js" + "pretest": "standard minimatch.js test/*.js", + "test": "tap test/*.js", + "prepublish": "browserify -o browser.js -e minimatch.js --bare" }, "engines": { "node": "*" }, "dependencies": { - "lru-cache": "2", - "sigmund": "~1.0.0" + "brace-expansion": "^1.0.0" }, "devDependencies": { + "browserify": "^9.0.3", + "standard": "^3.7.2", "tap": "" }, - "license": { - "type": "MIT", - "url": "http://github.com/isaacs/minimatch/raw/master/LICENSE" - }, - "gitHead": "b374a643976eb55cdc19c60b6dd51ebe9bcc607a", + "license": "ISC", + "files": [ + "minimatch.js", + "browser.js" + ], + "gitHead": "0bc7d9c4b2bc816502184862b45bd090de3406a3", "bugs": { "url": "https://github.com/isaacs/minimatch/issues" }, - "homepage": "https://github.com/isaacs/minimatch", - "_id": "minimatch@1.0.0", - "_shasum": "e0dd2120b49e1b724ce8d714c520822a9438576d", - "_from": "minimatch@latest", - "_npmVersion": "1.4.21", + "homepage": "https://github.com/isaacs/minimatch#readme", + "_id": "minimatch@2.0.8", + "_shasum": "0bc20f6bf3570a698ef0ddff902063c6cabda6bf", + "_from": "minimatch@>=2.0.8 <2.1.0", + "_npmVersion": "2.10.0", + "_nodeVersion": "2.0.1", "_npmUser": { "name": "isaacs", - "email": "i@izs.me" + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "0bc20f6bf3570a698ef0ddff902063c6cabda6bf", + "tarball": "http://registry.npmjs.org/minimatch/-/minimatch-2.0.8.tgz" }, "maintainers": [ { @@ -48,11 +57,7 @@ "email": "i@izs.me" } ], - "dist": { - "shasum": "e0dd2120b49e1b724ce8d714c520822a9438576d", - "tarball": "http://registry.npmjs.org/minimatch/-/minimatch-1.0.0.tgz" - }, "directories": {}, - "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-1.0.0.tgz", + "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.8.tgz", "readme": "ERROR: No README data found!" } diff --git a/deps/npm/node_modules/mkdirp/.npmignore b/deps/npm/node_modules/mkdirp/.npmignore deleted file mode 100644 index 9303c347ee6..00000000000 --- a/deps/npm/node_modules/mkdirp/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -npm-debug.log \ No newline at end of file diff --git a/deps/npm/node_modules/mkdirp/.travis.yml b/deps/npm/node_modules/mkdirp/.travis.yml index c693a939df9..74c57bf15e2 100644 --- a/deps/npm/node_modules/mkdirp/.travis.yml +++ b/deps/npm/node_modules/mkdirp/.travis.yml @@ -1,5 +1,8 @@ language: node_js node_js: - - 0.6 - - 0.8 + - "0.8" - "0.10" + - "0.12" + - "iojs" +before_install: + - npm install -g npm@~1.4.6 diff --git a/deps/npm/node_modules/mkdirp/index.js b/deps/npm/node_modules/mkdirp/index.js index a1742b20694..6ce241b58c1 100644 --- a/deps/npm/node_modules/mkdirp/index.js +++ b/deps/npm/node_modules/mkdirp/index.js @@ -1,5 +1,6 @@ var path = require('path'); var fs = require('fs'); +var _0777 = parseInt('0777', 8); module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; @@ -16,7 +17,7 @@ function mkdirP (p, opts, f, made) { var xfs = opts.fs || fs; if (mode === undefined) { - mode = 0777 & (~process.umask()); + mode = _0777 & (~process.umask()); } if (!made) made = null; @@ -60,7 +61,7 @@ mkdirP.sync = function sync (p, opts, made) { var xfs = opts.fs || fs; if (mode === undefined) { - mode = 0777 & (~process.umask()); + mode = _0777 & (~process.umask()); } if (!made) made = null; diff --git a/deps/npm/node_modules/mkdirp/node_modules/minimist/package.json b/deps/npm/node_modules/mkdirp/node_modules/minimist/package.json index 09e9ec44107..7cd80f4f41a 100644 --- a/deps/npm/node_modules/mkdirp/node_modules/minimist/package.json +++ b/deps/npm/node_modules/mkdirp/node_modules/minimist/package.json @@ -62,6 +62,5 @@ ], "directories": {}, "_shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d", - "_resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "readme": "ERROR: No README data found!" + "_resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz" } diff --git a/deps/npm/node_modules/mkdirp/package.json b/deps/npm/node_modules/mkdirp/package.json index adb67f6a671..24411034800 100644 --- a/deps/npm/node_modules/mkdirp/package.json +++ b/deps/npm/node_modules/mkdirp/package.json @@ -1,20 +1,20 @@ { "name": "mkdirp", "description": "Recursively mkdir, like `mkdir -p`", - "version": "0.5.0", + "version": "0.5.1", "author": { "name": "James Halliday", "email": "mail@substack.net", "url": "http://substack.net" }, - "main": "./index", + "main": "index.js", "keywords": [ "mkdir", "directory" ], "repository": { "type": "git", - "url": "https://github.com/substack/node-mkdirp.git" + "url": "git+https://github.com/substack/node-mkdirp.git" }, "scripts": { "test": "tap test/*.js" @@ -23,27 +23,30 @@ "minimist": "0.0.8" }, "devDependencies": { - "tap": "~0.4.0", - "mock-fs": "~2.2.0" + "tap": "1", + "mock-fs": "2 >=2.7.0" }, "bin": { "mkdirp": "bin/cmd.js" }, "license": "MIT", + "gitHead": "d4eff0f06093aed4f387e88e9fc301cb76beedc7", "bugs": { "url": "https://github.com/substack/node-mkdirp/issues" }, - "homepage": "https://github.com/substack/node-mkdirp", - "_id": "mkdirp@0.5.0", - "dist": { - "shasum": "1d73076a6df986cd9344e15e71fcc05a4c9abf12", - "tarball": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz" - }, - "_from": "mkdirp@latest", - "_npmVersion": "1.4.3", + "homepage": "https://github.com/substack/node-mkdirp#readme", + "_id": "mkdirp@0.5.1", + "_shasum": "30057438eac6cf7f8c4767f38648d6697d75c903", + "_from": "mkdirp@>=0.5.1 <0.6.0", + "_npmVersion": "2.9.0", + "_nodeVersion": "2.0.0", "_npmUser": { "name": "substack", - "email": "mail@substack.net" + "email": "substack@gmail.com" + }, + "dist": { + "shasum": "30057438eac6cf7f8c4767f38648d6697d75c903", + "tarball": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz" }, "maintainers": [ { @@ -52,7 +55,5 @@ } ], "directories": {}, - "_shasum": "1d73076a6df986cd9344e15e71fcc05a4c9abf12", - "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz", - "readme": "ERROR: No README data found!" + "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz" } diff --git a/deps/npm/node_modules/mkdirp/test/chmod.js b/deps/npm/node_modules/mkdirp/test/chmod.js index 520dcb8e9b5..6a404b932f9 100644 --- a/deps/npm/node_modules/mkdirp/test/chmod.js +++ b/deps/npm/node_modules/mkdirp/test/chmod.js @@ -2,6 +2,9 @@ var mkdirp = require('../').mkdirp; var path = require('path'); var fs = require('fs'); var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); +var _0744 = parseInt('0744', 8); var ps = [ '', 'tmp' ]; @@ -13,20 +16,20 @@ for (var i = 0; i < 25; i++) { var file = ps.join('/'); test('chmod-pre', function (t) { - var mode = 0744 + var mode = _0744 mkdirp(file, mode, function (er) { t.ifError(er, 'should not error'); fs.stat(file, function (er, stat) { t.ifError(er, 'should exist'); t.ok(stat && stat.isDirectory(), 'should be directory'); - t.equal(stat && stat.mode & 0777, mode, 'should be 0744'); + t.equal(stat && stat.mode & _0777, mode, 'should be 0744'); t.end(); }); }); }); test('chmod', function (t) { - var mode = 0755 + var mode = _0755 mkdirp(file, mode, function (er) { t.ifError(er, 'should not error'); fs.stat(file, function (er, stat) { diff --git a/deps/npm/node_modules/mkdirp/test/clobber.js b/deps/npm/node_modules/mkdirp/test/clobber.js index 0eb70998700..2433b9ad548 100644 --- a/deps/npm/node_modules/mkdirp/test/clobber.js +++ b/deps/npm/node_modules/mkdirp/test/clobber.js @@ -2,6 +2,7 @@ var mkdirp = require('../').mkdirp; var path = require('path'); var fs = require('fs'); var test = require('tap').test; +var _0755 = parseInt('0755', 8); var ps = [ '', 'tmp' ]; @@ -29,7 +30,7 @@ test('clobber-pre', function (t) { test('clobber', function (t) { t.plan(2); - mkdirp(file, 0755, function (err) { + mkdirp(file, _0755, function (err) { t.ok(err); t.equal(err.code, 'ENOTDIR'); t.end(); diff --git a/deps/npm/node_modules/mkdirp/test/mkdirp.js b/deps/npm/node_modules/mkdirp/test/mkdirp.js index 3b624ddbeb0..eaa8921c7f1 100644 --- a/deps/npm/node_modules/mkdirp/test/mkdirp.js +++ b/deps/npm/node_modules/mkdirp/test/mkdirp.js @@ -3,6 +3,8 @@ var path = require('path'); var fs = require('fs'); var exists = fs.exists || path.exists; var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); test('woo', function (t) { t.plan(5); @@ -12,13 +14,13 @@ test('woo', function (t) { var file = '/tmp/' + [x,y,z].join('/'); - mkdirp(file, 0755, function (err) { + mkdirp(file, _0755, function (err) { t.ifError(err); exists(file, function (ex) { t.ok(ex, 'file created'); fs.stat(file, function (err, stat) { t.ifError(err); - t.equal(stat.mode & 0777, 0755); + t.equal(stat.mode & _0777, _0755); t.ok(stat.isDirectory(), 'target not a directory'); }) }) diff --git a/deps/npm/node_modules/mkdirp/test/opts_fs.js b/deps/npm/node_modules/mkdirp/test/opts_fs.js index f1fbeca146d..97186b62e0b 100644 --- a/deps/npm/node_modules/mkdirp/test/opts_fs.js +++ b/deps/npm/node_modules/mkdirp/test/opts_fs.js @@ -2,6 +2,8 @@ var mkdirp = require('../'); var path = require('path'); var test = require('tap').test; var mockfs = require('mock-fs'); +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); test('opts.fs', function (t) { t.plan(5); @@ -13,13 +15,13 @@ test('opts.fs', function (t) { var file = '/beep/boop/' + [x,y,z].join('/'); var xfs = mockfs.fs(); - mkdirp(file, { fs: xfs, mode: 0755 }, function (err) { + mkdirp(file, { fs: xfs, mode: _0755 }, function (err) { t.ifError(err); xfs.exists(file, function (ex) { t.ok(ex, 'created file'); xfs.stat(file, function (err, stat) { t.ifError(err); - t.equal(stat.mode & 0777, 0755); + t.equal(stat.mode & _0777, _0755); t.ok(stat.isDirectory(), 'target not a directory'); }); }); diff --git a/deps/npm/node_modules/mkdirp/test/opts_fs_sync.js b/deps/npm/node_modules/mkdirp/test/opts_fs_sync.js index 224b50642fe..6c370aa6e93 100644 --- a/deps/npm/node_modules/mkdirp/test/opts_fs_sync.js +++ b/deps/npm/node_modules/mkdirp/test/opts_fs_sync.js @@ -2,6 +2,8 @@ var mkdirp = require('../'); var path = require('path'); var test = require('tap').test; var mockfs = require('mock-fs'); +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); test('opts.fs sync', function (t) { t.plan(4); @@ -13,12 +15,12 @@ test('opts.fs sync', function (t) { var file = '/beep/boop/' + [x,y,z].join('/'); var xfs = mockfs.fs(); - mkdirp.sync(file, { fs: xfs, mode: 0755 }); + mkdirp.sync(file, { fs: xfs, mode: _0755 }); xfs.exists(file, function (ex) { t.ok(ex, 'created file'); xfs.stat(file, function (err, stat) { t.ifError(err); - t.equal(stat.mode & 0777, 0755); + t.equal(stat.mode & _0777, _0755); t.ok(stat.isDirectory(), 'target not a directory'); }); }); diff --git a/deps/npm/node_modules/mkdirp/test/perm.js b/deps/npm/node_modules/mkdirp/test/perm.js index 2c975905204..fbce44b82ba 100644 --- a/deps/npm/node_modules/mkdirp/test/perm.js +++ b/deps/npm/node_modules/mkdirp/test/perm.js @@ -3,18 +3,20 @@ var path = require('path'); var fs = require('fs'); var exists = fs.exists || path.exists; var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); test('async perm', function (t) { t.plan(5); var file = '/tmp/' + (Math.random() * (1<<30)).toString(16); - mkdirp(file, 0755, function (err) { + mkdirp(file, _0755, function (err) { t.ifError(err); exists(file, function (ex) { t.ok(ex, 'file created'); fs.stat(file, function (err, stat) { t.ifError(err); - t.equal(stat.mode & 0777, 0755); + t.equal(stat.mode & _0777, _0755); t.ok(stat.isDirectory(), 'target not a directory'); }) }) @@ -22,7 +24,7 @@ test('async perm', function (t) { }); test('async root perm', function (t) { - mkdirp('/tmp', 0755, function (err) { + mkdirp('/tmp', _0755, function (err) { if (err) t.fail(err); t.end(); }); diff --git a/deps/npm/node_modules/mkdirp/test/perm_sync.js b/deps/npm/node_modules/mkdirp/test/perm_sync.js index 327e54b2e95..398229fe54a 100644 --- a/deps/npm/node_modules/mkdirp/test/perm_sync.js +++ b/deps/npm/node_modules/mkdirp/test/perm_sync.js @@ -3,17 +3,19 @@ var path = require('path'); var fs = require('fs'); var exists = fs.exists || path.exists; var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); test('sync perm', function (t) { t.plan(4); var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json'; - mkdirp.sync(file, 0755); + mkdirp.sync(file, _0755); exists(file, function (ex) { t.ok(ex, 'file created'); fs.stat(file, function (err, stat) { t.ifError(err); - t.equal(stat.mode & 0777, 0755); + t.equal(stat.mode & _0777, _0755); t.ok(stat.isDirectory(), 'target not a directory'); }); }); @@ -23,7 +25,7 @@ test('sync root perm', function (t) { t.plan(3); var file = '/tmp'; - mkdirp.sync(file, 0755); + mkdirp.sync(file, _0755); exists(file, function (ex) { t.ok(ex, 'file created'); fs.stat(file, function (err, stat) { diff --git a/deps/npm/node_modules/mkdirp/test/race.js b/deps/npm/node_modules/mkdirp/test/race.js index 7c295f410de..b0b9e183c90 100644 --- a/deps/npm/node_modules/mkdirp/test/race.js +++ b/deps/npm/node_modules/mkdirp/test/race.js @@ -3,9 +3,11 @@ var path = require('path'); var fs = require('fs'); var exists = fs.exists || path.exists; var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); test('race', function (t) { - t.plan(6); + t.plan(10); var ps = [ '', 'tmp' ]; for (var i = 0; i < 25; i++) { @@ -15,24 +17,19 @@ test('race', function (t) { var file = ps.join('/'); var res = 2; - mk(file, function () { - if (--res === 0) t.end(); - }); + mk(file); - mk(file, function () { - if (--res === 0) t.end(); - }); + mk(file); function mk (file, cb) { - mkdirp(file, 0755, function (err) { + mkdirp(file, _0755, function (err) { t.ifError(err); exists(file, function (ex) { t.ok(ex, 'file created'); fs.stat(file, function (err, stat) { t.ifError(err); - t.equal(stat.mode & 0777, 0755); + t.equal(stat.mode & _0777, _0755); t.ok(stat.isDirectory(), 'target not a directory'); - if (cb) cb(); }); }) }); diff --git a/deps/npm/node_modules/mkdirp/test/rel.js b/deps/npm/node_modules/mkdirp/test/rel.js index d1f175c2406..4ddb34276a7 100644 --- a/deps/npm/node_modules/mkdirp/test/rel.js +++ b/deps/npm/node_modules/mkdirp/test/rel.js @@ -3,6 +3,8 @@ var path = require('path'); var fs = require('fs'); var exists = fs.exists || path.exists; var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); test('rel', function (t) { t.plan(5); @@ -15,14 +17,14 @@ test('rel', function (t) { var file = [x,y,z].join('/'); - mkdirp(file, 0755, function (err) { + mkdirp(file, _0755, function (err) { t.ifError(err); exists(file, function (ex) { t.ok(ex, 'file created'); fs.stat(file, function (err, stat) { t.ifError(err); process.chdir(cwd); - t.equal(stat.mode & 0777, 0755); + t.equal(stat.mode & _0777, _0755); t.ok(stat.isDirectory(), 'target not a directory'); }) }) diff --git a/deps/npm/node_modules/mkdirp/test/root.js b/deps/npm/node_modules/mkdirp/test/root.js index 97ad7a2f358..9e7d079d9fc 100644 --- a/deps/npm/node_modules/mkdirp/test/root.js +++ b/deps/npm/node_modules/mkdirp/test/root.js @@ -2,12 +2,13 @@ var mkdirp = require('../'); var path = require('path'); var fs = require('fs'); var test = require('tap').test; +var _0755 = parseInt('0755', 8); test('root', function (t) { // '/' on unix, 'c:/' on windows. var file = path.resolve('/'); - mkdirp(file, 0755, function (err) { + mkdirp(file, _0755, function (err) { if (err) throw err fs.stat(file, function (er, stat) { if (er) throw er diff --git a/deps/npm/node_modules/mkdirp/test/sync.js b/deps/npm/node_modules/mkdirp/test/sync.js index 88fa4324ee1..8c8dc938c8b 100644 --- a/deps/npm/node_modules/mkdirp/test/sync.js +++ b/deps/npm/node_modules/mkdirp/test/sync.js @@ -3,6 +3,8 @@ var path = require('path'); var fs = require('fs'); var exists = fs.exists || path.exists; var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); test('sync', function (t) { t.plan(4); @@ -13,7 +15,7 @@ test('sync', function (t) { var file = '/tmp/' + [x,y,z].join('/'); try { - mkdirp.sync(file, 0755); + mkdirp.sync(file, _0755); } catch (err) { t.fail(err); return t.end(); @@ -23,7 +25,7 @@ test('sync', function (t) { t.ok(ex, 'file created'); fs.stat(file, function (err, stat) { t.ifError(err); - t.equal(stat.mode & 0777, 0755); + t.equal(stat.mode & _0777, _0755); t.ok(stat.isDirectory(), 'target not a directory'); }); }); diff --git a/deps/npm/node_modules/mkdirp/test/umask.js b/deps/npm/node_modules/mkdirp/test/umask.js index 82c393a006a..2033c63a414 100644 --- a/deps/npm/node_modules/mkdirp/test/umask.js +++ b/deps/npm/node_modules/mkdirp/test/umask.js @@ -3,6 +3,8 @@ var path = require('path'); var fs = require('fs'); var exists = fs.exists || path.exists; var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); test('implicit mode from umask', function (t) { t.plan(5); @@ -18,7 +20,7 @@ test('implicit mode from umask', function (t) { t.ok(ex, 'file created'); fs.stat(file, function (err, stat) { t.ifError(err); - t.equal(stat.mode & 0777, 0777 & (~process.umask())); + t.equal(stat.mode & _0777, _0777 & (~process.umask())); t.ok(stat.isDirectory(), 'target not a directory'); }); }) diff --git a/deps/npm/node_modules/mkdirp/test/umask_sync.js b/deps/npm/node_modules/mkdirp/test/umask_sync.js index e537fbe4bee..11a76147496 100644 --- a/deps/npm/node_modules/mkdirp/test/umask_sync.js +++ b/deps/npm/node_modules/mkdirp/test/umask_sync.js @@ -3,6 +3,8 @@ var path = require('path'); var fs = require('fs'); var exists = fs.exists || path.exists; var test = require('tap').test; +var _0777 = parseInt('0777', 8); +var _0755 = parseInt('0755', 8); test('umask sync modes', function (t) { t.plan(4); @@ -23,7 +25,7 @@ test('umask sync modes', function (t) { t.ok(ex, 'file created'); fs.stat(file, function (err, stat) { t.ifError(err); - t.equal(stat.mode & 0777, (0777 & (~process.umask()))); + t.equal(stat.mode & _0777, (_0777 & (~process.umask()))); t.ok(stat.isDirectory(), 'target not a directory'); }); }); diff --git a/deps/npm/node_modules/node-gyp/0001-gyp-always-install-into-PRODUCT_DIR.patch b/deps/npm/node_modules/node-gyp/0001-gyp-always-install-into-PRODUCT_DIR.patch new file mode 100644 index 00000000000..3607789397f --- /dev/null +++ b/deps/npm/node_modules/node-gyp/0001-gyp-always-install-into-PRODUCT_DIR.patch @@ -0,0 +1,34 @@ +From 9b5e8dc426ada891d67d27b09acc73122ab46849 Mon Sep 17 00:00:00 2001 +From: Nathan Rajlich +Date: Wed, 14 Nov 2012 16:48:52 -0800 +Subject: [PATCH 1/3] gyp: always install into $PRODUCT_DIR + +--- + gyp/pylib/gyp/generator/make.py | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/gyp/pylib/gyp/generator/make.py b/gyp/pylib/gyp/generator/make.py +index b88a433..9b3e4e3 100644 +--- a/gyp/pylib/gyp/generator/make.py ++++ b/gyp/pylib/gyp/generator/make.py +@@ -1888,11 +1888,13 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD + """Returns the location of the final output for an installable target.""" + # Xcode puts shared_library results into PRODUCT_DIR, and some gyp files + # rely on this. Emulate this behavior for mac. +- if (self.type == 'shared_library' and +- (self.flavor != 'mac' or self.toolset != 'target')): +- # Install all shared libs into a common directory (per toolset) for +- # convenient access with LD_LIBRARY_PATH. +- return '$(builddir)/lib.%s/%s' % (self.toolset, self.alias) ++ ++ # XXX(TooTallNate): disabling this code since we don't want this behavior... ++ #if (self.type == 'shared_library' and ++ # (self.flavor != 'mac' or self.toolset != 'target')): ++ # # Install all shared libs into a common directory (per toolset) for ++ # # convenient access with LD_LIBRARY_PATH. ++ # return '$(builddir)/lib.%s/%s' % (self.toolset, self.alias) + return '$(builddir)/' + self.alias + + +-- +2.3.2 (Apple Git-55) diff --git a/deps/npm/node_modules/node-gyp/0002-gyp-apply-https-codereview.chromium.org-11361103.patch b/deps/npm/node_modules/node-gyp/0002-gyp-apply-https-codereview.chromium.org-11361103.patch new file mode 100644 index 00000000000..cc0a5b87f85 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/0002-gyp-apply-https-codereview.chromium.org-11361103.patch @@ -0,0 +1,35 @@ +From 511840e82116662aa825088fb8a52a9f799f7767 Mon Sep 17 00:00:00 2001 +From: Nathan Rajlich +Date: Wed, 14 Nov 2012 16:54:04 -0800 +Subject: [PATCH 2/3] gyp: apply https://codereview.chromium.org/11361103/ + +--- + gyp/pylib/gyp/generator/msvs.py | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/gyp/pylib/gyp/generator/msvs.py b/gyp/pylib/gyp/generator/msvs.py +index d8e0872..c59aea1 100644 +--- a/gyp/pylib/gyp/generator/msvs.py ++++ b/gyp/pylib/gyp/generator/msvs.py +@@ -2720,6 +2720,9 @@ def _GetMSBuildAttributes(spec, config, build_file): + product_name = spec.get('product_name', '$(ProjectName)') + target_name = prefix + product_name + msbuild_attributes['TargetName'] = target_name ++ if 'TargetExt' not in msbuild_attributes and 'product_extension' in spec: ++ ext = spec.get('product_extension') ++ msbuild_attributes['TargetExt'] = '.' + ext + + if spec.get('msvs_external_builder'): + external_out_dir = spec.get('msvs_external_builder_out_dir', '.') +@@ -2773,6 +2776,9 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file): + attributes['OutputDirectory']) + _AddConditionalProperty(properties, condition, 'TargetName', + attributes['TargetName']) ++ if 'TargetExt' in attributes: ++ _AddConditionalProperty(properties, condition, 'TargetExt', ++ attributes['TargetExt']) + + if attributes.get('TargetPath'): + _AddConditionalProperty(properties, condition, 'TargetPath', +-- +2.3.2 (Apple Git-55) diff --git a/deps/npm/node_modules/node-gyp/0003-gyp-don-t-use-links-at-all-just-copy-the-files-inste.patch b/deps/npm/node_modules/node-gyp/0003-gyp-don-t-use-links-at-all-just-copy-the-files-inste.patch new file mode 100644 index 00000000000..291e82dcad1 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/0003-gyp-don-t-use-links-at-all-just-copy-the-files-inste.patch @@ -0,0 +1,38 @@ +From 0cd9f08a6d4f4be6643001b6c3b5ad40e094bdcc Mon Sep 17 00:00:00 2001 +From: Nathan Zadoks +Date: Tue, 2 Jul 2013 11:07:16 -0700 +Subject: [PATCH 3/3] gyp: don't use links at all, just copy the files instead + +--- + gyp/pylib/gyp/generator/make.py | 2 +- + gyp/pylib/gyp/generator/ninja.py | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gyp/pylib/gyp/generator/make.py b/gyp/pylib/gyp/generator/make.py +index 9b3e4e3..b3f8a2b 100644 +--- a/gyp/pylib/gyp/generator/make.py ++++ b/gyp/pylib/gyp/generator/make.py +@@ -372,7 +372,7 @@ cmd_touch = touch $@ + + quiet_cmd_copy = COPY $@ + # send stderr to /dev/null to ignore messages when linking directories. +-cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@") ++cmd_copy = rm -rf "$@" && cp -af "$<" "$@" + + %(link_commands)s + """ +diff --git a/gyp/pylib/gyp/generator/ninja.py b/gyp/pylib/gyp/generator/ninja.py +index 7461814..c2951a4 100644 +--- a/gyp/pylib/gyp/generator/ninja.py ++++ b/gyp/pylib/gyp/generator/ninja.py +@@ -2020,7 +2020,7 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, + master_ninja.rule( + 'copy', + description='COPY $in $out', +- command='ln -f $in $out 2>/dev/null || (rm -rf $out && cp -af $in $out)') ++ command='rm -rf $out && cp -af $in $out') + master_ninja.newline() + + all_targets = set() +-- +2.3.2 (Apple Git-55) diff --git a/deps/npm/node_modules/node-gyp/History.md b/deps/npm/node_modules/node-gyp/History.md new file mode 100644 index 00000000000..a2af92175f3 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/History.md @@ -0,0 +1,27 @@ + +2.0.1 / 2015-05-28 +================== + + * configure: try/catcht the semver range.test() call + * README: update for visual studio 2013 (#510, @samccone) + +2.0.0 / 2015-05-24 +================== + + * configure: check for python2 executable by default, fallback to python + * configure: don't clobber existing $PYTHONPATH + * configure: use "path-array" for PYTHONPATH + * gyp: fix for non-acsii userprofile name on Windows + * gyp: always install into $PRODUCT_DIR + * gyp: apply https://codereview.chromium.org/11361103/ + * gyp: don't use links at all, just copy the files instead + * gyp: update gyp to e1c8fcf7 + * Updated README.md with updated Windows build info + * Show URL when a download fails + * package: add a "license" field + * move HMODULE m declaration to top + * Only add "-undefined dynamic_lookup" to loadable_module targets + * win: optionally allow node.exe/iojs.exe to be renamed + * Avoid downloading shasums if using tarPath + * Add target name preprocessor define: `NODE_GYP_MODULE_NAME` + * Show better error message in case of bad network settings diff --git a/deps/npm/node_modules/node-gyp/README.md b/deps/npm/node_modules/node-gyp/README.md index 8d2d4951272..386e54eb833 100644 --- a/deps/npm/node_modules/node-gyp/README.md +++ b/deps/npm/node_modules/node-gyp/README.md @@ -38,13 +38,21 @@ You will also need to install: * A proper C/C++ compiler toolchain, like GCC * On Windows: * [Python][windows-python] ([`v2.7.3`][windows-python-v2.7.3] recommended, `v3.x.x` is __*not*__ supported) + * Make sure that you have a PYTHON environment variable, and it is set to drive:\path\to\python.exe not to a folder. * Windows XP/Vista/7: - * Microsoft Visual Studio C++ 2010 ([Express][msvc2010] version works well) - * For 64-bit builds of node and native modules you will _**also**_ need the [Windows 7 64-bit SDK][win7sdk] + * Microsoft Visual Studio C++ 2013 ([Express][msvc2013] version works well) * If the install fails, try uninstalling any C++ 2010 x64&x86 Redistributable that you have installed first. - * If you get errors that the 64-bit compilers are not installed you may also need the [compiler update for the Windows SDK 7.1] + * If you get errors that the 64-bit compilers are not installed you may also need the [compiler update for the Windows SDK 7.1] * Windows 7/8: - * Microsoft Visual Studio C++ 2012 for Windows Desktop ([Express][msvc2012] version works well) + * Microsoft Visual Studio C++ 2013 for Windows Desktop ([Express][msvc2013] version works well) + * All Windows Versions + * For 64-bit builds of node and native modules you will _**also**_ need the [Windows 7 64-bit SDK][win7sdk] + * You may need to run one of the following commands if your build complains about WindowsSDKDir not being set, and you are sure you have already installed the SDK: + +``` +call "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\Setenv.cmd" /Release /x86 +call "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\Setenv.cmd" /Release /x64 +``` If you have multiple Python versions installed, you can identify which Python version `node-gyp` uses by setting the '--python' variable: @@ -82,7 +90,7 @@ $ node-gyp configure ``` __Note__: The `configure` step looks for the `binding.gyp` file in the current -directory to processs. See below for instructions on creating the `binding.gyp` file. +directory to process. See below for instructions on creating the `binding.gyp` file. Now you will have either a `Makefile` (on Unix platforms) or a `vcxproj` file (on Windows) in the `build/` directory. Next invoke the `build` command: @@ -96,7 +104,7 @@ in `build/Debug/` or `build/Release/`, depending on the build mode. At this poin you can require the `.node` file with Node and run your tests! __Note:__ To create a _Debug_ build of the bindings file, pass the `--debug` (or -`-d`) switch when running the either `configure` or `build` command. +`-d`) switch when running either the `configure`, `build` or `rebuild` command. The "binding.gyp" file @@ -120,8 +128,9 @@ A barebones `gyp` file appropriate for building a node addon looks like: } ``` -Some additional resources for writing `gyp` files: +Some additional resources for addons and writing `gyp` files: + * ["Going Native" a nodeschool.io tutorial](http://nodeschool.io/#goingnative) * ["Hello World" node addon example](https://github.com/joyent/node/tree/master/test/addons/hello-world) * [gyp user documentation](http://code.google.com/p/gyp/wiki/GypUserDocumentation) * [gyp input format reference](http://code.google.com/p/gyp/wiki/InputFormatReference) @@ -136,9 +145,9 @@ Commands | **Command** | **Description** |:--------------|:--------------------------------------------------------------- | `build` | Invokes `make`/`msbuild.exe` and builds the native addon -| `clean` | Removes any the `build` dir if it exists +| `clean` | Removes the `build` directory if it exists | `configure` | Generates project build files for the current platform -| `rebuild` | Runs "clean", "configure" and "build" all in a row +| `rebuild` | Runs `clean`, `configure` and `build` all in a row | `install` | Installs node development header files for the given version | `list` | Lists the currently installed node development file versions | `remove` | Removes the node development header files for the given version @@ -173,7 +182,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. [windows-python]: http://www.python.org/getit/windows [windows-python-v2.7.3]: http://www.python.org/download/releases/2.7.3#download -[msvc2010]: http://go.microsoft.com/?linkid=9709949 -[msvc2012]: http://go.microsoft.com/?linkid=9816758 +[msvc2013]: http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs [win7sdk]: http://www.microsoft.com/en-us/download/details.aspx?id=8279 [compiler update for the Windows SDK 7.1]: http://www.microsoft.com/en-us/download/details.aspx?id=4422 diff --git a/deps/npm/node_modules/node-gyp/addon.gypi b/deps/npm/node_modules/node-gyp/addon.gypi index 0b81fab2027..7f6264ac611 100644 --- a/deps/npm/node_modules/node-gyp/addon.gypi +++ b/deps/npm/node_modules/node-gyp/addon.gypi @@ -1,29 +1,65 @@ { 'target_defaults': { 'type': 'loadable_module', + 'win_delay_load_hook': 'false', 'product_prefix': '', + 'include_dirs': [ '<(node_root_dir)/src', '<(node_root_dir)/deps/uv/include', '<(node_root_dir)/deps/v8/include' ], + 'defines': [ + 'NODE_GYP_MODULE_NAME=>(_target_name)' + ], 'target_conditions': [ ['_type=="loadable_module"', { 'product_extension': 'node', - 'defines': [ 'BUILDING_NODE_EXTENSION' ], + 'defines': [ + 'BUILDING_NODE_EXTENSION' + ], + 'xcode_settings': { + 'OTHER_LDFLAGS': [ + '-undefined dynamic_lookup' + ], + }, }], + ['_type=="static_library"', { # set to `1` to *disable* the -T thin archive 'ld' flag. # older linkers don't support this flag. 'standalone_static_library': '<(standalone_static_library)' }], + + ['_win_delay_load_hook=="true"', { + # If the addon specifies `'win_delay_load_hook': 'true'` in its + # binding.gyp, link a delay-load hook into the DLL. This hook ensures + # that the addon will work regardless of whether the node/iojs binary + # is named node.exe, iojs.exe, or something else. + 'conditions': [ + [ 'OS=="win"', { + 'sources': [ + 'src/win_delay_load_hook.c', + ], + 'msvs_settings': { + 'VCLinkerTool': { + 'DelayLoadDLLs': [ 'iojs.exe', 'node.exe' ], + # Don't print a linker warning when no imports from either .exe + # are used. + 'AdditionalOptions': [ '/ignore:4199' ], + }, + }, + }], + ], + }], ], 'conditions': [ [ 'OS=="mac"', { - 'defines': [ '_DARWIN_USE_64_BIT_INODE=1' ], - 'libraries': [ '-undefined dynamic_lookup' ], + 'defines': [ + '_DARWIN_USE_64_BIT_INODE=1' + ], 'xcode_settings': { 'DYLIB_INSTALL_NAME_BASE': '@rpath' }, @@ -44,12 +80,18 @@ '-lDelayImp.lib', '-l"<(node_root_dir)/$(ConfigurationName)/node.lib"' ], - # warning C4251: 'node::ObjectWrap::handle_' : class 'v8::Persistent' - # needs to have dll-interface to be used by clients of class 'node::ObjectWrap' - 'msvs_disabled_warnings': [ 4251 ], + 'msvs_disabled_warnings': [ + # warning C4251: 'node::ObjectWrap::handle_' : class 'v8::Persistent' + # needs to have dll-interface to be used by + # clients of class 'node::ObjectWrap' + 4251 + ], }, { # OS!="win" - 'defines': [ '_LARGEFILE_SOURCE', '_FILE_OFFSET_BITS=64' ], + 'defines': [ + '_LARGEFILE_SOURCE', + '_FILE_OFFSET_BITS=64' + ], }], [ 'OS=="freebsd" or OS=="openbsd" or OS=="solaris" or (OS=="linux" and target_arch!="ia32")', { 'cflags': [ '-fPIC' ], diff --git a/deps/npm/node_modules/node-gyp/gyp/PRESUBMIT.py b/deps/npm/node_modules/node-gyp/gyp/PRESUBMIT.py index 9c474eb2b10..abec27b3e33 100644 --- a/deps/npm/node_modules/node-gyp/gyp/PRESUBMIT.py +++ b/deps/npm/node_modules/node-gyp/gyp/PRESUBMIT.py @@ -16,8 +16,6 @@ 'test/lib/TestCmd.py', 'test/lib/TestCommon.py', 'test/lib/TestGyp.py', - # Needs style fix. - 'pylib/gyp/generator/xcode.py', ] @@ -25,6 +23,10 @@ # TODO: fix me. # Many tests include modules they don't use. 'W0611', + # Possible unbalanced tuple unpacking with sequence. + 'W0632', + # Attempting to unpack a non-sequence. + 'W0633', # Include order doesn't properly include local files? 'F0401', # Some use of built-in names. @@ -40,6 +42,10 @@ 'W0613', # String has no effect (docstring in wrong place). 'W0105', + # map/filter on lambda could be replaced by comprehension. + 'W0110', + # Use of eval. + 'W0123', # Comma not followed by space. 'C0324', # Access to a protected member. @@ -56,6 +62,8 @@ 'E1101', # Dangerous default {}. 'W0102', + # Cyclic import. + 'R0401', # Others, too many to sort. 'W0201', 'W0232', 'E1103', 'W0621', 'W0108', 'W0223', 'W0231', 'R0201', 'E0101', 'C0321', @@ -116,5 +124,16 @@ def CheckChangeOnCommit(input_api, output_api): return report -def GetPreferredTrySlaves(): - return ['gyp-win32', 'gyp-win64', 'gyp-linux', 'gyp-mac', 'gyp-android'] +TRYBOTS = [ + 'gyp-win32', + 'gyp-win64', + 'gyp-linux', + 'gyp-mac', + 'gyp-android' +] + + +def GetPreferredTryMasters(_, change): + return { + 'tryserver.nacl': { t: set(['defaulttests']) for t in TRYBOTS }, + } diff --git a/deps/npm/node_modules/node-gyp/gyp/buildbot/aosp_manifest.xml b/deps/npm/node_modules/node-gyp/gyp/buildbot/aosp_manifest.xml new file mode 100644 index 00000000000..bd73b303c6e --- /dev/null +++ b/deps/npm/node_modules/node-gyp/gyp/buildbot/aosp_manifest.xml @@ -0,0 +1,466 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/deps/npm/node_modules/node-gyp/gyp/buildbot/buildbot_run.py b/deps/npm/node_modules/node-gyp/gyp/buildbot/buildbot_run.py index 979073c773b..f46ab1822fe 100755 --- a/deps/npm/node_modules/node-gyp/gyp/buildbot/buildbot_run.py +++ b/deps/npm/node_modules/node-gyp/gyp/buildbot/buildbot_run.py @@ -7,6 +7,7 @@ """Argument-less script to select what to run on the buildbots.""" +import filecmp import os import shutil import subprocess @@ -30,7 +31,8 @@ def CallSubProcess(*args, **kwargs): """Wrapper around subprocess.call which treats errors as build exceptions.""" - retcode = subprocess.call(*args, **kwargs) + with open(os.devnull) as devnull_fd: + retcode = subprocess.call(stdin=devnull_fd, *args, **kwargs) if retcode != 0: print '@@@STEP_EXCEPTION@@@' sys.exit(1) @@ -49,10 +51,6 @@ def PrepareCmake(): print '@@@BUILD_STEP Initialize CMake checkout@@@' os.mkdir(CMAKE_DIR) - CallSubProcess(['git', 'config', '--global', 'user.name', 'trybot']) - CallSubProcess(['git', 'config', '--global', - 'user.email', 'chrome-bot@google.com']) - CallSubProcess(['git', 'config', '--global', 'color.ui', 'false']) print '@@@BUILD_STEP Sync CMake@@@' CallSubProcess( @@ -73,41 +71,96 @@ def PrepareCmake(): CallSubProcess( ['make', 'cmake'], cwd=CMAKE_DIR) +_ANDROID_SETUP = 'source build/envsetup.sh && lunch full-eng' + + def PrepareAndroidTree(): """Prepare an Android tree to run 'android' format tests.""" if os.environ['BUILDBOT_CLOBBER'] == '1': print '@@@BUILD_STEP Clobber Android checkout@@@' shutil.rmtree(ANDROID_DIR) - # The release of Android we use is static, so there's no need to do anything - # if the directory already exists. - if os.path.isdir(ANDROID_DIR): + # (Re)create the directory so that the following steps will succeed. + if not os.path.isdir(ANDROID_DIR): + os.mkdir(ANDROID_DIR) + + # We use a manifest from the gyp project listing pinned revisions of AOSP to + # use, to ensure that we test against a stable target. This needs to be + # updated to pick up new build system changes sometimes, so we must test if + # it has changed. + manifest_filename = 'aosp_manifest.xml' + gyp_manifest = os.path.join(BUILDBOT_DIR, manifest_filename) + android_manifest = os.path.join(ANDROID_DIR, '.repo', 'manifests', + manifest_filename) + manifest_is_current = (os.path.isfile(android_manifest) and + filecmp.cmp(gyp_manifest, android_manifest)) + if not manifest_is_current: + # It's safe to repeat these steps, so just do them again to make sure we are + # in a good state. + print '@@@BUILD_STEP Initialize Android checkout@@@' + CallSubProcess( + ['repo', 'init', + '-u', 'https://android.googlesource.com/platform/manifest', + '-b', 'master', + '-g', 'all,-notdefault,-device,-darwin,-mips,-x86'], + cwd=ANDROID_DIR) + shutil.copy(gyp_manifest, android_manifest) + + print '@@@BUILD_STEP Sync Android@@@' + CallSubProcess(['repo', 'sync', '-j4', '-m', manifest_filename], + cwd=ANDROID_DIR) + + # If we already built the system image successfully and didn't sync to a new + # version of the source, skip running the build again as it's expensive even + # when there's nothing to do. + system_img = os.path.join(ANDROID_DIR, 'out', 'target', 'product', 'generic', + 'system.img') + if manifest_is_current and os.path.isfile(system_img): return - print '@@@BUILD_STEP Initialize Android checkout@@@' - os.mkdir(ANDROID_DIR) - CallSubProcess(['git', 'config', '--global', 'user.name', 'trybot']) - CallSubProcess(['git', 'config', '--global', - 'user.email', 'chrome-bot@google.com']) - CallSubProcess(['git', 'config', '--global', 'color.ui', 'false']) + print '@@@BUILD_STEP Build Android@@@' CallSubProcess( - ['repo', 'init', - '-u', 'https://android.googlesource.com/platform/manifest', - '-b', 'android-4.2.1_r1', - '-g', 'all,-notdefault,-device,-darwin,-mips,-x86'], + ['/bin/bash', + '-c', '%s && make -j4' % _ANDROID_SETUP], cwd=ANDROID_DIR) - print '@@@BUILD_STEP Sync Android@@@' - CallSubProcess(['repo', 'sync', '-j4'], cwd=ANDROID_DIR) - print '@@@BUILD_STEP Build Android@@@' +def StartAndroidEmulator(): + """Start an android emulator from the built android tree.""" + print '@@@BUILD_STEP Start Android emulator@@@' + + CallSubProcess(['/bin/bash', '-c', + '%s && adb kill-server ' % _ANDROID_SETUP], + cwd=ANDROID_DIR) + + # If taskset is available, use it to force adbd to run only on one core, as, + # sadly, it improves its reliability (see crbug.com/268450). + adbd_wrapper = '' + with open(os.devnull, 'w') as devnull_fd: + if subprocess.call(['which', 'taskset'], stdout=devnull_fd) == 0: + adbd_wrapper = 'taskset -c 0' + CallSubProcess(['/bin/bash', '-c', + '%s && %s adb start-server ' % (_ANDROID_SETUP, adbd_wrapper)], + cwd=ANDROID_DIR) + + subprocess.Popen( + ['/bin/bash', '-c', + '%s && emulator -no-window' % _ANDROID_SETUP], + cwd=ANDROID_DIR) CallSubProcess( - ['/bin/bash', - '-c', 'source build/envsetup.sh && lunch full-eng && make -j4'], + ['/bin/bash', '-c', + '%s && adb wait-for-device' % _ANDROID_SETUP], cwd=ANDROID_DIR) -def GypTestFormat(title, format=None, msvs_version=None): +def StopAndroidEmulator(): + """Stop all android emulators.""" + print '@@@BUILD_STEP Stop Android emulator@@@' + # If this fails, it's because there is no emulator running. + subprocess.call(['pkill', 'emulator.*']) + + +def GypTestFormat(title, format=None, msvs_version=None, tests=[]): """Run the gyp tests for a given format, emitting annotator tags. See annotator docs at: @@ -126,19 +179,18 @@ def GypTestFormat(title, format=None, msvs_version=None): if msvs_version: env['GYP_MSVS_VERSION'] = msvs_version command = ' '.join( - [sys.executable, 'trunk/gyptest.py', + [sys.executable, 'gyp/gyptest.py', '--all', '--passed', '--format', format, '--path', CMAKE_BIN_DIR, - '--chdir', 'trunk']) + '--chdir', 'gyp'] + tests) if format == 'android': # gyptest needs the environment setup from envsetup/lunch in order to build # using the 'android' backend, so this is done in a single shell. retcode = subprocess.call( ['/bin/bash', - '-c', 'source build/envsetup.sh && lunch full-eng && cd %s && %s' - % (ROOT_DIR, command)], + '-c', '%s && cd %s && %s' % (_ANDROID_SETUP, ROOT_DIR, command)], cwd=ANDROID_DIR, env=env) else: retcode = subprocess.call(command, cwd=ROOT_DIR, env=env, shell=True) @@ -160,7 +212,11 @@ def GypBuild(): # The Android gyp bot runs on linux so this must be tested first. if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-android': PrepareAndroidTree() - retcode += GypTestFormat('android') + StartAndroidEmulator() + try: + retcode += GypTestFormat('android') + finally: + StopAndroidEmulator() elif sys.platform.startswith('linux'): retcode += GypTestFormat('ninja') retcode += GypTestFormat('make') @@ -173,8 +229,13 @@ def GypBuild(): elif sys.platform == 'win32': retcode += GypTestFormat('ninja') if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-win64': - retcode += GypTestFormat('msvs-2010', format='msvs', msvs_version='2010') - retcode += GypTestFormat('msvs-2012', format='msvs', msvs_version='2012') + retcode += GypTestFormat('msvs-ninja-2013', format='msvs-ninja', + msvs_version='2013', + tests=[ + r'test\generator-output\gyptest-actions.py', + r'test\generator-output\gyptest-relocate.py', + r'test\generator-output\gyptest-rules.py']) + retcode += GypTestFormat('msvs-2013', format='msvs', msvs_version='2013') else: raise Exception('Unknown platform') if retcode: diff --git a/deps/npm/node_modules/node-gyp/gyp/buildbot/commit_queue/OWNERS b/deps/npm/node_modules/node-gyp/gyp/buildbot/commit_queue/OWNERS new file mode 100644 index 00000000000..b269c198b43 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/gyp/buildbot/commit_queue/OWNERS @@ -0,0 +1,6 @@ +set noparent +bradnelson@chromium.org +bradnelson@google.com +iannucci@chromium.org +scottmg@chromium.org +thakis@chromium.org diff --git a/deps/npm/node_modules/node-gyp/gyp/buildbot/commit_queue/README b/deps/npm/node_modules/node-gyp/gyp/buildbot/commit_queue/README new file mode 100644 index 00000000000..94284978832 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/gyp/buildbot/commit_queue/README @@ -0,0 +1,3 @@ +cq_config.json describes the trybots that must pass in order +to land a change through the commit queue. +Comments are here as the file is strictly JSON. diff --git a/deps/npm/node_modules/node-gyp/gyp/buildbot/commit_queue/cq_config.json b/deps/npm/node_modules/node-gyp/gyp/buildbot/commit_queue/cq_config.json new file mode 100644 index 00000000000..bbf20e394f3 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/gyp/buildbot/commit_queue/cq_config.json @@ -0,0 +1,16 @@ +{ + "trybots": { + "launched": { + "tryserver.nacl": { + "gyp-presubmit": ["defaulttests"], + "gyp-android": ["defaulttests"], + "gyp-linux": ["defaulttests"], + "gyp-mac": ["defaulttests"], + "gyp-win32": ["defaulttests"], + "gyp-win64": ["defaulttests"] + } + }, + "triggered": { + } + } +} diff --git a/deps/npm/node_modules/node-gyp/gyp/codereview.settings b/deps/npm/node_modules/node-gyp/gyp/codereview.settings index a04a2440df3..faf37f1145f 100644 --- a/deps/npm/node_modules/node-gyp/gyp/codereview.settings +++ b/deps/npm/node_modules/node-gyp/gyp/codereview.settings @@ -1,10 +1,10 @@ # This file is used by gcl to get repository specific information. CODE_REVIEW_SERVER: codereview.chromium.org CC_LIST: gyp-developer@googlegroups.com -VIEW_VC: http://code.google.com/p/gyp/source/detail?r= -TRY_ON_UPLOAD: True +VIEW_VC: https://chromium.googlesource.com/external/gyp/+/ +TRY_ON_UPLOAD: False TRYSERVER_PROJECT: gyp -TRYSERVER_PATCHLEVEL: 0 -TRYSERVER_ROOT: trunk +TRYSERVER_PATCHLEVEL: 1 +TRYSERVER_ROOT: gyp TRYSERVER_SVN_URL: svn://svn.chromium.org/chrome-try/try-nacl - +PROJECT: gyp diff --git a/deps/npm/node_modules/node-gyp/gyp/gyp b/deps/npm/node_modules/node-gyp/gyp/gyp index b53a6dde8f2..1b8b9bdfb05 100755 --- a/deps/npm/node_modules/node-gyp/gyp/gyp +++ b/deps/npm/node_modules/node-gyp/gyp/gyp @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/deps/npm/node_modules/node-gyp/gyp/gyp_dummy.c b/deps/npm/node_modules/node-gyp/gyp/gyp_dummy.c deleted file mode 100644 index fb55bbc78da..00000000000 --- a/deps/npm/node_modules/node-gyp/gyp/gyp_dummy.c +++ /dev/null @@ -1,7 +0,0 @@ -/* Copyright (c) 2009 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. */ - -int main() { - return 0; -} diff --git a/deps/npm/node_modules/node-gyp/gyp/gyptest.py b/deps/npm/node_modules/node-gyp/gyp/gyptest.py index 8f3ee0ffb04..8e4fc47d5c8 100755 --- a/deps/npm/node_modules/node-gyp/gyp/gyptest.py +++ b/deps/npm/node_modules/node-gyp/gyp/gyptest.py @@ -13,7 +13,7 @@ import subprocess import sys -class CommandRunner: +class CommandRunner(object): """ Executor class for commands, including "commands" implemented by Python functions. @@ -117,7 +117,7 @@ def run(self, command, display=None, stdout=None, stderr=None): return self.execute(command, stdout, stderr) -class Unbuffered: +class Unbuffered(object): def __init__(self, fp): self.fp = fp def write(self, arg): @@ -224,7 +224,7 @@ def main(argv=None): 'win32': ['msvs', 'ninja'], 'linux2': ['make', 'ninja'], 'linux3': ['make', 'ninja'], - 'darwin': ['make', 'ninja', 'xcode'], + 'darwin': ['make', 'ninja', 'xcode', 'xcode-ninja'], }[sys.platform] for format in format_list: diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py index 845dcb0639d..593f0e5b0b2 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py @@ -172,7 +172,7 @@ def set_msbuild_toolset(self, msbuild_toolset): #------------------------------------------------------------------------------ -class MSVSSolution: +class MSVSSolution(object): """Visual Studio solution.""" def __init__(self, path, version, entries=None, variants=None, diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py index 0c9532d8e67..dde0e07092b 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -"""Code to validate and convert settings of the Microsoft build tools. +r"""Code to validate and convert settings of the Microsoft build tools. This file contains code to validate and convert settings of the Microsoft build tools. The function ConvertToMSBuildSettings(), ValidateMSVSSettings(), @@ -314,7 +314,14 @@ def _MSBuildOnly(tool, name, setting_type): name: the name of the setting. setting_type: the type of this setting. """ + + def _Translate(value, msbuild_settings): + # Let msbuild-only properties get translated as-is from msvs_settings. + tool_settings = msbuild_settings.setdefault(tool.msbuild_name, {}) + tool_settings[name] = value + _msbuild_validators[tool.msbuild_name][name] = setting_type.ValidateMSBuild + _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate def _ConvertedToAdditionalOption(tool, msvs_name, flag): @@ -367,6 +374,35 @@ def _Translate(value, msbuild_settings): r'(\$\((?:%s)\))(?:[\\/]+)' % "|".join(fix_vc_macro_slashes_regex_list) ) +# Regular expression to detect keys that were generated by exclusion lists +_EXCLUDED_SUFFIX_RE = re.compile('^(.*)_excluded$') + + +def _ValidateExclusionSetting(setting, settings, error_msg, stderr=sys.stderr): + """Verify that 'setting' is valid if it is generated from an exclusion list. + + If the setting appears to be generated from an exclusion list, the root name + is checked. + + Args: + setting: A string that is the setting name to validate + settings: A dictionary where the keys are valid settings + error_msg: The message to emit in the event of error + stderr: The stream receiving the error messages. + """ + # This may be unrecognized because it's an exclusion list. If the + # setting name has the _excluded suffix, then check the root name. + unrecognized = True + m = re.match(_EXCLUDED_SUFFIX_RE, setting) + if m: + root_setting = m.group(1) + unrecognized = root_setting not in settings + + if unrecognized: + # We don't know this setting. Give a warning. + print >> stderr, error_msg + + def FixVCMacroSlashes(s): """Replace macros which have excessive following slashes. @@ -388,11 +424,11 @@ def ConvertVCMacrosToMSBuild(s): if '$' in s: replace_map = { '$(ConfigurationName)': '$(Configuration)', - '$(InputDir)': '%(RootDir)%(Directory)', + '$(InputDir)': '%(RelativeDir)', '$(InputExt)': '%(Extension)', '$(InputFileName)': '%(Filename)%(Extension)', '$(InputName)': '%(Filename)', - '$(InputPath)': '%(FullPath)', + '$(InputPath)': '%(Identity)', '$(ParentName)': '$(ProjectFileName)', '$(PlatformName)': '$(Platform)', '$(SafeInputName)': '%(Filename)', @@ -429,10 +465,12 @@ def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr): print >> stderr, ('Warning: while converting %s/%s to MSBuild, ' '%s' % (msvs_tool_name, msvs_setting, e)) else: - # We don't know this setting. Give a warning. - print >> stderr, ('Warning: unrecognized setting %s/%s ' - 'while converting to MSBuild.' % - (msvs_tool_name, msvs_setting)) + _ValidateExclusionSetting(msvs_setting, + msvs_tool, + ('Warning: unrecognized setting %s/%s ' + 'while converting to MSBuild.' % + (msvs_tool_name, msvs_setting)), + stderr) else: print >> stderr, ('Warning: unrecognized tool %s while converting to ' 'MSBuild.' % msvs_tool_name) @@ -483,8 +521,12 @@ def _ValidateSettings(validators, settings, stderr): print >> stderr, ('Warning: for %s/%s, %s' % (tool_name, setting, e)) else: - print >> stderr, ('Warning: unrecognized setting %s/%s' % - (tool_name, setting)) + _ValidateExclusionSetting(setting, + tool_validators, + ('Warning: unrecognized setting %s/%s' % + (tool_name, setting)), + stderr) + else: print >> stderr, ('Warning: unrecognized tool %s' % tool_name) @@ -496,6 +538,7 @@ def _ValidateSettings(validators, settings, stderr): _rc = _Tool('VCResourceCompilerTool', 'ResourceCompile') _lib = _Tool('VCLibrarianTool', 'Lib') _manifest = _Tool('VCManifestTool', 'Manifest') +_masm = _Tool('MASM', 'MASM') _AddTool(_compile) @@ -504,6 +547,7 @@ def _ValidateSettings(validators, settings, stderr): _AddTool(_rc) _AddTool(_lib) _AddTool(_manifest) +_AddTool(_masm) # Add sections only found in the MSBuild settings. _msbuild_validators[''] = {} _msbuild_validators['ProjectReference'] = {} @@ -567,7 +611,8 @@ def _ValidateSettings(validators, settings, stderr): _Same(_compile, 'CallingConvention', _Enumeration(['Cdecl', # /Gd 'FastCall', # /Gr - 'StdCall'])) # /Gz + 'StdCall', # /Gz + 'VectorCall'])) # /Gv _Same(_compile, 'CompileAs', _Enumeration(['Default', 'CompileAsC', # /TC @@ -581,7 +626,12 @@ def _ValidateSettings(validators, settings, stderr): _Same(_compile, 'EnableEnhancedInstructionSet', _Enumeration(['NotSet', 'StreamingSIMDExtensions', # /arch:SSE - 'StreamingSIMDExtensions2'])) # /arch:SSE2 + 'StreamingSIMDExtensions2', # /arch:SSE2 + 'AdvancedVectorExtensions', # /arch:AVX (vs2012+) + 'NoExtensions', # /arch:IA32 (vs2012+) + # This one only exists in the new msbuild format. + 'AdvancedVectorExtensions2', # /arch:AVX2 (vs2013r2+) + ])) _Same(_compile, 'ErrorReporting', _Enumeration(['None', # /errorReport:none 'Prompt', # /errorReport:prompt @@ -836,13 +886,6 @@ def _ValidateSettings(validators, settings, stderr): # MSVS options not found in MSBuild. _MSVSOnly(_link, 'OptimizeForWindows98', _newly_boolean) _MSVSOnly(_link, 'UseUnicodeResponseFiles', _boolean) -# These settings generate correctly in the MSVS output files when using -# e.g. DelayLoadDLLs! or AdditionalDependencies! to exclude files from -# configuration entries, but result in spurious artifacts which can be -# safely ignored here. See crbug.com/246570 -_MSVSOnly(_link, 'AdditionalLibraryDirectories_excluded', _folder_list) -_MSVSOnly(_link, 'DelayLoadDLLs_excluded', _file_list) -_MSVSOnly(_link, 'AdditionalDependencies_excluded', _file_list) # MSBuild options not found in MSVS. _MSBuildOnly(_link, 'BuildingInIDE', _boolean) @@ -991,9 +1034,6 @@ def _ValidateSettings(validators, settings, stderr): # ProjectReference. We may want to validate that they are consistent. _Moved(_lib, 'LinkLibraryDependencies', 'ProjectReference', _boolean) -# TODO(jeanluc) I don't think these are genuine settings but byproducts of Gyp. -_MSVSOnly(_lib, 'AdditionalLibraryDirectories_excluded', _folder_list) - _MSBuildOnly(_lib, 'DisplayLibrary', _string) # /LIST Visible='false' _MSBuildOnly(_lib, 'ErrorReporting', _Enumeration([], new=['PromptImmediately', # /ERRORREPORT:PROMPT @@ -1049,3 +1089,11 @@ def _ValidateSettings(validators, settings, stderr): _MSBuildOnly(_manifest, 'OutputResourceManifests', _string) # /outputresource _MSBuildOnly(_manifest, 'SuppressDependencyElement', _boolean) # /nodependency _MSBuildOnly(_manifest, 'TrackerLogDirectory', _folder_name) + + +# Directives for MASM. +# See "$(VCTargetsPath)\BuildCustomizations\masm.xml" for the schema of the +# MSBuild MASM settings. + +# Options that have the same name in MSVS and MSBuild. +_Same(_masm, 'UseSafeExceptionHandlers', _boolean) # /safeseh diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py index 4e06da3bbe3..d24dcac4d5e 100755 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py @@ -109,6 +109,7 @@ def testValidateMSVSSettings_settings(self): 'ZZXYZ': 'bogus'}, 'VCLinkerTool': { 'AdditionalDependencies': 'file1;file2', + 'AdditionalDependencies_excluded': 'file3', 'AdditionalLibraryDirectories': 'folder1;folder2', 'AdditionalManifestDependencies': 'file1;file2', 'AdditionalOptions': 'a string1', @@ -266,7 +267,7 @@ def testValidateMSVSSettings_settings(self): 'Warning: for VCCLCompilerTool/BrowseInformation, ' "invalid literal for int() with base 10: 'fdkslj'", 'Warning: for VCCLCompilerTool/CallingConvention, ' - 'index value (-1) not in expected range [0, 3)', + 'index value (-1) not in expected range [0, 4)', 'Warning: for VCCLCompilerTool/DebugInformationFormat, ' 'converted value for 2 not specified.', 'Warning: unrecognized setting VCCLCompilerTool/Enableprefast', diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py index 62e8d260d44..0b32e911807 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py @@ -8,10 +8,12 @@ import os -_TARGET_TYPE_EXT = { - 'executable': '.exe', - 'loadable_module': '.dll', - 'shared_library': '.dll', +# A dictionary mapping supported target types to extensions. +TARGET_TYPE_EXT = { + 'executable': 'exe', + 'loadable_module': 'dll', + 'shared_library': 'dll', + 'static_library': 'lib', } @@ -109,15 +111,16 @@ def ShardTargets(target_list, target_dicts): new_target_dicts[t] = target_dicts[t] # Shard dependencies. for t in new_target_dicts: - dependencies = copy.copy(new_target_dicts[t].get('dependencies', [])) - new_dependencies = [] - for d in dependencies: - if d in targets_to_shard: - for i in range(targets_to_shard[d]): - new_dependencies.append(_ShardName(d, i)) - else: - new_dependencies.append(d) - new_target_dicts[t]['dependencies'] = new_dependencies + for deptype in ('dependencies', 'dependencies_original'): + dependencies = copy.copy(new_target_dicts[t].get(deptype, [])) + new_dependencies = [] + for d in dependencies: + if d in targets_to_shard: + for i in range(targets_to_shard[d]): + new_dependencies.append(_ShardName(d, i)) + else: + new_dependencies.append(d) + new_target_dicts[t][deptype] = new_dependencies return (new_target_list, new_target_dicts) @@ -156,7 +159,7 @@ def _GetPdbPath(target_dict, config_name, vars): pdb_base = target_dict.get('product_name', target_dict['target_name']) - pdb_base = '%s%s.pdb' % (pdb_base, _TARGET_TYPE_EXT[target_dict['type']]) + pdb_base = '%s.%s.pdb' % (pdb_base, TARGET_TYPE_EXT[target_dict['type']]) pdb_path = vars['PRODUCT_DIR'] + '/' + pdb_base return pdb_path @@ -264,4 +267,4 @@ def InsertLargePdbShims(target_list, target_dicts, vars): # Update the original target to depend on the shim target. target_dict.setdefault('dependencies', []).append(full_shim_target_name) - return (target_list, target_dicts) \ No newline at end of file + return (target_list, target_dicts) diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py index 03b6d8ad42c..92e583fd6e2 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py @@ -138,7 +138,7 @@ def _RegistryQueryBase(sysdir, key, value): def _RegistryQuery(key, value=None): - """Use reg.exe to read a particular key through _RegistryQueryBase. + r"""Use reg.exe to read a particular key through _RegistryQueryBase. First tries to launch from %WinDir%\Sysnative to avoid WoW64 redirection. If that fails, it falls back to System32. Sysnative is available on Vista and @@ -165,8 +165,33 @@ def _RegistryQuery(key, value=None): return text +def _RegistryGetValueUsingWinReg(key, value): + """Use the _winreg module to obtain the value of a registry key. + + Args: + key: The registry key. + value: The particular registry value to read. + Return: + contents of the registry key's value, or None on failure. Throws + ImportError if _winreg is unavailable. + """ + import _winreg + try: + root, subkey = key.split('\\', 1) + assert root == 'HKLM' # Only need HKLM for now. + with _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, subkey) as hkey: + return _winreg.QueryValueEx(hkey, value)[0] + except WindowsError: + return None + + def _RegistryGetValue(key, value): - """Use reg.exe to obtain the value of a registry key. + """Use _winreg or reg.exe to obtain the value of a registry key. + + Using _winreg is preferable because it solves an issue on some corporate + environments where access to reg.exe is locked down. However, we still need + to fallback to reg.exe for the case where the _winreg module is not available + (for example in cygwin python). Args: key: The registry key. @@ -174,6 +199,12 @@ def _RegistryGetValue(key, value): Return: contents of the registry key's value, or None on failure. """ + try: + return _RegistryGetValueUsingWinReg(key, value) + except ImportError: + pass + + # Fallback to reg.exe if we fail to import _winreg. text = _RegistryQuery(key, value) if not text: return None @@ -184,19 +215,6 @@ def _RegistryGetValue(key, value): return match.group(1) -def _RegistryKeyExists(key): - """Use reg.exe to see if a key exists. - - Args: - key: The registry key to check. - Return: - True if the key exists - """ - if not _RegistryQuery(key): - return False - return True - - def _CreateVersion(name, path, sdk_based=False): """Sets up MSVS project generation. @@ -207,6 +225,15 @@ def _CreateVersion(name, path, sdk_based=False): if path: path = os.path.normpath(path) versions = { + '2015': VisualStudioVersion('2015', + 'Visual Studio 2015', + solution_version='12.00', + project_version='14.0', + flat_sln=False, + uses_vcxproj=True, + path=path, + sdk_based=sdk_based, + default_toolset='v140'), '2013': VisualStudioVersion('2013', 'Visual Studio 2013', solution_version='13.00', @@ -316,7 +343,8 @@ def _DetectVisualStudioVersions(versions_to_check, force_express): 2008(e) - Visual Studio 2008 (9) 2010(e) - Visual Studio 2010 (10) 2012(e) - Visual Studio 2012 (11) - 2013(e) - Visual Studio 2013 (11) + 2013(e) - Visual Studio 2013 (12) + 2015 - Visual Studio 2015 (14) Where (e) is e for express editions of MSVS and blank otherwise. """ version_to_year = { @@ -325,6 +353,7 @@ def _DetectVisualStudioVersions(versions_to_check, force_express): '10.0': '2010', '11.0': '2012', '12.0': '2013', + '14.0': '2015', } versions = [] for version in versions_to_check: @@ -361,13 +390,14 @@ def _DetectVisualStudioVersions(versions_to_check, force_express): if not path: continue path = _ConvertToCygpath(path) - versions.append(_CreateVersion(version_to_year[version] + 'e', - os.path.join(path, '..'), sdk_based=True)) + if version != '14.0': # There is no Express edition for 2015. + versions.append(_CreateVersion(version_to_year[version] + 'e', + os.path.join(path, '..'), sdk_based=True)) return versions -def SelectVisualStudioVersion(version='auto'): +def SelectVisualStudioVersion(version='auto', allow_fallback=True): """Select which version of Visual Studio projects to generate. Arguments: @@ -379,7 +409,7 @@ def SelectVisualStudioVersion(version='auto'): if version == 'auto': version = os.environ.get('GYP_MSVS_VERSION', 'auto') version_map = { - 'auto': ('10.0', '12.0', '9.0', '8.0', '11.0'), + 'auto': ('14.0', '12.0', '10.0', '9.0', '8.0', '11.0'), '2005': ('8.0',), '2005e': ('8.0',), '2008': ('9.0',), @@ -390,6 +420,7 @@ def SelectVisualStudioVersion(version='auto'): '2012e': ('11.0',), '2013': ('12.0',), '2013e': ('12.0',), + '2015': ('14.0',), } override_path = os.environ.get('GYP_MSVS_OVERRIDE_PATH') if override_path: @@ -401,6 +432,8 @@ def SelectVisualStudioVersion(version='auto'): version = str(version) versions = _DetectVisualStudioVersions(version_map[version], 'e' in version) if not versions: + if not allow_fallback: + raise ValueError('Could not locate Visual Studio installation.') if version == 'auto': # Default to 2005 if we couldn't find anything return _CreateVersion('2005', None) diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py index 30edea56752..ac6d918b849 100755 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py @@ -59,7 +59,6 @@ def Load(build_files, format, default_variables={}, if params is None: params = {} - flavor = None if '-' in format: format, params['flavor'] = format.split('-', 1) @@ -69,6 +68,7 @@ def Load(build_files, format, default_variables={}, # named WITH_CAPITAL_LETTERS to provide a distinct "best practice" namespace, # avoiding collisions with user and automatic variables. default_variables['GENERATOR'] = format + default_variables['GENERATOR_FLAVOR'] = params.get('flavor', '') # Format can be a custom python file, or by default the name of a module # within gyp.generator. @@ -371,7 +371,7 @@ def gyp_main(args): if options.use_environment: generate_formats = os.environ.get('GYP_GENERATORS', []) if generate_formats: - generate_formats = re.split('[\s,]', generate_formats) + generate_formats = re.split(r'[\s,]', generate_formats) if generate_formats: options.formats = generate_formats else: @@ -493,14 +493,13 @@ def gyp_main(args): 'gyp_binary': sys.argv[0], 'home_dot_gyp': home_dot_gyp, 'parallel': options.parallel, - 'root_targets': options.root_targets} + 'root_targets': options.root_targets, + 'target_arch': cmdline_default_variables.get('target_arch', '')} # Start with the default variables from the command line. - [generator, flat_list, targets, data] = Load(build_files, format, - cmdline_default_variables, - includes, options.depth, - params, options.check, - options.circular_check) + [generator, flat_list, targets, data] = Load( + build_files, format, cmdline_default_variables, includes, options.depth, + params, options.check, options.circular_check) # TODO(mark): Pass |data| for now because the generator needs a list of # build files that came in. In the future, maybe it should just accept diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py index f9c6c6f3a8c..b6875e43efc 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py @@ -4,6 +4,7 @@ from __future__ import with_statement +import collections import errno import filecmp import os.path @@ -328,7 +329,7 @@ def WriteOnDiff(filename): the target if it differs (on close). """ - class Writer: + class Writer(object): """Wrapper around file which only covers the target if it differs.""" def __init__(self): # Pick temporary file. @@ -472,6 +473,72 @@ def uniquer(seq, idfun=None): return result +# Based on http://code.activestate.com/recipes/576694/. +class OrderedSet(collections.MutableSet): + def __init__(self, iterable=None): + self.end = end = [] + end += [None, end, end] # sentinel node for doubly linked list + self.map = {} # key --> [key, prev, next] + if iterable is not None: + self |= iterable + + def __len__(self): + return len(self.map) + + def __contains__(self, key): + return key in self.map + + def add(self, key): + if key not in self.map: + end = self.end + curr = end[1] + curr[2] = end[1] = self.map[key] = [key, curr, end] + + def discard(self, key): + if key in self.map: + key, prev_item, next_item = self.map.pop(key) + prev_item[2] = next_item + next_item[1] = prev_item + + def __iter__(self): + end = self.end + curr = end[2] + while curr is not end: + yield curr[0] + curr = curr[2] + + def __reversed__(self): + end = self.end + curr = end[1] + while curr is not end: + yield curr[0] + curr = curr[1] + + # The second argument is an addition that causes a pylint warning. + def pop(self, last=True): # pylint: disable=W0221 + if not self: + raise KeyError('set is empty') + key = self.end[1][0] if last else self.end[2][0] + self.discard(key) + return key + + def __repr__(self): + if not self: + return '%s()' % (self.__class__.__name__,) + return '%s(%r)' % (self.__class__.__name__, list(self)) + + def __eq__(self, other): + if isinstance(other, OrderedSet): + return len(self) == len(other) and list(self) == list(other) + return set(self) == set(other) + + # Extensions to the recipe. + def update(self, iterable): + for i in iterable: + if i not in self: + self.add(i) + + class CycleError(Exception): """An exception raised when an unexpected cycle is detected.""" def __init__(self, nodes): @@ -481,7 +548,7 @@ def __str__(self): def TopologicallySorted(graph, get_edges): - """Topologically sort based on a user provided edge definition. + r"""Topologically sort based on a user provided edge definition. Args: graph: A list of node names. @@ -519,3 +586,14 @@ def Visit(node): for node in sorted(graph): Visit(node) return ordered_nodes + +def CrossCompileRequested(): + # TODO: figure out how to not build extra host objects in the + # non-cross-compile case when this is enabled, and enable unconditionally. + return (os.environ.get('GYP_CROSSCOMPILE') or + os.environ.get('AR_host') or + os.environ.get('CC_host') or + os.environ.get('CXX_host') or + os.environ.get('AR_target') or + os.environ.get('CC_target') or + os.environ.get('CXX_target')) diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py index bf949b6ac9b..b71e9d4e8a5 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py @@ -116,6 +116,11 @@ def WriteXmlIfChanged(content, path, encoding='utf-8', pretty=False, if win32 and os.linesep != '\r\n': xml_string = xml_string.replace('\n', '\r\n') + try: + xml_string = xml_string.encode(encoding) + except Exception: + xml_string = unicode(xml_string, 'latin-1').encode(encoding) + # Get the old content try: f = open(path, 'r') diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py index 3e7efff26ea..b38d8660f72 100755 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py @@ -40,7 +40,12 @@ def ExecFlock(self, lockfile, *cmd_list): # with EBADF, that's why we use this F_SETLK # hack instead. fd = os.open(lockfile, os.O_WRONLY|os.O_NOCTTY|os.O_CREAT, 0666) - op = struct.pack('hhllhhl', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0) + if sys.platform.startswith('aix'): + # Python on AIX is compiled with LARGEFILE support, which changes the + # struct size. + op = struct.pack('hhIllqq', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0) + else: + op = struct.pack('hhllhhl', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0) fcntl.fcntl(fd, fcntl.F_SETLK, op) return subprocess.call(cmd_list) diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py new file mode 100644 index 00000000000..15b80ef9737 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py @@ -0,0 +1,569 @@ +# Copyright (c) 2014 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. + +""" +This script is intended for use as a GYP_GENERATOR. It takes as input (by way of +the generator flag config_path) the path of a json file that dictates the files +and targets to search for. The following keys are supported: +files: list of paths (relative) of the files to search for. +targets: list of targets to search for. The target names are unqualified. + +The following is output: +error: only supplied if there is an error. +targets: the set of targets passed in via targets that either directly or + indirectly depend upon the set of paths supplied in files. +build_targets: minimal set of targets that directly depend on the changed + files and need to be built. The expectation is this set of targets is passed + into a build step. +status: outputs one of three values: none of the supplied files were found, + one of the include files changed so that it should be assumed everything + changed (in this case targets and build_targets are not output) or at + least one file was found. +invalid_targets: list of supplied targets thare were not found. + +If the generator flag analyzer_output_path is specified, output is written +there. Otherwise output is written to stdout. +""" + +import gyp.common +import gyp.ninja_syntax as ninja_syntax +import json +import os +import posixpath +import sys + +debug = False + +found_dependency_string = 'Found dependency' +no_dependency_string = 'No dependencies' +# Status when it should be assumed that everything has changed. +all_changed_string = 'Found dependency (all)' + +# MatchStatus is used indicate if and how a target depends upon the supplied +# sources. +# The target's sources contain one of the supplied paths. +MATCH_STATUS_MATCHES = 1 +# The target has a dependency on another target that contains one of the +# supplied paths. +MATCH_STATUS_MATCHES_BY_DEPENDENCY = 2 +# The target's sources weren't in the supplied paths and none of the target's +# dependencies depend upon a target that matched. +MATCH_STATUS_DOESNT_MATCH = 3 +# The target doesn't contain the source, but the dependent targets have not yet +# been visited to determine a more specific status yet. +MATCH_STATUS_TBD = 4 + +generator_supports_multiple_toolsets = gyp.common.CrossCompileRequested() + +generator_wants_static_library_dependencies_adjusted = False + +generator_default_variables = { +} +for dirname in ['INTERMEDIATE_DIR', 'SHARED_INTERMEDIATE_DIR', 'PRODUCT_DIR', + 'LIB_DIR', 'SHARED_LIB_DIR']: + generator_default_variables[dirname] = '!!!' + +for unused in ['RULE_INPUT_PATH', 'RULE_INPUT_ROOT', 'RULE_INPUT_NAME', + 'RULE_INPUT_DIRNAME', 'RULE_INPUT_EXT', + 'EXECUTABLE_PREFIX', 'EXECUTABLE_SUFFIX', + 'STATIC_LIB_PREFIX', 'STATIC_LIB_SUFFIX', + 'SHARED_LIB_PREFIX', 'SHARED_LIB_SUFFIX', + 'CONFIGURATION_NAME']: + generator_default_variables[unused] = '' + + +def _ToGypPath(path): + """Converts a path to the format used by gyp.""" + if os.sep == '\\' and os.altsep == '/': + return path.replace('\\', '/') + return path + + +def _ResolveParent(path, base_path_components): + """Resolves |path|, which starts with at least one '../'. Returns an empty + string if the path shouldn't be considered. See _AddSources() for a + description of |base_path_components|.""" + depth = 0 + while path.startswith('../'): + depth += 1 + path = path[3:] + # Relative includes may go outside the source tree. For example, an action may + # have inputs in /usr/include, which are not in the source tree. + if depth > len(base_path_components): + return '' + if depth == len(base_path_components): + return path + return '/'.join(base_path_components[0:len(base_path_components) - depth]) + \ + '/' + path + + +def _AddSources(sources, base_path, base_path_components, result): + """Extracts valid sources from |sources| and adds them to |result|. Each + source file is relative to |base_path|, but may contain '..'. To make + resolving '..' easier |base_path_components| contains each of the + directories in |base_path|. Additionally each source may contain variables. + Such sources are ignored as it is assumed dependencies on them are expressed + and tracked in some other means.""" + # NOTE: gyp paths are always posix style. + for source in sources: + if not len(source) or source.startswith('!!!') or source.startswith('$'): + continue + # variable expansion may lead to //. + org_source = source + source = source[0] + source[1:].replace('//', '/') + if source.startswith('../'): + source = _ResolveParent(source, base_path_components) + if len(source): + result.append(source) + continue + result.append(base_path + source) + if debug: + print 'AddSource', org_source, result[len(result) - 1] + + +def _ExtractSourcesFromAction(action, base_path, base_path_components, + results): + if 'inputs' in action: + _AddSources(action['inputs'], base_path, base_path_components, results) + + +def _ToLocalPath(toplevel_dir, path): + """Converts |path| to a path relative to |toplevel_dir|.""" + if path == toplevel_dir: + return '' + if path.startswith(toplevel_dir + '/'): + return path[len(toplevel_dir) + len('/'):] + return path + + +def _ExtractSources(target, target_dict, toplevel_dir): + # |target| is either absolute or relative and in the format of the OS. Gyp + # source paths are always posix. Convert |target| to a posix path relative to + # |toplevel_dir_|. This is done to make it easy to build source paths. + base_path = posixpath.dirname(_ToLocalPath(toplevel_dir, _ToGypPath(target))) + base_path_components = base_path.split('/') + + # Add a trailing '/' so that _AddSources() can easily build paths. + if len(base_path): + base_path += '/' + + if debug: + print 'ExtractSources', target, base_path + + results = [] + if 'sources' in target_dict: + _AddSources(target_dict['sources'], base_path, base_path_components, + results) + # Include the inputs from any actions. Any changes to these affect the + # resulting output. + if 'actions' in target_dict: + for action in target_dict['actions']: + _ExtractSourcesFromAction(action, base_path, base_path_components, + results) + if 'rules' in target_dict: + for rule in target_dict['rules']: + _ExtractSourcesFromAction(rule, base_path, base_path_components, results) + + return results + + +class Target(object): + """Holds information about a particular target: + deps: set of Targets this Target depends upon. This is not recursive, only the + direct dependent Targets. + match_status: one of the MatchStatus values. + back_deps: set of Targets that have a dependency on this Target. + visited: used during iteration to indicate whether we've visited this target. + This is used for two iterations, once in building the set of Targets and + again in _GetBuildTargets(). + name: fully qualified name of the target. + requires_build: True if the target type is such that it needs to be built. + See _DoesTargetTypeRequireBuild for details. + added_to_compile_targets: used when determining if the target was added to the + set of targets that needs to be built. + in_roots: true if this target is a descendant of one of the root nodes. + is_executable: true if the type of target is executable.""" + def __init__(self, name): + self.deps = set() + self.match_status = MATCH_STATUS_TBD + self.back_deps = set() + self.name = name + # TODO(sky): I don't like hanging this off Target. This state is specific + # to certain functions and should be isolated there. + self.visited = False + self.requires_build = False + self.added_to_compile_targets = False + self.in_roots = False + self.is_executable = False + + +class Config(object): + """Details what we're looking for + files: set of files to search for + targets: see file description for details.""" + def __init__(self): + self.files = [] + self.targets = set() + + def Init(self, params): + """Initializes Config. This is a separate method as it raises an exception + if there is a parse error.""" + generator_flags = params.get('generator_flags', {}) + config_path = generator_flags.get('config_path', None) + if not config_path: + return + try: + f = open(config_path, 'r') + config = json.load(f) + f.close() + except IOError: + raise Exception('Unable to open file ' + config_path) + except ValueError as e: + raise Exception('Unable to parse config file ' + config_path + str(e)) + if not isinstance(config, dict): + raise Exception('config_path must be a JSON file containing a dictionary') + self.files = config.get('files', []) + self.targets = set(config.get('targets', [])) + + +def _WasBuildFileModified(build_file, data, files, toplevel_dir): + """Returns true if the build file |build_file| is either in |files| or + one of the files included by |build_file| is in |files|. |toplevel_dir| is + the root of the source tree.""" + if _ToLocalPath(toplevel_dir, _ToGypPath(build_file)) in files: + if debug: + print 'gyp file modified', build_file + return True + + # First element of included_files is the file itself. + if len(data[build_file]['included_files']) <= 1: + return False + + for include_file in data[build_file]['included_files'][1:]: + # |included_files| are relative to the directory of the |build_file|. + rel_include_file = \ + _ToGypPath(gyp.common.UnrelativePath(include_file, build_file)) + if _ToLocalPath(toplevel_dir, rel_include_file) in files: + if debug: + print 'included gyp file modified, gyp_file=', build_file, \ + 'included file=', rel_include_file + return True + return False + + +def _GetOrCreateTargetByName(targets, target_name): + """Creates or returns the Target at targets[target_name]. If there is no + Target for |target_name| one is created. Returns a tuple of whether a new + Target was created and the Target.""" + if target_name in targets: + return False, targets[target_name] + target = Target(target_name) + targets[target_name] = target + return True, target + + +def _DoesTargetTypeRequireBuild(target_dict): + """Returns true if the target type is such that it needs to be built.""" + # If a 'none' target has rules or actions we assume it requires a build. + return target_dict['type'] != 'none' or \ + target_dict.get('actions') or target_dict.get('rules') + + +def _GenerateTargets(data, target_list, target_dicts, toplevel_dir, files, + build_files): + """Returns a tuple of the following: + . A dictionary mapping from fully qualified name to Target. + . A list of the targets that have a source file in |files|. + . Set of root Targets reachable from the the files |build_files|. + This sets the |match_status| of the targets that contain any of the source + files in |files| to MATCH_STATUS_MATCHES. + |toplevel_dir| is the root of the source tree.""" + # Maps from target name to Target. + targets = {} + + # Targets that matched. + matching_targets = [] + + # Queue of targets to visit. + targets_to_visit = target_list[:] + + # Maps from build file to a boolean indicating whether the build file is in + # |files|. + build_file_in_files = {} + + # Root targets across all files. + roots = set() + + # Set of Targets in |build_files|. + build_file_targets = set() + + while len(targets_to_visit) > 0: + target_name = targets_to_visit.pop() + created_target, target = _GetOrCreateTargetByName(targets, target_name) + if created_target: + roots.add(target) + elif target.visited: + continue + + target.visited = True + target.requires_build = _DoesTargetTypeRequireBuild( + target_dicts[target_name]) + target.is_executable = target_dicts[target_name]['type'] == 'executable' + + build_file = gyp.common.ParseQualifiedTarget(target_name)[0] + if not build_file in build_file_in_files: + build_file_in_files[build_file] = \ + _WasBuildFileModified(build_file, data, files, toplevel_dir) + + if build_file in build_files: + build_file_targets.add(target) + + # If a build file (or any of its included files) is modified we assume all + # targets in the file are modified. + if build_file_in_files[build_file]: + print 'matching target from modified build file', target_name + target.match_status = MATCH_STATUS_MATCHES + matching_targets.append(target) + else: + sources = _ExtractSources(target_name, target_dicts[target_name], + toplevel_dir) + for source in sources: + if source in files: + print 'target', target_name, 'matches', source + target.match_status = MATCH_STATUS_MATCHES + matching_targets.append(target) + break + + # Add dependencies to visit as well as updating back pointers for deps. + for dep in target_dicts[target_name].get('dependencies', []): + targets_to_visit.append(dep) + + created_dep_target, dep_target = _GetOrCreateTargetByName(targets, dep) + if not created_dep_target: + roots.discard(dep_target) + + target.deps.add(dep_target) + dep_target.back_deps.add(target) + + return targets, matching_targets, roots & build_file_targets + + +def _GetUnqualifiedToTargetMapping(all_targets, to_find): + """Returns a mapping (dictionary) from unqualified name to Target for all the + Targets in |to_find|.""" + result = {} + if not to_find: + return result + to_find = set(to_find) + for target_name in all_targets.keys(): + extracted = gyp.common.ParseQualifiedTarget(target_name) + if len(extracted) > 1 and extracted[1] in to_find: + to_find.remove(extracted[1]) + result[extracted[1]] = all_targets[target_name] + if not to_find: + return result + return result + + +def _DoesTargetDependOn(target): + """Returns true if |target| or any of its dependencies matches the supplied + set of paths. This updates |matches| of the Targets as it recurses. + target: the Target to look for.""" + if target.match_status == MATCH_STATUS_DOESNT_MATCH: + return False + if target.match_status == MATCH_STATUS_MATCHES or \ + target.match_status == MATCH_STATUS_MATCHES_BY_DEPENDENCY: + return True + for dep in target.deps: + if _DoesTargetDependOn(dep): + target.match_status = MATCH_STATUS_MATCHES_BY_DEPENDENCY + return True + target.match_status = MATCH_STATUS_DOESNT_MATCH + return False + + +def _GetTargetsDependingOn(possible_targets): + """Returns the list of Targets in |possible_targets| that depend (either + directly on indirectly) on the matched targets. + possible_targets: targets to search from.""" + found = [] + for target in possible_targets: + if _DoesTargetDependOn(target): + found.append(target) + return found + + +def _AddBuildTargets(target, roots, add_if_no_ancestor, result): + """Recurses through all targets that depend on |target|, adding all targets + that need to be built (and are in |roots|) to |result|. + roots: set of root targets. + add_if_no_ancestor: If true and there are no ancestors of |target| then add + |target| to |result|. |target| must still be in |roots|. + result: targets that need to be built are added here.""" + if target.visited: + return + + target.visited = True + target.in_roots = not target.back_deps and target in roots + + for back_dep_target in target.back_deps: + _AddBuildTargets(back_dep_target, roots, False, result) + target.added_to_compile_targets |= back_dep_target.added_to_compile_targets + target.in_roots |= back_dep_target.in_roots + + # Always add 'executable' targets. Even though they may be built by other + # targets that depend upon them it makes detection of what is going to be + # built easier. + if target.in_roots and \ + (target.is_executable or + (not target.added_to_compile_targets and + (add_if_no_ancestor or target.requires_build))): + result.add(target) + target.added_to_compile_targets = True + + +def _GetBuildTargets(matching_targets, roots): + """Returns the set of Targets that require a build. + matching_targets: targets that changed and need to be built. + roots: set of root targets in the build files to search from.""" + result = set() + for target in matching_targets: + _AddBuildTargets(target, roots, True, result) + return result + + +def _WriteOutput(params, **values): + """Writes the output, either to stdout or a file is specified.""" + if 'error' in values: + print 'Error:', values['error'] + if 'status' in values: + print values['status'] + if 'targets' in values: + values['targets'].sort() + print 'Supplied targets that depend on changed files:' + for target in values['targets']: + print '\t', target + if 'invalid_targets' in values: + values['invalid_targets'].sort() + print 'The following targets were not found:' + for target in values['invalid_targets']: + print '\t', target + if 'build_targets' in values: + values['build_targets'].sort() + print 'Targets that require a build:' + for target in values['build_targets']: + print '\t', target + + output_path = params.get('generator_flags', {}).get( + 'analyzer_output_path', None) + if not output_path: + print json.dumps(values) + return + try: + f = open(output_path, 'w') + f.write(json.dumps(values) + '\n') + f.close() + except IOError as e: + print 'Error writing to output file', output_path, str(e) + + +def _WasGypIncludeFileModified(params, files): + """Returns true if one of the files in |files| is in the set of included + files.""" + if params['options'].includes: + for include in params['options'].includes: + if _ToGypPath(include) in files: + print 'Include file modified, assuming all changed', include + return True + return False + + +def _NamesNotIn(names, mapping): + """Returns a list of the values in |names| that are not in |mapping|.""" + return [name for name in names if name not in mapping] + + +def _LookupTargets(names, mapping): + """Returns a list of the mapping[name] for each value in |names| that is in + |mapping|.""" + return [mapping[name] for name in names if name in mapping] + + +def CalculateVariables(default_variables, params): + """Calculate additional variables for use in the build (called by gyp).""" + flavor = gyp.common.GetFlavor(params) + if flavor == 'mac': + default_variables.setdefault('OS', 'mac') + elif flavor == 'win': + default_variables.setdefault('OS', 'win') + # Copy additional generator configuration data from VS, which is shared + # by the Windows Ninja generator. + import gyp.generator.msvs as msvs_generator + generator_additional_non_configuration_keys = getattr(msvs_generator, + 'generator_additional_non_configuration_keys', []) + generator_additional_path_sections = getattr(msvs_generator, + 'generator_additional_path_sections', []) + + gyp.msvs_emulation.CalculateCommonVariables(default_variables, params) + else: + operating_system = flavor + if flavor == 'android': + operating_system = 'linux' # Keep this legacy behavior for now. + default_variables.setdefault('OS', operating_system) + + +def GenerateOutput(target_list, target_dicts, data, params): + """Called by gyp as the final stage. Outputs results.""" + config = Config() + try: + config.Init(params) + if not config.files: + raise Exception('Must specify files to analyze via config_path generator ' + 'flag') + + toplevel_dir = _ToGypPath(os.path.abspath(params['options'].toplevel_dir)) + if debug: + print 'toplevel_dir', toplevel_dir + + if _WasGypIncludeFileModified(params, config.files): + result_dict = { 'status': all_changed_string, + 'targets': list(config.targets) } + _WriteOutput(params, **result_dict) + return + + all_targets, matching_targets, roots = _GenerateTargets( + data, target_list, target_dicts, toplevel_dir, frozenset(config.files), + params['build_files']) + + unqualified_mapping = _GetUnqualifiedToTargetMapping(all_targets, + config.targets) + invalid_targets = None + if len(unqualified_mapping) != len(config.targets): + invalid_targets = _NamesNotIn(config.targets, unqualified_mapping) + + if matching_targets: + search_targets = _LookupTargets(config.targets, unqualified_mapping) + matched_search_targets = _GetTargetsDependingOn(search_targets) + # Reset the visited status for _GetBuildTargets. + for target in all_targets.itervalues(): + target.visited = False + build_targets = _GetBuildTargets(matching_targets, roots) + matched_search_targets = [gyp.common.ParseQualifiedTarget(target.name)[1] + for target in matched_search_targets] + build_targets = [gyp.common.ParseQualifiedTarget(target.name)[1] + for target in build_targets] + else: + matched_search_targets = [] + build_targets = [] + + result_dict = { 'targets': matched_search_targets, + 'status': found_dependency_string if matching_targets else + no_dependency_string, + 'build_targets': build_targets} + if invalid_targets: + result_dict['invalid_targets'] = invalid_targets + _WriteOutput(params, **result_dict) + + except Exception as e: + _WriteOutput(params, error=str(e)) diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py index 41346e2b1c3..ad6eff6d17b 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py @@ -50,12 +50,14 @@ generator_additional_non_configuration_keys = [ # Boolean to declare that this target does not want its name mangled. 'android_unmangled_name', + # Map of android build system variables to set. + 'aosp_build_settings', ] generator_additional_path_sections = [] generator_extra_sources_for_rules = [] -SHARED_FOOTER = """\ +ALL_MODULES_FOOTER = """\ # "gyp_all_modules" is a concatenation of the "gyp_all_modules" targets from # all the included sub-makefiles. This is just here to clarify. gyp_all_modules: @@ -66,33 +68,6 @@ """ -android_standard_include_paths = set([ - # JNI_H_INCLUDE in build/core/binary.mk - 'dalvik/libnativehelper/include/nativehelper', - # from SRC_HEADERS in build/core/config.mk - 'system/core/include', - 'hardware/libhardware/include', - 'hardware/libhardware_legacy/include', - 'hardware/ril/include', - 'dalvik/libnativehelper/include', - 'frameworks/native/include', - 'frameworks/native/opengl/include', - 'frameworks/base/include', - 'frameworks/base/opengl/include', - 'frameworks/base/native/include', - 'external/skia/include', - # TARGET_C_INCLUDES in build/core/combo/TARGET_linux-arm.mk - 'bionic/libc/arch-arm/include', - 'bionic/libc/include', - 'bionic/libstdc++/include', - 'bionic/libc/kernel/common', - 'bionic/libc/kernel/arch-arm', - 'bionic/libm/include', - 'bionic/libm/include/arm', - 'bionic/libthread_db/include', - ]) - - # Map gyp target types to Android module classes. MODULE_CLASSES = { 'static_library': 'STATIC_LIBRARIES', @@ -133,7 +108,7 @@ def __init__(self, android_top_dir): self.android_top_dir = android_top_dir def Write(self, qualified_target, relative_target, base_path, output_filename, - spec, configs, part_of_all): + spec, configs, part_of_all, write_alias_target, sdk_version): """The main entry point: writes a .mk file for a single target. Arguments: @@ -144,6 +119,9 @@ def Write(self, qualified_target, relative_target, base_path, output_filename, output_filename: output .mk file name to write spec, configs: gyp info part_of_all: flag indicating this target is part of 'all' + write_alias_target: flag indicating whether to create short aliases for + this target + sdk_version: what to emit for LOCAL_SDK_VERSION in output """ gyp.common.EnsureDirExists(output_filename) @@ -183,14 +161,23 @@ def Write(self, qualified_target, relative_target, base_path, output_filename, if self.android_stem != self.android_module: self.WriteLn('LOCAL_MODULE_STEM := ' + self.android_stem) self.WriteLn('LOCAL_MODULE_SUFFIX := ' + self.android_suffix) - self.WriteLn('LOCAL_MODULE_TAGS := optional') if self.toolset == 'host': self.WriteLn('LOCAL_IS_HOST_MODULE := true') + self.WriteLn('LOCAL_MULTILIB := $(GYP_HOST_MULTILIB)') + else: + self.WriteLn('LOCAL_MODULE_TARGET_ARCH := ' + '$(TARGET_$(GYP_VAR_PREFIX)ARCH)') + self.WriteLn('LOCAL_SDK_VERSION := %s' % sdk_version) # Grab output directories; needed for Actions and Rules. - self.WriteLn('gyp_intermediate_dir := $(call local-intermediates-dir)') + if self.toolset == 'host': + self.WriteLn('gyp_intermediate_dir := ' + '$(call local-intermediates-dir,,$(GYP_HOST_VAR_PREFIX))') + else: + self.WriteLn('gyp_intermediate_dir := ' + '$(call local-intermediates-dir,,$(GYP_VAR_PREFIX))') self.WriteLn('gyp_shared_intermediate_dir := ' - '$(call intermediates-dir-for,GYP,shared)') + '$(call intermediates-dir-for,GYP,shared,,,$(GYP_VAR_PREFIX))') self.WriteLn() # List files this target depends on so that actions/rules/copies/sources @@ -226,7 +213,8 @@ def Write(self, qualified_target, relative_target, base_path, output_filename, if spec.get('sources', []) or extra_sources: self.WriteSources(spec, configs, extra_sources) - self.WriteTarget(spec, configs, deps, link_deps, part_of_all) + self.WriteTarget(spec, configs, deps, link_deps, part_of_all, + write_alias_target) # Update global list of target outputs, used in dependency tracking. target_outputs[qualified_target] = ('path', self.output_binary) @@ -291,6 +279,7 @@ def WriteActions(self, actions, extra_sources, extra_outputs): # writing duplicate dummy rules for those outputs. main_output = make.QuoteSpaces(self.LocalPathify(outputs[0])) self.WriteLn('%s: gyp_local_path := $(LOCAL_PATH)' % main_output) + self.WriteLn('%s: gyp_var_prefix := $(GYP_VAR_PREFIX)' % main_output) self.WriteLn('%s: gyp_intermediate_dir := ' '$(abspath $(gyp_intermediate_dir))' % main_output) self.WriteLn('%s: gyp_shared_intermediate_dir := ' @@ -305,12 +294,19 @@ def WriteActions(self, actions, extra_sources, extra_outputs): self.WriteLn('%s: export PATH := $(subst $(ANDROID_BUILD_PATHS),,$(PATH))' % main_output) + # Don't allow spaces in input/output filenames, but make an exception for + # filenames which start with '$(' since it's okay for there to be spaces + # inside of make function/macro invocations. for input in inputs: - assert ' ' not in input, ( - "Spaces in action input filenames not supported (%s)" % input) + if not input.startswith('$(') and ' ' in input: + raise gyp.common.GypError( + 'Action input filename "%s" in target %s contains a space' % + (input, self.target)) for output in outputs: - assert ' ' not in output, ( - "Spaces in action output filenames not supported (%s)" % output) + if not output.startswith('$(') and ' ' in output: + raise gyp.common.GypError( + 'Action output filename "%s" in target %s contains a space' % + (output, self.target)) self.WriteLn('%s: %s $(GYP_TARGET_DEPENDENCIES)' % (main_output, ' '.join(map(self.LocalPathify, inputs)))) @@ -337,13 +333,10 @@ def WriteRules(self, rules, extra_sources, extra_outputs): """ if len(rules) == 0: return - rule_trigger = '%s_rule_trigger' % self.android_module - did_write_rule = False for rule in rules: if len(rule.get('rule_sources', [])) == 0: continue - did_write_rule = True name = make.StringToMakefileVariable('%s_%s' % (self.relative_target, rule['rule_name'])) self.WriteLn('\n### Generated for rule "%s":' % name) @@ -391,6 +384,7 @@ def WriteRules(self, rules, extra_sources, extra_outputs): outputs = map(self.LocalPathify, outputs) main_output = outputs[0] self.WriteLn('%s: gyp_local_path := $(LOCAL_PATH)' % main_output) + self.WriteLn('%s: gyp_var_prefix := $(GYP_VAR_PREFIX)' % main_output) self.WriteLn('%s: gyp_intermediate_dir := ' '$(abspath $(gyp_intermediate_dir))' % main_output) self.WriteLn('%s: gyp_shared_intermediate_dir := ' @@ -412,13 +406,9 @@ def WriteRules(self, rules, extra_sources, extra_outputs): # Make each output depend on the main output, with an empty command # to force make to notice that the mtime has changed. self.WriteLn('%s: %s ;' % (output, main_output)) - self.WriteLn('.PHONY: %s' % (rule_trigger)) - self.WriteLn('%s: %s' % (rule_trigger, main_output)) - self.WriteLn('') - if did_write_rule: - extra_sources.append(rule_trigger) # Force all rules to run. - self.WriteLn('### Finished generating for all rules') - self.WriteLn('') + self.WriteLn() + + self.WriteLn() def WriteCopies(self, copies, extra_outputs): @@ -501,6 +491,9 @@ def WriteSourceFlags(self, spec, configs): self.WriteLn('LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) ' '$(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION))') self.WriteLn('LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION))') + # Android uses separate flags for assembly file invocations, but gyp expects + # the same CFLAGS to be applied: + self.WriteLn('LOCAL_ASFLAGS := $(LOCAL_CFLAGS)') def WriteSources(self, spec, configs, extra_sources): @@ -609,16 +602,16 @@ def ComputeAndroidModule(self, spec): prefix = '' if spec['toolset'] == 'host': - suffix = '_host_gyp' + suffix = '_$(TARGET_$(GYP_VAR_PREFIX)ARCH)_host_gyp' else: suffix = '_gyp' if self.path: - name = '%s%s_%s%s' % (prefix, self.path, self.target, suffix) + middle = make.StringToMakefileVariable('%s_%s' % (self.path, self.target)) else: - name = '%s%s%s' % (prefix, self.target, suffix) + middle = make.StringToMakefileVariable(self.target) - return make.StringToMakefileVariable(name) + return ''.join([prefix, middle, suffix]) def ComputeOutputParts(self, spec): @@ -672,32 +665,31 @@ def ComputeOutput(self, spec): E.g., the loadable module 'foobar' in directory 'baz' will produce '$(obj)/baz/libfoobar.so' """ - if self.type == 'executable' and self.toolset == 'host': + if self.type == 'executable': # We install host executables into shared_intermediate_dir so they can be # run by gyp rules that refer to PRODUCT_DIR. path = '$(gyp_shared_intermediate_dir)' elif self.type == 'shared_library': if self.toolset == 'host': - path = '$(HOST_OUT_INTERMEDIATE_LIBRARIES)' + path = '$($(GYP_HOST_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES)' else: - path = '$(TARGET_OUT_INTERMEDIATE_LIBRARIES)' + path = '$($(GYP_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)' else: # Other targets just get built into their intermediate dir. if self.toolset == 'host': - path = '$(call intermediates-dir-for,%s,%s,true)' % (self.android_class, - self.android_module) + path = ('$(call intermediates-dir-for,%s,%s,true,,' + '$(GYP_HOST_VAR_PREFIX))' % (self.android_class, + self.android_module)) else: - path = '$(call intermediates-dir-for,%s,%s)' % (self.android_class, - self.android_module) + path = ('$(call intermediates-dir-for,%s,%s,,,$(GYP_VAR_PREFIX))' + % (self.android_class, self.android_module)) assert spec.get('product_dir') is None # TODO: not supported? return os.path.join(path, self.ComputeOutputBasename(spec)) def NormalizeIncludePaths(self, include_paths): """ Normalize include_paths. - Convert absolute paths to relative to the Android top directory; - filter out include paths that are already brought in by the Android build - system. + Convert absolute paths to relative to the Android top directory. Args: include_paths: A list of unprocessed include paths. @@ -708,10 +700,7 @@ def NormalizeIncludePaths(self, include_paths): for path in include_paths: if path[0] == '/': path = gyp.common.RelativePath(path, self.android_top_dir) - - # Filter out the Android standard search path. - if path not in android_standard_include_paths: - normalized.append(path) + normalized.append(path) return normalized def ExtractIncludesFromCFlags(self, cflags): @@ -732,16 +721,20 @@ def ExtractIncludesFromCFlags(self, cflags): return (clean_cflags, include_paths) - def ComputeAndroidLibraryModuleNames(self, libraries): - """Compute the Android module names from libraries, ie spec.get('libraries') + def FilterLibraries(self, libraries): + """Filter the 'libraries' key to separate things that shouldn't be ldflags. + + Library entries that look like filenames should be converted to android + module names instead of being passed to the linker as flags. Args: libraries: the value of spec.get('libraries') Returns: - A tuple (static_lib_modules, dynamic_lib_modules) + A tuple (static_lib_modules, dynamic_lib_modules, ldflags) """ static_lib_modules = [] dynamic_lib_modules = [] + ldflags = [] for libs in libraries: # Libs can have multiple words. for lib in libs.split(): @@ -758,13 +751,9 @@ def ComputeAndroidLibraryModuleNames(self, libraries): if match: dynamic_lib_modules.append(match.group(1)) continue - # "-lstlport" -> libstlport if lib.startswith('-l'): - if lib.endswith('_static'): - static_lib_modules.append('lib' + lib[2:]) - else: - dynamic_lib_modules.append('lib' + lib[2:]) - return (static_lib_modules, dynamic_lib_modules) + ldflags.append(lib) + return (static_lib_modules, dynamic_lib_modules, ldflags) def ComputeDeps(self, spec): @@ -792,47 +781,74 @@ def WriteTargetFlags(self, spec, configs, link_deps): spec, configs: input from gyp. link_deps: link dependency list; see ComputeDeps() """ - for configname, config in sorted(configs.iteritems()): - ldflags = list(config.get('ldflags', [])) - self.WriteLn('') - self.WriteList(ldflags, 'LOCAL_LDFLAGS_%s' % configname) - self.WriteLn('\nLOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION))') - # Libraries (i.e. -lfoo) + # These must be included even for static libraries as some of them provide + # implicit include paths through the build system. libraries = gyp.common.uniquer(spec.get('libraries', [])) - static_libs, dynamic_libs = self.ComputeAndroidLibraryModuleNames( - libraries) - - # Link dependencies (i.e. libfoo.a, libfoo.so) - static_link_deps = [x[1] for x in link_deps if x[0] == 'static'] - shared_link_deps = [x[1] for x in link_deps if x[0] == 'shared'] - self.WriteLn('') - self.WriteList(static_libs + static_link_deps, - 'LOCAL_STATIC_LIBRARIES') - self.WriteLn('# Enable grouping to fix circular references') - self.WriteLn('LOCAL_GROUP_STATIC_LIBRARIES := true') - self.WriteLn('') - self.WriteList(dynamic_libs + shared_link_deps, - 'LOCAL_SHARED_LIBRARIES') - - - def WriteTarget(self, spec, configs, deps, link_deps, part_of_all): + static_libs, dynamic_libs, ldflags_libs = self.FilterLibraries(libraries) + + if self.type != 'static_library': + for configname, config in sorted(configs.iteritems()): + ldflags = list(config.get('ldflags', [])) + self.WriteLn('') + self.WriteList(ldflags, 'LOCAL_LDFLAGS_%s' % configname) + self.WriteList(ldflags_libs, 'LOCAL_GYP_LIBS') + self.WriteLn('LOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION)) ' + '$(LOCAL_GYP_LIBS)') + + # Link dependencies (i.e. other gyp targets this target depends on) + # These need not be included for static libraries as within the gyp build + # we do not use the implicit include path mechanism. + if self.type != 'static_library': + static_link_deps = [x[1] for x in link_deps if x[0] == 'static'] + shared_link_deps = [x[1] for x in link_deps if x[0] == 'shared'] + else: + static_link_deps = [] + shared_link_deps = [] + + # Only write the lists if they are non-empty. + if static_libs or static_link_deps: + self.WriteLn('') + self.WriteList(static_libs + static_link_deps, + 'LOCAL_STATIC_LIBRARIES') + self.WriteLn('# Enable grouping to fix circular references') + self.WriteLn('LOCAL_GROUP_STATIC_LIBRARIES := true') + if dynamic_libs or shared_link_deps: + self.WriteLn('') + self.WriteList(dynamic_libs + shared_link_deps, + 'LOCAL_SHARED_LIBRARIES') + + + def WriteTarget(self, spec, configs, deps, link_deps, part_of_all, + write_alias_target): """Write Makefile code to produce the final target of the gyp spec. spec, configs: input from gyp. deps, link_deps: dependency lists; see ComputeDeps() part_of_all: flag indicating this target is part of 'all' + write_alias_target: flag indicating whether to create short aliases for this + target """ self.WriteLn('### Rules for final target.') if self.type != 'none': self.WriteTargetFlags(spec, configs, link_deps) + settings = spec.get('aosp_build_settings', {}) + if settings: + self.WriteLn('### Set directly by aosp_build_settings.') + for k, v in settings.iteritems(): + if isinstance(v, list): + self.WriteList(v, k) + else: + self.WriteLn('%s := %s' % (k, make.QuoteIfNecessary(v))) + self.WriteLn('') + # Add to the set of targets which represent the gyp 'all' target. We use the # name 'gyp_all_modules' as the Android build system doesn't allow the use # of the Make target 'all' and because 'all_modules' is the equivalent of # the Make target 'all' on Android. - if part_of_all: + if part_of_all and write_alias_target: self.WriteLn('# Add target alias to "gyp_all_modules" target.') self.WriteLn('.PHONY: gyp_all_modules') self.WriteLn('gyp_all_modules: %s' % self.android_module) @@ -841,7 +857,7 @@ def WriteTarget(self, spec, configs, deps, link_deps, part_of_all): # Add an alias from the gyp target name to the Android module name. This # simplifies manual builds of the target, and is required by the test # framework. - if self.target != self.android_module: + if self.target != self.android_module and write_alias_target: self.WriteLn('# Alias gyp target name.') self.WriteLn('.PHONY: %s' % self.target) self.WriteLn('%s: %s' % (self.target, self.android_module)) @@ -859,17 +875,17 @@ def WriteTarget(self, spec, configs, deps, link_deps, part_of_all): self.WriteLn('LOCAL_PRELINK_MODULE := false') self.WriteLn('include $(BUILD_%sSHARED_LIBRARY)' % modifier) elif self.type == 'executable': - if self.toolset == 'host': - self.WriteLn('LOCAL_MODULE_PATH := $(gyp_shared_intermediate_dir)') - else: - # Don't install target executables for now, as it results in them being - # included in ROM. This can be revisited if there's a reason to install - # them later. - self.WriteLn('LOCAL_UNINSTALLABLE_MODULE := true') + # Executables are for build and test purposes only, so they're installed + # to a directory that doesn't get included in the system image. + self.WriteLn('LOCAL_MODULE_PATH := $(gyp_shared_intermediate_dir)') self.WriteLn('include $(BUILD_%sEXECUTABLE)' % modifier) else: self.WriteLn('LOCAL_MODULE_PATH := $(PRODUCT_OUT)/gyp_stamp') self.WriteLn('LOCAL_UNINSTALLABLE_MODULE := true') + if self.toolset == 'target': + self.WriteLn('LOCAL_2ND_ARCH_VAR_PREFIX := $(GYP_VAR_PREFIX)') + else: + self.WriteLn('LOCAL_2ND_ARCH_VAR_PREFIX := $(GYP_HOST_VAR_PREFIX)') self.WriteLn() self.WriteLn('include $(BUILD_SYSTEM)/base_rules.mk') self.WriteLn() @@ -877,6 +893,8 @@ def WriteTarget(self, spec, configs, deps, link_deps, part_of_all): self.WriteLn('\t$(hide) echo "Gyp timestamp: $@"') self.WriteLn('\t$(hide) mkdir -p $(dir $@)') self.WriteLn('\t$(hide) touch $@') + self.WriteLn() + self.WriteLn('LOCAL_2ND_ARCH_VAR_PREFIX :=') def WriteList(self, value_list, variable=None, prefix='', @@ -926,7 +944,7 @@ def ExpandInputRoot(self, template, expansion, dirname): 'INPUT_ROOT': expansion, 'INPUT_DIRNAME': dirname, } - return path + return os.path.normpath(path) def PerformBuild(data, configurations, params): @@ -946,6 +964,8 @@ def GenerateOutput(target_list, target_dicts, data, params): generator_flags = params.get('generator_flags', {}) builddir_name = generator_flags.get('output_dir', 'out') limit_to_target_all = generator_flags.get('limit_to_target_all', False) + write_alias_targets = generator_flags.get('write_alias_targets', True) + sdk_version = generator_flags.get('aosp_sdk_version', 19) android_top_dir = os.environ.get('ANDROID_BUILD_TOP') assert android_top_dir, '$ANDROID_BUILD_TOP not set; you need to run lunch.' @@ -1031,8 +1051,7 @@ def CalculateMakefilePath(build_file, base_name): spec = target_dicts[qualified_target] configs = spec['configurations'] - part_of_all = (qualified_target in needed_targets and - not int(spec.get('suppress_wildcard', False))) + part_of_all = qualified_target in needed_targets if limit_to_target_all and not part_of_all: continue @@ -1041,7 +1060,9 @@ def CalculateMakefilePath(build_file, base_name): writer = AndroidMkWriter(android_top_dir) android_module = writer.Write(qualified_target, relative_target, base_path, output_file, spec, configs, - part_of_all=part_of_all) + part_of_all=part_of_all, + write_alias_target=write_alias_targets, + sdk_version=sdk_version) if android_module in android_modules: print ('ERROR: Android module names must be unique. The following ' 'targets both generate Android module name %s.\n %s\n %s' % @@ -1057,6 +1078,9 @@ def CalculateMakefilePath(build_file, base_name): include_list.add(mkfile_rel_path) root_makefile.write('GYP_CONFIGURATION ?= %s\n' % default_configuration) + root_makefile.write('GYP_VAR_PREFIX ?=\n') + root_makefile.write('GYP_HOST_VAR_PREFIX ?=\n') + root_makefile.write('GYP_HOST_MULTILIB ?=\n') # Write out the sorted list of includes. root_makefile.write('\n') @@ -1064,6 +1088,7 @@ def CalculateMakefilePath(build_file, base_name): root_makefile.write('include $(LOCAL_PATH)/' + include_file + '\n') root_makefile.write('\n') - root_makefile.write(SHARED_FOOTER) + if write_alias_targets: + root_makefile.write(ALL_MODULES_FOOTER) root_makefile.close() diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py index 10d015ee831..8f5feddee1c 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py @@ -216,7 +216,7 @@ def WriteVariable(output, variable_name, prepend=None): output.write('}') -class CMakeTargetType: +class CMakeTargetType(object): def __init__(self, command, modifier, property_modifier): self.command = command self.modifier = modifier @@ -464,7 +464,7 @@ def WriteCopies(target_name, copies, extra_deps, path_to_gyp, output): extra_deps.append(copy_name) return - class Copy: + class Copy(object): def __init__(self, ext, command): self.cmake_inputs = [] self.cmake_outputs = [] @@ -743,7 +743,7 @@ def partition(l, p): if target_output_directory is None: if target_type in ('executable', 'loadable_module'): target_output_directory = generator_default_variables['PRODUCT_DIR'] - elif target_type in ('shared_library'): + elif target_type == 'shared_library': target_output_directory = '${builddir}/lib.${TOOLSET}' elif spec.get('standalone_static_library', False): target_output_directory = generator_default_variables['PRODUCT_DIR'] diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py index 84380b04da2..3544347b3ba 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py @@ -24,6 +24,7 @@ import gyp.common import gyp.msvs_emulation import shlex +import xml.etree.cElementTree as ET generator_wants_static_library_dependencies_adjusted = False @@ -31,8 +32,8 @@ } for dirname in ['INTERMEDIATE_DIR', 'PRODUCT_DIR', 'LIB_DIR', 'SHARED_LIB_DIR']: - # Some gyp steps fail if these are empty(!). - generator_default_variables[dirname] = 'dir' + # Some gyp steps fail if these are empty(!), so we convert them to variables + generator_default_variables[dirname] = '$' + dirname for unused in ['RULE_INPUT_PATH', 'RULE_INPUT_ROOT', 'RULE_INPUT_NAME', 'RULE_INPUT_DIRNAME', 'RULE_INPUT_EXT', @@ -77,7 +78,8 @@ def CalculateGeneratorInputInfo(params): def GetAllIncludeDirectories(target_list, target_dicts, - shared_intermediate_dirs, config_name, params): + shared_intermediate_dirs, config_name, params, + compiler_path): """Calculate the set of include directories to be used. Returns: @@ -88,6 +90,33 @@ def GetAllIncludeDirectories(target_list, target_dicts, gyp_includes_set = set() compiler_includes_list = [] + # Find compiler's default include dirs. + if compiler_path: + command = shlex.split(compiler_path) + command.extend(['-E', '-xc++', '-v', '-']) + proc = subprocess.Popen(args=command, stdin=subprocess.PIPE, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output = proc.communicate()[1] + # Extract the list of include dirs from the output, which has this format: + # ... + # #include "..." search starts here: + # #include <...> search starts here: + # /usr/include/c++/4.6 + # /usr/local/include + # End of search list. + # ... + in_include_list = False + for line in output.splitlines(): + if line.startswith('#include'): + in_include_list = True + continue + if line.startswith('End of search list.'): + break + if in_include_list: + include_dir = line.strip() + if include_dir not in compiler_includes_list: + compiler_includes_list.append(include_dir) + flavor = gyp.common.GetFlavor(params) if flavor == 'win': generator_flags = params.get('generator_flags', {}) @@ -106,11 +135,10 @@ def GetAllIncludeDirectories(target_list, target_dicts, else: cflags = config['cflags'] for cflag in cflags: - include_dir = '' if cflag.startswith('-I'): include_dir = cflag[2:] - if include_dir and not include_dir in compiler_includes_list: - compiler_includes_list.append(include_dir) + if include_dir not in compiler_includes_list: + compiler_includes_list.append(include_dir) # Find standard gyp include dirs. if config.has_key('include_dirs'): @@ -125,9 +153,7 @@ def GetAllIncludeDirectories(target_list, target_dicts, include_dir = base_dir + '/' + include_dir include_dir = os.path.abspath(include_dir) - if not include_dir in gyp_includes_set: - gyp_includes_set.add(include_dir) - + gyp_includes_set.add(include_dir) # Generate a list that has all the include dirs. all_includes_list = list(gyp_includes_set) @@ -140,7 +166,7 @@ def GetAllIncludeDirectories(target_list, target_dicts, return all_includes_list -def GetCompilerPath(target_list, target_dicts, data): +def GetCompilerPath(target_list, data, options): """Determine a command that can be used to invoke the compiler. Returns: @@ -148,13 +174,12 @@ def GetCompilerPath(target_list, target_dicts, data): the compiler from that. Otherwise, see if a compiler was specified via the CC_target environment variable. """ - # First, see if the compiler is configured in make's settings. build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) make_global_settings_dict = data[build_file].get('make_global_settings', {}) for key, value in make_global_settings_dict: if key in ['CC', 'CXX']: - return value + return os.path.join(options.toplevel_dir, value) # Check to see if the compiler was specified as an environment variable. for key in ['CC_target', 'CC', 'CXX']: @@ -165,7 +190,8 @@ def GetCompilerPath(target_list, target_dicts, data): return 'gcc' -def GetAllDefines(target_list, target_dicts, data, config_name, params): +def GetAllDefines(target_list, target_dicts, data, config_name, params, + compiler_path): """Calculate the defines for a project. Returns: @@ -202,9 +228,8 @@ def GetAllDefines(target_list, target_dicts, data, config_name, params): # Get default compiler defines (if possible). if flavor == 'win': return all_defines # Default defines already processed in the loop above. - cc_target = GetCompilerPath(target_list, target_dicts, data) - if cc_target: - command = shlex.split(cc_target) + if compiler_path: + command = shlex.split(compiler_path) command.extend(['-E', '-dM', '-']) cpp_proc = subprocess.Popen(args=command, cwd='.', stdin=subprocess.PIPE, stdout=subprocess.PIPE) @@ -270,31 +295,123 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, shared_intermediate_dirs = [os.path.join(toplevel_build, 'obj', 'gen'), os.path.join(toplevel_build, 'gen')] - out_name = os.path.join(toplevel_build, 'eclipse-cdt-settings.xml') + GenerateCdtSettingsFile(target_list, + target_dicts, + data, + params, + config_name, + os.path.join(toplevel_build, + 'eclipse-cdt-settings.xml'), + options, + shared_intermediate_dirs) + GenerateClasspathFile(target_list, + target_dicts, + options.toplevel_dir, + toplevel_build, + os.path.join(toplevel_build, + 'eclipse-classpath.xml')) + + +def GenerateCdtSettingsFile(target_list, target_dicts, data, params, + config_name, out_name, options, + shared_intermediate_dirs): gyp.common.EnsureDirExists(out_name) - out = open(out_name, 'w') + with open(out_name, 'w') as out: + out.write('\n') + out.write('\n') + + eclipse_langs = ['C++ Source File', 'C Source File', 'Assembly Source File', + 'GNU C++', 'GNU C', 'Assembly'] + compiler_path = GetCompilerPath(target_list, data, options) + include_dirs = GetAllIncludeDirectories(target_list, target_dicts, + shared_intermediate_dirs, + config_name, params, compiler_path) + WriteIncludePaths(out, eclipse_langs, include_dirs) + defines = GetAllDefines(target_list, target_dicts, data, config_name, + params, compiler_path) + WriteMacros(out, eclipse_langs, defines) + + out.write('\n') + + +def GenerateClasspathFile(target_list, target_dicts, toplevel_dir, + toplevel_build, out_name): + '''Generates a classpath file suitable for symbol navigation and code + completion of Java code (such as in Android projects) by finding all + .java and .jar files used as action inputs.''' + gyp.common.EnsureDirExists(out_name) + result = ET.Element('classpath') + + def AddElements(kind, paths): + # First, we need to normalize the paths so they are all relative to the + # toplevel dir. + rel_paths = set() + for path in paths: + if os.path.isabs(path): + rel_paths.add(os.path.relpath(path, toplevel_dir)) + else: + rel_paths.add(path) - out.write('\n') - out.write('\n') + for path in sorted(rel_paths): + entry_element = ET.SubElement(result, 'classpathentry') + entry_element.set('kind', kind) + entry_element.set('path', path) - eclipse_langs = ['C++ Source File', 'C Source File', 'Assembly Source File', - 'GNU C++', 'GNU C', 'Assembly'] - include_dirs = GetAllIncludeDirectories(target_list, target_dicts, - shared_intermediate_dirs, config_name, - params) - WriteIncludePaths(out, eclipse_langs, include_dirs) - defines = GetAllDefines(target_list, target_dicts, data, config_name, params) - WriteMacros(out, eclipse_langs, defines) + AddElements('lib', GetJavaJars(target_list, target_dicts, toplevel_dir)) + AddElements('src', GetJavaSourceDirs(target_list, target_dicts, toplevel_dir)) + # Include the standard JRE container and a dummy out folder + AddElements('con', ['org.eclipse.jdt.launching.JRE_CONTAINER']) + # Include a dummy out folder so that Eclipse doesn't use the default /bin + # folder in the root of the project. + AddElements('output', [os.path.join(toplevel_build, '.eclipse-java-build')]) - out.write('\n') - out.close() + ET.ElementTree(result).write(out_name) + + +def GetJavaJars(target_list, target_dicts, toplevel_dir): + '''Generates a sequence of all .jars used as inputs.''' + for target_name in target_list: + target = target_dicts[target_name] + for action in target.get('actions', []): + for input_ in action['inputs']: + if os.path.splitext(input_)[1] == '.jar' and not input_.startswith('$'): + if os.path.isabs(input_): + yield input_ + else: + yield os.path.join(os.path.dirname(target_name), input_) + + +def GetJavaSourceDirs(target_list, target_dicts, toplevel_dir): + '''Generates a sequence of all likely java package root directories.''' + for target_name in target_list: + target = target_dicts[target_name] + for action in target.get('actions', []): + for input_ in action['inputs']: + if (os.path.splitext(input_)[1] == '.java' and + not input_.startswith('$')): + dir_ = os.path.dirname(os.path.join(os.path.dirname(target_name), + input_)) + # If there is a parent 'src' or 'java' folder, navigate up to it - + # these are canonical package root names in Chromium. This will + # break if 'src' or 'java' exists in the package structure. This + # could be further improved by inspecting the java file for the + # package name if this proves to be too fragile in practice. + parent_search = dir_ + while os.path.basename(parent_search) not in ['src', 'java']: + parent_search, _ = os.path.split(parent_search) + if not parent_search or parent_search == toplevel_dir: + # Didn't find a known root, just return the original path + yield dir_ + break + else: + yield parent_search def GenerateOutput(target_list, target_dicts, data, params): """Generate an XML settings file that can be imported into a CDT project.""" if params['options'].generator_output: - raise NotImplementedError, "--generator_output not implemented for eclipse" + raise NotImplementedError("--generator_output not implemented for eclipse") user_config = params.get('generator_flags', {}).get('config', None) if user_config: diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py index 22ef57f847d..3efdb9966a6 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py @@ -39,9 +39,11 @@ # These variables should just be spit back out as variable references. _generator_identity_variables = [ + 'CONFIGURATION_NAME', 'EXECUTABLE_PREFIX', 'EXECUTABLE_SUFFIX', 'INTERMEDIATE_DIR', + 'LIB_DIR', 'PRODUCT_DIR', 'RULE_INPUT_ROOT', 'RULE_INPUT_DIRNAME', @@ -49,6 +51,11 @@ 'RULE_INPUT_NAME', 'RULE_INPUT_PATH', 'SHARED_INTERMEDIATE_DIR', + 'SHARED_LIB_DIR', + 'SHARED_LIB_PREFIX', + 'SHARED_LIB_SUFFIX', + 'STATIC_LIB_PREFIX', + 'STATIC_LIB_SUFFIX', ] # gypd doesn't define a default value for OS like many other generator diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py index b3f8a2b775c..06c7fdc2e84 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py @@ -29,6 +29,7 @@ import gyp.common import gyp.xcode_emulation from gyp.common import GetEnvironFallback +from gyp.common import GypError generator_default_variables = { 'EXECUTABLE_PREFIX': '', @@ -280,15 +281,7 @@ def CalculateGeneratorInputInfo(params): AR.target ?= $(AR) # C++ apps need to be linked with g++. -# -# Note: flock is used to seralize linking. Linking is a memory-intensive -# process so running parallel links can often lead to thrashing. To disable -# the serialization, override LINK via an envrionment variable as follows: -# -# export LINK=g++ -# -# This will allow make to invoke N linker processes as specified in -jN. -LINK ?= %(flock)s $(builddir)/linker.lock $(CXX.target) +LINK ?= $(CXX.target) # TODO(evan): move all cross-compilation logic to gyp-time so we don't need # to replicate this environment fallback in make as well. @@ -631,6 +624,38 @@ def QuoteSpaces(s, quote=r'\ '): return s.replace(' ', quote) +# TODO: Avoid code duplication with _ValidateSourcesForMSVSProject in msvs.py. +def _ValidateSourcesForOSX(spec, all_sources): + """Makes sure if duplicate basenames are not specified in the source list. + + Arguments: + spec: The target dictionary containing the properties of the target. + """ + if spec.get('type', None) != 'static_library': + return + + basenames = {} + for source in all_sources: + name, ext = os.path.splitext(source) + is_compiled_file = ext in [ + '.c', '.cc', '.cpp', '.cxx', '.m', '.mm', '.s', '.S'] + if not is_compiled_file: + continue + basename = os.path.basename(name) # Don't include extension. + basenames.setdefault(basename, []).append(source) + + error = '' + for basename, files in basenames.iteritems(): + if len(files) > 1: + error += ' %s: %s\n' % (basename, ' '.join(files)) + + if error: + print('static library %s has several files with the same basename:\n' % + spec['target_name'] + error + 'libtool on OS X will generate' + + ' warnings for them.') + raise GypError('Duplicate basenames in sources section, see list above') + + # Map from qualified target to path to output. target_outputs = {} # Map from qualified target to any linkable output. A subset @@ -640,7 +665,7 @@ def QuoteSpaces(s, quote=r'\ '): target_link_deps = {} -class MakefileWriter: +class MakefileWriter(object): """MakefileWriter packages up the writing of one target-specific foobar.mk. Its only real entry point is Write(), and is mostly used for namespacing. @@ -758,6 +783,10 @@ def Write(self, qualified_target, base_path, output_filename, spec, configs, # Sources. all_sources = spec.get('sources', []) + extra_sources if all_sources: + if self.flavor == 'mac': + # libtool on OS X generates warnings for duplicate basenames in the same + # target. + _ValidateSourcesForOSX(spec, all_sources) self.WriteSources( configs, deps, all_sources, extra_outputs, extra_link_deps, part_of_all, @@ -1101,9 +1130,12 @@ def WriteMacBundleResources(self, resources, bundle_deps): for output, res in gyp.xcode_emulation.GetMacBundleResources( generator_default_variables['PRODUCT_DIR'], self.xcode_settings, map(Sourceify, map(self.Absolutify, resources))): - self.WriteDoCmd([output], [res], 'mac_tool,,,copy-bundle-resource', - part_of_all=True) - bundle_deps.append(output) + _, ext = os.path.splitext(output) + if ext != '.xcassets': + # Make does not supports '.xcassets' emulation. + self.WriteDoCmd([output], [res], 'mac_tool,,,copy-bundle-resource', + part_of_all=True) + bundle_deps.append(output) def WriteMacInfoPlist(self, bundle_deps): @@ -2036,7 +2068,6 @@ def CalculateMakefilePath(build_file, base_name): build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) make_global_settings_array = data[build_file].get('make_global_settings', []) wrappers = {} - wrappers['LINK'] = '%s $(builddir)/linker.lock' % flock_command for key, value in make_global_settings_array: if key.endswith('_wrapper'): wrappers[key[:-len('_wrapper')]] = '$(abspath %s)' % value diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py index c59aea10624..8e6bd7ba0a0 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import collections import copy import ntpath import os @@ -13,6 +12,7 @@ import gyp.common import gyp.easy_xml as easy_xml +import gyp.generator.ninja as ninja_generator import gyp.MSVSNew as MSVSNew import gyp.MSVSProject as MSVSProject import gyp.MSVSSettings as MSVSSettings @@ -21,6 +21,7 @@ import gyp.MSVSUtil as MSVSUtil import gyp.MSVSVersion as MSVSVersion from gyp.common import GypError +from gyp.common import OrderedSet # TODO: Remove once bots are on 2.7, http://crbug.com/241769 def _import_OrderedDict(): @@ -41,7 +42,7 @@ def _import_OrderedDict(): # if IncrediBuild is executed from inside Visual Studio. This regex # validates that the string looks like a GUID with all uppercase hex # letters. -VALID_MSVS_GUID_CHARS = re.compile('^[A-F0-9\-]+$') +VALID_MSVS_GUID_CHARS = re.compile(r'^[A-F0-9\-]+$') generator_default_variables = { @@ -81,6 +82,10 @@ def _import_OrderedDict(): 'msvs_external_builder_out_dir', 'msvs_external_builder_build_cmd', 'msvs_external_builder_clean_cmd', + 'msvs_external_builder_clcompile_cmd', + 'msvs_enable_winrt', + 'msvs_requires_importlibrary', + 'msvs_enable_winphone', ] @@ -97,46 +102,6 @@ def _import_OrderedDict(): cached_domain = None -# Based on http://code.activestate.com/recipes/576694/. -class OrderedSet(collections.MutableSet): - def __init__(self, iterable=None): - self.end = end = [] - end += [None, end, end] # sentinel node for doubly linked list - self.map = {} # key --> [key, prev, next] - if iterable is not None: - self |= iterable - - def __len__(self): - return len(self.map) - - def discard(self, key): - if key in self.map: - key, prev, next = self.map.pop(key) - prev[2] = next - next[1] = prev - - def __contains__(self, key): - return key in self.map - - def add(self, key): - if key not in self.map: - end = self.end - curr = end[1] - curr[2] = end[1] = self.map[key] = [key, curr, end] - - def update(self, iterable): - for i in iterable: - if i not in self: - self.add(i) - - def __iter__(self): - end = self.end - curr = end[2] - while curr is not end: - yield curr[0] - curr = curr[2] - - # TODO(gspencer): Switch the os.environ calls to be # win32api.GetDomainName() and win32api.GetUserName() once the # python version in depot_tools has been updated to work on Vista @@ -153,11 +118,11 @@ def _GetDomainAndUserName(): call = subprocess.Popen(['net', 'config', 'Workstation'], stdout=subprocess.PIPE) config = call.communicate()[0] - username_re = re.compile('^User name\s+(\S+)', re.MULTILINE) + username_re = re.compile(r'^User name\s+(\S+)', re.MULTILINE) username_match = username_re.search(config) if username_match: username = username_match.group(1) - domain_re = re.compile('^Logon domain\s+(\S+)', re.MULTILINE) + domain_re = re.compile(r'^Logon domain\s+(\S+)', re.MULTILINE) domain_match = domain_re.search(config) if domain_match: domain = domain_match.group(1) @@ -266,7 +231,8 @@ def _ConvertSourcesToFilterHierarchy(sources, prefix=None, excluded=None, for f in folders: contents = _ConvertSourcesToFilterHierarchy(folders[f], prefix=prefix + [f], excluded=excluded, - list_excluded=list_excluded) + list_excluded=list_excluded, + msvs_version=msvs_version) contents = MSVSProject.Filter(f, contents=contents) result.append(contents) return result @@ -322,7 +288,7 @@ def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path, if [x for x in cmd if '$(InputDir)' in x]: input_dir_preamble = ( 'set INPUTDIR=$(InputDir)\n' - 'set INPUTDIR=%INPUTDIR:$(ProjectDir)=%\n' + 'if NOT DEFINED INPUTDIR set INPUTDIR=.\\\n' 'set INPUTDIR=%INPUTDIR:~0,-1%\n' ) else: @@ -851,23 +817,27 @@ def _GenerateRulesForMSVS(p, output_dir, options, spec, if rules_external: _GenerateExternalRules(rules_external, output_dir, spec, sources, options, actions_to_add) - _AdjustSourcesForRules(spec, rules, sources, excluded_sources) + _AdjustSourcesForRules(rules, sources, excluded_sources, False) -def _AdjustSourcesForRules(spec, rules, sources, excluded_sources): +def _AdjustSourcesForRules(rules, sources, excluded_sources, is_msbuild): # Add outputs generated by each rule (if applicable). for rule in rules: - # Done if not processing outputs as sources. - if int(rule.get('process_outputs_as_sources', False)): - # Add in the outputs from this rule. - trigger_files = _FindRuleTriggerFiles(rule, sources) - for trigger_file in trigger_files: + # Add in the outputs from this rule. + trigger_files = _FindRuleTriggerFiles(rule, sources) + for trigger_file in trigger_files: + # Remove trigger_file from excluded_sources to let the rule be triggered + # (e.g. rule trigger ax_enums.idl is added to excluded_sources + # because it's also in an action's inputs in the same project) + excluded_sources.discard(_FixPath(trigger_file)) + # Done if not processing outputs as sources. + if int(rule.get('process_outputs_as_sources', False)): inputs, outputs = _RuleInputsAndOutputs(rule, trigger_file) inputs = OrderedSet(_FixPaths(inputs)) outputs = OrderedSet(_FixPaths(outputs)) inputs.remove(_FixPath(trigger_file)) sources.update(inputs) - if not spec.get('msvs_external_builder'): + if not is_msbuild: excluded_sources.update(inputs) sources.update(outputs) @@ -954,6 +924,42 @@ def _GenerateProject(project, options, version, generator_flags): return _GenerateMSVSProject(project, options, version, generator_flags) +# TODO: Avoid code duplication with _ValidateSourcesForOSX in make.py. +def _ValidateSourcesForMSVSProject(spec, version): + """Makes sure if duplicate basenames are not specified in the source list. + + Arguments: + spec: The target dictionary containing the properties of the target. + version: The VisualStudioVersion object. + """ + # This validation should not be applied to MSVC2010 and later. + assert not version.UsesVcxproj() + + # TODO: Check if MSVC allows this for loadable_module targets. + if spec.get('type', None) not in ('static_library', 'shared_library'): + return + sources = spec.get('sources', []) + basenames = {} + for source in sources: + name, ext = os.path.splitext(source) + is_compiled_file = ext in [ + '.c', '.cc', '.cpp', '.cxx', '.m', '.mm', '.s', '.S'] + if not is_compiled_file: + continue + basename = os.path.basename(name) # Don't include extension. + basenames.setdefault(basename, []).append(source) + + error = '' + for basename, files in basenames.iteritems(): + if len(files) > 1: + error += ' %s: %s\n' % (basename, ' '.join(files)) + + if error: + print('static library %s has several files with the same basename:\n' % + spec['target_name'] + error + 'MSVC08 cannot handle that.') + raise GypError('Duplicate basenames in sources section, see list above') + + def _GenerateMSVSProject(project, options, version, generator_flags): """Generates a .vcproj file. It may create .rules and .user files too. @@ -979,6 +985,11 @@ def _GenerateMSVSProject(project, options, version, generator_flags): for config_name, config in spec['configurations'].iteritems(): _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config) + # MSVC08 and prior version cannot handle duplicate basenames in the same + # target. + # TODO: Take excluded sources into consideration if possible. + _ValidateSourcesForMSVSProject(spec, version) + # Prepare list of sources and excluded sources. gyp_file = os.path.split(project.build_file)[1] sources, excluded_sources = _PrepareListOfSources(spec, generator_flags, @@ -1098,7 +1109,8 @@ def _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config): for this configuration. """ # Get the information for this configuration - include_dirs, resource_include_dirs = _GetIncludeDirs(config) + include_dirs, midl_include_dirs, resource_include_dirs = \ + _GetIncludeDirs(config) libraries = _GetLibraries(spec) library_dirs = _GetLibraryDirs(config) out_file, vc_tool, _ = _GetOutputFilePathAndTool(spec, msbuild=False) @@ -1126,6 +1138,8 @@ def _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config): # Add the information to the appropriate tool _ToolAppend(tools, 'VCCLCompilerTool', 'AdditionalIncludeDirectories', include_dirs) + _ToolAppend(tools, 'VCMIDLTool', + 'AdditionalIncludeDirectories', midl_include_dirs) _ToolAppend(tools, 'VCResourceCompilerTool', 'AdditionalIncludeDirectories', resource_include_dirs) # Add in libraries. @@ -1181,10 +1195,14 @@ def _GetIncludeDirs(config): include_dirs = ( config.get('include_dirs', []) + config.get('msvs_system_include_dirs', [])) + midl_include_dirs = ( + config.get('midl_include_dirs', []) + + config.get('msvs_system_include_dirs', [])) resource_include_dirs = config.get('resource_include_dirs', include_dirs) include_dirs = _FixPaths(include_dirs) + midl_include_dirs = _FixPaths(midl_include_dirs) resource_include_dirs = _FixPaths(resource_include_dirs) - return include_dirs, resource_include_dirs + return include_dirs, midl_include_dirs, resource_include_dirs def _GetLibraryDirs(config): @@ -1218,7 +1236,7 @@ def _GetLibraries(spec): found = OrderedSet() unique_libraries_list = [] for entry in reversed(libraries): - library = re.sub('^\-l', '', entry) + library = re.sub(r'^\-l', '', entry) if not os.path.splitext(library)[1]: library += '.lib' if library not in found: @@ -1478,8 +1496,14 @@ def _AdjustSourcesAndConvertToFilterHierarchy( # Prune filters with a single child to flatten ugly directory structures # such as ../../src/modules/module1 etc. - while len(sources) == 1 and isinstance(sources[0], MSVSProject.Filter): - sources = sources[0].contents + if version.UsesVcxproj(): + while all([isinstance(s, MSVSProject.Filter) for s in sources]) \ + and len(set([s.name for s in sources])) == 1: + assert all([len(s.contents) == 1 for s in sources]) + sources = [s.contents[0] for s in sources] + else: + while len(sources) == 1 and isinstance(sources[0], MSVSProject.Filter): + sources = sources[0].contents return sources, excluded_sources, excluded_idl @@ -1815,7 +1839,7 @@ def _CreateProjectObjects(target_list, target_dicts, options, msvs_version): return projects -def _InitNinjaFlavor(options, target_list, target_dicts): +def _InitNinjaFlavor(params, target_list, target_dicts): """Initialize targets for the ninja flavor. This sets up the necessary variables in the targets to generate msvs projects @@ -1823,7 +1847,7 @@ def _InitNinjaFlavor(options, target_list, target_dicts): if they have not been set. This allows individual specs to override the default values initialized here. Arguments: - options: Options provided to the generator. + params: Params provided to the generator. target_list: List of target pairs: 'base/base.gyp:base'. target_dicts: Dict of target properties keyed on target pair. """ @@ -1837,8 +1861,15 @@ def _InitNinjaFlavor(options, target_list, target_dicts): spec['msvs_external_builder'] = 'ninja' if not spec.get('msvs_external_builder_out_dir'): - spec['msvs_external_builder_out_dir'] = \ - options.depth + '/out/$(Configuration)' + gyp_file, _, _ = gyp.common.ParseQualifiedTarget(qualified_target) + gyp_dir = os.path.dirname(gyp_file) + configuration = '$(Configuration)' + if params.get('target_arch') == 'x64': + configuration += '_x64' + spec['msvs_external_builder_out_dir'] = os.path.join( + gyp.common.RelativePath(params['options'].toplevel_dir, gyp_dir), + ninja_generator.ComputeOutputDir(params), + configuration) if not spec.get('msvs_external_builder_build_cmd'): spec['msvs_external_builder_build_cmd'] = [ path_to_ninja, @@ -1851,8 +1882,7 @@ def _InitNinjaFlavor(options, target_list, target_dicts): path_to_ninja, '-C', '$(OutDir)', - '-t', - 'clean', + '-tclean', '$(ProjectName)', ] @@ -1933,7 +1963,7 @@ def GenerateOutput(target_list, target_dicts, data, params): # Optionally configure each spec to use ninja as the external builder. if params.get('flavor') == 'ninja': - _InitNinjaFlavor(options, target_list, target_dicts) + _InitNinjaFlavor(params, target_list, target_dicts) # Prepare the set of configurations. configs = set() @@ -1986,7 +2016,7 @@ def GenerateOutput(target_list, target_dicts, data, params): def _GenerateMSBuildFiltersFile(filters_path, source_files, - extension_to_rule_name): + rule_dependencies, extension_to_rule_name): """Generate the filters file. This file is used by Visual Studio to organize the presentation of source @@ -1999,8 +2029,8 @@ def _GenerateMSBuildFiltersFile(filters_path, source_files, """ filter_group = [] source_group = [] - _AppendFiltersForMSBuild('', source_files, extension_to_rule_name, - filter_group, source_group) + _AppendFiltersForMSBuild('', source_files, rule_dependencies, + extension_to_rule_name, filter_group, source_group) if filter_group: content = ['Project', {'ToolsVersion': '4.0', @@ -2015,7 +2045,7 @@ def _GenerateMSBuildFiltersFile(filters_path, source_files, os.unlink(filters_path) -def _AppendFiltersForMSBuild(parent_filter_name, sources, +def _AppendFiltersForMSBuild(parent_filter_name, sources, rule_dependencies, extension_to_rule_name, filter_group, source_group): """Creates the list of filters and sources to be added in the filter file. @@ -2041,11 +2071,12 @@ def _AppendFiltersForMSBuild(parent_filter_name, sources, ['UniqueIdentifier', MSVSNew.MakeGuid(source.name)]]) # Recurse and add its dependents. _AppendFiltersForMSBuild(filter_name, source.contents, - extension_to_rule_name, + rule_dependencies, extension_to_rule_name, filter_group, source_group) else: # It's a source. Create a source entry. - _, element = _MapFileToMsBuildSourceType(source, extension_to_rule_name) + _, element = _MapFileToMsBuildSourceType(source, rule_dependencies, + extension_to_rule_name) source_entry = [element, {'Include': source}] # Specify the filter it is part of, if any. if parent_filter_name: @@ -2053,7 +2084,8 @@ def _AppendFiltersForMSBuild(parent_filter_name, sources, source_group.append(source_entry) -def _MapFileToMsBuildSourceType(source, extension_to_rule_name): +def _MapFileToMsBuildSourceType(source, rule_dependencies, + extension_to_rule_name): """Returns the group and element type of the source file. Arguments: @@ -2076,9 +2108,15 @@ def _MapFileToMsBuildSourceType(source, extension_to_rule_name): elif ext == '.rc': group = 'resource' element = 'ResourceCompile' + elif ext == '.asm': + group = 'masm' + element = 'MASM' elif ext == '.idl': group = 'midl' element = 'Midl' + elif source in rule_dependencies: + group = 'rule_dependency' + element = 'CustomBuild' else: group = 'none' element = 'None' @@ -2088,7 +2126,8 @@ def _MapFileToMsBuildSourceType(source, extension_to_rule_name): def _GenerateRulesForMSBuild(output_dir, options, spec, sources, excluded_sources, props_files_of_rules, targets_files_of_rules, - actions_to_add, extension_to_rule_name): + actions_to_add, rule_dependencies, + extension_to_rule_name): # MSBuild rules are implemented using three files: an XML file, a .targets # file and a .props file. # See http://blogs.msdn.com/b/vcblog/archive/2010/04/21/quick-help-on-vs2010-custom-build-rule.aspx @@ -2104,6 +2143,7 @@ def _GenerateRulesForMSBuild(output_dir, options, spec, continue msbuild_rule = MSBuildRule(rule, spec) msbuild_rules.append(msbuild_rule) + rule_dependencies.update(msbuild_rule.additional_dependencies.split(';')) extension_to_rule_name[msbuild_rule.extension] = msbuild_rule.rule_name if msbuild_rules: base = spec['target_name'] + options.suffix @@ -2125,7 +2165,7 @@ def _GenerateRulesForMSBuild(output_dir, options, spec, if rules_external: _GenerateExternalRules(rules_external, output_dir, spec, sources, options, actions_to_add) - _AdjustSourcesForRules(spec, rules, sources, excluded_sources) + _AdjustSourcesForRules(rules, sources, excluded_sources, True) class MSBuildRule(object): @@ -2578,14 +2618,30 @@ def _GetMSBuildProjectConfigurations(configurations): def _GetMSBuildGlobalProperties(spec, guid, gyp_file_name): namespace = os.path.splitext(gyp_file_name)[0] - return [ + properties = [ ['PropertyGroup', {'Label': 'Globals'}, - ['ProjectGuid', guid], - ['Keyword', 'Win32Proj'], - ['RootNamespace', namespace], + ['ProjectGuid', guid], + ['Keyword', 'Win32Proj'], + ['RootNamespace', namespace], + ['IgnoreWarnCompileDuplicatedFilename', 'true'], ] - ] + ] + if os.environ.get('PROCESSOR_ARCHITECTURE') == 'AMD64' or \ + os.environ.get('PROCESSOR_ARCHITEW6432') == 'AMD64': + properties[0].append(['PreferredToolArchitecture', 'x64']) + + if spec.get('msvs_enable_winrt'): + properties[0].append(['DefaultLanguage', 'en-US']) + properties[0].append(['AppContainerApplication', 'true']) + properties[0].append(['ApplicationTypeRevision', '8.1']) + + if spec.get('msvs_enable_winphone'): + properties[0].append(['ApplicationType', 'Windows Phone']) + else: + properties[0].append(['ApplicationType', 'Windows Store']) + + return properties def _GetMSBuildConfigurationDetails(spec, build_file): properties = {} @@ -2596,8 +2652,9 @@ def _GetMSBuildConfigurationDetails(spec, build_file): _AddConditionalProperty(properties, condition, 'ConfigurationType', msbuild_attributes['ConfigurationType']) if character_set: - _AddConditionalProperty(properties, condition, 'CharacterSet', - character_set) + if 'msvs_enable_winrt' not in spec : + _AddConditionalProperty(properties, condition, 'CharacterSet', + character_set) return _GetMSBuildPropertyGroup(spec, 'Configuration', properties) @@ -2818,7 +2875,7 @@ def _AddConditionalProperty(properties, condition, name, value): # Regex for msvs variable references ( i.e. $(FOO) ). -MSVS_VARIABLE_REFERENCE = re.compile('\$\(([a-zA-Z_][a-zA-Z0-9_]*)\)') +MSVS_VARIABLE_REFERENCE = re.compile(r'\$\(([a-zA-Z_][a-zA-Z0-9_]*)\)') def _GetMSBuildPropertyGroup(spec, label, properties): @@ -2902,7 +2959,8 @@ def _FinalizeMSBuildSettings(spec, configuration): converted = True msvs_settings = configuration.get('msvs_settings', {}) msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(msvs_settings) - include_dirs, resource_include_dirs = _GetIncludeDirs(configuration) + include_dirs, midl_include_dirs, resource_include_dirs = \ + _GetIncludeDirs(configuration) libraries = _GetLibraries(spec) library_dirs = _GetLibraryDirs(configuration) out_file, _, msbuild_tool = _GetOutputFilePathAndTool(spec, msbuild=True) @@ -2912,7 +2970,7 @@ def _FinalizeMSBuildSettings(spec, configuration): # Visual Studio 2010 has TR1 defines = [d for d in defines if d != '_HAS_TR1=0'] # Warn of ignored settings - ignored_settings = ['msvs_prebuild', 'msvs_postbuild', 'msvs_tool_files'] + ignored_settings = ['msvs_tool_files'] for ignored_setting in ignored_settings: value = configuration.get(ignored_setting) if value: @@ -2921,9 +2979,8 @@ def _FinalizeMSBuildSettings(spec, configuration): defines = [_EscapeCppDefineForMSBuild(d) for d in defines] disabled_warnings = _GetDisabledWarnings(configuration) - # TODO(jeanluc) Validate & warn that we don't translate - # prebuild = configuration.get('msvs_prebuild') - # postbuild = configuration.get('msvs_postbuild') + prebuild = configuration.get('msvs_prebuild') + postbuild = configuration.get('msvs_postbuild') def_file = _GetModuleDefinition(spec) precompiled_header = configuration.get('msvs_precompiled_header') @@ -2933,6 +2990,8 @@ def _FinalizeMSBuildSettings(spec, configuration): # if you don't have any resources. _ToolAppend(msbuild_settings, 'ClCompile', 'AdditionalIncludeDirectories', include_dirs) + _ToolAppend(msbuild_settings, 'Midl', + 'AdditionalIncludeDirectories', midl_include_dirs) _ToolAppend(msbuild_settings, 'ResourceCompile', 'AdditionalIncludeDirectories', resource_include_dirs) # Add in libraries, note that even for empty libraries, we want this @@ -2963,6 +3022,13 @@ def _FinalizeMSBuildSettings(spec, configuration): 'PrecompiledHeaderFile', precompiled_header) _ToolAppend(msbuild_settings, 'ClCompile', 'ForcedIncludeFiles', [precompiled_header]) + else: + _ToolAppend(msbuild_settings, 'ClCompile', 'PrecompiledHeader', 'NotUsing') + # Turn off WinRT compilation + _ToolAppend(msbuild_settings, 'ClCompile', 'CompileAsWinRT', 'false') + # Turn on import libraries if appropriate + if spec.get('msvs_requires_importlibrary'): + _ToolAppend(msbuild_settings, '', 'IgnoreImportLibrary', 'false') # Loadable modules don't generate import libraries; # tell dependent projects to not expect one. if spec['type'] == 'loadable_module': @@ -2971,6 +3037,10 @@ def _FinalizeMSBuildSettings(spec, configuration): if def_file: _ToolAppend(msbuild_settings, 'Link', 'ModuleDefinitionFile', def_file) configuration['finalized_msbuild_settings'] = msbuild_settings + if prebuild: + _ToolAppend(msbuild_settings, 'PreBuildEvent', 'Command', prebuild) + if postbuild: + _ToolAppend(msbuild_settings, 'PostBuildEvent', 'Command', postbuild) def _GetValueFormattedForMSBuild(tool_name, name, value): @@ -3026,15 +3096,18 @@ def _VerifySourcesExist(sources, root_dir): return missing_sources -def _GetMSBuildSources(spec, sources, exclusions, extension_to_rule_name, - actions_spec, sources_handled_by_action, list_excluded): - groups = ['none', 'midl', 'include', 'compile', 'resource', 'rule'] +def _GetMSBuildSources(spec, sources, exclusions, rule_dependencies, + extension_to_rule_name, actions_spec, + sources_handled_by_action, list_excluded): + groups = ['none', 'masm', 'midl', 'include', 'compile', 'resource', 'rule', + 'rule_dependency'] grouped_sources = {} for g in groups: grouped_sources[g] = [] _AddSources2(spec, sources, exclusions, grouped_sources, - extension_to_rule_name, sources_handled_by_action, list_excluded) + rule_dependencies, extension_to_rule_name, + sources_handled_by_action, list_excluded) sources = [] for g in groups: if grouped_sources[g]: @@ -3045,13 +3118,15 @@ def _GetMSBuildSources(spec, sources, exclusions, extension_to_rule_name, def _AddSources2(spec, sources, exclusions, grouped_sources, - extension_to_rule_name, sources_handled_by_action, + rule_dependencies, extension_to_rule_name, + sources_handled_by_action, list_excluded): extensions_excluded_from_precompile = [] for source in sources: if isinstance(source, MSVSProject.Filter): _AddSources2(spec, source.contents, exclusions, grouped_sources, - extension_to_rule_name, sources_handled_by_action, + rule_dependencies, extension_to_rule_name, + sources_handled_by_action, list_excluded) else: if not source in sources_handled_by_action: @@ -3094,7 +3169,7 @@ def _AddSources2(spec, sources, exclusions, grouped_sources, detail.append(['PrecompiledHeader', '']) detail.append(['ForcedIncludeFiles', '']) - group, element = _MapFileToMsBuildSourceType(source, + group, element = _MapFileToMsBuildSourceType(source, rule_dependencies, extension_to_rule_name) grouped_sources[group].append([element, {'Include': source}] + detail) @@ -3138,6 +3213,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags): actions_to_add = {} props_files_of_rules = set() targets_files_of_rules = set() + rule_dependencies = set() extension_to_rule_name = {} list_excluded = generator_flags.get('msvs_list_excluded_files', True) @@ -3146,10 +3222,11 @@ def _GenerateMSBuildProject(project, options, version, generator_flags): _GenerateRulesForMSBuild(project_dir, options, spec, sources, excluded_sources, props_files_of_rules, targets_files_of_rules, - actions_to_add, extension_to_rule_name) + actions_to_add, rule_dependencies, + extension_to_rule_name) else: rules = spec.get('rules', []) - _AdjustSourcesForRules(spec, rules, sources, excluded_sources) + _AdjustSourcesForRules(rules, sources, excluded_sources, True) sources, excluded_sources, excluded_idl = ( _AdjustSourcesAndConvertToFilterHierarchy(spec, options, @@ -3172,6 +3249,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags): spec, actions_to_add) _GenerateMSBuildFiltersFile(project.path + '.filters', sources, + rule_dependencies, extension_to_rule_name) missing_sources = _VerifySourcesExist(sources, project_dir) @@ -3186,6 +3264,12 @@ def _GenerateMSBuildProject(project, options, version, generator_flags): ['Import', {'Project': r'$(VCTargetsPath)\Microsoft.Cpp.props'}]] import_cpp_targets_section = [ ['Import', {'Project': r'$(VCTargetsPath)\Microsoft.Cpp.targets'}]] + import_masm_props_section = [ + ['Import', + {'Project': r'$(VCTargetsPath)\BuildCustomizations\masm.props'}]] + import_masm_targets_section = [ + ['Import', + {'Project': r'$(VCTargetsPath)\BuildCustomizations\masm.targets'}]] macro_section = [['PropertyGroup', {'Label': 'UserMacros'}]] content = [ @@ -3199,8 +3283,12 @@ def _GenerateMSBuildProject(project, options, version, generator_flags): content += _GetMSBuildGlobalProperties(spec, project.guid, project_file_name) content += import_default_section content += _GetMSBuildConfigurationDetails(spec, project.build_file) - content += _GetMSBuildLocalProperties(project.msbuild_toolset) + if spec.get('msvs_enable_winphone'): + content += _GetMSBuildLocalProperties('v120_wp81') + else: + content += _GetMSBuildLocalProperties(project.msbuild_toolset) content += import_cpp_props_section + content += import_masm_props_section content += _GetMSBuildExtensions(props_files_of_rules) content += _GetMSBuildPropertySheets(configurations) content += macro_section @@ -3208,10 +3296,11 @@ def _GenerateMSBuildProject(project, options, version, generator_flags): project.build_file) content += _GetMSBuildToolSettingsSections(spec, configurations) content += _GetMSBuildSources( - spec, sources, exclusions, extension_to_rule_name, actions_spec, - sources_handled_by_action, list_excluded) + spec, sources, exclusions, rule_dependencies, extension_to_rule_name, + actions_spec, sources_handled_by_action, list_excluded) content += _GetMSBuildProjectReferences(project) content += import_cpp_targets_section + content += import_masm_targets_section content += _GetMSBuildExtensionTargets(targets_files_of_rules) if spec.get('msvs_external_builder'): @@ -3228,7 +3317,9 @@ def _GenerateMSBuildProject(project, options, version, generator_flags): def _GetMSBuildExternalBuilderTargets(spec): """Return a list of MSBuild targets for external builders. - Right now, only "Build" and "Clean" targets are generated. + The "Build" and "Clean" targets are always generated. If the spec contains + 'msvs_external_builder_clcompile_cmd', then the "ClCompile" target will also + be generated, to support building selected C/C++ files. Arguments: spec: The gyp target spec. @@ -3247,7 +3338,17 @@ def _GetMSBuildExternalBuilderTargets(spec): clean_target = ['Target', {'Name': 'Clean'}] clean_target.append(['Exec', {'Command': clean_cmd}]) - return [build_target, clean_target] + targets = [build_target, clean_target] + + if spec.get('msvs_external_builder_clcompile_cmd'): + clcompile_cmd = _BuildCommandLineForRuleRaw( + spec, spec['msvs_external_builder_clcompile_cmd'], + False, False, False, False) + clcompile_target = ['Target', {'Name': 'ClCompile'}] + clcompile_target.append(['Exec', {'Command': clcompile_cmd}]) + targets.append(clcompile_target) + + return targets def _GetMSBuildExtensions(props_files_of_rules): @@ -3301,8 +3402,8 @@ def _GenerateActionsForMSBuild(spec, actions_to_add): # get too long. See also _AddActions: cygwin's setup_env mustn't be called # for every invocation or the command that sets the PATH will grow too # long. - command = ( - '\r\nif %errorlevel% neq 0 exit /b %errorlevel%\r\n'.join(commands)) + command = '\r\n'.join([c + '\r\nif %errorlevel% neq 0 exit /b %errorlevel%' + for c in commands]) _AddMSBuildAction(spec, primary_input, inputs, diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py index c2951a4c589..624c99ae896 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import collections import copy import hashlib import json @@ -13,6 +14,7 @@ import sys import gyp import gyp.common +from gyp.common import OrderedSet import gyp.msvs_emulation import gyp.MSVSUtil as MSVSUtil import gyp.xcode_emulation @@ -60,17 +62,7 @@ generator_extra_sources_for_rules = [] generator_filelist_paths = None -# TODO: figure out how to not build extra host objects in the non-cross-compile -# case when this is enabled, and enable unconditionally. -generator_supports_multiple_toolsets = ( - os.environ.get('GYP_CROSSCOMPILE') or - os.environ.get('AR_host') or - os.environ.get('CC_host') or - os.environ.get('CXX_host') or - os.environ.get('AR_target') or - os.environ.get('CC_target') or - os.environ.get('CXX_target')) - +generator_supports_multiple_toolsets = gyp.common.CrossCompileRequested() def StripPrefix(arg, prefix): if arg.startswith(prefix): @@ -106,7 +98,7 @@ def AddArch(output, arch): return '%s.%s%s' % (output, arch, extension) -class Target: +class Target(object): """Target represents the paths used within a single gyp target. Conceptually, building a single target A is a series of steps: @@ -210,8 +202,8 @@ def FinalOutput(self): # an output file; the result can be namespaced such that it is unique # to the input file name as well as the output target name. -class NinjaWriter: - def __init__(self, qualified_target, target_outputs, base_dir, build_dir, +class NinjaWriter(object): + def __init__(self, hash_for_rules, target_outputs, base_dir, build_dir, output_file, toplevel_build, output_file_name, flavor, toplevel_dir=None): """ @@ -221,7 +213,7 @@ def __init__(self, qualified_target, target_outputs, base_dir, build_dir, toplevel_dir: path to the toplevel directory """ - self.qualified_target = qualified_target + self.hash_for_rules = hash_for_rules self.target_outputs = target_outputs self.base_dir = base_dir self.build_dir = build_dir @@ -338,12 +330,15 @@ def GypPathToUniqueOutput(self, path, qualified=True): obj += '.' + self.toolset path_dir, path_basename = os.path.split(path) + assert not os.path.isabs(path_dir), ( + "'%s' can not be absolute path (see crbug.com/462153)." % path_dir) + if qualified: path_basename = self.name + '.' + path_basename return os.path.normpath(os.path.join(obj, self.base_dir, path_dir, path_basename)) - def WriteCollapsedDependencies(self, name, targets): + def WriteCollapsedDependencies(self, name, targets, order_only=None): """Given a list of targets, return a path for a single file representing the result of building all the targets or None. @@ -351,10 +346,11 @@ def WriteCollapsedDependencies(self, name, targets): assert targets == filter(None, targets), targets if len(targets) == 0: + assert not order_only return None - if len(targets) > 1: + if len(targets) > 1 or order_only: stamp = self.GypPathToUniqueOutput(name + '.stamp') - targets = self.ninja.build(stamp, 'stamp', targets) + targets = self.ninja.build(stamp, 'stamp', targets, order_only=order_only) self.ninja.newline() return targets[0] @@ -391,6 +387,9 @@ def WriteSpec(self, spec, config_name, generator_flags): self.ninja.variable('arch', self.win_env[arch]) self.ninja.variable('cc', '$cl_' + arch) self.ninja.variable('cxx', '$cl_' + arch) + self.ninja.variable('cc_host', '$cl_' + arch) + self.ninja.variable('cxx_host', '$cl_' + arch) + self.ninja.variable('asm', '$ml_' + arch) if self.flavor == 'mac': self.archs = self.xcode_settings.GetActiveArchs(config_name) @@ -472,6 +471,8 @@ def WriteSpec(self, spec, config_name, generator_flags): else: print "Warning: Actions/rules writing object files don't work with " \ "multiarch targets, dropping. (target %s)" % spec['target_name'] + elif self.flavor == 'mac' and len(self.archs) > 1: + link_deps = collections.defaultdict(list) if self.flavor == 'win' and self.target.type == 'static_library': @@ -523,7 +524,7 @@ def fix_path(path, rel=None): def WriteWinIdlFiles(self, spec, prebuild): """Writes rules to match MSVS's implicit idl handling.""" assert self.flavor == 'win' - if self.msvs_settings.HasExplicitIdlRules(spec): + if self.msvs_settings.HasExplicitIdlRulesOrActions(spec): return [] outputs = [] for source in filter(lambda x: x.endswith('.idl'), spec['sources']): @@ -557,9 +558,10 @@ def WriteActionsRulesCopies(self, spec, extra_sources, prebuild, stamp = self.WriteCollapsedDependencies('actions_rules_copies', outputs) if self.is_mac_bundle: - self.WriteMacBundleResources( + xcassets = self.WriteMacBundleResources( extra_mac_bundle_resources + mac_bundle_resources, mac_bundle_depends) - self.WriteMacInfoPlist(mac_bundle_depends) + partial_info_plist = self.WriteMacXCassets(xcassets, mac_bundle_depends) + self.WriteMacInfoPlist(partial_info_plist, mac_bundle_depends) return stamp @@ -580,23 +582,24 @@ def GenerateDescription(self, verb, message, fallback): def WriteActions(self, actions, extra_sources, prebuild, extra_mac_bundle_resources): # Actions cd into the base directory. - env = self.GetSortedXcodeEnv() - if self.flavor == 'win': - env = self.msvs_settings.GetVSMacroEnv( - '$!PRODUCT_DIR', config=self.config_name) + env = self.GetToolchainEnv() all_outputs = [] for action in actions: # First write out a rule for the action. - name = '%s_%s' % (action['action_name'], - hashlib.md5(self.qualified_target).hexdigest()) + name = '%s_%s' % (action['action_name'], self.hash_for_rules) description = self.GenerateDescription('ACTION', action.get('message', None), name) is_cygwin = (self.msvs_settings.IsRuleRunUnderCygwin(action) if self.flavor == 'win' else False) args = action['action'] + depfile = action.get('depfile', None) + if depfile: + depfile = self.ExpandSpecial(depfile, self.base_to_build) + pool = 'console' if int(action.get('ninja_use_console', 0)) else None rule_name, _ = self.WriteNewNinjaRule(name, args, description, - is_cygwin, env=env) + is_cygwin, env, pool, + depfile=depfile) inputs = [self.GypPathToNinja(i, env) for i in action['inputs']] if int(action.get('process_outputs_as_sources', False)): @@ -616,15 +619,16 @@ def WriteActions(self, actions, extra_sources, prebuild, def WriteRules(self, rules, extra_sources, prebuild, mac_bundle_resources, extra_mac_bundle_resources): - env = self.GetSortedXcodeEnv() + env = self.GetToolchainEnv() all_outputs = [] for rule in rules: - # First write out a rule for the rule action. - name = '%s_%s' % (rule['rule_name'], - hashlib.md5(self.qualified_target).hexdigest()) # Skip a rule with no action and no inputs. if 'action' not in rule and not rule.get('rule_sources', []): continue + + # First write out a rule for the rule action. + name = '%s_%s' % (rule['rule_name'], self.hash_for_rules) + args = rule['action'] description = self.GenerateDescription( 'RULE', @@ -632,8 +636,9 @@ def WriteRules(self, rules, extra_sources, prebuild, ('%s ' + generator_default_variables['RULE_INPUT_PATH']) % name) is_cygwin = (self.msvs_settings.IsRuleRunUnderCygwin(rule) if self.flavor == 'win' else False) + pool = 'console' if int(rule.get('ninja_use_console', 0)) else None rule_name, args = self.WriteNewNinjaRule( - name, args, description, is_cygwin, env=env) + name, args, description, is_cygwin, env, pool) # TODO: if the command references the outputs directly, we should # simplify it to just use $out. @@ -645,16 +650,31 @@ def WriteRules(self, rules, extra_sources, prebuild, needed_variables = set(['source']) for argument in args: for var in special_locals: - if ('${%s}' % var) in argument: + if '${%s}' % var in argument: needed_variables.add(var) def cygwin_munge(path): + # pylint: disable=cell-var-from-loop if is_cygwin: return path.replace('\\', '/') return path + inputs = [self.GypPathToNinja(i, env) for i in rule.get('inputs', [])] + + # If there are n source files matching the rule, and m additional rule + # inputs, then adding 'inputs' to each build edge written below will + # write m * n inputs. Collapsing reduces this to m + n. + sources = rule.get('rule_sources', []) + num_inputs = len(inputs) + if prebuild: + num_inputs += 1 + if num_inputs > 2 and len(sources) > 2: + inputs = [self.WriteCollapsedDependencies( + rule['rule_name'], inputs, order_only=prebuild)] + prebuild = [] + # For each source file, write an edge that generates all the outputs. - for source in rule.get('rule_sources', []): + for source in sources: source = os.path.normpath(source) dirname, basename = os.path.split(source) root, ext = os.path.splitext(basename) @@ -663,9 +683,6 @@ def cygwin_munge(path): outputs = [self.ExpandRuleVariables(o, root, dirname, source, ext, basename) for o in rule['outputs']] - inputs = [self.ExpandRuleVariables(i, root, dirname, - source, ext, basename) - for i in rule.get('inputs', [])] if int(rule.get('process_outputs_as_sources', False)): extra_sources += outputs @@ -703,10 +720,11 @@ def cygwin_munge(path): else: assert var == None, repr(var) - inputs = [self.GypPathToNinja(i, env) for i in inputs] outputs = [self.GypPathToNinja(o, env) for o in outputs] - extra_bindings.append(('unique_name', - hashlib.md5(outputs[0]).hexdigest())) + if self.flavor == 'win': + # WriteNewNinjaRule uses unique_name for creating an rsp file on win. + extra_bindings.append(('unique_name', + hashlib.md5(outputs[0]).hexdigest())) self.ninja.build(outputs, rule_name, self.GypPathToNinja(source), implicit=inputs, order_only=prebuild, @@ -718,7 +736,7 @@ def cygwin_munge(path): def WriteCopies(self, copies, prebuild, mac_bundle_depends): outputs = [] - env = self.GetSortedXcodeEnv() + env = self.GetToolchainEnv() for copy in copies: for path in copy['files']: # Normalize the path so trailing slashes don't confuse us. @@ -742,15 +760,68 @@ def WriteCopies(self, copies, prebuild, mac_bundle_depends): def WriteMacBundleResources(self, resources, bundle_depends): """Writes ninja edges for 'mac_bundle_resources'.""" + xcassets = [] for output, res in gyp.xcode_emulation.GetMacBundleResources( generator_default_variables['PRODUCT_DIR'], self.xcode_settings, map(self.GypPathToNinja, resources)): output = self.ExpandSpecial(output) - self.ninja.build(output, 'mac_tool', res, - variables=[('mactool_cmd', 'copy-bundle-resource')]) - bundle_depends.append(output) + if os.path.splitext(output)[-1] != '.xcassets': + isBinary = self.xcode_settings.IsBinaryOutputFormat(self.config_name) + self.ninja.build(output, 'mac_tool', res, + variables=[('mactool_cmd', 'copy-bundle-resource'), \ + ('binary', isBinary)]) + bundle_depends.append(output) + else: + xcassets.append(res) + return xcassets + + def WriteMacXCassets(self, xcassets, bundle_depends): + """Writes ninja edges for 'mac_bundle_resources' .xcassets files. + + This add an invocation of 'actool' via the 'mac_tool.py' helper script. + It assumes that the assets catalogs define at least one imageset and + thus an Assets.car file will be generated in the application resources + directory. If this is not the case, then the build will probably be done + at each invocation of ninja.""" + if not xcassets: + return + + extra_arguments = {} + settings_to_arg = { + 'XCASSETS_APP_ICON': 'app-icon', + 'XCASSETS_LAUNCH_IMAGE': 'launch-image', + } + settings = self.xcode_settings.xcode_settings[self.config_name] + for settings_key, arg_name in settings_to_arg.iteritems(): + value = settings.get(settings_key) + if value: + extra_arguments[arg_name] = value + + partial_info_plist = None + if extra_arguments: + partial_info_plist = self.GypPathToUniqueOutput( + 'assetcatalog_generated_info.plist') + extra_arguments['output-partial-info-plist'] = partial_info_plist - def WriteMacInfoPlist(self, bundle_depends): + outputs = [] + outputs.append( + os.path.join( + self.xcode_settings.GetBundleResourceFolder(), + 'Assets.car')) + if partial_info_plist: + outputs.append(partial_info_plist) + + keys = QuoteShellArgument(json.dumps(extra_arguments), self.flavor) + extra_env = self.xcode_settings.GetPerTargetSettings() + env = self.GetSortedXcodeEnv(additional_settings=extra_env) + env = self.ComputeExportEnvString(env) + + bundle_depends.extend(self.ninja.build( + outputs, 'compile_xcassets', xcassets, + variables=[('env', env), ('keys', keys)])) + return partial_info_plist + + def WriteMacInfoPlist(self, partial_info_plist, bundle_depends): """Write build rules for bundle Info.plist files.""" info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist( generator_default_variables['PRODUCT_DIR'], @@ -770,10 +841,18 @@ def WriteMacInfoPlist(self, bundle_depends): env = self.GetSortedXcodeEnv(additional_settings=extra_env) env = self.ComputeExportEnvString(env) + if partial_info_plist: + intermediate_plist = self.GypPathToUniqueOutput('merged_info.plist') + info_plist = self.ninja.build( + intermediate_plist, 'merge_infoplist', + [partial_info_plist, info_plist]) + keys = self.xcode_settings.GetExtraPlistItems(self.config_name) keys = QuoteShellArgument(json.dumps(keys), self.flavor) + isBinary = self.xcode_settings.IsBinaryOutputFormat(self.config_name) self.ninja.build(out, 'copy_infoplist', info_plist, - variables=[('env', env), ('keys', keys)]) + variables=[('env', env), ('keys', keys), + ('binary', isBinary)]) bundle_depends.append(out) def WriteSources(self, ninja_file, config_name, config, sources, predepends, @@ -785,6 +864,8 @@ def WriteSources(self, ninja_file, config_name, config, sources, predepends, self.ninja.variable('cxx', '$cxx_host') self.ninja.variable('ld', '$ld_host') self.ninja.variable('ldxx', '$ldxx_host') + self.ninja.variable('nm', '$nm_host') + self.ninja.variable('readelf', '$readelf_host') if self.flavor != 'mac' or len(self.archs) == 1: return self.WriteSourcesForArch( @@ -810,6 +891,7 @@ def WriteSourcesForArch(self, ninja_file, config_name, config, sources, cflags_objcc = ['$cflags_cc'] + \ self.xcode_settings.GetCflagsObjCC(config_name) elif self.flavor == 'win': + asmflags = self.msvs_settings.GetAsmflags(config_name) cflags = self.msvs_settings.GetCflags(config_name) cflags_c = self.msvs_settings.GetCflagsC(config_name) cflags_cc = self.msvs_settings.GetCflagsCC(config_name) @@ -844,22 +926,31 @@ def WriteSourcesForArch(self, ninja_file, config_name, config, sources, self.WriteVariableList(ninja_file, 'defines', [Define(d, self.flavor) for d in defines]) if self.flavor == 'win': + self.WriteVariableList(ninja_file, 'asmflags', + map(self.ExpandSpecial, asmflags)) self.WriteVariableList(ninja_file, 'rcflags', [QuoteShellArgument(self.ExpandSpecial(f), self.flavor) for f in self.msvs_settings.GetRcflags(config_name, self.GypPathToNinja)]) include_dirs = config.get('include_dirs', []) - env = self.GetSortedXcodeEnv() + + env = self.GetToolchainEnv() if self.flavor == 'win': - env = self.msvs_settings.GetVSMacroEnv('$!PRODUCT_DIR', - config=config_name) include_dirs = self.msvs_settings.AdjustIncludeDirs(include_dirs, config_name) self.WriteVariableList(ninja_file, 'includes', [QuoteShellArgument('-I' + self.GypPathToNinja(i, env), self.flavor) for i in include_dirs]) + if self.flavor == 'win': + midl_include_dirs = config.get('midl_include_dirs', []) + midl_include_dirs = self.msvs_settings.AdjustMidlIncludeDirs( + midl_include_dirs, config_name) + self.WriteVariableList(ninja_file, 'midl_includes', + [QuoteShellArgument('-I' + self.GypPathToNinja(i, env), self.flavor) + for i in midl_include_dirs]) + pch_commands = precompiled_header.GetPchBuildCommands(arch) if self.flavor == 'mac': # Most targets use no precompiled headers, so only write these if needed. @@ -868,6 +959,8 @@ def WriteSourcesForArch(self, ninja_file, config_name, config, sources, include = precompiled_header.GetInclude(ext, arch) if include: ninja_file.variable(var, include) + arflags = config.get('arflags', []) + self.WriteVariableList(ninja_file, 'cflags', map(self.ExpandSpecial, cflags)) self.WriteVariableList(ninja_file, 'cflags_c', @@ -879,6 +972,8 @@ def WriteSourcesForArch(self, ninja_file, config_name, config, sources, map(self.ExpandSpecial, cflags_objc)) self.WriteVariableList(ninja_file, 'cflags_objcc', map(self.ExpandSpecial, cflags_objcc)) + self.WriteVariableList(ninja_file, 'arflags', + map(self.ExpandSpecial, arflags)) ninja_file.newline() outputs = [] has_rc_source = False @@ -894,9 +989,7 @@ def WriteSourcesForArch(self, ninja_file, config_name, config, sources, elif ext == 's' and self.flavor != 'win': # Doesn't generate .o.d files. command = 'cc_s' elif (self.flavor == 'win' and ext == 'asm' and - self.msvs_settings.GetArch(config_name) == 'x86' and not self.msvs_settings.HasExplicitAsmRules(spec)): - # Asm files only get auto assembled for x86 (not x64). command = 'asm' # Add the _asm suffix as msvs is capable of handling .cc and # .asm files of the same name without collision. @@ -968,9 +1061,19 @@ def WriteLink(self, spec, config_name, config, link_deps): arch=arch) for arch in self.archs] extra_bindings = [] + build_output = output if not self.is_mac_bundle: self.AppendPostbuildVariable(extra_bindings, spec, output, output) - self.ninja.build(output, 'lipo', inputs, variables=extra_bindings) + + # TODO(yyanagisawa): more work needed to fix: + # https://code.google.com/p/gyp/issues/detail?id=411 + if (spec['type'] in ('shared_library', 'loadable_module') and + not self.is_mac_bundle): + extra_bindings.append(('lib', output)) + self.ninja.build([output, output + '.TOC'], 'solipo', inputs, + variables=extra_bindings) + else: + self.ninja.build(build_output, 'lipo', inputs, variables=extra_bindings) return output def WriteLinkForArch(self, ninja_file, spec, config_name, config, @@ -1063,7 +1166,7 @@ def WriteLinkForArch(self, ninja_file, spec, config_name, config, rpath = 'lib/' if self.toolset != 'target': rpath += self.toolset - ldflags.append('-Wl,-rpath=\$$ORIGIN/%s' % rpath) + ldflags.append(r'-Wl,-rpath=\$$ORIGIN/%s' % rpath) ldflags.append('-Wl,-rpath-link=%s' % rpath) self.WriteVariableList(ninja_file, 'ldflags', gyp.common.uniquer(map(self.ExpandSpecial, ldflags))) @@ -1095,9 +1198,27 @@ def WriteLinkForArch(self, ninja_file, spec, config_name, config, extra_bindings.append(('soname', os.path.split(output)[1])) extra_bindings.append(('lib', gyp.common.EncodePOSIXShellArgument(output))) + if self.flavor != 'win': + link_file_list = output + if self.is_mac_bundle: + # 'Dependency Framework.framework/Versions/A/Dependency Framework' -> + # 'Dependency Framework.framework.rsp' + link_file_list = self.xcode_settings.GetWrapperName() + if arch: + link_file_list += '.' + arch + link_file_list += '.rsp' + # If an rspfile contains spaces, ninja surrounds the filename with + # quotes around it and then passes it to open(), creating a file with + # quotes in its name (and when looking for the rsp file, the name + # makes it through bash which strips the quotes) :-/ + link_file_list = link_file_list.replace(' ', '_') + extra_bindings.append( + ('link_file_list', + gyp.common.EncodePOSIXShellArgument(link_file_list))) if self.flavor == 'win': extra_bindings.append(('binary', output)) - if '/NOENTRY' not in ldflags: + if ('/NOENTRY' not in ldflags and + not self.msvs_settings.GetNoImportLibrary(config_name)): self.target.import_lib = output + '.lib' extra_bindings.append(('implibflag', '/IMPLIB:%s' % self.target.import_lib)) @@ -1196,6 +1317,19 @@ def WriteMacBundle(self, spec, mac_bundle_depends, is_empty): self.target.bundle = output return output + def GetToolchainEnv(self, additional_settings=None): + """Returns the variables toolchain would set for build steps.""" + env = self.GetSortedXcodeEnv(additional_settings=additional_settings) + if self.flavor == 'win': + env = self.GetMsvsToolchainEnv( + additional_settings=additional_settings) + return env + + def GetMsvsToolchainEnv(self, additional_settings=None): + """Returns the variables Visual Studio would set for build steps.""" + return self.msvs_settings.GetVSMacroEnv('$!PRODUCT_DIR', + config=self.config_name) + def GetSortedXcodeEnv(self, additional_settings=None): """Returns the variables Xcode would set for build steps.""" assert self.abs_build_dir @@ -1377,7 +1511,8 @@ def WriteVariableList(self, ninja_file, var, values): values = [] ninja_file.variable(var, ' '.join(values)) - def WriteNewNinjaRule(self, name, args, description, is_cygwin, env): + def WriteNewNinjaRule(self, name, args, description, is_cygwin, env, pool, + depfile=None): """Write out a new ninja "rule" statement for a given command. Returns the name of the new rule, and a copy of |args| with variables @@ -1435,7 +1570,8 @@ def WriteNewNinjaRule(self, name, args, description, is_cygwin, env): # GYP rules/actions express being no-ops by not touching their outputs. # Avoid executing downstream dependencies in this case by specifying # restat=1 to ninja. - self.ninja.rule(rule_name, command, description, restat=True, + self.ninja.rule(rule_name, command, description, depfile=depfile, + restat=True, pool=pool, rspfile=rspfile, rspfile_content=rspfile_content) self.ninja.newline() @@ -1466,12 +1602,13 @@ def CalculateVariables(default_variables, params): generator_extra_sources_for_rules = getattr(xcode_generator, 'generator_extra_sources_for_rules', []) elif flavor == 'win': + exts = gyp.MSVSUtil.TARGET_TYPE_EXT default_variables.setdefault('OS', 'win') - default_variables['EXECUTABLE_SUFFIX'] = '.exe' + default_variables['EXECUTABLE_SUFFIX'] = '.' + exts['executable'] default_variables['STATIC_LIB_PREFIX'] = '' - default_variables['STATIC_LIB_SUFFIX'] = '.lib' + default_variables['STATIC_LIB_SUFFIX'] = '.' + exts['static_library'] default_variables['SHARED_LIB_PREFIX'] = '' - default_variables['SHARED_LIB_SUFFIX'] = '.dll' + default_variables['SHARED_LIB_SUFFIX'] = '.' + exts['shared_library'] # Copy additional generator configuration data from VS, which is shared # by the Windows Ninja generator. @@ -1535,6 +1672,10 @@ def CommandWithWrapper(cmd, wrappers, prog): def GetDefaultConcurrentLinks(): """Returns a best-guess for a number of concurrent links.""" + pool_size = int(os.getenv('GYP_LINK_CONCURRENCY', 0)) + if pool_size: + return pool_size + if sys.platform in ('win32', 'cygwin'): import ctypes @@ -1557,19 +1698,17 @@ class MEMORYSTATUSEX(ctypes.Structure): mem_limit = max(1, stat.ullTotalPhys / (4 * (2 ** 30))) # total / 4GB hard_cap = max(1, int(os.getenv('GYP_LINK_CONCURRENCY_MAX', 2**32))) - # return min(mem_limit, hard_cap) - # TODO(scottmg): Temporary speculative fix for OOM on builders - # See http://crbug.com/333000. - return 2 + return min(mem_limit, hard_cap) elif sys.platform.startswith('linux'): - with open("/proc/meminfo") as meminfo: - memtotal_re = re.compile(r'^MemTotal:\s*(\d*)\s*kB') - for line in meminfo: - match = memtotal_re.match(line) - if not match: - continue - # Allow 8Gb per link on Linux because Gold is quite memory hungry - return max(1, int(match.group(1)) / (8 * (2 ** 20))) + if os.path.exists("/proc/meminfo"): + with open("/proc/meminfo") as meminfo: + memtotal_re = re.compile(r'^MemTotal:\s*(\d*)\s*kB') + for line in meminfo: + match = memtotal_re.match(line) + if not match: + continue + # Allow 8Gb per link on Linux because Gold is quite memory hungry + return max(1, int(match.group(1)) / (8 * (2 ** 20))) return 1 elif sys.platform == 'darwin': try: @@ -1666,14 +1805,15 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, # 'CC_host'/'CXX_host' enviroment variable, cc_host/cxx_host should be set # to cc/cxx. if flavor == 'win': - # Overridden by local arch choice in the use_deps case. - # Chromium's ffmpeg c99conv.py currently looks for a 'cc =' line in - # build.ninja so needs something valid here. http://crbug.com/233985 - cc = 'cl.exe' - cxx = 'cl.exe' + ar = 'lib.exe' + # cc and cxx must be set to the correct architecture by overriding with one + # of cl_x86 or cl_x64 below. + cc = 'UNSET' + cxx = 'UNSET' ld = 'link.exe' ld_host = '$ld' else: + ar = 'ar' cc = 'cc' cxx = 'c++' ld = '$cc' @@ -1681,10 +1821,16 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, ld_host = '$cc_host' ldxx_host = '$cxx_host' + ar_host = 'ar' cc_host = None cxx_host = None cc_host_global_setting = None cxx_host_global_setting = None + clang_cl = None + nm = 'nm' + nm_host = 'nm' + readelf = 'readelf' + readelf_host = 'readelf' build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) make_global_settings = data[build_file].get('make_global_settings', []) @@ -1692,8 +1838,14 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, options.toplevel_dir) wrappers = {} for key, value in make_global_settings: + if key == 'AR': + ar = os.path.join(build_to_root, value) + if key == 'AR.host': + ar_host = os.path.join(build_to_root, value) if key == 'CC': cc = os.path.join(build_to_root, value) + if cc.endswith('clang-cl'): + clang_cl = cc if key == 'CXX': cxx = os.path.join(build_to_root, value) if key == 'CC.host': @@ -1702,6 +1854,18 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, if key == 'CXX.host': cxx_host = os.path.join(build_to_root, value) cxx_host_global_setting = value + if key == 'LD': + ld = os.path.join(build_to_root, value) + if key == 'LD.host': + ld_host = os.path.join(build_to_root, value) + if key == 'NM': + nm = os.path.join(build_to_root, value) + if key == 'NM.host': + nm_host = os.path.join(build_to_root, value) + if key == 'READELF': + readelf = os.path.join(build_to_root, value) + if key == 'READELF.host': + readelf_host = os.path.join(build_to_root, value) if key.endswith('_wrapper'): wrappers[key[:-len('_wrapper')]] = os.path.join(build_to_root, value) @@ -1713,12 +1877,25 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, wrappers[key_prefix] = os.path.join(build_to_root, value) if flavor == 'win': + configs = [target_dicts[qualified_target]['configurations'][config_name] + for qualified_target in target_list] + shared_system_includes = None + if not generator_flags.get('ninja_use_custom_environment_files', 0): + shared_system_includes = \ + gyp.msvs_emulation.ExtractSharedMSVSSystemIncludes( + configs, generator_flags) cl_paths = gyp.msvs_emulation.GenerateEnvironmentFiles( - toplevel_build, generator_flags, OpenOutput) + toplevel_build, generator_flags, shared_system_includes, OpenOutput) for arch, path in cl_paths.iteritems(): - master_ninja.variable( - 'cl_' + arch, CommandWithWrapper('CC', wrappers, - QuoteShellArgument(path, flavor))) + if clang_cl: + # If we have selected clang-cl, use that instead. + path = clang_cl + command = CommandWithWrapper('CC', wrappers, + QuoteShellArgument(path, 'win')) + if clang_cl: + # Use clang-cl to cross-compile for x86 or x86_64. + command += (' -m32' if arch == 'x86' else ' -m64') + master_ninja.variable('cl_' + arch, command) cc = GetEnvironFallback(['CC_target', 'CC'], cc) master_ninja.variable('cc', CommandWithWrapper('CC', wrappers, cc)) @@ -1728,14 +1905,22 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, if flavor == 'win': master_ninja.variable('ld', ld) master_ninja.variable('idl', 'midl.exe') - master_ninja.variable('ar', 'lib.exe') + master_ninja.variable('ar', ar) master_ninja.variable('rc', 'rc.exe') - master_ninja.variable('asm', 'ml.exe') + master_ninja.variable('ml_x86', 'ml.exe') + master_ninja.variable('ml_x64', 'ml64.exe') master_ninja.variable('mt', 'mt.exe') else: master_ninja.variable('ld', CommandWithWrapper('LINK', wrappers, ld)) master_ninja.variable('ldxx', CommandWithWrapper('LINK', wrappers, ldxx)) - master_ninja.variable('ar', GetEnvironFallback(['AR_target', 'AR'], 'ar')) + master_ninja.variable('ar', GetEnvironFallback(['AR_target', 'AR'], ar)) + if flavor != 'mac': + # Mac does not use readelf/nm for .TOC generation, so avoiding polluting + # the master ninja with extra unused variables. + master_ninja.variable( + 'nm', GetEnvironFallback(['NM_target', 'NM'], nm)) + master_ninja.variable( + 'readelf', GetEnvironFallback(['READELF_target', 'READELF'], readelf)) if generator_supports_multiple_toolsets: if not cc_host: @@ -1743,7 +1928,10 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, if not cxx_host: cxx_host = cxx - master_ninja.variable('ar_host', GetEnvironFallback(['AR_host'], 'ar')) + master_ninja.variable('ar_host', GetEnvironFallback(['AR_host'], ar_host)) + master_ninja.variable('nm_host', GetEnvironFallback(['NM_host'], nm_host)) + master_ninja.variable('readelf_host', + GetEnvironFallback(['READELF_host'], readelf_host)) cc_host = GetEnvironFallback(['CC_host'], cc_host) cxx_host = GetEnvironFallback(['CXX_host'], cxx_host) @@ -1826,7 +2014,7 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, description='IDL $in', command=('%s gyp-win-tool midl-wrapper $arch $outdir ' '$tlb $h $dlldata $iid $proxy $in ' - '$idlflags' % sys.executable)) + '$midl_includes $idlflags' % sys.executable)) master_ninja.rule( 'rc', description='RC $in', @@ -1836,20 +2024,20 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, sys.executable)) master_ninja.rule( 'asm', - description='ASM $in', + description='ASM $out', command=('%s gyp-win-tool asm-wrapper ' - '$arch $asm $defines $includes /c /Fo $out $in' % + '$arch $asm $defines $includes $asmflags /c /Fo $out $in' % sys.executable)) if flavor != 'mac' and flavor != 'win': master_ninja.rule( 'alink', description='AR $out', - command='rm -f $out && $ar rcs $out $in') + command='rm -f $out && $ar rcs $arflags $out $in') master_ninja.rule( 'alink_thin', description='AR $out', - command='rm -f $out && $ar rcsT $out $in') + command='rm -f $out && $ar rcsT $arflags $out $in') # This allows targets that only need to depend on $lib's API to declare an # order-only dependency on $lib.TOC and avoid relinking such downstream @@ -1857,38 +2045,39 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, # The resulting string leaves an uninterpolated %{suffix} which # is used in the final substitution below. mtime_preserving_solink_base = ( - 'if [ ! -e $lib -o ! -e ${lib}.TOC ]; then ' - '%(solink)s && %(extract_toc)s > ${lib}.TOC; else ' - '%(solink)s && %(extract_toc)s > ${lib}.tmp && ' - 'if ! cmp -s ${lib}.tmp ${lib}.TOC; then mv ${lib}.tmp ${lib}.TOC ; ' + 'if [ ! -e $lib -o ! -e $lib.TOC ]; then ' + '%(solink)s && %(extract_toc)s > $lib.TOC; else ' + '%(solink)s && %(extract_toc)s > $lib.tmp && ' + 'if ! cmp -s $lib.tmp $lib.TOC; then mv $lib.tmp $lib.TOC ; ' 'fi; fi' % { 'solink': '$ld -shared $ldflags -o $lib -Wl,-soname=$soname %(suffix)s', 'extract_toc': - ('{ readelf -d ${lib} | grep SONAME ; ' - 'nm -gD -f p ${lib} | cut -f1-2 -d\' \'; }')}) + ('{ $readelf -d $lib | grep SONAME ; ' + '$nm -gD -f p $lib | cut -f1-2 -d\' \'; }')}) master_ninja.rule( 'solink', description='SOLINK $lib', restat=True, - command=(mtime_preserving_solink_base % { - 'suffix': '-Wl,--whole-archive $in $solibs -Wl,--no-whole-archive ' - '$libs'}), + command=mtime_preserving_solink_base % {'suffix': '@$link_file_list'}, + rspfile='$link_file_list', + rspfile_content= + '-Wl,--whole-archive $in $solibs -Wl,--no-whole-archive $libs', pool='link_pool') master_ninja.rule( 'solink_module', description='SOLINK(module) $lib', restat=True, - command=(mtime_preserving_solink_base % { - 'suffix': '-Wl,--start-group $in $solibs -Wl,--end-group ' - '$libs'}), + command=mtime_preserving_solink_base % {'suffix': '@$link_file_list'}, + rspfile='$link_file_list', + rspfile_content='-Wl,--start-group $in -Wl,--end-group $solibs $libs', pool='link_pool') master_ninja.rule( 'link', description='LINK $out', command=('$ld $ldflags -o $out ' - '-Wl,--start-group $in $solibs -Wl,--end-group $libs'), + '-Wl,--start-group $in -Wl,--end-group $solibs $libs'), pool='link_pool') elif flavor == 'win': master_ninja.rule( @@ -1927,21 +2116,31 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, 'lipo', description='LIPO $out, POSTBUILDS', command='rm -f $out && lipo -create $in -output $out$postbuilds') + master_ninja.rule( + 'solipo', + description='SOLIPO $out, POSTBUILDS', + command=( + 'rm -f $lib $lib.TOC && lipo -create $in -output $lib$postbuilds &&' + '%(extract_toc)s > $lib.TOC' + % { 'extract_toc': + '{ otool -l $lib | grep LC_ID_DYLIB -A 5; ' + 'nm -gP $lib | cut -f1-2 -d\' \' | grep -v U$$; true; }'})) + # Record the public interface of $lib in $lib.TOC. See the corresponding # comment in the posix section above for details. solink_base = '$ld %(type)s $ldflags -o $lib %(suffix)s' mtime_preserving_solink_base = ( - 'if [ ! -e $lib -o ! -e ${lib}.TOC ] || ' + 'if [ ! -e $lib -o ! -e $lib.TOC ] || ' # Always force dependent targets to relink if this library # reexports something. Handling this correctly would require # recursive TOC dumping but this is rare in practice, so punt. 'otool -l $lib | grep -q LC_REEXPORT_DYLIB ; then ' - '%(solink)s && %(extract_toc)s > ${lib}.TOC; ' + '%(solink)s && %(extract_toc)s > $lib.TOC; ' 'else ' - '%(solink)s && %(extract_toc)s > ${lib}.tmp && ' - 'if ! cmp -s ${lib}.tmp ${lib}.TOC; then ' - 'mv ${lib}.tmp ${lib}.TOC ; ' + '%(solink)s && %(extract_toc)s > $lib.tmp && ' + 'if ! cmp -s $lib.tmp $lib.TOC; then ' + 'mv $lib.tmp $lib.TOC ; ' 'fi; ' 'fi' % { 'solink': solink_base, @@ -1949,34 +2148,42 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, '{ otool -l $lib | grep LC_ID_DYLIB -A 5; ' 'nm -gP $lib | cut -f1-2 -d\' \' | grep -v U$$; true; }'}) - solink_suffix = '$in $solibs $libs$postbuilds' + + solink_suffix = '@$link_file_list$postbuilds' master_ninja.rule( 'solink', description='SOLINK $lib, POSTBUILDS', restat=True, command=mtime_preserving_solink_base % {'suffix': solink_suffix, 'type': '-shared'}, + rspfile='$link_file_list', + rspfile_content='$in $solibs $libs', pool='link_pool') master_ninja.rule( 'solink_notoc', description='SOLINK $lib, POSTBUILDS', restat=True, command=solink_base % {'suffix':solink_suffix, 'type': '-shared'}, + rspfile='$link_file_list', + rspfile_content='$in $solibs $libs', pool='link_pool') - solink_module_suffix = '$in $solibs $libs$postbuilds' master_ninja.rule( 'solink_module', description='SOLINK(module) $lib, POSTBUILDS', restat=True, - command=mtime_preserving_solink_base % {'suffix': solink_module_suffix, + command=mtime_preserving_solink_base % {'suffix': solink_suffix, 'type': '-bundle'}, + rspfile='$link_file_list', + rspfile_content='$in $solibs $libs', pool='link_pool') master_ninja.rule( 'solink_module_notoc', description='SOLINK(module) $lib, POSTBUILDS', restat=True, - command=solink_base % {'suffix': solink_module_suffix, 'type': '-bundle'}, + command=solink_base % {'suffix': solink_suffix, 'type': '-bundle'}, + rspfile='$link_file_list', + rspfile_content='$in $solibs $libs', pool='link_pool') master_ninja.rule( @@ -1993,11 +2200,19 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, master_ninja.rule( 'copy_infoplist', description='COPY INFOPLIST $in', - command='$env ./gyp-mac-tool copy-info-plist $in $out $keys') + command='$env ./gyp-mac-tool copy-info-plist $in $out $binary $keys') + master_ninja.rule( + 'merge_infoplist', + description='MERGE INFOPLISTS $in', + command='$env ./gyp-mac-tool merge-info-plist $out $in') + master_ninja.rule( + 'compile_xcassets', + description='COMPILE XCASSETS $in', + command='$env ./gyp-mac-tool compile-xcassets $keys $in') master_ninja.rule( 'mac_tool', description='MACTOOL $mactool_cmd $in', - command='$env ./gyp-mac-tool $mactool_cmd $in $out') + command='$env ./gyp-mac-tool $mactool_cmd $in $out $binary') master_ninja.rule( 'package_framework', description='PACKAGE FRAMEWORK $out, POSTBUILDS', @@ -2037,6 +2252,15 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, # objects. target_short_names = {} + # short name of targets that were skipped because they didn't contain anything + # interesting. + # NOTE: there may be overlap between this an non_empty_target_names. + empty_target_names = set() + + # Set of non-empty short target names. + # NOTE: there may be overlap between this an empty_target_names. + non_empty_target_names = set() + for qualified_target in target_list: # qualified_target is like: third_party/icu/icu.gyp:icui18n#target build_file, name, toolset = \ @@ -2053,6 +2277,10 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, build_file = gyp.common.RelativePath(build_file, options.toplevel_dir) + qualified_target_for_hash = gyp.common.QualifiedTarget(build_file, name, + toolset) + hash_for_rules = hashlib.md5(qualified_target_for_hash).hexdigest() + base_path = os.path.dirname(build_file) obj = 'obj' if toolset != 'target': @@ -2060,7 +2288,7 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, output_file = os.path.join(obj, base_path, name + '.ninja') ninja_output = StringIO() - writer = NinjaWriter(qualified_target, target_outputs, base_path, build_dir, + writer = NinjaWriter(hash_for_rules, target_outputs, base_path, build_dir, ninja_output, toplevel_build, output_file, flavor, toplevel_dir=options.toplevel_dir) @@ -2080,6 +2308,9 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, target_outputs[qualified_target] = target if qualified_target in all_targets: all_outputs.add(target.FinalOutput()) + non_empty_target_names.add(name) + else: + empty_target_names.add(name) if target_short_names: # Write a short name to build this target. This benefits both the @@ -2091,6 +2322,16 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, master_ninja.build(short_name, 'phony', [x.FinalOutput() for x in target_short_names[short_name]]) + # Write phony targets for any empty targets that weren't written yet. As + # short names are not necessarily unique only do this for short names that + # haven't already been output for another target. + empty_target_names = empty_target_names - non_empty_target_names + if empty_target_names: + master_ninja.newline() + master_ninja.comment('Empty targets (output for completeness).') + for name in sorted(empty_target_names): + master_ninja.build(name, 'phony') + if all_outputs: master_ninja.newline() master_ninja.build('all', 'phony', list(all_outputs)) diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py index 52661bcdf09..1767b2f45a0 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py @@ -15,15 +15,18 @@ class TestPrefixesAndSuffixes(unittest.TestCase): def test_BinaryNamesWindows(self): - writer = ninja.NinjaWriter('foo', 'wee', '.', '.', 'build.ninja', '.', - 'build.ninja', 'win') - spec = { 'target_name': 'wee' } - self.assertTrue(writer.ComputeOutputFileName(spec, 'executable'). - endswith('.exe')) - self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). - endswith('.dll')) - self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). - endswith('.lib')) + # These cannot run on non-Windows as they require a VS installation to + # correctly handle variable expansion. + if sys.platform.startswith('win'): + writer = ninja.NinjaWriter('foo', 'wee', '.', '.', 'build.ninja', '.', + 'build.ninja', 'win') + spec = { 'target_name': 'wee' } + self.assertTrue(writer.ComputeOutputFileName(spec, 'executable'). + endswith('.exe')) + self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). + endswith('.dll')) + self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). + endswith('.lib')) def test_BinaryNamesLinux(self): writer = ninja.NinjaWriter('foo', 'wee', '.', '.', 'build.ninja', '.', diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py index 331e78baaa6..482b53ac8ad 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py @@ -5,6 +5,7 @@ import filecmp import gyp.common import gyp.xcodeproj_file +import gyp.xcode_ninja import errno import os import sys @@ -68,6 +69,9 @@ # The Xcode-specific keys that exist on targets and aren't moved down to # configurations. generator_additional_non_configuration_keys = [ + 'ios_app_extension', + 'ios_watch_app', + 'ios_watchkit_extension', 'mac_bundle', 'mac_bundle_resources', 'mac_framework_headers', @@ -484,7 +488,7 @@ def Write(self): def AddSourceToTarget(source, type, pbxp, xct): # TODO(mark): Perhaps source_extensions and library_extensions can be made a # little bit fancier. - source_extensions = ['c', 'cc', 'cpp', 'cxx', 'm', 'mm', 's'] + source_extensions = ['c', 'cc', 'cpp', 'cxx', 'm', 'mm', 's', 'swift'] # .o is conceptually more of a "source" than a "library," but Xcode thinks # of "sources" as things to compile and "libraries" (or "frameworks") as @@ -520,7 +524,7 @@ def AddHeaderToTarget(header, pbxp, xct, is_public): xct.HeadersPhase().AddFile(header, settings) -_xcode_variable_re = re.compile('(\$\((.*?)\))') +_xcode_variable_re = re.compile(r'(\$\((.*?)\))') def ExpandXcodeVariables(string, expansions): """Expands Xcode-style $(VARIABLES) in string per the expansions dict. @@ -575,12 +579,17 @@ def PerformBuild(data, configurations, params): def GenerateOutput(target_list, target_dicts, data, params): + # Optionally configure each spec to use ninja as the external builder. + ninja_wrapper = params.get('flavor') == 'ninja' + if ninja_wrapper: + (target_list, target_dicts, data) = \ + gyp.xcode_ninja.CreateWrapper(target_list, target_dicts, data, params) + options = params['options'] generator_flags = params.get('generator_flags', {}) parallel_builds = generator_flags.get('xcode_parallel_builds', True) serialize_all_tests = \ generator_flags.get('xcode_serialize_all_test_runs', True) - project_version = generator_flags.get('xcode_project_version', None) skip_excluded_files = \ not generator_flags.get('xcode_list_excluded_files', True) xcode_projects = {} @@ -598,8 +607,6 @@ def GenerateOutput(target_list, target_dicts, data, params): if parallel_builds: pbxp.SetProperty('attributes', {'BuildIndependentTargetsInParallel': 'YES'}) - if project_version: - xcp.project_file.SetXcodeVersion(project_version) # Add gyp/gypi files to project if not generator_flags.get('standalone'): @@ -637,14 +644,18 @@ def GenerateOutput(target_list, target_dicts, data, params): # com.googlecode.gyp.xcode.bundle, a pseudo-type that xcode.py interprets # to create a single-file mh_bundle. _types = { - 'executable': 'com.apple.product-type.tool', - 'loadable_module': 'com.googlecode.gyp.xcode.bundle', - 'shared_library': 'com.apple.product-type.library.dynamic', - 'static_library': 'com.apple.product-type.library.static', - 'executable+bundle': 'com.apple.product-type.application', - 'loadable_module+bundle': 'com.apple.product-type.bundle', - 'loadable_module+xctest': 'com.apple.product-type.bundle.unit-test', - 'shared_library+bundle': 'com.apple.product-type.framework', + 'executable': 'com.apple.product-type.tool', + 'loadable_module': 'com.googlecode.gyp.xcode.bundle', + 'shared_library': 'com.apple.product-type.library.dynamic', + 'static_library': 'com.apple.product-type.library.static', + 'executable+bundle': 'com.apple.product-type.application', + 'loadable_module+bundle': 'com.apple.product-type.bundle', + 'loadable_module+xctest': 'com.apple.product-type.bundle.unit-test', + 'shared_library+bundle': 'com.apple.product-type.framework', + 'executable+extension+bundle': 'com.apple.product-type.app-extension', + 'executable+watch+extension+bundle': + 'com.apple.product-type.watchkit-extension', + 'executable+watch+bundle': 'com.apple.product-type.application.watchapp', } target_properties = { @@ -655,6 +666,9 @@ def GenerateOutput(target_list, target_dicts, data, params): type = spec['type'] is_xctest = int(spec.get('mac_xctest_bundle', 0)) is_bundle = int(spec.get('mac_bundle', 0)) or is_xctest + is_app_extension = int(spec.get('ios_app_extension', 0)) + is_watchkit_extension = int(spec.get('ios_watchkit_extension', 0)) + is_watch_app = int(spec.get('ios_watch_app', 0)) if type != 'none': type_bundle_key = type if is_xctest: @@ -662,6 +676,18 @@ def GenerateOutput(target_list, target_dicts, data, params): assert type == 'loadable_module', ( 'mac_xctest_bundle targets must have type loadable_module ' '(target %s)' % target_name) + elif is_app_extension: + assert is_bundle, ('ios_app_extension flag requires mac_bundle ' + '(target %s)' % target_name) + type_bundle_key += '+extension+bundle' + elif is_watchkit_extension: + assert is_bundle, ('ios_watchkit_extension flag requires mac_bundle ' + '(target %s)' % target_name) + type_bundle_key += '+watch+extension+bundle' + elif is_watch_app: + assert is_bundle, ('ios_watch_app flag requires mac_bundle ' + '(target %s)' % target_name) + type_bundle_key += '+watch+bundle' elif is_bundle: type_bundle_key += '+bundle' @@ -703,11 +729,16 @@ def GenerateOutput(target_list, target_dicts, data, params): # and is made a dependency of this target. This way the work is done # before the dependency checks for what should be recompiled. support_xct = None - if type != 'none' and (spec_actions or spec_rules): + # The Xcode "issues" don't affect xcode-ninja builds, since the dependency + # logic all happens in ninja. Don't bother creating the extra targets in + # that case. + if type != 'none' and (spec_actions or spec_rules) and not ninja_wrapper: support_xccl = CreateXCConfigurationList(configuration_names); + support_target_suffix = generator_flags.get( + 'support_target_suffix', ' Support') support_target_properties = { 'buildConfigurationList': support_xccl, - 'name': target_name + ' Support', + 'name': target_name + support_target_suffix, } if target_product_name: support_target_properties['productName'] = \ @@ -1096,6 +1127,9 @@ def GenerateOutput(target_list, target_dicts, data, params): # Relative paths are relative to $(SRCROOT). dest = '$(SRCROOT)/' + dest + code_sign = int(copy_group.get('xcode_code_sign', 0)) + settings = (None, '{ATTRIBUTES = (CodeSignOnCopy, ); }')[code_sign]; + # Coalesce multiple "copies" sections in the same target with the same # "destination" property into the same PBXCopyFilesBuildPhase, otherwise # they'll wind up with ID collisions. @@ -1114,7 +1148,7 @@ def GenerateOutput(target_list, target_dicts, data, params): pbxcp_dict[dest] = pbxcp for file in copy_group['files']: - pbxcp.AddFile(file) + pbxcp.AddFile(file, settings) # Excluded files can also go into the project file. if not skip_excluded_files: diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py index 6472912db8e..34fbc547119 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py @@ -10,8 +10,8 @@ from compiler.ast import Node from compiler.ast import Stmt import compiler -import copy import gyp.common +import gyp.simple_copy import multiprocessing import optparse import os.path @@ -24,6 +24,7 @@ import time import traceback from gyp.common import GypError +from gyp.common import OrderedSet # A list of types that are treated as linkable. @@ -45,18 +46,36 @@ 'outputs', 'sources', ] -path_sections = [] +path_sections = set() -is_path_section_charset = set('=+?!') -is_path_section_match_re = re.compile('_(dir|file|path)s?$') +# These per-process dictionaries are used to cache build file data when loading +# in parallel mode. +per_process_data = {} +per_process_aux_data = {} def IsPathSection(section): - # If section ends in one of these characters, it's applied to a section + # If section ends in one of the '=+?!' characters, it's applied to a section # without the trailing characters. '/' is notably absent from this list, # because there's no way for a regular expression to be treated as a path. - while section[-1:] in is_path_section_charset: + while section[-1:] in '=+?!': section = section[:-1] - return section in path_sections or is_path_section_match_re.search(section) + + if section in path_sections: + return True + + # Sections mathing the regexp '_(dir|file|path)s?$' are also + # considered PathSections. Using manual string matching since that + # is much faster than the regexp and this can be called hundreds of + # thousands of times so micro performance matters. + if "_" in section: + tail = section[-6:] + if tail[-1] == 's': + tail = tail[:-1] + if tail[-5:] in ('_file', '_path'): + return True + return tail[-4:] == '_dir' + + return False # base_non_configuration_keys is a list of key names that belong in the target # itself and should not be propagated into its configurations. It is merged @@ -196,11 +215,11 @@ def CheckNode(node, keypath): elif isinstance(node, Const): return node.getChildren()[0] else: - raise TypeError, "Unknown AST node at key path '" + '.'.join(keypath) + \ - "': " + repr(node) + raise TypeError("Unknown AST node at key path '" + '.'.join(keypath) + + "': " + repr(node)) -def LoadOneBuildFile(build_file_path, data, aux_data, variables, includes, +def LoadOneBuildFile(build_file_path, data, aux_data, includes, is_target, check): if build_file_path in data: return data[build_file_path] @@ -224,7 +243,7 @@ def LoadOneBuildFile(build_file_path, data, aux_data, variables, includes, gyp.common.ExceptionAppend(e, 'while reading ' + build_file_path) raise - if not isinstance(build_file_data, dict): + if type(build_file_data) is not dict: raise GypError("%s does not evaluate to a dictionary." % build_file_path) data[build_file_path] = build_file_data @@ -236,10 +255,10 @@ def LoadOneBuildFile(build_file_path, data, aux_data, variables, includes, try: if is_target: LoadBuildFileIncludesIntoDict(build_file_data, build_file_path, data, - aux_data, variables, includes, check) + aux_data, includes, check) else: LoadBuildFileIncludesIntoDict(build_file_data, build_file_path, data, - aux_data, variables, None, check) + aux_data, None, check) except Exception, e: gyp.common.ExceptionAppend(e, 'while reading includes of ' + build_file_path) @@ -249,7 +268,7 @@ def LoadOneBuildFile(build_file_path, data, aux_data, variables, includes, def LoadBuildFileIncludesIntoDict(subdict, subdict_path, data, aux_data, - variables, includes, check): + includes, check): includes_list = [] if includes != None: includes_list.extend(includes) @@ -273,30 +292,27 @@ def LoadBuildFileIncludesIntoDict(subdict, subdict_path, data, aux_data, gyp.DebugOutput(gyp.DEBUG_INCLUDES, "Loading Included File: '%s'", include) MergeDicts(subdict, - LoadOneBuildFile(include, data, aux_data, variables, None, - False, check), + LoadOneBuildFile(include, data, aux_data, None, False, check), subdict_path, include) # Recurse into subdictionaries. for k, v in subdict.iteritems(): - if v.__class__ == dict: - LoadBuildFileIncludesIntoDict(v, subdict_path, data, aux_data, variables, + if type(v) is dict: + LoadBuildFileIncludesIntoDict(v, subdict_path, data, aux_data, None, check) - elif v.__class__ == list: - LoadBuildFileIncludesIntoList(v, subdict_path, data, aux_data, variables, + elif type(v) is list: + LoadBuildFileIncludesIntoList(v, subdict_path, data, aux_data, check) # This recurses into lists so that it can look for dicts. -def LoadBuildFileIncludesIntoList(sublist, sublist_path, data, aux_data, - variables, check): +def LoadBuildFileIncludesIntoList(sublist, sublist_path, data, aux_data, check): for item in sublist: - if item.__class__ == dict: + if type(item) is dict: LoadBuildFileIncludesIntoDict(item, sublist_path, data, aux_data, - variables, None, check) - elif item.__class__ == list: - LoadBuildFileIncludesIntoList(item, sublist_path, data, aux_data, - variables, check) + None, check) + elif type(item) is list: + LoadBuildFileIncludesIntoList(item, sublist_path, data, aux_data, check) # Processes toolsets in all the targets. This recurses into condition entries # since they can contain toolsets as well. @@ -320,7 +336,7 @@ def ProcessToolsetsInDict(data): if len(toolsets) > 0: # Optimization: only do copies if more than one toolset is specified. for build in toolsets[1:]: - new_target = copy.deepcopy(target) + new_target = gyp.simple_copy.deepcopy(target) new_target['toolset'] = build new_target_list.append(new_target) target['toolset'] = toolsets[0] @@ -328,9 +344,10 @@ def ProcessToolsetsInDict(data): data['targets'] = new_target_list if 'conditions' in data: for condition in data['conditions']: - if isinstance(condition, list): + if type(condition) is list: for condition_dict in condition[1:]: - ProcessToolsetsInDict(condition_dict) + if type(condition_dict) is dict: + ProcessToolsetsInDict(condition_dict) # TODO(mark): I don't love this name. It just means that it's going to load @@ -350,15 +367,22 @@ def LoadTargetBuildFile(build_file_path, data, aux_data, variables, includes, else: variables['DEPTH'] = d.replace('\\', '/') - if build_file_path in data['target_build_files']: - # Already loaded. - return False - data['target_build_files'].add(build_file_path) + # The 'target_build_files' key is only set when loading target build files in + # the non-parallel code path, where LoadTargetBuildFile is called + # recursively. In the parallel code path, we don't need to check whether the + # |build_file_path| has already been loaded, because the 'scheduled' set in + # ParallelState guarantees that we never load the same |build_file_path| + # twice. + if 'target_build_files' in data: + if build_file_path in data['target_build_files']: + # Already loaded. + return False + data['target_build_files'].add(build_file_path) gyp.DebugOutput(gyp.DEBUG_INCLUDES, "Loading Target Build File '%s'", build_file_path) - build_file_data = LoadOneBuildFile(build_file_path, data, aux_data, variables, + build_file_data = LoadOneBuildFile(build_file_path, data, aux_data, includes, True, check) # Store DEPTH for later use in generators. @@ -408,7 +432,8 @@ def LoadTargetBuildFile(build_file_path, data, aux_data, variables, includes, # copy with the target-specific data merged into it as the replacement # target dict. old_target_dict = build_file_data['targets'][index] - new_target_dict = copy.deepcopy(build_file_data['target_defaults']) + new_target_dict = gyp.simple_copy.deepcopy( + build_file_data['target_defaults']) MergeDicts(new_target_dict, old_target_dict, build_file_path, build_file_path) build_file_data['targets'][index] = new_target_dict @@ -443,10 +468,8 @@ def LoadTargetBuildFile(build_file_path, data, aux_data, variables, includes, else: return (build_file_path, dependencies) - def CallLoadTargetBuildFile(global_flags, - build_file_path, data, - aux_data, variables, + build_file_path, variables, includes, depth, check, generator_input_info): """Wrapper around LoadTargetBuildFile for parallel processing. @@ -462,35 +485,24 @@ def CallLoadTargetBuildFile(global_flags, for key, value in global_flags.iteritems(): globals()[key] = value - # Save the keys so we can return data that changed. - data_keys = set(data) - aux_data_keys = set(aux_data) - SetGeneratorGlobals(generator_input_info) - result = LoadTargetBuildFile(build_file_path, data, - aux_data, variables, + result = LoadTargetBuildFile(build_file_path, per_process_data, + per_process_aux_data, variables, includes, depth, check, False) if not result: return result (build_file_path, dependencies) = result - data_out = {} - for key in data: - if key == 'target_build_files': - continue - if key not in data_keys: - data_out[key] = data[key] - aux_data_out = {} - for key in aux_data: - if key not in aux_data_keys: - aux_data_out[key] = aux_data[key] + # We can safely pop the build_file_data from per_process_data because it + # will never be referenced by this process again, so we don't need to keep + # it in the cache. + build_file_data = per_process_data.pop(build_file_path) # This gets serialized and sent back to the main process via a pipe. # It's handled in LoadTargetBuildFileCallback. return (build_file_path, - data_out, - aux_data_out, + build_file_data, dependencies) except GypError, e: sys.stderr.write("gyp: %s\n" % e) @@ -521,8 +533,6 @@ def __init__(self): self.condition = None # The "data" dict that was passed to LoadTargetBuildFileParallel self.data = None - # The "aux_data" dict that was passed to LoadTargetBuildFileParallel - self.aux_data = None # The number of parallel calls outstanding; decremented when a response # was received. self.pending = 0 @@ -543,12 +553,9 @@ def LoadTargetBuildFileCallback(self, result): self.condition.notify() self.condition.release() return - (build_file_path0, data0, aux_data0, dependencies0) = result + (build_file_path0, build_file_data0, dependencies0) = result + self.data[build_file_path0] = build_file_data0 self.data['target_build_files'].add(build_file_path0) - for key in data0: - self.data[key] = data0[key] - for key in aux_data0: - self.aux_data[key] = aux_data0[key] for new_dependency in dependencies0: if new_dependency not in self.scheduled: self.scheduled.add(new_dependency) @@ -558,9 +565,8 @@ def LoadTargetBuildFileCallback(self, result): self.condition.release() -def LoadTargetBuildFilesParallel(build_files, data, aux_data, - variables, includes, depth, check, - generator_input_info): +def LoadTargetBuildFilesParallel(build_files, data, variables, includes, depth, + check, generator_input_info): parallel_state = ParallelState() parallel_state.condition = threading.Condition() # Make copies of the build_files argument that we can modify while working. @@ -568,7 +574,6 @@ def LoadTargetBuildFilesParallel(build_files, data, aux_data, parallel_state.scheduled = set(build_files) parallel_state.pending = 0 parallel_state.data = data - parallel_state.aux_data = aux_data try: parallel_state.condition.acquire() @@ -582,20 +587,16 @@ def LoadTargetBuildFilesParallel(build_files, data, aux_data, dependency = parallel_state.dependencies.pop() parallel_state.pending += 1 - data_in = {} - data_in['target_build_files'] = data['target_build_files'] - aux_data_in = {} global_flags = { 'path_sections': globals()['path_sections'], 'non_configuration_keys': globals()['non_configuration_keys'], 'multiple_toolsets': globals()['multiple_toolsets']} if not parallel_state.pool: - parallel_state.pool = multiprocessing.Pool(8) + parallel_state.pool = multiprocessing.Pool(multiprocessing.cpu_count()) parallel_state.pool.apply_async( CallLoadTargetBuildFile, args = (global_flags, dependency, - data_in, aux_data_in, variables, includes, depth, check, generator_input_info), callback = parallel_state.LoadTargetBuildFileCallback) except KeyboardInterrupt, e: @@ -636,39 +637,50 @@ def FindEnclosingBracketGroup(input_str): return (-1, -1) -canonical_int_re = re.compile('(0|-?[1-9][0-9]*)$') - - def IsStrCanonicalInt(string): """Returns True if |string| is in its canonical integer form. The canonical form is such that str(int(string)) == string. """ - return isinstance(string, str) and canonical_int_re.match(string) + if type(string) is str: + # This function is called a lot so for maximum performance, avoid + # involving regexps which would otherwise make the code much + # shorter. Regexps would need twice the time of this function. + if string: + if string == "0": + return True + if string[0] == "-": + string = string[1:] + if not string: + return False + if '1' <= string[0] <= '9': + return string.isdigit() + + return False # This matches things like "<(asdf)", "(?P<(?:(?:!?@?)|\|)?)' - '(?P[-a-zA-Z0-9_.]+)?' - '\((?P\s*\[?)' - '(?P.*?)(\]?)\))') + r'(?P(?P<(?:(?:!?@?)|\|)?)' + r'(?P[-a-zA-Z0-9_.]+)?' + r'\((?P\s*\[?)' + r'(?P.*?)(\]?)\))') # This matches the same as early_variable_re, but with '>' instead of '<'. late_variable_re = re.compile( - '(?P(?P>(?:(?:!?@?)|\|)?)' - '(?P[-a-zA-Z0-9_.]+)?' - '\((?P\s*\[?)' - '(?P.*?)(\]?)\))') + r'(?P(?P>(?:(?:!?@?)|\|)?)' + r'(?P[-a-zA-Z0-9_.]+)?' + r'\((?P\s*\[?)' + r'(?P.*?)(\]?)\))') # This matches the same as early_variable_re, but with '^' instead of '<'. latelate_variable_re = re.compile( - '(?P(?P[\^](?:(?:!?@?)|\|)?)' - '(?P[-a-zA-Z0-9_.]+)?' - '\((?P\s*\[?)' - '(?P.*?)(\]?)\))') + r'(?P(?P[\^](?:(?:!?@?)|\|)?)' + r'(?P[-a-zA-Z0-9_.]+)?' + r'\((?P\s*\[?)' + r'(?P.*?)(\]?)\))') # Global cache of results from running commands so they don't have to be run # more then once. @@ -677,7 +689,7 @@ def IsStrCanonicalInt(string): def FixupPlatformCommand(cmd): if sys.platform == 'win32': - if type(cmd) == list: + if type(cmd) is list: cmd = [re.sub('^cat ', 'type ', cmd[0])] + cmd[1:] else: cmd = re.sub('^cat ', 'type ', cmd) @@ -767,7 +779,7 @@ def ExpandVariables(input, phase, variables, build_file): # contexts. However, since filtration has no chance to run on <|(), # this seems like the only obvious way to give them access to filters. if file_list: - processed_variables = copy.deepcopy(variables) + processed_variables = gyp.simple_copy.deepcopy(variables) ProcessListFiltersInDict(contents, processed_variables) # Recurse to expand variables in the contents contents = ExpandVariables(contents, phase, @@ -804,7 +816,7 @@ def ExpandVariables(input, phase, variables, build_file): # This works around actions/rules which have more inputs than will # fit on the command line. if file_list: - if type(contents) == list: + if type(contents) is list: contents_list = contents else: contents_list = contents.split(' ') @@ -837,17 +849,15 @@ def ExpandVariables(input, phase, variables, build_file): use_shell = False # Check for a cached value to avoid executing commands, or generating - # file lists more than once. - # TODO(http://code.google.com/p/gyp/issues/detail?id=112): It is - # possible that the command being invoked depends on the current - # directory. For that case the syntax needs to be extended so that the - # directory is also used in cache_key (it becomes a tuple). + # file lists more than once. The cache key contains the command to be + # run as well as the directory to run it from, to account for commands + # that depend on their current directory. # TODO(http://code.google.com/p/gyp/issues/detail?id=111): In theory, # someone could author a set of GYP files where each time the command # is invoked it produces different output by design. When the need # arises, the syntax should be extended to support no caching off a # command's output so it is run every time. - cache_key = str(contents) + cache_key = (str(contents), build_file_dir) cached_value = cached_command_results.get(cache_key, None) if cached_value is None: gyp.DebugOutput(gyp.DEBUG_VARIABLES, @@ -925,10 +935,9 @@ def ExpandVariables(input, phase, variables, build_file): else: replacement = variables[contents] - if isinstance(replacement, list): + if type(replacement) is list: for item in replacement: - if (not contents[-1] == '/' and - not isinstance(item, str) and not isinstance(item, int)): + if not contents[-1] == '/' and type(item) not in (str, int): raise GypError('Variable ' + contents + ' must expand to a string or list of strings; ' + 'list contains a ' + @@ -938,8 +947,7 @@ def ExpandVariables(input, phase, variables, build_file): # with conditions sections. ProcessVariablesAndConditionsInList(replacement, phase, variables, build_file) - elif not isinstance(replacement, str) and \ - not isinstance(replacement, int): + elif type(replacement) not in (str, int): raise GypError('Variable ' + contents + ' must expand to a string or list of strings; ' + 'found a ' + replacement.__class__.__name__) @@ -948,7 +956,7 @@ def ExpandVariables(input, phase, variables, build_file): # Expanding in list context. It's guaranteed that there's only one # replacement to do in |input_str| and that it's this replacement. See # above. - if isinstance(replacement, list): + if type(replacement) is list: # If it's already a list, make a copy. output = replacement[:] else: @@ -957,7 +965,7 @@ def ExpandVariables(input, phase, variables, build_file): else: # Expanding in string context. encoded_replacement = '' - if isinstance(replacement, list): + if type(replacement) is list: # When expanding a list into string context, turn the list items # into a string in a way that will work with a subprocess call. # @@ -975,26 +983,32 @@ def ExpandVariables(input, phase, variables, build_file): # Prepare for the next match iteration. input_str = output - # Look for more matches now that we've replaced some, to deal with - # expanding local variables (variables defined in the same - # variables block as this one). - gyp.DebugOutput(gyp.DEBUG_VARIABLES, "Found output %r, recursing.", output) - if isinstance(output, list): - if output and isinstance(output[0], list): - # Leave output alone if it's a list of lists. - # We don't want such lists to be stringified. - pass - else: - new_output = [] - for item in output: - new_output.append( - ExpandVariables(item, phase, variables, build_file)) - output = new_output + if output == input: + gyp.DebugOutput(gyp.DEBUG_VARIABLES, + "Found only identity matches on %r, avoiding infinite " + "recursion.", + output) else: - output = ExpandVariables(output, phase, variables, build_file) + # Look for more matches now that we've replaced some, to deal with + # expanding local variables (variables defined in the same + # variables block as this one). + gyp.DebugOutput(gyp.DEBUG_VARIABLES, "Found output %r, recursing.", output) + if type(output) is list: + if output and type(output[0]) is list: + # Leave output alone if it's a list of lists. + # We don't want such lists to be stringified. + pass + else: + new_output = [] + for item in output: + new_output.append( + ExpandVariables(item, phase, variables, build_file)) + output = new_output + else: + output = ExpandVariables(output, phase, variables, build_file) # Convert all strings that are canonically-represented integers into integers. - if isinstance(output, list): + if type(output) is list: for index in xrange(0, len(output)): if IsStrCanonicalInt(output[index]): output[index] = int(output[index]) @@ -1003,6 +1017,80 @@ def ExpandVariables(input, phase, variables, build_file): return output +# The same condition is often evaluated over and over again so it +# makes sense to cache as much as possible between evaluations. +cached_conditions_asts = {} + +def EvalCondition(condition, conditions_key, phase, variables, build_file): + """Returns the dict that should be used or None if the result was + that nothing should be used.""" + if type(condition) is not list: + raise GypError(conditions_key + ' must be a list') + if len(condition) < 2: + # It's possible that condition[0] won't work in which case this + # attempt will raise its own IndexError. That's probably fine. + raise GypError(conditions_key + ' ' + condition[0] + + ' must be at least length 2, not ' + str(len(condition))) + + i = 0 + result = None + while i < len(condition): + cond_expr = condition[i] + true_dict = condition[i + 1] + if type(true_dict) is not dict: + raise GypError('{} {} must be followed by a dictionary, not {}'.format( + conditions_key, cond_expr, type(true_dict))) + if len(condition) > i + 2 and type(condition[i + 2]) is dict: + false_dict = condition[i + 2] + i = i + 3 + if i != len(condition): + raise GypError('{} {} has {} unexpected trailing items'.format( + conditions_key, cond_expr, len(condition) - i)) + else: + false_dict = None + i = i + 2 + if result == None: + result = EvalSingleCondition( + cond_expr, true_dict, false_dict, phase, variables, build_file) + + return result + + +def EvalSingleCondition( + cond_expr, true_dict, false_dict, phase, variables, build_file): + """Returns true_dict if cond_expr evaluates to true, and false_dict + otherwise.""" + # Do expansions on the condition itself. Since the conditon can naturally + # contain variable references without needing to resort to GYP expansion + # syntax, this is of dubious value for variables, but someone might want to + # use a command expansion directly inside a condition. + cond_expr_expanded = ExpandVariables(cond_expr, phase, variables, + build_file) + if type(cond_expr_expanded) not in (str, int): + raise ValueError( + 'Variable expansion in this context permits str and int ' + \ + 'only, found ' + cond_expr_expanded.__class__.__name__) + + try: + if cond_expr_expanded in cached_conditions_asts: + ast_code = cached_conditions_asts[cond_expr_expanded] + else: + ast_code = compile(cond_expr_expanded, '', 'eval') + cached_conditions_asts[cond_expr_expanded] = ast_code + if eval(ast_code, {'__builtins__': None}, variables): + return true_dict + return false_dict + except SyntaxError, e: + syntax_error = SyntaxError('%s while evaluating condition \'%s\' in %s ' + 'at character %d.' % + (str(e.args[0]), e.text, build_file, e.offset), + e.filename, e.lineno, e.offset, e.text) + raise syntax_error + except NameError, e: + gyp.common.ExceptionAppend(e, 'while evaluating condition \'%s\' in %s' % + (cond_expr_expanded, build_file)) + raise GypError(e) + def ProcessConditionsInDict(the_dict, phase, variables, build_file): # Process a 'conditions' or 'target_conditions' section in the_dict, @@ -1038,48 +1126,8 @@ def ProcessConditionsInDict(the_dict, phase, variables, build_file): del the_dict[conditions_key] for condition in conditions_list: - if not isinstance(condition, list): - raise GypError(conditions_key + ' must be a list') - if len(condition) != 2 and len(condition) != 3: - # It's possible that condition[0] won't work in which case this - # attempt will raise its own IndexError. That's probably fine. - raise GypError(conditions_key + ' ' + condition[0] + - ' must be length 2 or 3, not ' + str(len(condition))) - - [cond_expr, true_dict] = condition[0:2] - false_dict = None - if len(condition) == 3: - false_dict = condition[2] - - # Do expansions on the condition itself. Since the conditon can naturally - # contain variable references without needing to resort to GYP expansion - # syntax, this is of dubious value for variables, but someone might want to - # use a command expansion directly inside a condition. - cond_expr_expanded = ExpandVariables(cond_expr, phase, variables, - build_file) - if not isinstance(cond_expr_expanded, str) and \ - not isinstance(cond_expr_expanded, int): - raise ValueError, \ - 'Variable expansion in this context permits str and int ' + \ - 'only, found ' + expanded.__class__.__name__ - - try: - ast_code = compile(cond_expr_expanded, '', 'eval') - - if eval(ast_code, {'__builtins__': None}, variables): - merge_dict = true_dict - else: - merge_dict = false_dict - except SyntaxError, e: - syntax_error = SyntaxError('%s while evaluating condition \'%s\' in %s ' - 'at character %d.' % - (str(e.args[0]), e.text, build_file, e.offset), - e.filename, e.lineno, e.offset, e.text) - raise syntax_error - except NameError, e: - gyp.common.ExceptionAppend(e, 'while evaluating condition \'%s\' in %s' % - (cond_expr_expanded, build_file)) - raise GypError(e) + merge_dict = EvalCondition(condition, conditions_key, phase, variables, + build_file) if merge_dict != None: # Expand variables and nested conditinals in the merge_dict before @@ -1094,8 +1142,7 @@ def LoadAutomaticVariablesFromDict(variables, the_dict): # Any keys with plain string values in the_dict become automatic variables. # The variable name is the key name with a "_" character prepended. for key, value in the_dict.iteritems(): - if isinstance(value, str) or isinstance(value, int) or \ - isinstance(value, list): + if type(value) in (str, int, list): variables['_' + key] = value @@ -1108,8 +1155,7 @@ def LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key): # (it could be a list or it could be parentless because it is a root dict), # the_dict_key will be None. for key, value in the_dict.get('variables', {}).iteritems(): - if not isinstance(value, str) and not isinstance(value, int) and \ - not isinstance(value, list): + if type(value) not in (str, int, list): continue if key.endswith('%'): @@ -1162,12 +1208,12 @@ def ProcessVariablesAndConditionsInDict(the_dict, phase, variables_in, for key, value in the_dict.iteritems(): # Skip "variables", which was already processed if present. - if key != 'variables' and isinstance(value, str): + if key != 'variables' and type(value) is str: expanded = ExpandVariables(value, phase, variables, build_file) - if not isinstance(expanded, str) and not isinstance(expanded, int): - raise ValueError, \ + if type(expanded) not in (str, int): + raise ValueError( 'Variable expansion in this context permits str and int ' + \ - 'only, found ' + expanded.__class__.__name__ + ' for ' + key + 'only, found ' + expanded.__class__.__name__ + ' for ' + key) the_dict[key] = expanded # Variable expansion may have resulted in changes to automatics. Reload. @@ -1221,23 +1267,23 @@ def ProcessVariablesAndConditionsInDict(the_dict, phase, variables_in, for key, value in the_dict.iteritems(): # Skip "variables" and string values, which were already processed if # present. - if key == 'variables' or isinstance(value, str): + if key == 'variables' or type(value) is str: continue - if isinstance(value, dict): + if type(value) is dict: # Pass a copy of the variables dict so that subdicts can't influence # parents. ProcessVariablesAndConditionsInDict(value, phase, variables, build_file, key) - elif isinstance(value, list): + elif type(value) is list: # The list itself can't influence the variables dict, and # ProcessVariablesAndConditionsInList will make copies of the variables # dict if it needs to pass it to something that can influence it. No # copy is necessary here. ProcessVariablesAndConditionsInList(value, phase, variables, build_file) - elif not isinstance(value, int): - raise TypeError, 'Unknown type ' + value.__class__.__name__ + \ - ' for ' + key + elif type(value) is not int: + raise TypeError('Unknown type ' + value.__class__.__name__ + \ + ' for ' + key) def ProcessVariablesAndConditionsInList(the_list, phase, variables, @@ -1246,17 +1292,17 @@ def ProcessVariablesAndConditionsInList(the_list, phase, variables, index = 0 while index < len(the_list): item = the_list[index] - if isinstance(item, dict): + if type(item) is dict: # Make a copy of the variables dict so that it won't influence anything # outside of its own scope. ProcessVariablesAndConditionsInDict(item, phase, variables, build_file) - elif isinstance(item, list): + elif type(item) is list: ProcessVariablesAndConditionsInList(item, phase, variables, build_file) - elif isinstance(item, str): + elif type(item) is str: expanded = ExpandVariables(item, phase, variables, build_file) - if isinstance(expanded, str) or isinstance(expanded, int): + if type(expanded) in (str, int): the_list[index] = expanded - elif isinstance(expanded, list): + elif type(expanded) is list: the_list[index:index+1] = expanded index += len(expanded) @@ -1264,13 +1310,13 @@ def ProcessVariablesAndConditionsInList(the_list, phase, variables, # without falling into the index increment below. continue else: - raise ValueError, \ + raise ValueError( 'Variable expansion in this context permits strings and ' + \ 'lists only, found ' + expanded.__class__.__name__ + ' at ' + \ - index - elif not isinstance(item, int): - raise TypeError, 'Unknown type ' + item.__class__.__name__ + \ - ' at index ' + index + index) + elif type(item) is not int: + raise TypeError('Unknown type ' + item.__class__.__name__ + \ + ' at index ' + index) index = index + 1 @@ -1443,6 +1489,20 @@ def RemoveSelfDependencies(targets): target_dict[dependency_key] = Filter(dependencies, target_name) +def RemoveLinkDependenciesFromNoneTargets(targets): + """Remove dependencies having the 'link_dependency' attribute from the 'none' + targets.""" + for target_name, target_dict in targets.iteritems(): + for dependency_key in dependency_sections: + dependencies = target_dict.get(dependency_key, []) + if dependencies: + for t in dependencies: + if target_dict.get('type', None) == 'none': + if targets[t].get('variables', {}).get('link_dependency', 0): + target_dict[dependency_key] = \ + Filter(target_dict[dependency_key], t) + + class DependencyGraphNode(object): """ @@ -1468,7 +1528,7 @@ def FlattenToList(self): # are the "ref" attributes of DependencyGraphNodes. Every target will # appear in flat_list after all of its dependencies, and before all of its # dependents. - flat_list = [] + flat_list = OrderedSet() # in_degree_zeros is the list of DependencyGraphNodes that have no # dependencies not in flat_list. Initially, it is a copy of the children @@ -1482,12 +1542,15 @@ def FlattenToList(self): # as work progresses, so that the next node to process from the list can # always be accessed at a consistent position. node = in_degree_zeros.pop() - flat_list.append(node.ref) + flat_list.add(node.ref) # Look at dependents of the node just added to flat_list. Some of them # may now belong in in_degree_zeros. for node_dependent in node.dependents: is_in_degree_zero = True + # TODO: We want to check through the + # node_dependent.dependencies list but if it's long and we + # always start at the beginning, then we get O(n^2) behaviour. for node_dependent_dependency in node_dependent.dependencies: if not node_dependent_dependency.ref in flat_list: # The dependent one or more dependencies not in flat_list. There @@ -1503,28 +1566,27 @@ def FlattenToList(self): # iteration of the outer loop. in_degree_zeros.add(node_dependent) - return flat_list + return list(flat_list) - def FindCycles(self, path=None): + def FindCycles(self): """ Returns a list of cycles in the graph, where each cycle is its own list. """ - if path is None: - path = [self] - results = [] - for node in self.dependents: - if node in path: - cycle = [node] - for part in path: - cycle.append(part) - if part == node: - break - results.append(tuple(cycle)) - else: - results.extend(node.FindCycles([node] + path)) + visited = set() + + def Visit(node, path): + for child in node.dependents: + if child in path: + results.append([child] + path[:path.index(child) + 1]) + elif not child in visited: + visited.add(child) + Visit(child, [child] + path) + + visited.add(self) + Visit(self, [self]) - return list(set(results)) + return results def DirectDependencies(self, dependencies=None): """Returns a list of just direct dependencies.""" @@ -1589,21 +1651,26 @@ def DirectAndImportedDependencies(self, targets, dependencies=None): return self._AddImportedDependencies(targets, dependencies) def DeepDependencies(self, dependencies=None): - """Returns a list of all of a target's dependencies, recursively.""" - if dependencies == None: - dependencies = [] + """Returns an OrderedSet of all of a target's dependencies, recursively.""" + if dependencies is None: + # Using a list to get ordered output and a set to do fast "is it + # already added" checks. + dependencies = OrderedSet() for dependency in self.dependencies: # Check for None, corresponding to the root node. - if dependency.ref != None and dependency.ref not in dependencies: - dependencies.append(dependency.ref) + if dependency.ref is None: + continue + if dependency.ref not in dependencies: + dependencies.add(dependency.ref) dependency.DeepDependencies(dependencies) return dependencies def _LinkDependenciesInternal(self, targets, include_shared_libraries, dependencies=None, initial=True): - """Returns a list of dependency targets that are linked into this target. + """Returns an OrderedSet of dependency targets that are linked + into this target. This function has a split personality, depending on the setting of |initial|. Outside callers should always leave |initial| at its default @@ -1616,11 +1683,13 @@ def _LinkDependenciesInternal(self, targets, include_shared_libraries, If |include_shared_libraries| is False, the resulting dependencies will not include shared_library targets that are linked into this target. """ - if dependencies == None: - dependencies = [] + if dependencies is None: + # Using a list to get ordered output and a set to do fast "is it + # already added" checks. + dependencies = OrderedSet() # Check for None, corresponding to the root node. - if self.ref == None: + if self.ref is None: return dependencies # It's kind of sucky that |targets| has to be passed into this function, @@ -1648,8 +1717,7 @@ def _LinkDependenciesInternal(self, targets, include_shared_libraries, # Don't traverse 'none' targets if explicitly excluded. if (target_type == 'none' and not targets[self.ref].get('dependencies_traverse', True)): - if self.ref not in dependencies: - dependencies.append(self.ref) + dependencies.add(self.ref) return dependencies # Executables and loadable modules are already fully and finally linked. @@ -1671,7 +1739,7 @@ def _LinkDependenciesInternal(self, targets, include_shared_libraries, # The target is linkable, add it to the list of link dependencies. if self.ref not in dependencies: - dependencies.append(self.ref) + dependencies.add(self.ref) if initial or not is_linkable: # If this is a subsequent target and it's linkable, don't look any # further for linkable dependencies, as they'll already be linked into @@ -1735,12 +1803,22 @@ def BuildDependencyList(targets): flat_list = root_node.FlattenToList() # If there's anything left unvisited, there must be a circular dependency - # (cycle). If you need to figure out what's wrong, look for elements of - # targets that are not in flat_list. + # (cycle). if len(flat_list) != len(targets): + if not root_node.dependents: + # If all targets have dependencies, add the first target as a dependent + # of root_node so that the cycle can be discovered from root_node. + target = targets.keys()[0] + target_node = dependency_nodes[target] + target_node.dependencies.append(root_node) + root_node.dependents.append(target_node) + + cycles = [] + for cycle in root_node.FindCycles(): + paths = [node.ref for node in cycle] + cycles.append('Cycle: %s' % ' -> '.join(paths)) raise DependencyGraphNode.CircularException( - 'Some targets not reachable, cycle in dependency graph detected: ' + - ' '.join(set(flat_list) ^ set(targets))) + 'Cycles in dependency graph detected:\n' + '\n'.join(cycles)) return [dependency_nodes, flat_list] @@ -1790,20 +1868,18 @@ def VerifyNoGYPFileCircularDependencies(targets): # If there's anything left unvisited, there must be a circular dependency # (cycle). if len(flat_list) != len(dependency_nodes): - bad_files = [] - for file in dependency_nodes.iterkeys(): - if not file in flat_list: - bad_files.append(file) - common_path_prefix = os.path.commonprefix(dependency_nodes) + if not root_node.dependents: + # If all files have dependencies, add the first file as a dependent + # of root_node so that the cycle can be discovered from root_node. + file_node = dependency_nodes.values()[0] + file_node.dependencies.append(root_node) + root_node.dependents.append(file_node) cycles = [] for cycle in root_node.FindCycles(): - simplified_paths = [] - for node in cycle: - assert(node.ref.startswith(common_path_prefix)) - simplified_paths.append(node.ref[len(common_path_prefix):]) - cycles.append('Cycle: %s' % ' -> '.join(simplified_paths)) - raise DependencyGraphNode.CircularException, \ - 'Cycles in .gyp file dependency graph detected:\n' + '\n'.join(cycles) + paths = [node.ref for node in cycle] + cycles.append('Cycle: %s' % ' -> '.join(paths)) + raise DependencyGraphNode.CircularException( + 'Cycles in .gyp file dependency graph detected:\n' + '\n'.join(cycles)) def DoDependentSettings(key, flat_list, targets, dependency_nodes): @@ -1966,25 +2042,25 @@ def is_in_set_or_list(x, s, l): hashable_to_set = set(x for x in to if is_hashable(x)) for item in fro: singleton = False - if isinstance(item, str) or isinstance(item, int): + if type(item) in (str, int): # The cheap and easy case. if is_paths: to_item = MakePathRelative(to_file, fro_file, item) else: to_item = item - if not isinstance(item, str) or not item.startswith('-'): + if not (type(item) is str and item.startswith('-')): # Any string that doesn't begin with a "-" is a singleton - it can # only appear once in a list, to be enforced by the list merge append # or prepend. singleton = True - elif isinstance(item, dict): + elif type(item) is dict: # Make a copy of the dictionary, continuing to look for paths to fix. # The other intelligent aspects of merge processing won't apply because # item is being merged into an empty dict. to_item = {} MergeDicts(to_item, item, to_file, fro_file) - elif isinstance(item, list): + elif type(item) is list: # Recurse, making a copy of the list. If the list contains any # descendant dicts, path fixing will occur. Note that here, custom # values for is_paths and append are dropped; those are only to be @@ -1993,9 +2069,9 @@ def is_in_set_or_list(x, s, l): to_item = [] MergeLists(to_item, item, to_file, fro_file) else: - raise TypeError, \ + raise TypeError( 'Attempt to merge list item of unsupported type ' + \ - item.__class__.__name__ + item.__class__.__name__) if append: # If appending a singleton that's already in the list, don't append. @@ -2030,30 +2106,30 @@ def MergeDicts(to, fro, to_file, fro_file): # modified. if k in to: bad_merge = False - if isinstance(v, str) or isinstance(v, int): - if not (isinstance(to[k], str) or isinstance(to[k], int)): + if type(v) in (str, int): + if type(to[k]) not in (str, int): bad_merge = True - elif v.__class__ != to[k].__class__: + elif type(v) is not type(to[k]): bad_merge = True if bad_merge: - raise TypeError, \ + raise TypeError( 'Attempt to merge dict value of type ' + v.__class__.__name__ + \ ' into incompatible type ' + to[k].__class__.__name__ + \ - ' for key ' + k - if isinstance(v, str) or isinstance(v, int): + ' for key ' + k) + if type(v) in (str, int): # Overwrite the existing value, if any. Cheap and easy. is_path = IsPathSection(k) if is_path: to[k] = MakePathRelative(to_file, fro_file, v) else: to[k] = v - elif isinstance(v, dict): + elif type(v) is dict: # Recurse, guaranteeing copies will be made of objects that require it. if not k in to: to[k] = {} MergeDicts(to[k], v, to_file, fro_file) - elif isinstance(v, list): + elif type(v) is list: # Lists in dicts can be merged with different policies, depending on # how the key in the "from" dict (k, the from-key) is written. # @@ -2096,13 +2172,13 @@ def MergeDicts(to, fro, to_file, fro_file): # If the key ends in "?", the list will only be merged if it doesn't # already exist. continue - if not isinstance(to[list_base], list): + elif type(to[list_base]) is not list: # This may not have been checked above if merging in a list with an # extension character. - raise TypeError, \ + raise TypeError( 'Attempt to merge dict value of type ' + v.__class__.__name__ + \ ' into incompatible type ' + to[list_base].__class__.__name__ + \ - ' for key ' + list_base + '(' + k + ')' + ' for key ' + list_base + '(' + k + ')') else: to[list_base] = [] @@ -2114,9 +2190,9 @@ def MergeDicts(to, fro, to_file, fro_file): is_paths = IsPathSection(list_base) MergeLists(to[list_base], v, to_file, fro_file, is_paths, append) else: - raise TypeError, \ + raise TypeError( 'Attempt to merge dict value of unsupported type ' + \ - v.__class__.__name__ + ' for key ' + k + v.__class__.__name__ + ' for key ' + k) def MergeConfigWithInheritance(new_configuration_dict, build_file, @@ -2157,43 +2233,39 @@ def SetUpConfigurations(target, target_dict): if not 'configurations' in target_dict: target_dict['configurations'] = {'Default': {}} if not 'default_configuration' in target_dict: - concrete = [i for i in target_dict['configurations'].iterkeys() - if not target_dict['configurations'][i].get('abstract')] + concrete = [i for (i, config) in target_dict['configurations'].iteritems() + if not config.get('abstract')] target_dict['default_configuration'] = sorted(concrete)[0] - for configuration in target_dict['configurations'].keys(): - old_configuration_dict = target_dict['configurations'][configuration] + merged_configurations = {} + configs = target_dict['configurations'] + for (configuration, old_configuration_dict) in configs.iteritems(): # Skip abstract configurations (saves work only). if old_configuration_dict.get('abstract'): continue # Configurations inherit (most) settings from the enclosing target scope. # Get the inheritance relationship right by making a copy of the target # dict. - new_configuration_dict = copy.deepcopy(target_dict) - - # Take out the bits that don't belong in a "configurations" section. - # Since configuration setup is done before conditional, exclude, and rules - # processing, be careful with handling of the suffix characters used in - # those phases. - delete_keys = [] - for key in new_configuration_dict: + new_configuration_dict = {} + for (key, target_val) in target_dict.iteritems(): key_ext = key[-1:] if key_ext in key_suffixes: key_base = key[:-1] else: key_base = key - if key_base in non_configuration_keys: - delete_keys.append(key) - - for key in delete_keys: - del new_configuration_dict[key] + if not key_base in non_configuration_keys: + new_configuration_dict[key] = gyp.simple_copy.deepcopy(target_val) # Merge in configuration (with all its parents first). MergeConfigWithInheritance(new_configuration_dict, build_file, target_dict, configuration, []) - # Put the new result back into the target dict as a configuration. - target_dict['configurations'][configuration] = new_configuration_dict + merged_configurations[configuration] = new_configuration_dict + + # Put the new configurations back into the target dict as a configuration. + for configuration in merged_configurations.keys(): + target_dict['configurations'][configuration] = ( + merged_configurations[configuration]) # Now drop all the abstract ones. for configuration in target_dict['configurations'].keys(): @@ -2264,9 +2336,9 @@ def ProcessListFiltersInDict(name, the_dict): if operation != '!' and operation != '/': continue - if not isinstance(value, list): - raise ValueError, name + ' key ' + key + ' must be list, not ' + \ - value.__class__.__name__ + if type(value) is not list: + raise ValueError(name + ' key ' + key + ' must be list, not ' + \ + value.__class__.__name__) list_key = key[:-1] if list_key not in the_dict: @@ -2276,12 +2348,12 @@ def ProcessListFiltersInDict(name, the_dict): del_lists.append(key) continue - if not isinstance(the_dict[list_key], list): + if type(the_dict[list_key]) is not list: value = the_dict[list_key] - raise ValueError, name + ' key ' + list_key + \ - ' must be list, not ' + \ - value.__class__.__name__ + ' when applying ' + \ - {'!': 'exclusion', '/': 'regex'}[operation] + raise ValueError(name + ' key ' + list_key + \ + ' must be list, not ' + \ + value.__class__.__name__ + ' when applying ' + \ + {'!': 'exclusion', '/': 'regex'}[operation]) if not list_key in lists: lists.append(list_key) @@ -2330,8 +2402,8 @@ def ProcessListFiltersInDict(name, the_dict): action_value = 1 else: # This is an action that doesn't make any sense. - raise ValueError, 'Unrecognized action ' + action + ' in ' + name + \ - ' key ' + regex_key + raise ValueError('Unrecognized action ' + action + ' in ' + name + \ + ' key ' + regex_key) for index in xrange(0, len(the_list)): list_item = the_list[index] @@ -2378,17 +2450,17 @@ def ProcessListFiltersInDict(name, the_dict): # Now recurse into subdicts and lists that may contain dicts. for key, value in the_dict.iteritems(): - if isinstance(value, dict): + if type(value) is dict: ProcessListFiltersInDict(key, value) - elif isinstance(value, list): + elif type(value) is list: ProcessListFiltersInList(key, value) def ProcessListFiltersInList(name, the_list): for item in the_list: - if isinstance(item, dict): + if type(item) is dict: ProcessListFiltersInDict(name, item) - elif isinstance(item, list): + elif type(item) is list: ProcessListFiltersInList(name, item) @@ -2416,33 +2488,6 @@ def ValidateTargetType(target, target_dict): target_type)) -def ValidateSourcesInTarget(target, target_dict, build_file): - # TODO: Check if MSVC allows this for loadable_module targets. - if target_dict.get('type', None) not in ('static_library', 'shared_library'): - return - sources = target_dict.get('sources', []) - basenames = {} - for source in sources: - name, ext = os.path.splitext(source) - is_compiled_file = ext in [ - '.c', '.cc', '.cpp', '.cxx', '.m', '.mm', '.s', '.S'] - if not is_compiled_file: - continue - basename = os.path.basename(name) # Don't include extension. - basenames.setdefault(basename, []).append(source) - - error = '' - for basename, files in basenames.iteritems(): - if len(files) > 1: - error += ' %s: %s\n' % (basename, ' '.join(files)) - - if error: - print('static library %s has several files with the same basename:\n' % - target + error + 'Some build systems, e.g. MSVC08, ' - 'cannot handle that.') - raise GypError('Duplicate basenames in sources section, see list above') - - def ValidateRulesInTarget(target, target_dict, extra_sources_for_rules): """Ensures that the rules sections in target_dict are valid and consistent, and determines which sources they apply to. @@ -2506,7 +2551,7 @@ def ValidateRunAsInTarget(target, target_dict, build_file): run_as = target_dict.get('run_as') if not run_as: return - if not isinstance(run_as, dict): + if type(run_as) is not dict: raise GypError("The 'run_as' in target %s from file %s should be a " "dictionary." % (target_name, build_file)) @@ -2515,17 +2560,17 @@ def ValidateRunAsInTarget(target, target_dict, build_file): raise GypError("The 'run_as' in target %s from file %s must have an " "'action' section." % (target_name, build_file)) - if not isinstance(action, list): + if type(action) is not list: raise GypError("The 'action' for 'run_as' in target %s from file %s " "must be a list." % (target_name, build_file)) working_directory = run_as.get('working_directory') - if working_directory and not isinstance(working_directory, str): + if working_directory and type(working_directory) is not str: raise GypError("The 'working_directory' for 'run_as' in target %s " "in file %s should be a string." % (target_name, build_file)) environment = run_as.get('environment') - if environment and not isinstance(environment, dict): + if environment and type(environment) is not dict: raise GypError("The 'environment' for 'run_as' in target %s " "in file %s should be a dictionary." % (target_name, build_file)) @@ -2555,17 +2600,17 @@ def TurnIntIntoStrInDict(the_dict): # Use items instead of iteritems because there's no need to try to look at # reinserted keys and their associated values. for k, v in the_dict.items(): - if isinstance(v, int): + if type(v) is int: v = str(v) the_dict[k] = v - elif isinstance(v, dict): + elif type(v) is dict: TurnIntIntoStrInDict(v) - elif isinstance(v, list): + elif type(v) is list: TurnIntIntoStrInList(v) - if isinstance(k, int): - the_dict[str(k)] = v + if type(k) is int: del the_dict[k] + the_dict[str(k)] = v def TurnIntIntoStrInList(the_list): @@ -2573,11 +2618,11 @@ def TurnIntIntoStrInList(the_list): """ for index in xrange(0, len(the_list)): item = the_list[index] - if isinstance(item, int): + if type(item) is int: the_list[index] = str(item) - elif isinstance(item, dict): + elif type(item) is dict: TurnIntIntoStrInDict(item) - elif isinstance(item, list): + elif type(item) is list: TurnIntIntoStrInList(item) @@ -2647,8 +2692,8 @@ def SetGeneratorGlobals(generator_input_info): # Set up path_sections and non_configuration_keys with the default data plus # the generator-specific data. global path_sections - path_sections = base_path_sections[:] - path_sections.extend(generator_input_info['path_sections']) + path_sections = set(base_path_sections) + path_sections.update(generator_input_info['path_sections']) global non_configuration_keys non_configuration_keys = base_non_configuration_keys[:] @@ -2677,15 +2722,14 @@ def Load(build_files, variables, includes, depth, generator_input_info, check, # well as meta-data (e.g. 'included_files' key). 'target_build_files' keeps # track of the keys corresponding to "target" files. data = {'target_build_files': set()} - aux_data = {} # Normalize paths everywhere. This is important because paths will be # used as keys to the data dict and for references between input files. build_files = set(map(os.path.normpath, build_files)) if parallel: - LoadTargetBuildFilesParallel(build_files, data, aux_data, - variables, includes, depth, check, - generator_input_info) + LoadTargetBuildFilesParallel(build_files, data, variables, includes, depth, + check, generator_input_info) else: + aux_data = {} for build_file in build_files: try: LoadTargetBuildFile(build_file, data, aux_data, @@ -2707,6 +2751,10 @@ def Load(build_files, variables, includes, depth, generator_input_info, check, # Expand dependencies specified as build_file:*. ExpandWildcardDependencies(targets, data) + # Remove all dependencies marked as 'link_dependency' from the targets of + # type 'none'. + RemoveLinkDependenciesFromNoneTargets(targets) + # Apply exclude (!) and regex (/) list filters only for dependency_sections. for target_name, target_dict in targets.iteritems(): tmp_dict = {} @@ -2792,10 +2840,6 @@ def Load(build_files, variables, includes, depth, generator_input_info, check, target_dict = targets[target] build_file = gyp.common.BuildFile(target) ValidateTargetType(target, target_dict) - # TODO(thakis): Get vpx_scale/arm/scalesystemdependent.c to be renamed to - # scalesystemdependent_arm_additions.c or similar. - if 'arm' not in variables.get('target_arch', ''): - ValidateSourcesInTarget(target, target_dict, build_file) ValidateRulesInTarget(target, target_dict, extra_sources_for_rules) ValidateRunAsInTarget(target, target_dict, build_file) ValidateActionsInTarget(target, target_dict, build_file) diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input_test.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input_test.py index cdbf6b2fad6..4234fbb8302 100755 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input_test.py @@ -44,16 +44,16 @@ def test_no_cycle_dag(self): def test_cycle_self_reference(self): self._create_dependency(self.nodes['a'], self.nodes['a']) - self.assertEquals([(self.nodes['a'], self.nodes['a'])], + self.assertEquals([[self.nodes['a'], self.nodes['a']]], self.nodes['a'].FindCycles()) def test_cycle_two_nodes(self): self._create_dependency(self.nodes['a'], self.nodes['b']) self._create_dependency(self.nodes['b'], self.nodes['a']) - self.assertEquals([(self.nodes['a'], self.nodes['b'], self.nodes['a'])], + self.assertEquals([[self.nodes['a'], self.nodes['b'], self.nodes['a']]], self.nodes['a'].FindCycles()) - self.assertEquals([(self.nodes['b'], self.nodes['a'], self.nodes['b'])], + self.assertEquals([[self.nodes['b'], self.nodes['a'], self.nodes['b']]], self.nodes['b'].FindCycles()) def test_two_cycles(self): @@ -65,9 +65,9 @@ def test_two_cycles(self): cycles = self.nodes['a'].FindCycles() self.assertTrue( - (self.nodes['a'], self.nodes['b'], self.nodes['a']) in cycles) + [self.nodes['a'], self.nodes['b'], self.nodes['a']] in cycles) self.assertTrue( - (self.nodes['b'], self.nodes['c'], self.nodes['b']) in cycles) + [self.nodes['b'], self.nodes['c'], self.nodes['b']] in cycles) self.assertEquals(2, len(cycles)) def test_big_cycle(self): @@ -77,12 +77,12 @@ def test_big_cycle(self): self._create_dependency(self.nodes['d'], self.nodes['e']) self._create_dependency(self.nodes['e'], self.nodes['a']) - self.assertEquals([(self.nodes['a'], + self.assertEquals([[self.nodes['a'], self.nodes['b'], self.nodes['c'], self.nodes['d'], self.nodes['e'], - self.nodes['a'])], + self.nodes['a']]], self.nodes['a'].FindCycles()) diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py index ac19b6dc81f..366439a062d 100755 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py @@ -45,7 +45,7 @@ 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): + def ExecCopyBundleResource(self, source, dest, convert_to_binary): """Copies a resource file to the bundle/Resources directory, performing any necessary compilation on each resource.""" extension = os.path.splitext(source)[1].lower() @@ -62,7 +62,7 @@ def ExecCopyBundleResource(self, source, dest): elif extension == '.storyboard': return self._CopyXIBFile(source, dest) elif extension == '.strings': - self._CopyStringsFile(source, dest) + self._CopyStringsFile(source, dest, convert_to_binary) else: shutil.copy(source, dest) @@ -92,7 +92,11 @@ def _CopyXIBFile(self, source, dest): sys.stdout.write(line) return ibtoolout.returncode - def _CopyStringsFile(self, source, dest): + def _ConvertToBinary(self, dest): + subprocess.check_call([ + 'xcrun', 'plutil', '-convert', 'binary1', '-o', dest, dest]) + + def _CopyStringsFile(self, source, dest, convert_to_binary): """Copies a .strings file using iconv to reconvert the input into UTF-16.""" input_code = self._DetectInputEncoding(source) or "UTF-8" @@ -112,6 +116,9 @@ def _CopyStringsFile(self, source, dest): fp.write(s.decode(input_code).encode('UTF-16')) fp.close() + if convert_to_binary == 'True': + self._ConvertToBinary(dest) + 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.""" @@ -131,7 +138,7 @@ def _DetectInputEncoding(self, file_name): else: return None - def ExecCopyInfoPlist(self, source, dest, *keys): + def ExecCopyInfoPlist(self, source, dest, convert_to_binary, *keys): """Copies the |source| Info.plist to the destination directory |dest|.""" # Read the source Info.plist into memory. fd = open(source, 'r') @@ -146,7 +153,7 @@ def ExecCopyInfoPlist(self, source, dest, *keys): # Go through all the environment variables and replace them as variables in # the file. - IDENT_RE = re.compile('[/\s]') + IDENT_RE = re.compile(r'[/\s]') for key in os.environ: if key.startswith('_'): continue @@ -185,6 +192,9 @@ def ExecCopyInfoPlist(self, source, dest, *keys): # "compiled". self._WritePkgInfo(dest) + if convert_to_binary == 'True': + self._ConvertToBinary(dest) + def _WritePkgInfo(self, info_plist): """This writes the PkgInfo file from the data stored in Info.plist.""" plist = plistlib.readPlist(info_plist) @@ -219,11 +229,28 @@ 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) + libtool_re5 = re.compile( + r'^.*libtool: warning for library: ' + + r'.* the table of contents is empty ' + + r'\(no object file members in the library define global symbols\)$') + env = os.environ.copy() + # Ref: + # http://www.opensource.apple.com/source/cctools/cctools-809/misc/libtool.c + # The problem with this flag is that it resets the file mtime on the file to + # epoch=0, e.g. 1970-1-1 or 1969-12-31 depending on timezone. + env['ZERO_AR_DATE'] = '1' + libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE, env=env) _, err = libtoolout.communicate() for line in err.splitlines(): - if not libtool_re.match(line): + if not libtool_re.match(line) and not libtool_re5.match(line): print >>sys.stderr, line + # Unconditionally touch the output .a file on the command line if present + # and the command succeeded. A bit hacky. + if not libtoolout.returncode: + for i in range(len(cmd_list) - 1): + if cmd_list[i] == "-o" and cmd_list[i+1].endswith('.a'): + os.utime(cmd_list[i+1], None) + break return libtoolout.returncode def ExecPackageFramework(self, framework, version): @@ -262,6 +289,66 @@ def _Relink(self, dest, link): os.remove(link) os.symlink(dest, link) + def ExecCompileXcassets(self, keys, *inputs): + """Compiles multiple .xcassets files into a single .car file. + + This invokes 'actool' to compile all the inputs .xcassets files. The + |keys| arguments is a json-encoded dictionary of extra arguments to + pass to 'actool' when the asset catalogs contains an application icon + or a launch image. + + Note that 'actool' does not create the Assets.car file if the asset + catalogs does not contains imageset. + """ + command_line = [ + 'xcrun', 'actool', '--output-format', 'human-readable-text', + '--compress-pngs', '--notices', '--warnings', '--errors', + ] + is_iphone_target = 'IPHONEOS_DEPLOYMENT_TARGET' in os.environ + if is_iphone_target: + platform = os.environ['CONFIGURATION'].split('-')[-1] + if platform not in ('iphoneos', 'iphonesimulator'): + platform = 'iphonesimulator' + command_line.extend([ + '--platform', platform, '--target-device', 'iphone', + '--target-device', 'ipad', '--minimum-deployment-target', + os.environ['IPHONEOS_DEPLOYMENT_TARGET'], '--compile', + os.path.abspath(os.environ['CONTENTS_FOLDER_PATH']), + ]) + else: + command_line.extend([ + '--platform', 'macosx', '--target-device', 'mac', + '--minimum-deployment-target', os.environ['MACOSX_DEPLOYMENT_TARGET'], + '--compile', + os.path.abspath(os.environ['UNLOCALIZED_RESOURCES_FOLDER_PATH']), + ]) + if keys: + keys = json.loads(keys) + for key, value in keys.iteritems(): + arg_name = '--' + key + if isinstance(value, bool): + if value: + command_line.append(arg_name) + elif isinstance(value, list): + for v in value: + command_line.append(arg_name) + command_line.append(str(v)) + else: + command_line.append(arg_name) + command_line.append(str(value)) + # Note: actool crashes if inputs path are relative, so use os.path.abspath + # to get absolute path name for inputs. + command_line.extend(map(os.path.abspath, inputs)) + subprocess.check_call(command_line) + + def ExecMergeInfoPlist(self, output, *inputs): + """Merge multiple .plist files into a single .plist file.""" + merged_plist = {} + for path in inputs: + plist = self._LoadPlistMaybeBinary(path) + self._MergePlist(merged_plist, plist) + plistlib.writePlist(merged_plist, output) + def ExecCodeSignBundle(self, key, resource_rules, entitlements, provisioning): """Code sign a bundle. @@ -398,6 +485,19 @@ def _LoadProvisioningProfile(self, profile_path): 'security', 'cms', '-D', '-i', profile_path, '-o', temp.name]) return self._LoadPlistMaybeBinary(temp.name) + def _MergePlist(self, merged_plist, plist): + """Merge |plist| into |merged_plist|.""" + for key, value in plist.iteritems(): + if isinstance(value, dict): + merged_value = merged_plist.get(key, {}) + if isinstance(merged_value, dict): + self._MergePlist(merged_value, value) + merged_plist[key] = merged_value + else: + merged_plist[key] = value + else: + merged_plist[key] = value + def _LoadPlistMaybeBinary(self, plist_path): """Loads into a memory a plist possibly encoded in binary format. diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py index 6428fced005..ce5c46ea5b3 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py @@ -12,10 +12,14 @@ import subprocess import sys +from gyp.common import OrderedSet +import gyp.MSVSUtil import gyp.MSVSVersion + windows_quoter_regex = re.compile(r'(\\*)"') + def QuoteForRspFile(arg): """Quote a command line argument so that it appears as one argument when processed via cmd.exe and parsed by CommandLineToArgvW (as is typical for @@ -131,6 +135,54 @@ def _FindDirectXInstallation(): return dxsdk_dir +def GetGlobalVSMacroEnv(vs_version): + """Get a dict of variables mapping internal VS macro names to their gyp + equivalents. Returns all variables that are independent of the target.""" + env = {} + # '$(VSInstallDir)' and '$(VCInstallDir)' are available when and only when + # Visual Studio is actually installed. + if vs_version.Path(): + env['$(VSInstallDir)'] = vs_version.Path() + env['$(VCInstallDir)'] = os.path.join(vs_version.Path(), 'VC') + '\\' + # Chromium uses DXSDK_DIR in include/lib paths, but it may or may not be + # set. This happens when the SDK is sync'd via src-internal, rather than + # by typical end-user installation of the SDK. If it's not set, we don't + # want to leave the unexpanded variable in the path, so simply strip it. + dxsdk_dir = _FindDirectXInstallation() + env['$(DXSDK_DIR)'] = dxsdk_dir if dxsdk_dir else '' + # Try to find an installation location for the Windows DDK by checking + # the WDK_DIR environment variable, may be None. + env['$(WDK_DIR)'] = os.environ.get('WDK_DIR', '') + return env + +def ExtractSharedMSVSSystemIncludes(configs, generator_flags): + """Finds msvs_system_include_dirs that are common to all targets, removes + them from all targets, and returns an OrderedSet containing them.""" + all_system_includes = OrderedSet( + configs[0].get('msvs_system_include_dirs', [])) + for config in configs[1:]: + system_includes = config.get('msvs_system_include_dirs', []) + all_system_includes = all_system_includes & OrderedSet(system_includes) + if not all_system_includes: + return None + # Expand macros in all_system_includes. + env = GetGlobalVSMacroEnv(GetVSVersion(generator_flags)) + expanded_system_includes = OrderedSet([ExpandMacros(include, env) + for include in all_system_includes]) + if any(['$' in include for include in expanded_system_includes]): + # Some path relies on target-specific variables, bail. + return None + + # Remove system includes shared by all targets from the targets. + for config in configs: + includes = config.get('msvs_system_include_dirs', []) + if includes: # Don't insert a msvs_system_include_dirs key if not needed. + # This must check the unexpanded includes list: + new_includes = [i for i in includes if i not in all_system_includes] + config['msvs_system_include_dirs'] = new_includes + return expanded_system_includes + + class MsvsSettings(object): """A class that understands the gyp 'msvs_...' values (especially the msvs_settings field). They largely correpond to the VS2008 IDE DOM. This @@ -139,11 +191,6 @@ class helps map those settings to command line options.""" def __init__(self, spec, generator_flags): self.spec = spec self.vs_version = GetVSVersion(generator_flags) - self.dxsdk_dir = _FindDirectXInstallation() - - # Try to find an installation location for the Windows DDK by checking - # the WDK_DIR environment variable, may be None. - self.wdk_dir = os.environ.get('WDK_DIR') supported_fields = [ ('msvs_configuration_attributes', dict), @@ -163,6 +210,30 @@ def __init__(self, spec, generator_flags): self.msvs_cygwin_dirs = spec.get('msvs_cygwin_dirs', ['.']) + unsupported_fields = [ + 'msvs_prebuild', + 'msvs_postbuild', + ] + unsupported = [] + for field in unsupported_fields: + for config in configs.values(): + if field in config: + unsupported += ["%s not supported (target %s)." % + (field, spec['target_name'])] + if unsupported: + raise Exception('\n'.join(unsupported)) + + def GetExtension(self): + """Returns the extension for the target, with no leading dot. + + Uses 'product_extension' if specified, otherwise uses MSVS defaults based on + the target type. + """ + ext = self.spec.get('product_extension', None) + if ext: + return ext + return gyp.MSVSUtil.TARGET_TYPE_EXT.get(self.spec['type'], '') + def GetVSMacroEnv(self, base_to_build=None, config=None): """Get a dict of variables mapping internal VS macro names to their gyp equivalents.""" @@ -170,29 +241,24 @@ def GetVSMacroEnv(self, base_to_build=None, config=None): target_name = self.spec.get('product_prefix', '') + \ self.spec.get('product_name', self.spec['target_name']) target_dir = base_to_build + '\\' if base_to_build else '' + target_ext = '.' + self.GetExtension() + target_file_name = target_name + target_ext + replacements = { - '$(OutDir)\\': target_dir, - '$(TargetDir)\\': target_dir, - '$(IntDir)': '$!INTERMEDIATE_DIR', - '$(InputPath)': '${source}', '$(InputName)': '${root}', - '$(ProjectName)': self.spec['target_name'], - '$(TargetName)': target_name, + '$(InputPath)': '${source}', + '$(IntDir)': '$!INTERMEDIATE_DIR', + '$(OutDir)\\': target_dir, '$(PlatformName)': target_platform, '$(ProjectDir)\\': '', + '$(ProjectName)': self.spec['target_name'], + '$(TargetDir)\\': target_dir, + '$(TargetExt)': target_ext, + '$(TargetFileName)': target_file_name, + '$(TargetName)': target_name, + '$(TargetPath)': os.path.join(target_dir, target_file_name), } - # '$(VSInstallDir)' and '$(VCInstallDir)' are available when and only when - # Visual Studio is actually installed. - if self.vs_version.Path(): - replacements['$(VSInstallDir)'] = self.vs_version.Path() - replacements['$(VCInstallDir)'] = os.path.join(self.vs_version.Path(), - 'VC') + '\\' - # Chromium uses DXSDK_DIR in include/lib paths, but it may or may not be - # set. This happens when the SDK is sync'd via src-internal, rather than - # by typical end-user installation of the SDK. If it's not set, we don't - # want to leave the unexpanded variable in the path, so simply strip it. - replacements['$(DXSDK_DIR)'] = self.dxsdk_dir if self.dxsdk_dir else '' - replacements['$(WDK_DIR)'] = self.wdk_dir if self.wdk_dir else '' + replacements.update(GetGlobalVSMacroEnv(self.vs_version)) return replacements def ConvertVSMacros(self, s, base_to_build=None, config=None): @@ -272,6 +338,15 @@ def AdjustIncludeDirs(self, include_dirs, config): ('VCCLCompilerTool', 'AdditionalIncludeDirectories'), config, default=[])) return [self.ConvertVSMacros(p, config=config) for p in includes] + def AdjustMidlIncludeDirs(self, midl_include_dirs, config): + """Updates midl_include_dirs to expand VS specific paths, and adds the + system include dirs used for platform SDK and similar.""" + config = self._TargetConfig(config) + includes = midl_include_dirs + self.msvs_system_include_dirs[config] + includes.extend(self._Setting( + ('VCMIDLTool', 'AdditionalIncludeDirectories'), config, default=[])) + return [self.ConvertVSMacros(p, config=config) for p in includes] + def GetComputedDefines(self, config): """Returns the set of defines that are injected to the defines list based on other VS settings.""" @@ -324,7 +399,7 @@ def GetPDBName(self, config, expand_special, default): output_file = self._Setting(('VCLinkerTool', 'ProgramDatabaseFile'), config) generate_debug_info = self._Setting( ('VCLinkerTool', 'GenerateDebugInformation'), config) - if generate_debug_info: + if generate_debug_info == 'true': if output_file: return expand_special(self.ConvertVSMacros(output_file, config=config)) else: @@ -332,6 +407,22 @@ def GetPDBName(self, config, expand_special, default): else: return None + def GetNoImportLibrary(self, config): + """If NoImportLibrary: true, ninja will not expect the output to include + an import library.""" + config = self._TargetConfig(config) + noimplib = self._Setting(('NoImportLibrary',), config) + return noimplib == 'true' + + def GetAsmflags(self, config): + """Returns the flags that need to be added to ml invocations.""" + config = self._TargetConfig(config) + asmflags = [] + safeseh = self._Setting(('MASM', 'UseSafeExceptionHandlers'), config) + if safeseh == 'true': + asmflags.append('/safeseh') + return asmflags + def GetCflags(self, config): """Returns the flags that need to be added to .c and .cc compilations.""" config = self._TargetConfig(config) @@ -348,9 +439,14 @@ def GetCflags(self, config): cl('OmitFramePointers', map={'false': '-', 'true': ''}, prefix='/Oy') cl('EnableIntrinsicFunctions', map={'false': '-', 'true': ''}, prefix='/Oi') cl('FavorSizeOrSpeed', map={'1': 't', '2': 's'}, prefix='/O') + cl('FloatingPointModel', + map={'0': 'precise', '1': 'strict', '2': 'fast'}, prefix='/fp:', + default='0') cl('WholeProgramOptimization', map={'true': '/GL'}) cl('WarningLevel', prefix='/W') cl('WarnAsError', map={'true': '/WX'}) + cl('CallingConvention', + map={'0': 'd', '1': 'r', '2': 'z', '3': 'v'}, prefix='/G') cl('DebugInformationFormat', map={'1': '7', '3': 'i', '4': 'I'}, prefix='/Z') cl('RuntimeTypeInfo', map={'true': '/GR', 'false': '/GR-'}) @@ -366,21 +462,18 @@ def GetCflags(self, config): map={'false': '-', 'true': ''}, prefix='/Zc:wchar_t') cl('EnablePREfast', map={'true': '/analyze'}) cl('AdditionalOptions', prefix='') + cl('EnableEnhancedInstructionSet', + map={'1': 'SSE', '2': 'SSE2', '3': 'AVX', '4': 'IA32', '5': 'AVX2'}, + prefix='/arch:') cflags.extend(['/FI' + f for f in self._Setting( ('VCCLCompilerTool', 'ForcedIncludeFiles'), config, default=[])]) - if self.vs_version.short_name in ('2013', '2013e'): + if self.vs_version.short_name in ('2013', '2013e', '2015'): # New flag required in 2013 to maintain previous PDB behavior. cflags.append('/FS') # ninja handles parallelism by itself, don't have the compiler do it too. cflags = filter(lambda x: not x.startswith('/MP'), cflags) return cflags - def GetPrecompiledHeader(self, config, gyp_to_build_path): - """Returns an object that handles the generation of precompiled header - build steps.""" - config = self._TargetConfig(config) - return _PchHelper(self, config, gyp_to_build_path) - def _GetPchFlags(self, config, extension): """Get the flags to be added to the cflags for precompiled header support. """ @@ -425,7 +518,8 @@ def GetLibFlags(self, config, gyp_to_build_path): libflags.extend(self._GetAdditionalLibraryDirectories( 'VCLibrarianTool', config, gyp_to_build_path)) lib('LinkTimeCodeGeneration', map={'true': '/LTCG'}) - lib('TargetMachine', map={'1': 'X86', '17': 'X64'}, prefix='/MACHINE:') + lib('TargetMachine', map={'1': 'X86', '17': 'X64', '3': 'ARM'}, + prefix='/MACHINE:') lib('AdditionalOptions') return libflags @@ -468,7 +562,8 @@ def GetLdflags(self, config, gyp_to_build_path, expand_special, 'VCLinkerTool', append=ldflags) self._GetDefFileAsLdflags(ldflags, gyp_to_build_path) ld('GenerateDebugInformation', map={'true': '/DEBUG'}) - ld('TargetMachine', map={'1': 'X86', '17': 'X64'}, prefix='/MACHINE:') + ld('TargetMachine', map={'1': 'X86', '17': 'X64', '3': 'ARM'}, + prefix='/MACHINE:') ldflags.extend(self._GetAdditionalLibraryDirectories( 'VCLinkerTool', config, gyp_to_build_path)) ld('DelayLoadDLLs', prefix='/DELAYLOAD:') @@ -522,6 +617,14 @@ def GetLdflags(self, config, gyp_to_build_path, expand_special, # TODO(scottmg): This should sort of be somewhere else (not really a flag). ld('AdditionalDependencies', prefix='') + if self.GetArch(config) == 'x86': + safeseh_default = 'true' + else: + safeseh_default = None + ld('ImageHasSafeExceptionHandlers', + map={'false': ':NO', 'true': ''}, prefix='/SAFESEH', + default=safeseh_default) + # If the base address is not specifically controlled, DYNAMICBASE should # be on by default. base_flags = filter(lambda x: 'DYNAMICBASE' in x or x == '/FIXED', @@ -708,10 +811,16 @@ def _HasExplicitRuleForExtension(self, spec, extension): return True return False - def HasExplicitIdlRules(self, spec): - """Determine if there's an explicit rule for idl files. When there isn't we - need to generate implicit rules to build MIDL .idl files.""" - return self._HasExplicitRuleForExtension(spec, 'idl') + def _HasExplicitIdlActions(self, spec): + """Determine if an action should not run midl for .idl files.""" + return any([action.get('explicit_idl_action', 0) + for action in spec.get('actions', [])]) + + def HasExplicitIdlRulesOrActions(self, spec): + """Determine if there's an explicit rule or action for idl files. When + there isn't we need to generate implicit rules to build MIDL .idl files.""" + return (self._HasExplicitRuleForExtension(spec, 'idl') or + self._HasExplicitIdlActions(spec)) def HasExplicitAsmRules(self, spec): """Determine if there's an explicit rule for asm files. When there isn't we @@ -774,7 +883,7 @@ def _PchHeader(self): def GetObjDependencies(self, sources, objs, arch): """Given a list of sources files and the corresponding object files, returns a list of the pch files that should be depended upon. The - additional wrapping in the return value is for interface compatability + additional wrapping in the return value is for interface compatibility with make.py on Mac, and xcode_emulation.py.""" assert arch is None if not self._PchHeader(): @@ -810,7 +919,8 @@ def GetVSVersion(generator_flags): global vs_version if not vs_version: vs_version = gyp.MSVSVersion.SelectVisualStudioVersion( - generator_flags.get('msvs_version', 'auto')) + generator_flags.get('msvs_version', 'auto'), + allow_fallback=False) return vs_version def _GetVsvarsSetupArgs(generator_flags, arch): @@ -878,7 +988,8 @@ def _ExtractCLPath(output_of_where): if line.startswith('LOC:'): return line[len('LOC:'):].strip() -def GenerateEnvironmentFiles(toplevel_build_dir, generator_flags, open_out): +def GenerateEnvironmentFiles(toplevel_build_dir, generator_flags, + system_includes, open_out): """It's not sufficient to have the absolute path to the compiler, linker, etc. on Windows, as those tools rely on .dlls being in the PATH. We also need to support both x86 and x64 compilers within the same build (to support @@ -909,6 +1020,13 @@ def GenerateEnvironmentFiles(toplevel_build_dir, generator_flags, open_out): args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) variables, _ = popen.communicate() env = _ExtractImportantEnvironment(variables) + + # Inject system includes from gyp files into INCLUDE. + if system_includes: + system_includes = system_includes | OrderedSet( + env.get('INCLUDE', '').split(';')) + env['INCLUDE'] = ';'.join(system_includes) + env_block = _FormatAsEnvironmentBlock(env) f = open_out(os.path.join(toplevel_build_dir, 'environment.' + arch), 'wb') f.write(env_block) diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py new file mode 100644 index 00000000000..74c98c5a795 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py @@ -0,0 +1,46 @@ +# Copyright 2014 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. + +"""A clone of the default copy.deepcopy that doesn't handle cyclic +structures or complex types except for dicts and lists. This is +because gyp copies so large structure that small copy overhead ends up +taking seconds in a project the size of Chromium.""" + +class Error(Exception): + pass + +__all__ = ["Error", "deepcopy"] + +def deepcopy(x): + """Deep copy operation on gyp objects such as strings, ints, dicts + and lists. More than twice as fast as copy.deepcopy but much less + generic.""" + + try: + return _deepcopy_dispatch[type(x)](x) + except KeyError: + raise Error('Unsupported type %s for deepcopy. Use copy.deepcopy ' + + 'or expand simple_copy support.' % type(x)) + +_deepcopy_dispatch = d = {} + +def _deepcopy_atomic(x): + return x + +for x in (type(None), int, long, float, + bool, str, unicode, type): + d[x] = _deepcopy_atomic + +def _deepcopy_list(x): + return [deepcopy(a) for a in x] +d[list] = _deepcopy_list + +def _deepcopy_dict(x): + y = {} + for key, value in x.iteritems(): + y[deepcopy(key)] = deepcopy(value) + return y +d[dict] = _deepcopy_dict + +del d diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py index e9d7df0bb77..417e465f785 100755 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py @@ -13,6 +13,7 @@ import re import shutil import subprocess +import stat import string import sys @@ -48,7 +49,8 @@ def _UseSeparateMspdbsrv(self, env, args): for arg in args: m = _LINK_EXE_OUT_ARG.match(arg) if m: - endpoint_name = '%s_%d' % (m.group('out'), os.getpid()) + endpoint_name = re.sub(r'\W+', '', + '%s_%d' % (m.group('out'), os.getpid())) break if endpoint_name is None: @@ -88,9 +90,19 @@ def ExecRecursiveMirror(self, source, dest): """Emulation of rm -rf out && cp -af in out.""" if os.path.exists(dest): if os.path.isdir(dest): - shutil.rmtree(dest) + def _on_error(fn, path, excinfo): + # The operation failed, possibly because the file is set to + # read-only. If that's why, make it writable and try the op again. + if not os.access(path, os.W_OK): + os.chmod(path, stat.S_IWRITE) + fn(path) + shutil.rmtree(dest, onerror=_on_error) else: + if not os.access(dest, os.W_OK): + # Attempt to make the file writable before deleting it. + os.chmod(dest, stat.S_IWRITE) os.unlink(dest) + if os.path.isdir(source): shutil.copytree(source, dest) else: @@ -104,7 +116,7 @@ def ExecLinkWrapper(self, arch, use_separate_mspdbsrv, *args): env = self._GetEnv(arch) if use_separate_mspdbsrv == 'True': self._UseSeparateMspdbsrv(env, args) - link = subprocess.Popen(args, + link = subprocess.Popen([args[0].replace('/', '\\')] + list(args[1:]), shell=True, env=env, stdout=subprocess.PIPE, @@ -236,19 +248,17 @@ def ExecMidlWrapper(self, arch, outdir, tlb, h, dlldata, iid, proxy, idl, # Processing C:\Program Files (x86)\Microsoft SDKs\...\include\objidl.idl # objidl.idl lines = out.splitlines() - prefix = 'Processing ' - processing = set(os.path.basename(x) for x in lines if x.startswith(prefix)) + prefixes = ('Processing ', '64 bit Processing ') + processing = set(os.path.basename(x) + for x in lines if x.startswith(prefixes)) for line in lines: - if not line.startswith(prefix) and line not in processing: + if not line.startswith(prefixes) and line not in processing: print line return popen.returncode def ExecAsmWrapper(self, arch, *args): """Filter logo banner from invocations of asm.exe.""" env = self._GetEnv(arch) - # MSVS doesn't assemble x64 asm files. - if arch == 'environment.x64': - return 0 popen = subprocess.Popen(args, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) out, _ = popen.communicate() @@ -287,5 +297,16 @@ def ExecActionWrapper(self, arch, rspfile, *dir): dir = dir[0] if dir else None return subprocess.call(args, shell=True, env=env, cwd=dir) + def ExecClCompile(self, project_dir, selected_files): + """Executed by msvs-ninja projects when the 'ClCompile' target is used to + build selected C/C++ files.""" + project_dir = os.path.relpath(project_dir, BASE_DIR) + selected_files = selected_files.split(';') + ninja_targets = [os.path.join(project_dir, filename) + '^^' + for filename in selected_files] + cmd = ['ninja.exe'] + cmd.extend(ninja_targets) + return subprocess.call(cmd, shell=True, cwd=BASE_DIR) + if __name__ == '__main__': sys.exit(main(sys.argv[1:])) diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py index 30f27d5832d..f1a839a2f59 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py @@ -18,6 +18,129 @@ import tempfile from gyp.common import GypError +# Populated lazily by XcodeVersion, for efficiency, and to fix an issue when +# "xcodebuild" is called too quickly (it has been found to return incorrect +# version number). +XCODE_VERSION_CACHE = None + +# Populated lazily by GetXcodeArchsDefault, to an |XcodeArchsDefault| instance +# corresponding to the installed version of Xcode. +XCODE_ARCHS_DEFAULT_CACHE = None + + +def XcodeArchsVariableMapping(archs, archs_including_64_bit=None): + """Constructs a dictionary with expansion for $(ARCHS_STANDARD) variable, + and optionally for $(ARCHS_STANDARD_INCLUDING_64_BIT).""" + mapping = {'$(ARCHS_STANDARD)': archs} + if archs_including_64_bit: + mapping['$(ARCHS_STANDARD_INCLUDING_64_BIT)'] = archs_including_64_bit + return mapping + +class XcodeArchsDefault(object): + """A class to resolve ARCHS variable from xcode_settings, resolving Xcode + macros and implementing filtering by VALID_ARCHS. The expansion of macros + depends on the SDKROOT used ("macosx", "iphoneos", "iphonesimulator") and + on the version of Xcode. + """ + + # Match variable like $(ARCHS_STANDARD). + variable_pattern = re.compile(r'\$\([a-zA-Z_][a-zA-Z0-9_]*\)$') + + def __init__(self, default, mac, iphonesimulator, iphoneos): + self._default = (default,) + self._archs = {'mac': mac, 'ios': iphoneos, 'iossim': iphonesimulator} + + def _VariableMapping(self, sdkroot): + """Returns the dictionary of variable mapping depending on the SDKROOT.""" + sdkroot = sdkroot.lower() + if 'iphoneos' in sdkroot: + return self._archs['ios'] + elif 'iphonesimulator' in sdkroot: + return self._archs['iossim'] + else: + return self._archs['mac'] + + def _ExpandArchs(self, archs, sdkroot): + """Expands variables references in ARCHS, and remove duplicates.""" + variable_mapping = self._VariableMapping(sdkroot) + expanded_archs = [] + for arch in archs: + if self.variable_pattern.match(arch): + variable = arch + try: + variable_expansion = variable_mapping[variable] + for arch in variable_expansion: + if arch not in expanded_archs: + expanded_archs.append(arch) + except KeyError as e: + print 'Warning: Ignoring unsupported variable "%s".' % variable + elif arch not in expanded_archs: + expanded_archs.append(arch) + return expanded_archs + + def ActiveArchs(self, archs, valid_archs, sdkroot): + """Expands variables references in ARCHS, and filter by VALID_ARCHS if it + is defined (if not set, Xcode accept any value in ARCHS, otherwise, only + values present in VALID_ARCHS are kept).""" + expanded_archs = self._ExpandArchs(archs or self._default, sdkroot or '') + if valid_archs: + filtered_archs = [] + for arch in expanded_archs: + if arch in valid_archs: + filtered_archs.append(arch) + expanded_archs = filtered_archs + return expanded_archs + + +def GetXcodeArchsDefault(): + """Returns the |XcodeArchsDefault| object to use to expand ARCHS for the + installed version of Xcode. The default values used by Xcode for ARCHS + and the expansion of the variables depends on the version of Xcode used. + + For all version anterior to Xcode 5.0 or posterior to Xcode 5.1 included + uses $(ARCHS_STANDARD) if ARCHS is unset, while Xcode 5.0 to 5.0.2 uses + $(ARCHS_STANDARD_INCLUDING_64_BIT). This variable was added to Xcode 5.0 + and deprecated with Xcode 5.1. + + For "macosx" SDKROOT, all version starting with Xcode 5.0 includes 64-bit + architecture as part of $(ARCHS_STANDARD) and default to only building it. + + For "iphoneos" and "iphonesimulator" SDKROOT, 64-bit architectures are part + of $(ARCHS_STANDARD_INCLUDING_64_BIT) from Xcode 5.0. From Xcode 5.1, they + are also part of $(ARCHS_STANDARD). + + All thoses rules are coded in the construction of the |XcodeArchsDefault| + object to use depending on the version of Xcode detected. The object is + for performance reason.""" + global XCODE_ARCHS_DEFAULT_CACHE + if XCODE_ARCHS_DEFAULT_CACHE: + return XCODE_ARCHS_DEFAULT_CACHE + xcode_version, _ = XcodeVersion() + if xcode_version < '0500': + XCODE_ARCHS_DEFAULT_CACHE = XcodeArchsDefault( + '$(ARCHS_STANDARD)', + XcodeArchsVariableMapping(['i386']), + XcodeArchsVariableMapping(['i386']), + XcodeArchsVariableMapping(['armv7'])) + elif xcode_version < '0510': + XCODE_ARCHS_DEFAULT_CACHE = XcodeArchsDefault( + '$(ARCHS_STANDARD_INCLUDING_64_BIT)', + XcodeArchsVariableMapping(['x86_64'], ['x86_64']), + XcodeArchsVariableMapping(['i386'], ['i386', 'x86_64']), + XcodeArchsVariableMapping( + ['armv7', 'armv7s'], + ['armv7', 'armv7s', 'arm64'])) + else: + XCODE_ARCHS_DEFAULT_CACHE = XcodeArchsDefault( + '$(ARCHS_STANDARD)', + XcodeArchsVariableMapping(['x86_64'], ['x86_64']), + XcodeArchsVariableMapping(['i386', 'x86_64'], ['i386', 'x86_64']), + XcodeArchsVariableMapping( + ['armv7', 'armv7s', 'arm64'], + ['armv7', 'armv7s', 'arm64'])) + return XCODE_ARCHS_DEFAULT_CACHE + + class XcodeSettings(object): """A class that understands the gyp 'xcode_settings' object.""" @@ -34,10 +157,6 @@ class XcodeSettings(object): # cached at class-level for efficiency. _codesigning_key_cache = {} - # Populated lazily by _XcodeVersion. Shared by all XcodeSettings, so cached - # at class-level for efficiency. - _xcode_version_cache = () - def __init__(self, spec): self.spec = spec @@ -96,9 +215,24 @@ def _WarnUnimplemented(self, test_key): if test_key in self._Settings(): print 'Warning: Ignoring not yet implemented key "%s".' % test_key + def IsBinaryOutputFormat(self, configname): + default = "binary" if self.isIOS else "xml" + format = self.xcode_settings[configname].get('INFOPLIST_OUTPUT_FORMAT', + default) + return format == "binary" + def _IsBundle(self): return int(self.spec.get('mac_bundle', 0)) != 0 + def _IsIosAppExtension(self): + return int(self.spec.get('ios_app_extension', 0)) != 0 + + def _IsIosWatchKitExtension(self): + return int(self.spec.get('ios_watchkit_extension', 0)) != 0 + + def _IsIosWatchApp(self): + return int(self.spec.get('ios_watch_app', 0)) != 0 + def GetFrameworkVersion(self): """Returns the framework version of the current target. Only valid for bundles.""" @@ -118,7 +252,10 @@ def GetWrapperExtension(self): 'WRAPPER_EXTENSION', default=default_wrapper_extension) return '.' + self.spec.get('product_extension', wrapper_extension) elif self.spec['type'] == 'executable': - return '.' + self.spec.get('product_extension', 'app') + if self._IsIosAppExtension() or self._IsIosWatchKitExtension(): + return '.' + self.spec.get('product_extension', 'appex') + else: + return '.' + self.spec.get('product_extension', 'app') else: assert False, "Don't know extension for '%s', target '%s'" % ( self.spec['type'], self.spec['target_name']) @@ -173,6 +310,18 @@ def GetBundlePlistPath(self): def GetProductType(self): """Returns the PRODUCT_TYPE of this target.""" + if self._IsIosAppExtension(): + assert self._IsBundle(), ('ios_app_extension flag requires mac_bundle ' + '(target %s)' % self.spec['target_name']) + return 'com.apple.product-type.app-extension' + if self._IsIosWatchKitExtension(): + assert self._IsBundle(), ('ios_watchkit_extension flag requires ' + 'mac_bundle (target %s)' % self.spec['target_name']) + return 'com.apple.product-type.watchkit-extension' + if self._IsIosWatchApp(): + assert self._IsBundle(), ('ios_watch_app flag requires mac_bundle ' + '(target %s)' % self.spec['target_name']) + return 'com.apple.product-type.application.watchapp' if self._IsBundle(): return { 'executable': 'com.apple.product-type.application', @@ -267,17 +416,12 @@ def GetExecutablePath(self): def GetActiveArchs(self, configname): """Returns the architectures this target should be built for.""" - # TODO: Look at VALID_ARCHS, ONLY_ACTIVE_ARCH; possibly set - # CURRENT_ARCH / NATIVE_ARCH env vars? - return self.xcode_settings[configname].get('ARCHS', [self._DefaultArch()]) - - def _GetStdout(self, cmdlist): - job = subprocess.Popen(cmdlist, stdout=subprocess.PIPE) - out = job.communicate()[0] - if job.returncode != 0: - sys.stderr.write(out + '\n') - raise GypError('Error %d running %s' % (job.returncode, cmdlist[0])) - return out.rstrip('\n') + config_settings = self.xcode_settings[configname] + xcode_archs_default = GetXcodeArchsDefault() + return xcode_archs_default.ActiveArchs( + config_settings.get('ARCHS'), + config_settings.get('VALID_ARCHS'), + config_settings.get('SDKROOT')) def _GetSdkVersionInfoItem(self, sdk, infoitem): # xcodebuild requires Xcode and can't run on Command Line Tools-only @@ -285,7 +429,7 @@ def _GetSdkVersionInfoItem(self, sdk, infoitem): # Since the CLT has no SDK paths anyway, returning None is the # most sensible route and should still do the right thing. try: - return self._GetStdout(['xcodebuild', '-version', '-sdk', sdk, infoitem]) + return GetStdout(['xcodebuild', '-version', '-sdk', sdk, infoitem]) except: pass @@ -396,7 +540,8 @@ def GetCflags(self, configname, arch=None): if arch is not None: archs = [arch] else: - archs = self._Settings().get('ARCHS', [self._DefaultArch()]) + assert self.configname + archs = self.GetActiveArchs(self.configname) if len(archs) != 1: # TODO: Supporting fat binaries will be annoying. self._WarnUnimplemented('ARCHS') @@ -588,8 +733,8 @@ def _MapLinkerFlagFilename(self, ldflag, gyp_to_build_path): # -exported_symbols_list file # -Wl,exported_symbols_list file # -Wl,exported_symbols_list,file - LINKER_FILE = '(\S+)' - WORD = '\S+' + LINKER_FILE = r'(\S+)' + WORD = r'\S+' linker_flags = [ ['-exported_symbols_list', LINKER_FILE], # Needed for NaCl. ['-unexported_symbols_list', LINKER_FILE], @@ -653,7 +798,8 @@ def GetLdflags(self, configname, product_dir, gyp_to_build_path, arch=None): if arch is not None: archs = [arch] else: - archs = self._Settings().get('ARCHS', [self._DefaultArch()]) + assert self.configname + archs = self.GetActiveArchs(self.configname) if len(archs) != 1: # TODO: Supporting fat binaries will be annoying. self._WarnUnimplemented('ARCHS') @@ -678,6 +824,21 @@ def GetLdflags(self, configname, product_dir, gyp_to_build_path, arch=None): for directory in framework_dirs: ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root)) + is_extension = self._IsIosAppExtension() or self._IsIosWatchKitExtension() + if sdk_root and is_extension: + # Adds the link flags for extensions. These flags are common for all + # extensions and provide loader and main function. + # These flags reflect the compilation options used by xcode to compile + # extensions. + ldflags.append('-lpkstart') + ldflags.append(sdk_root + + '/System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit') + ldflags.append('-fapplication-extension') + ldflags.append('-Xlinker -rpath ' + '-Xlinker @executable_path/../../Frameworks') + + self._Appendf(ldflags, 'CLANG_CXX_LIBRARY', '-stdlib=%s') + self.configname = None return ldflags @@ -803,7 +964,7 @@ def _GetIOSPostbuilds(self, configname, output_binary): """Return a shell command to codesign the iOS output binary so it can be deployed to a device. This should be run as the very last step of the build.""" - if not (self.isIOS and self.spec['type'] == "executable"): + if not (self.isIOS and self.spec['type'] == 'executable'): return [] settings = self.xcode_settings[configname] @@ -874,65 +1035,7 @@ def AdjustLibraries(self, libraries, config_name=None): return libraries def _BuildMachineOSBuild(self): - return self._GetStdout(['sw_vers', '-buildVersion']) - - # This method ported from the logic in Homebrew's CLT version check - def _CLTVersion(self): - # pkgutil output looks like - # package-id: com.apple.pkg.CLTools_Executables - # version: 5.0.1.0.1.1382131676 - # volume: / - # location: / - # install-time: 1382544035 - # groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group com.apple.DevToolsNonRelocatableShared.pkg-group - STANDALONE_PKG_ID = "com.apple.pkg.DeveloperToolsCLILeo" - FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI" - MAVERICKS_PKG_ID = "com.apple.pkg.CLTools_Executables" - - regex = re.compile('version: (?P.+)') - for key in [MAVERICKS_PKG_ID, STANDALONE_PKG_ID, FROM_XCODE_PKG_ID]: - try: - output = self._GetStdout(['/usr/sbin/pkgutil', '--pkg-info', key]) - return re.search(regex, output).groupdict()['version'] - except: - continue - - def _XcodeVersion(self): - # `xcodebuild -version` output looks like - # Xcode 4.6.3 - # Build version 4H1503 - # or like - # Xcode 3.2.6 - # Component versions: DevToolsCore-1809.0; DevToolsSupport-1806.0 - # BuildVersion: 10M2518 - # Convert that to '0463', '4H1503'. - if len(XcodeSettings._xcode_version_cache) == 0: - try: - version_list = self._GetStdout(['xcodebuild', '-version']).splitlines() - # In some circumstances xcodebuild exits 0 but doesn't return - # the right results; for example, a user on 10.7 or 10.8 with - # a bogus path set via xcode-select - # In that case this may be a CLT-only install so fall back to - # checking that version. - if len(version_list) < 2: - raise GypError, "xcodebuild returned unexpected results" - except: - version = self._CLTVersion() - if version: - version = re.match('(\d\.\d\.?\d*)', version).groups()[0] - else: - raise GypError, "No Xcode or CLT version detected!" - # The CLT has no build information, so we return an empty string. - version_list = [version, ''] - version = version_list[0] - build = version_list[-1] - # Be careful to convert "4.2" to "0420": - version = version.split()[-1].replace('.', '') - version = (version + '0' * (3 - len(version))).zfill(4) - if build: - build = build.split()[-1] - XcodeSettings._xcode_version_cache = (version, build) - return XcodeSettings._xcode_version_cache + return GetStdout(['sw_vers', '-buildVersion']) def _XcodeIOSDeviceFamily(self, configname): family = self.xcode_settings[configname].get('TARGETED_DEVICE_FAMILY', '1') @@ -944,7 +1047,7 @@ def GetExtraPlistItems(self, configname=None): cache = {} cache['BuildMachineOSBuild'] = self._BuildMachineOSBuild() - xcode, xcode_build = self._XcodeVersion() + xcode, xcode_build = XcodeVersion() cache['DTXcode'] = xcode cache['DTXcodeBuild'] = xcode_build @@ -982,14 +1085,15 @@ def _DefaultSdkRoot(self): project, then the environment variable was empty. Starting with this version, Xcode uses the name of the newest SDK installed. """ - if self._XcodeVersion() < '0500': + xcode_version, xcode_build = XcodeVersion() + if xcode_version < '0500': return '' default_sdk_path = self._XcodeSdkPath('') default_sdk_root = XcodeSettings._sdk_root_cache.get(default_sdk_path) if default_sdk_root: return default_sdk_root try: - all_sdks = self._GetStdout(['xcodebuild', '-showsdks']) + all_sdks = GetStdout(['xcodebuild', '-showsdks']) except: # If xcodebuild fails, there will be no valid SDKs return '' @@ -1002,28 +1106,6 @@ def _DefaultSdkRoot(self): return sdk_root return '' - def _DefaultArch(self): - # For Mac projects, Xcode changed the default value used when ARCHS is not - # set from "i386" to "x86_64". - # - # For iOS projects, if ARCHS is unset, it defaults to "armv7 armv7s" when - # building for a device, and the simulator binaries are always build for - # "i386". - # - # For new projects, ARCHS is set to $(ARCHS_STANDARD_INCLUDING_64_BIT), - # which correspond to "armv7 armv7s arm64", and when building the simulator - # the architecture is either "i386" or "x86_64" depending on the simulated - # device (respectively 32-bit or 64-bit device). - # - # Since the value returned by this function is only used when ARCHS is not - # set, then on iOS we return "i386", as the default xcode project generator - # does not set ARCHS if it is not set in the .gyp file. - if self.isIOS: - return 'i386' - version, build = self._XcodeVersion() - if version >= '0500': - return 'x86_64' - return 'i386' class MacPrefixHeader(object): """A class that helps with emulating Xcode's GCC_PREFIX_HEADER feature. @@ -1131,6 +1213,81 @@ def GetPchBuildCommands(self, arch=None): ] +def XcodeVersion(): + """Returns a tuple of version and build version of installed Xcode.""" + # `xcodebuild -version` output looks like + # Xcode 4.6.3 + # Build version 4H1503 + # or like + # Xcode 3.2.6 + # Component versions: DevToolsCore-1809.0; DevToolsSupport-1806.0 + # BuildVersion: 10M2518 + # Convert that to '0463', '4H1503'. + global XCODE_VERSION_CACHE + if XCODE_VERSION_CACHE: + return XCODE_VERSION_CACHE + try: + version_list = GetStdout(['xcodebuild', '-version']).splitlines() + # In some circumstances xcodebuild exits 0 but doesn't return + # the right results; for example, a user on 10.7 or 10.8 with + # a bogus path set via xcode-select + # In that case this may be a CLT-only install so fall back to + # checking that version. + if len(version_list) < 2: + raise GypError("xcodebuild returned unexpected results") + except: + version = CLTVersion() + if version: + version = re.match(r'(\d\.\d\.?\d*)', version).groups()[0] + else: + raise GypError("No Xcode or CLT version detected!") + # The CLT has no build information, so we return an empty string. + version_list = [version, ''] + version = version_list[0] + build = version_list[-1] + # Be careful to convert "4.2" to "0420": + version = version.split()[-1].replace('.', '') + version = (version + '0' * (3 - len(version))).zfill(4) + if build: + build = build.split()[-1] + XCODE_VERSION_CACHE = (version, build) + return XCODE_VERSION_CACHE + + +# This function ported from the logic in Homebrew's CLT version check +def CLTVersion(): + """Returns the version of command-line tools from pkgutil.""" + # pkgutil output looks like + # package-id: com.apple.pkg.CLTools_Executables + # version: 5.0.1.0.1.1382131676 + # volume: / + # location: / + # install-time: 1382544035 + # groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group com.apple.DevToolsNonRelocatableShared.pkg-group + STANDALONE_PKG_ID = "com.apple.pkg.DeveloperToolsCLILeo" + FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI" + MAVERICKS_PKG_ID = "com.apple.pkg.CLTools_Executables" + + regex = re.compile('version: (?P.+)') + for key in [MAVERICKS_PKG_ID, STANDALONE_PKG_ID, FROM_XCODE_PKG_ID]: + try: + output = GetStdout(['/usr/sbin/pkgutil', '--pkg-info', key]) + return re.search(regex, output).groupdict()['version'] + except: + continue + + +def GetStdout(cmdlist): + """Returns the content of standard output returned by invoking |cmdlist|. + Raises |GypError| if the command return with a non-zero return code.""" + job = subprocess.Popen(cmdlist, stdout=subprocess.PIPE) + out = job.communicate()[0] + if job.returncode != 0: + sys.stderr.write(out + '\n') + raise GypError('Error %d running %s' % (job.returncode, cmdlist[0])) + return out.rstrip('\n') + + def MergeGlobalXcodeSettingsToSpec(global_dict, spec): """Merges the global xcode_settings dictionary into each configuration of the target represented by spec. For keys that are both in the global and the local @@ -1310,6 +1467,13 @@ def _GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration, install_name_base = xcode_settings.GetInstallNameBase() if install_name_base: env['DYLIB_INSTALL_NAME_BASE'] = install_name_base + if XcodeVersion() >= '0500' and not env.get('SDKROOT'): + sdk_root = xcode_settings._SdkRoot(configuration) + if not sdk_root: + sdk_root = xcode_settings._XcodeSdkPath('') + if sdk_root is None: + sdk_root = '' + env['SDKROOT'] = sdk_root if not additional_settings: additional_settings = {} @@ -1420,16 +1584,16 @@ def _HasIOSTarget(targets): def _AddIOSDeviceConfigurations(targets): """Clone all targets and append -iphoneos to the name. Configure these targets - to build for iOS devices.""" - for target_dict in targets.values(): - for config_name in target_dict['configurations'].keys(): - config = target_dict['configurations'][config_name] - new_config_name = config_name + '-iphoneos' - new_config_dict = copy.deepcopy(config) - if target_dict['toolset'] == 'target': - new_config_dict['xcode_settings']['ARCHS'] = ['armv7'] - new_config_dict['xcode_settings']['SDKROOT'] = 'iphoneos' - target_dict['configurations'][new_config_name] = new_config_dict + to build for iOS devices and use correct architectures for those builds.""" + for target_dict in targets.itervalues(): + toolset = target_dict['toolset'] + configs = target_dict['configurations'] + for config_name, config_dict in dict(configs).iteritems(): + iphoneos_config_dict = copy.deepcopy(config_dict) + configs[config_name + '-iphoneos'] = iphoneos_config_dict + configs[config_name + '-iphonesimulator'] = config_dict + if toolset == 'target': + iphoneos_config_dict['xcode_settings']['SDKROOT'] = 'iphoneos' return targets def CloneConfigurationForDeviceAndEmulator(target_dicts): diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py new file mode 100644 index 00000000000..3820d6bf048 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py @@ -0,0 +1,270 @@ +# Copyright (c) 2014 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. + +"""Xcode-ninja wrapper project file generator. + +This updates the data structures passed to the Xcode gyp generator to build +with ninja instead. The Xcode project itself is transformed into a list of +executable targets, each with a build step to build with ninja, and a target +with every source and resource file. This appears to sidestep some of the +major performance headaches experienced using complex projects and large number +of targets within Xcode. +""" + +import errno +import gyp.generator.ninja +import os +import re +import xml.sax.saxutils + + +def _WriteWorkspace(main_gyp, sources_gyp, params): + """ Create a workspace to wrap main and sources gyp paths. """ + (build_file_root, build_file_ext) = os.path.splitext(main_gyp) + workspace_path = build_file_root + '.xcworkspace' + options = params['options'] + if options.generator_output: + workspace_path = os.path.join(options.generator_output, workspace_path) + try: + os.makedirs(workspace_path) + except OSError, e: + if e.errno != errno.EEXIST: + raise + output_string = '\n' + \ + '\n' + for gyp_name in [main_gyp, sources_gyp]: + name = os.path.splitext(os.path.basename(gyp_name))[0] + '.xcodeproj' + name = xml.sax.saxutils.quoteattr("group:" + name) + output_string += ' \n' % name + output_string += '\n' + + workspace_file = os.path.join(workspace_path, "contents.xcworkspacedata") + + try: + with open(workspace_file, 'r') as input_file: + input_string = input_file.read() + if input_string == output_string: + return + except IOError: + # Ignore errors if the file doesn't exist. + pass + + with open(workspace_file, 'w') as output_file: + output_file.write(output_string) + +def _TargetFromSpec(old_spec, params): + """ Create fake target for xcode-ninja wrapper. """ + # Determine ninja top level build dir (e.g. /path/to/out). + ninja_toplevel = None + jobs = 0 + if params: + options = params['options'] + ninja_toplevel = \ + os.path.join(options.toplevel_dir, + gyp.generator.ninja.ComputeOutputDir(params)) + jobs = params.get('generator_flags', {}).get('xcode_ninja_jobs', 0) + + target_name = old_spec.get('target_name') + product_name = old_spec.get('product_name', target_name) + product_extension = old_spec.get('product_extension') + + ninja_target = {} + ninja_target['target_name'] = target_name + ninja_target['product_name'] = product_name + if product_extension: + ninja_target['product_extension'] = product_extension + ninja_target['toolset'] = old_spec.get('toolset') + ninja_target['default_configuration'] = old_spec.get('default_configuration') + ninja_target['configurations'] = {} + + # Tell Xcode to look in |ninja_toplevel| for build products. + new_xcode_settings = {} + if ninja_toplevel: + new_xcode_settings['CONFIGURATION_BUILD_DIR'] = \ + "%s/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)" % ninja_toplevel + + if 'configurations' in old_spec: + for config in old_spec['configurations'].iterkeys(): + old_xcode_settings = \ + old_spec['configurations'][config].get('xcode_settings', {}) + if 'IPHONEOS_DEPLOYMENT_TARGET' in old_xcode_settings: + new_xcode_settings['CODE_SIGNING_REQUIRED'] = "NO" + new_xcode_settings['IPHONEOS_DEPLOYMENT_TARGET'] = \ + old_xcode_settings['IPHONEOS_DEPLOYMENT_TARGET'] + ninja_target['configurations'][config] = {} + ninja_target['configurations'][config]['xcode_settings'] = \ + new_xcode_settings + + ninja_target['mac_bundle'] = old_spec.get('mac_bundle', 0) + ninja_target['ios_app_extension'] = old_spec.get('ios_app_extension', 0) + ninja_target['ios_watchkit_extension'] = \ + old_spec.get('ios_watchkit_extension', 0) + ninja_target['ios_watchkit_app'] = old_spec.get('ios_watchkit_app', 0) + ninja_target['type'] = old_spec['type'] + if ninja_toplevel: + ninja_target['actions'] = [ + { + 'action_name': 'Compile and copy %s via ninja' % target_name, + 'inputs': [], + 'outputs': [], + 'action': [ + 'env', + 'PATH=%s' % os.environ['PATH'], + 'ninja', + '-C', + new_xcode_settings['CONFIGURATION_BUILD_DIR'], + target_name, + ], + 'message': 'Compile and copy %s via ninja' % target_name, + }, + ] + if jobs > 0: + ninja_target['actions'][0]['action'].extend(('-j', jobs)) + return ninja_target + +def IsValidTargetForWrapper(target_extras, executable_target_pattern, spec): + """Limit targets for Xcode wrapper. + + Xcode sometimes performs poorly with too many targets, so only include + proper executable targets, with filters to customize. + Arguments: + target_extras: Regular expression to always add, matching any target. + executable_target_pattern: Regular expression limiting executable targets. + spec: Specifications for target. + """ + target_name = spec.get('target_name') + # Always include targets matching target_extras. + if target_extras is not None and re.search(target_extras, target_name): + return True + + # Otherwise just show executable targets. + if spec.get('type', '') == 'executable' and \ + spec.get('product_extension', '') != 'bundle': + + # If there is a filter and the target does not match, exclude the target. + if executable_target_pattern is not None: + if not re.search(executable_target_pattern, target_name): + return False + return True + return False + +def CreateWrapper(target_list, target_dicts, data, params): + """Initialize targets for the ninja wrapper. + + This sets up the necessary variables in the targets to generate Xcode projects + that use ninja as an external builder. + Arguments: + target_list: List of target pairs: 'base/base.gyp:base'. + target_dicts: Dict of target properties keyed on target pair. + data: Dict of flattened build files keyed on gyp path. + params: Dict of global options for gyp. + """ + orig_gyp = params['build_files'][0] + for gyp_name, gyp_dict in data.iteritems(): + if gyp_name == orig_gyp: + depth = gyp_dict['_DEPTH'] + + # Check for custom main gyp name, otherwise use the default CHROMIUM_GYP_FILE + # and prepend .ninja before the .gyp extension. + generator_flags = params.get('generator_flags', {}) + main_gyp = generator_flags.get('xcode_ninja_main_gyp', None) + if main_gyp is None: + (build_file_root, build_file_ext) = os.path.splitext(orig_gyp) + main_gyp = build_file_root + ".ninja" + build_file_ext + + # Create new |target_list|, |target_dicts| and |data| data structures. + new_target_list = [] + new_target_dicts = {} + new_data = {} + + # Set base keys needed for |data|. + new_data[main_gyp] = {} + new_data[main_gyp]['included_files'] = [] + new_data[main_gyp]['targets'] = [] + new_data[main_gyp]['xcode_settings'] = \ + data[orig_gyp].get('xcode_settings', {}) + + # Normally the xcode-ninja generator includes only valid executable targets. + # If |xcode_ninja_executable_target_pattern| is set, that list is reduced to + # executable targets that match the pattern. (Default all) + executable_target_pattern = \ + generator_flags.get('xcode_ninja_executable_target_pattern', None) + + # For including other non-executable targets, add the matching target name + # to the |xcode_ninja_target_pattern| regular expression. (Default none) + target_extras = generator_flags.get('xcode_ninja_target_pattern', None) + + for old_qualified_target in target_list: + spec = target_dicts[old_qualified_target] + if IsValidTargetForWrapper(target_extras, executable_target_pattern, spec): + # Add to new_target_list. + target_name = spec.get('target_name') + new_target_name = '%s:%s#target' % (main_gyp, target_name) + new_target_list.append(new_target_name) + + # Add to new_target_dicts. + new_target_dicts[new_target_name] = _TargetFromSpec(spec, params) + + # Add to new_data. + for old_target in data[old_qualified_target.split(':')[0]]['targets']: + if old_target['target_name'] == target_name: + new_data_target = {} + new_data_target['target_name'] = old_target['target_name'] + new_data_target['toolset'] = old_target['toolset'] + new_data[main_gyp]['targets'].append(new_data_target) + + # Create sources target. + sources_target_name = 'sources_for_indexing' + sources_target = _TargetFromSpec( + { 'target_name' : sources_target_name, + 'toolset': 'target', + 'default_configuration': 'Default', + 'mac_bundle': '0', + 'type': 'executable' + }, None) + + # Tell Xcode to look everywhere for headers. + sources_target['configurations'] = {'Default': { 'include_dirs': [ depth ] } } + + sources = [] + for target, target_dict in target_dicts.iteritems(): + base = os.path.dirname(target) + files = target_dict.get('sources', []) + \ + target_dict.get('mac_bundle_resources', []) + for action in target_dict.get('actions', []): + files.extend(action.get('inputs', [])) + # Remove files starting with $. These are mostly intermediate files for the + # build system. + files = [ file for file in files if not file.startswith('$')] + + # Make sources relative to root build file. + relative_path = os.path.dirname(main_gyp) + sources += [ os.path.relpath(os.path.join(base, file), relative_path) + for file in files ] + + sources_target['sources'] = sorted(set(sources)) + + # Put sources_to_index in it's own gyp. + sources_gyp = \ + os.path.join(os.path.dirname(main_gyp), sources_target_name + ".gyp") + fully_qualified_target_name = \ + '%s:%s#target' % (sources_gyp, sources_target_name) + + # Add to new_target_list, new_target_dicts and new_data. + new_target_list.append(fully_qualified_target_name) + new_target_dicts[fully_qualified_target_name] = sources_target + new_data_target = {} + new_data_target['target_name'] = sources_target['target_name'] + new_data_target['_DEPTH'] = depth + new_data_target['toolset'] = "target" + new_data[sources_gyp] = {} + new_data[sources_gyp]['targets'] = [] + new_data[sources_gyp]['included_files'] = [] + new_data[sources_gyp]['xcode_settings'] = \ + data[orig_gyp].get('xcode_settings', {}) + new_data[sources_gyp]['targets'].append(new_data_target) + + # Write workspace to file. + _WriteWorkspace(main_gyp, sources_gyp, params) + return (new_target_list, new_target_dicts, new_data) diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py index 6e4a1dc69dc..034a0d2d4fc 100644 --- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py @@ -173,7 +173,7 @@ # Used by SourceTreeAndPathFromPath -_path_leading_variable = re.compile('^\$\((.*?)\)(/(.*))?$') +_path_leading_variable = re.compile(r'^\$\((.*?)\)(/(.*))?$') def SourceTreeAndPathFromPath(input_path): """Given input_path, returns a tuple with sourceTree and path values. @@ -196,7 +196,7 @@ def SourceTreeAndPathFromPath(input_path): return (source_tree, output_path) def ConvertVariablesToShellSyntax(input_string): - return re.sub('\$\((.*?)\)', '${\\1}', input_string) + return re.sub(r'\$\((.*?)\)', '${\\1}', input_string) class XCObject(object): """The abstract base of all class types used in Xcode project files. @@ -341,13 +341,13 @@ def Copy(self): elif isinstance(value, dict): # dicts are never strong. if is_strong: - raise TypeError, 'Strong dict for key ' + key + ' in ' + \ - self.__class__.__name__ + raise TypeError('Strong dict for key ' + key + ' in ' + \ + self.__class__.__name__) else: that._properties[key] = value.copy() else: - raise TypeError, 'Unexpected type ' + value.__class__.__name__ + \ - ' for key ' + key + ' in ' + self.__class__.__name__ + raise TypeError('Unexpected type ' + value.__class__.__name__ + \ + ' for key ' + key + ' in ' + self.__class__.__name__) return that @@ -366,8 +366,7 @@ def Name(self): ('name' in self._schema and self._schema['name'][3]): return self._properties['name'] - raise NotImplementedError, \ - self.__class__.__name__ + ' must implement Name' + raise NotImplementedError(self.__class__.__name__ + ' must implement Name') def Comment(self): """Return a comment string for the object. @@ -466,10 +465,10 @@ def EnsureNoIDCollisions(self): for descendant in descendants: if descendant.id in ids: other = ids[descendant.id] - raise KeyError, \ + raise KeyError( 'Duplicate ID %s, objects "%s" and "%s" in "%s"' % \ (descendant.id, str(descendant._properties), - str(other._properties), self._properties['rootObject'].Name()) + str(other._properties), self._properties['rootObject'].Name())) ids[descendant.id] = descendant def Children(self): @@ -630,7 +629,7 @@ def _XCPrintableValue(self, tabs, value, flatten_list=False): sep printable += end_tabs + '}' else: - raise TypeError, "Can't make " + value.__class__.__name__ + ' printable' + raise TypeError("Can't make " + value.__class__.__name__ + ' printable') if comment != None: printable += ' ' + self._EncodeComment(comment) @@ -756,31 +755,31 @@ def UpdateProperties(self, properties, do_copy=False): for property, value in properties.iteritems(): # Make sure the property is in the schema. if not property in self._schema: - raise KeyError, property + ' not in ' + self.__class__.__name__ + raise KeyError(property + ' not in ' + self.__class__.__name__) # Make sure the property conforms to the schema. (is_list, property_type, is_strong) = self._schema[property][0:3] if is_list: if value.__class__ != list: - raise TypeError, \ + raise TypeError( property + ' of ' + self.__class__.__name__ + \ - ' must be list, not ' + value.__class__.__name__ + ' must be list, not ' + value.__class__.__name__) for item in value: if not isinstance(item, property_type) and \ not (item.__class__ == unicode and property_type == str): # Accept unicode where str is specified. str is treated as # UTF-8-encoded. - raise TypeError, \ + raise TypeError( 'item of ' + property + ' of ' + self.__class__.__name__ + \ ' must be ' + property_type.__name__ + ', not ' + \ - item.__class__.__name__ + item.__class__.__name__) elif not isinstance(value, property_type) and \ not (value.__class__ == unicode and property_type == str): # Accept unicode where str is specified. str is treated as # UTF-8-encoded. - raise TypeError, \ + raise TypeError( property + ' of ' + self.__class__.__name__ + ' must be ' + \ - property_type.__name__ + ', not ' + value.__class__.__name__ + property_type.__name__ + ', not ' + value.__class__.__name__) # Checks passed, perform the assignment. if do_copy: @@ -804,9 +803,9 @@ def UpdateProperties(self, properties, do_copy=False): elif isinstance(value, dict): self._properties[property] = value.copy() else: - raise TypeError, "Don't know how to copy a " + \ - value.__class__.__name__ + ' object for ' + \ - property + ' in ' + self.__class__.__name__ + raise TypeError("Don't know how to copy a " + \ + value.__class__.__name__ + ' object for ' + \ + property + ' in ' + self.__class__.__name__) else: self._properties[property] = value @@ -837,15 +836,15 @@ def AppendProperty(self, key, value): # Schema validation. if not key in self._schema: - raise KeyError, key + ' not in ' + self.__class__.__name__ + raise KeyError(key + ' not in ' + self.__class__.__name__) (is_list, property_type, is_strong) = self._schema[key][0:3] if not is_list: - raise TypeError, key + ' of ' + self.__class__.__name__ + ' must be list' + raise TypeError(key + ' of ' + self.__class__.__name__ + ' must be list') if not isinstance(value, property_type): - raise TypeError, 'item of ' + key + ' of ' + self.__class__.__name__ + \ - ' must be ' + property_type.__name__ + ', not ' + \ - value.__class__.__name__ + raise TypeError('item of ' + key + ' of ' + self.__class__.__name__ + \ + ' must be ' + property_type.__name__ + ', not ' + \ + value.__class__.__name__) # If the property doesn't exist yet, create a new empty list to receive the # item. @@ -869,7 +868,7 @@ def VerifyHasRequiredProperties(self): for property, attributes in self._schema.iteritems(): (is_list, property_type, is_strong, is_required) = attributes[0:4] if is_required and not property in self._properties: - raise KeyError, self.__class__.__name__ + ' requires ' + property + raise KeyError(self.__class__.__name__ + ' requires ' + property) def _SetDefaultsFromSchema(self): """Assign object default values according to the schema. This will not @@ -1143,16 +1142,16 @@ def _AddChildToDicts(self, child): child_path = child.PathFromSourceTreeAndPath() if child_path: if child_path in self._children_by_path: - raise ValueError, 'Found multiple children with path ' + child_path + raise ValueError('Found multiple children with path ' + child_path) self._children_by_path[child_path] = child if isinstance(child, PBXVariantGroup): child_name = child._properties.get('name', None) key = (child_name, child_path) if key in self._variant_children_by_name_and_path: - raise ValueError, 'Found multiple PBXVariantGroup children with ' + \ - 'name ' + str(child_name) + ' and path ' + \ - str(child_path) + raise ValueError('Found multiple PBXVariantGroup children with ' + \ + 'name ' + str(child_name) + ' and path ' + \ + str(child_path)) self._variant_children_by_name_and_path[key] = child def AppendChild(self, child): @@ -1508,9 +1507,12 @@ def __init__(self, properties=None, id=None, parent=None): 's': 'sourcecode.asm', 'storyboard': 'file.storyboard', 'strings': 'text.plist.strings', + 'swift': 'sourcecode.swift', 'ttf': 'file', + 'xcassets': 'folder.assetcatalog', 'xcconfig': 'text.xcconfig', 'xcdatamodel': 'wrapper.xcdatamodel', + 'xcdatamodeld':'wrapper.xcdatamodeld', 'xib': 'file.xib', 'y': 'sourcecode.yacc', } @@ -1605,7 +1607,7 @@ def ConfigurationNamed(self, name): if configuration._properties['name'] == name: return configuration - raise KeyError, name + raise KeyError(name) def DefaultConfiguration(self): """Convenience accessor to obtain the default XCBuildConfiguration.""" @@ -1662,7 +1664,7 @@ def GetBuildSetting(self, key): value = configuration_value else: if value != configuration_value: - raise ValueError, 'Variant values for ' + key + raise ValueError('Variant values for ' + key) return value @@ -1769,8 +1771,8 @@ def FileGroup(self, path): # added, either as a child or deeper descendant. The second item should # be a boolean indicating whether files should be added into hierarchical # groups or one single flat group. - raise NotImplementedError, \ - self.__class__.__name__ + ' must implement FileGroup' + raise NotImplementedError( + self.__class__.__name__ + ' must implement FileGroup') def _AddPathToDict(self, pbxbuildfile, path): """Adds path to the dict tracking paths belonging to this build phase. @@ -1779,7 +1781,7 @@ def _AddPathToDict(self, pbxbuildfile, path): """ if path in self._files_by_path: - raise ValueError, 'Found multiple build files with path ' + path + raise ValueError('Found multiple build files with path ' + path) self._files_by_path[path] = pbxbuildfile def _AddBuildFileToDicts(self, pbxbuildfile, path=None): @@ -1834,8 +1836,8 @@ def _AddBuildFileToDicts(self, pbxbuildfile, path=None): # problem. if xcfilelikeelement in self._files_by_xcfilelikeelement and \ self._files_by_xcfilelikeelement[xcfilelikeelement] != pbxbuildfile: - raise ValueError, 'Found multiple build files for ' + \ - xcfilelikeelement.Name() + raise ValueError('Found multiple build files for ' + \ + xcfilelikeelement.Name()) self._files_by_xcfilelikeelement[xcfilelikeelement] = pbxbuildfile def AppendBuildFile(self, pbxbuildfile, path=None): @@ -1999,8 +2001,8 @@ def SetDestination(self, path): subfolder = 0 relative_path = path[1:] else: - raise ValueError, 'Can\'t use path %s in a %s' % \ - (path, self.__class__.__name__) + raise ValueError('Can\'t use path %s in a %s' % \ + (path, self.__class__.__name__)) self._properties['dstPath'] = relative_path self._properties['dstSubfolderSpec'] = subfolder @@ -2236,10 +2238,16 @@ class PBXNativeTarget(XCTarget): # Mapping from Xcode product-types to settings. The settings are: # filetype : used for explicitFileType in the project file # prefix : the prefix for the file name - # suffix : the suffix for the filen ame + # suffix : the suffix for the file name _product_filetypes = { - 'com.apple.product-type.application': ['wrapper.application', - '', '.app'], + 'com.apple.product-type.application': ['wrapper.application', + '', '.app'], + 'com.apple.product-type.application.watchapp': ['wrapper.application', + '', '.app'], + 'com.apple.product-type.watchkit-extension': ['wrapper.app-extension', + '', '.appex'], + 'com.apple.product-type.app-extension': ['wrapper.app-extension', + '', '.appex'], 'com.apple.product-type.bundle': ['wrapper.cfbundle', '', '.bundle'], 'com.apple.product-type.framework': ['wrapper.framework', @@ -2312,11 +2320,11 @@ def __init__(self, properties=None, id=None, parent=None, if force_extension is not None: # If it's a wrapper (bundle), set WRAPPER_EXTENSION. + # Extension override. + suffix = '.' + force_extension if filetype.startswith('wrapper.'): self.SetBuildSetting('WRAPPER_EXTENSION', force_extension) else: - # Extension override. - suffix = '.' + force_extension self.SetBuildSetting('EXECUTABLE_EXTENSION', force_extension) if filetype.startswith('compiled.mach-o.executable'): @@ -2732,8 +2740,53 @@ def AddOrGetProjectReference(self, other_pbxproject): self._SetUpProductReferences(other_pbxproject, product_group, project_ref) + inherit_unique_symroot = self._AllSymrootsUnique(other_pbxproject, False) + targets = other_pbxproject.GetProperty('targets') + if all(self._AllSymrootsUnique(t, inherit_unique_symroot) for t in targets): + dir_path = project_ref._properties['path'] + product_group._hashables.extend(dir_path) + return [product_group, project_ref] + def _AllSymrootsUnique(self, target, inherit_unique_symroot): + # Returns True if all configurations have a unique 'SYMROOT' attribute. + # The value of inherit_unique_symroot decides, if a configuration is assumed + # to inherit a unique 'SYMROOT' attribute from its parent, if it doesn't + # define an explicit value for 'SYMROOT'. + symroots = self._DefinedSymroots(target) + for s in self._DefinedSymroots(target): + if (s is not None and not self._IsUniqueSymrootForTarget(s) or + s is None and not inherit_unique_symroot): + return False + return True if symroots else inherit_unique_symroot + + def _DefinedSymroots(self, target): + # Returns all values for the 'SYMROOT' attribute defined in all + # configurations for this target. If any configuration doesn't define the + # 'SYMROOT' attribute, None is added to the returned set. If all + # configurations don't define the 'SYMROOT' attribute, an empty set is + # returned. + config_list = target.GetProperty('buildConfigurationList') + symroots = set() + for config in config_list.GetProperty('buildConfigurations'): + setting = config.GetProperty('buildSettings') + if 'SYMROOT' in setting: + symroots.add(setting['SYMROOT']) + else: + symroots.add(None) + if len(symroots) == 1 and None in symroots: + return set() + return symroots + + def _IsUniqueSymrootForTarget(self, symroot): + # This method returns True if all configurations in target contain a + # 'SYMROOT' attribute that is unique for the given target. A value is + # unique, if the Xcode macro '$SRCROOT' appears in it in any form. + uniquifier = ['$SRCROOT', '$(SRCROOT)'] + if any(x in symroot for x in uniquifier): + return True + return False + def _SetUpProductReferences(self, other_pbxproject, product_group, project_ref): # TODO(mark): This only adds references to products in other_pbxproject @@ -2802,7 +2855,7 @@ def CompareProducts(x, y, remote_products): product_group = ref_dict['ProductGroup'] product_group._properties['children'] = sorted( product_group._properties['children'], - cmp=lambda x, y: CompareProducts(x, y, remote_products)) + cmp=lambda x, y, rp=remote_products: CompareProducts(x, y, rp)) class XCProjectFile(XCObject): @@ -2810,27 +2863,10 @@ class XCProjectFile(XCObject): _schema.update({ 'archiveVersion': [0, int, 0, 1, 1], 'classes': [0, dict, 0, 1, {}], - 'objectVersion': [0, int, 0, 1, 45], + 'objectVersion': [0, int, 0, 1, 46], 'rootObject': [0, PBXProject, 1, 1], }) - def SetXcodeVersion(self, version): - version_to_object_version = { - '2.4': 45, - '3.0': 45, - '3.1': 45, - '3.2': 46, - } - if not version in version_to_object_version: - supported_str = ', '.join(sorted(version_to_object_version.keys())) - raise Exception( - 'Unsupported Xcode version %s (supported: %s)' % - ( version, supported_str ) ) - compatibility_version = 'Xcode %s' % version - self._properties['rootObject'].SetProperty('compatibilityVersion', - compatibility_version) - self.SetProperty('objectVersion', version_to_object_version[version]); - def ComputeIDs(self, recursive=True, overwrite=True, hash=None): # Although XCProjectFile is implemented here as an XCObject, it's not a # proper object in the Xcode sense, and it certainly doesn't have its own diff --git a/deps/npm/node_modules/node-gyp/gyp/pylintrc b/deps/npm/node_modules/node-gyp/gyp/pylintrc deleted file mode 100644 index d7c23d2a211..00000000000 --- a/deps/npm/node_modules/node-gyp/gyp/pylintrc +++ /dev/null @@ -1,307 +0,0 @@ -[MASTER] - -# Specify a configuration file. -#rcfile= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Profiled execution. -profile=no - -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=CVS - -# Pickle collected data for later comparisons. -persistent=yes - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - - -[MESSAGES CONTROL] - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time. -#enable= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). -# C0103: Invalid name "NN" (should match [a-z_][a-z0-9_]{2,30}$) -# C0111: Missing docstring -# C0302: Too many lines in module (NN) -# R0902: Too many instance attributes (N/7) -# R0903: Too few public methods (N/2) -# R0904: Too many public methods (NN/20) -# R0912: Too many branches (NN/12) -# R0913: Too many arguments (N/5) -# R0914: Too many local variables (NN/15) -# R0915: Too many statements (NN/50) -# W0141: Used builtin function 'map' -# W0142: Used * or ** magic -# W0232: Class has no __init__ method -# W0511: TODO -# W0603: Using the global statement -# -# These should be enabled eventually: -# C0112: Empty docstring -# C0301: Line too long (NN/80) -# C0321: More than one statement on single line -# C0322: Operator not preceded by a space -# C0323: Operator not followed by a space -# C0324: Comma not followed by a space -# E0101: Explicit return in __init__ -# E0102: function already defined line NN -# E1002: Use of super on an old style class -# E1101: Instance of 'XX' has no 'YY' member -# E1103: Instance of 'XX' has no 'XX' member (but some types could not be inferred) -# E0602: Undefined variable 'XX' -# F0401: Unable to import 'XX' -# R0201: Method could be a function -# R0801: Similar lines in N files -# W0102: Dangerous default value {} as argument -# W0104: Statement seems to have no effect -# W0105: String statement has no effect -# W0108: Lambda may not be necessary -# W0201: Attribute 'XX' defined outside __init__ -# W0212: Access to a protected member XX of a client class -# W0221: Arguments number differs from overridden method -# W0223: Method 'XX' is abstract in class 'YY' but is not overridden -# W0231: __init__ method from base class 'XX' is not called -# W0301: Unnecessary semicolon -# W0311: Bad indentation. Found NN spaces, expected NN -# W0401: Wildcard import XX -# W0402: Uses of a deprecated module 'string' -# W0403: Relative import 'XX', should be 'YY.XX' -# W0404: Reimport 'XX' (imported line NN) -# W0601: Global variable 'XX' undefined at the module level -# W0602: Using global for 'XX' but no assignment is done -# W0611: Unused import pprint -# W0612: Unused variable 'XX' -# W0613: Unused argument 'XX' -# W0614: Unused import XX from wildcard import -# W0621: Redefining name 'XX' from outer scope (line NN) -# W0622: Redefining built-in 'NN' -# W0631: Using possibly undefined loop variable 'XX' -# W0701: Raising a string exception -# W0702: No exception type(s) specified -disable=C0103,C0111,C0302,R0902,R0903,R0904,R0912,R0913,R0914,R0915,W0141,W0142,W0232,W0511,W0603,C0112,C0301,C0321,C0322,C0323,C0324,E0101,E0102,E1002,E1101,E1103,E0602,F0401,R0201,R0801,W0102,W0104,W0105,W0108,W0201,W0212,W0221,W0223,W0231,W0301,W0311,W0401,W0402,W0403,W0404,W0601,W0602,W0611,W0612,W0613,W0614,W0621,W0622,W0631,W0701,W0702 - - -[REPORTS] - -# Set the output format. Available formats are text, parseable, colorized, msvs -# (visual studio) and html -output-format=text - -# Include message's id in output -include-ids=yes - -# Put messages in a separate file for each module / package specified on the -# command line instead of printing them on stdout. Reports (if any) will be -# written in a file name "pylint_global.[txt|html]". -files-output=no - -# Tells whether to display a full report or only the messages -reports=no - -# Python expression which should return a note less than 10 (10 is the highest -# note). You have access to the variables errors warning, statement which -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Add a comment according to your evaluation note. This is used by the global -# evaluation report (RP0004). -comment=no - - -[VARIABLES] - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# A regular expression matching the beginning of the name of dummy variables -# (i.e. not used). -dummy-variables-rgx=_|dummy - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - - -[TYPECHECK] - -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# List of classes names for which member attributes should not be checked -# (useful for classes with attributes dynamically set). -ignored-classes=SQLObject - -# When zope mode is activated, add a predefined set of Zope acquired attributes -# to generated-members. -zope=no - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E0201 when accessed. Python regular -# expressions are accepted. -generated-members=REQUEST,acl_users,aq_parent - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX,TODO - - -[SIMILARITIES] - -# Minimum lines number of a similarity. -min-similarity-lines=4 - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - - -[FORMAT] - -# Maximum number of characters on a single line. -max-line-length=80 - -# Maximum number of lines in a module -max-module-lines=1000 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - - -[BASIC] - -# Required attributes for module, separated by a comma -required-attributes= - -# List of builtins function names that should not be used, separated by a comma -bad-functions=map,filter,apply,input - -# Regular expression which should only match correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Regular expression which should only match correct module level names -const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - -# Regular expression which should only match correct class names -class-rgx=[A-Z_][a-zA-Z0-9]+$ - -# Regular expression which should only match correct function names -function-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct method names -method-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct instance attribute names -attr-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct argument names -argument-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct variable names -variable-rgx=[a-z_][a-z0-9_]{2,30}$ - -# Regular expression which should only match correct list comprehension / -# generator expression variable names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Good variable names which should always be accepted, separated by a comma -good-names=i,j,k,ex,Run,_ - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo,bar,baz,toto,tutu,tata - -# Regular expression which should only match functions or classes name which do -# not require a docstring -no-docstring-rgx=__.*__ - - -[DESIGN] - -# Maximum number of arguments for function / method -max-args=5 - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore -ignored-argument-names=_.* - -# Maximum number of locals for function / method body -max-locals=15 - -# Maximum number of return / yield for function / method body -max-returns=6 - -# Maximum number of branch for function / method body -max-branchs=12 - -# Maximum number of statements in function / method body -max-statements=50 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of attributes for a class (see R0902). -max-attributes=7 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - - -[CLASSES] - -# List of interface methods to ignore, separated by a comma. This is used for -# instance to not check methods defines in Zope's Interface base class. -ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls - - -[IMPORTS] - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub,string,TERMIOS,Bastion,rexec - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= - -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled) -int-import-graph= - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception" -overgeneral-exceptions=Exception diff --git a/deps/npm/node_modules/node-gyp/gyp/tools/emacs/gyp.el b/deps/npm/node_modules/node-gyp/gyp/tools/emacs/gyp.el index 3db9f645943..b98b155ceda 100644 --- a/deps/npm/node_modules/node-gyp/gyp/tools/emacs/gyp.el +++ b/deps/npm/node_modules/node-gyp/gyp/tools/emacs/gyp.el @@ -15,14 +15,36 @@ "recent emacsen), not from the older and less maintained " "python-mode.el"))) -(defadvice python-calculate-indentation (after ami-outdent-closing-parens - activate) +(defadvice python-indent-calculate-levels (after gyp-outdent-closing-parens + activate) "De-indent closing parens, braces, and brackets in gyp-mode." - (if (and (eq major-mode 'gyp-mode) - (string-match "^ *[])}][],)}]* *$" - (buffer-substring-no-properties - (line-beginning-position) (line-end-position)))) - (setq ad-return-value (- ad-return-value 2)))) + (when (and (eq major-mode 'gyp-mode) + (string-match "^ *[])}][],)}]* *$" + (buffer-substring-no-properties + (line-beginning-position) (line-end-position)))) + (setf (first python-indent-levels) + (- (first python-indent-levels) python-continuation-offset)))) + +(defadvice python-indent-guess-indent-offset (around + gyp-indent-guess-indent-offset + activate) + "Guess correct indent offset in gyp-mode." + (or (and (not (eq major-mode 'gyp-mode)) + ad-do-it) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + ;; Find first line ending with an opening brace that is not a comment. + (or (and (re-search-forward "\\(^[[{]$\\|^.*[^#].*[[{]$\\)") + (forward-line) + (/= (current-indentation) 0) + (set (make-local-variable 'python-indent-offset) + (current-indentation)) + (set (make-local-variable 'python-continuation-offset) + (current-indentation))) + (message "Can't guess gyp indent offset, using default: %s" + python-continuation-offset)))))) (define-derived-mode gyp-mode python-mode "Gyp" "Major mode for editing .gyp files. See http://code.google.com/p/gyp/" @@ -35,9 +57,10 @@ (defun gyp-set-indentation () "Hook function to configure python indentation to suit gyp mode." - (setq python-continuation-offset 2 - python-indent 2 - python-guess-indent nil)) + (set (make-local-variable 'python-indent-offset) 2) + (set (make-local-variable 'python-continuation-offset) 2) + (set (make-local-variable 'python-indent-guess-indent-offset) t) + (python-indent-guess-indent-offset)) (add-hook 'gyp-mode-hook 'gyp-set-indentation) @@ -218,11 +241,11 @@ ;; Top-level keywords (list (concat "['\"]\\(" (regexp-opt (list "action" "action_name" "actions" "cflags" - "conditions" "configurations" "copies" "defines" - "dependencies" "destination" + "cflags_cc" "conditions" "configurations" + "copies" "defines" "dependencies" "destination" "direct_dependent_settings" "export_dependent_settings" "extension" "files" - "include_dirs" "includes" "inputs" "libraries" + "include_dirs" "includes" "inputs" "ldflags" "libraries" "link_settings" "mac_bundle" "message" "msvs_external_rule" "outputs" "product_name" "process_outputs_as_sources" "rules" "rule_name" diff --git a/deps/npm/node_modules/node-gyp/gyp/tools/pretty_sln.py b/deps/npm/node_modules/node-gyp/gyp/tools/pretty_sln.py index 3195d8581be..ca8cf4ad3fb 100755 --- a/deps/npm/node_modules/node-gyp/gyp/tools/pretty_sln.py +++ b/deps/npm/node_modules/node-gyp/gyp/tools/pretty_sln.py @@ -38,12 +38,13 @@ def ParseSolution(solution_file): # Regular expressions that matches the SLN format. # The first line of a project definition. - begin_project = re.compile(('^Project\("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942' - '}"\) = "(.*)", "(.*)", "(.*)"$')) + begin_project = re.compile(r'^Project\("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942' + r'}"\) = "(.*)", "(.*)", "(.*)"$') # The last line of a project definition. end_project = re.compile('^EndProject$') # The first line of a dependency list. - begin_dep = re.compile('ProjectSection\(ProjectDependencies\) = postProject$') + begin_dep = re.compile( + r'ProjectSection\(ProjectDependencies\) = postProject$') # The last line of a dependency list. end_dep = re.compile('EndProjectSection$') # A line describing a dependency. diff --git a/deps/npm/node_modules/node-gyp/lib/build.js b/deps/npm/node_modules/node-gyp/lib/build.js index f3605902e93..eeeb60266e0 100644 --- a/deps/npm/node_modules/node-gyp/lib/build.js +++ b/deps/npm/node_modules/node-gyp/lib/build.js @@ -150,7 +150,7 @@ function build (gyp, argv, callback) { return (x.version < y.version ? -1 : 1) }) ;(function verifyMsbuild () { - if (!msbuilds.length) return callback(notfoundErr); + if (!msbuilds.length) return callback(notfoundErr) msbuildPath = path.resolve(msbuilds.pop().path, 'msbuild.exe') fs.stat(msbuildPath, function (err, stat) { if (err) { @@ -222,8 +222,9 @@ function build (gyp, argv, callback) { var p = arch === 'x64' ? 'x64' : 'Win32' argv.push('/p:Configuration=' + buildType + ';Platform=' + p) if (jobs) { - if (!isNaN(parseInt(jobs, 10))) { - argv.push('/m:' + parseInt(jobs, 10)) + var j = parseInt(jobs, 10) + if (!isNaN(j) && j > 0) { + argv.push('/m:' + j) } else if (jobs.toUpperCase() === 'MAX') { argv.push('/m:' + require('os').cpus().length) } @@ -234,9 +235,10 @@ function build (gyp, argv, callback) { argv.push('-C') argv.push('build') if (jobs) { - if (!isNaN(parseInt(jobs, 10))) { + var j = parseInt(jobs, 10) + if (!isNaN(j) && j > 0) { argv.push('--jobs') - argv.push(parseInt(jobs, 10)) + argv.push(j) } else if (jobs.toUpperCase() === 'MAX') { argv.push('--jobs') argv.push(require('os').cpus().length) diff --git a/deps/npm/node_modules/node-gyp/lib/configure.js b/deps/npm/node_modules/node-gyp/lib/configure.js index 68f26d6e193..0a33e70088f 100644 --- a/deps/npm/node_modules/node-gyp/lib/configure.js +++ b/deps/npm/node_modules/node-gyp/lib/configure.js @@ -13,6 +13,7 @@ var fs = require('graceful-fs') , semver = require('semver') , mkdirp = require('mkdirp') , cp = require('child_process') + , PathArray = require('path-array') , extend = require('util')._extend , spawn = cp.spawn , execFile = cp.execFile @@ -22,7 +23,7 @@ exports.usage = 'Generates ' + (win ? 'MSVC project files' : 'a Makefile') + ' f function configure (gyp, argv, callback) { - var python = gyp.opts.python || process.env.PYTHON || 'python' + var python = gyp.opts.python || process.env.PYTHON || 'python2' , buildDir = path.resolve('build') , configNames = [ 'config.gypi', 'common.gypi' ] , configs = [] @@ -36,6 +37,10 @@ function configure (gyp, argv, callback) { which(python, function (err, execPath) { if (err) { log.verbose('`which` failed', python, err) + if (python === 'python2') { + python = 'python' + return checkPython() + } if (win) { guessPython() } else { @@ -73,8 +78,8 @@ function configure (gyp, argv, callback) { } function checkPythonVersion () { - var env = extend({}, process.env); - env.TERM = 'dumb'; + var env = extend({}, process.env) + env.TERM = 'dumb' execFile(python, ['-c', 'import platform; print(platform.python_version());'], { env: env }, function (err, stdout) { if (err) { @@ -91,7 +96,13 @@ function configure (gyp, argv, callback) { version = version.replace(/rc(.*)$/ig, '') } var range = semver.Range('>=2.5.0 <3.0.0') - if (range.test(version)) { + var valid = false + try { + valid = range.test(version) + } catch (e) { + log.silly('range.test() error', e) + } + if (valid) { getNodeDir() } else { failPythonVersion(version) @@ -328,7 +339,8 @@ function configure (gyp, argv, callback) { argv.unshift(gyp_script) // make sure python uses files that came with this particular node package - process.env.PYTHONPATH = path.resolve(__dirname, '..', 'gyp', 'pylib') + var pypath = new PathArray(process.env, 'PYTHONPATH') + pypath.unshift(path.join(__dirname, '..', 'gyp', 'pylib')) var cp = gyp.spawn(python, argv) cp.on('exit', onCpExit) diff --git a/deps/npm/node_modules/node-gyp/lib/install.js b/deps/npm/node_modules/node-gyp/lib/install.js index 6f72e6a93d6..89e4956a8ca 100644 --- a/deps/npm/node_modules/node-gyp/lib/install.js +++ b/deps/npm/node_modules/node-gyp/lib/install.js @@ -230,6 +230,11 @@ function install (gyp, argv, callback) { // something went wrong downloading the tarball? req.on('error', function (err) { + if (err.code === 'ENOTFOUND') { + return cb(new Error('This is most likely not a problem with node-gyp or the package itself and\n' + + 'is related to network connectivity. In most cases you are behind a proxy or have bad \n' + + 'network settings.')) + } badDownload = true cb(err) }) @@ -243,7 +248,7 @@ function install (gyp, argv, callback) { req.on('response', function (res) { if (res.statusCode !== 200) { badDownload = true - cb(new Error(res.statusCode + ' status code downloading tarball')) + cb(new Error(res.statusCode + ' response dowloading ' + tarballUrl)) return } // content checksum @@ -277,9 +282,12 @@ function install (gyp, argv, callback) { var installVersionPath = path.resolve(devDir, 'installVersion') fs.writeFile(installVersionPath, gyp.package.installVersion + '\n', deref) - // download SHASUMS.txt - async++ - downloadShasums(deref) + // Only download SHASUMS.txt if not using tarPath override + if (!tarPath) { + // download SHASUMS.txt + async++ + downloadShasums(deref) + } if (async === 0) { // no async tasks required diff --git a/deps/npm/node_modules/node-gyp/lib/node-gyp.js b/deps/npm/node_modules/node-gyp/lib/node-gyp.js index df7ce85553d..6223d4b1943 100644 --- a/deps/npm/node_modules/node-gyp/lib/node-gyp.js +++ b/deps/npm/node_modules/node-gyp/lib/node-gyp.js @@ -180,8 +180,8 @@ proto.parseArgv = function parseOpts (argv) { proto.spawn = function spawn (command, args, opts) { if (!opts) opts = {} - if (!opts.silent && !opts.customFds) { - opts.customFds = [ 0, 1, 2 ] + if (!opts.silent && !opts.stdio) { + opts.stdio = [ 0, 1, 2 ] } var cp = child_process.spawn(command, args, opts) log.info('spawn', command) diff --git a/deps/npm/node_modules/node-gyp/lib/rebuild.js b/deps/npm/node_modules/node-gyp/lib/rebuild.js index 595d87a7d4b..4c6f472aa7c 100644 --- a/deps/npm/node_modules/node-gyp/lib/rebuild.js +++ b/deps/npm/node_modules/node-gyp/lib/rebuild.js @@ -3,13 +3,11 @@ module.exports = exports = rebuild exports.usage = 'Runs "clean", "configure" and "build" all at once' -var log = require('npmlog') - function rebuild (gyp, argv, callback) { gyp.todo.push( { name: 'clean', args: [] } - , { name: 'configure', args: [] } + , { name: 'configure', args: argv } , { name: 'build', args: [] } ) process.nextTick(callback) diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/LICENSE b/deps/npm/node_modules/node-gyp/node_modules/glob/LICENSE new file mode 100644 index 00000000000..19129e315fe --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/README.md b/deps/npm/node_modules/node-gyp/node_modules/glob/README.md new file mode 100644 index 00000000000..258257ecb19 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/README.md @@ -0,0 +1,369 @@ +[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Dependency Status](https://david-dm.org/isaacs/node-glob.svg)](https://david-dm.org/isaacs/node-glob) [![devDependency Status](https://david-dm.org/isaacs/node-glob/dev-status.svg)](https://david-dm.org/isaacs/node-glob#info=devDependencies) [![optionalDependency Status](https://david-dm.org/isaacs/node-glob/optional-status.svg)](https://david-dm.org/isaacs/node-glob#info=optionalDependencies) + +# Glob + +Match files using the patterns the shell uses, like stars and stuff. + +This is a glob implementation in JavaScript. It uses the `minimatch` +library to do its matching. + +![](oh-my-glob.gif) + +## Usage + +```javascript +var glob = require("glob") + +// options is optional +glob("**/*.js", options, function (er, files) { + // files is an array of filenames. + // If the `nonull` option is set, and nothing + // was found, then files is ["**/*.js"] + // er is an error object or null. +}) +``` + +## Glob Primer + +"Globs" are the patterns you type when you do stuff like `ls *.js` on +the command line, or put `build/*` in a `.gitignore` file. + +Before parsing the path part patterns, braced sections are expanded +into a set. Braced sections start with `{` and end with `}`, with any +number of comma-delimited sections within. Braced sections may contain +slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`. + +The following characters have special magic meaning when used in a +path portion: + +* `*` Matches 0 or more characters in a single path portion +* `?` Matches 1 character +* `[...]` Matches a range of characters, similar to a RegExp range. + If the first character of the range is `!` or `^` then it matches + any character not in the range. +* `!(pattern|pattern|pattern)` Matches anything that does not match + any of the patterns provided. +* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the + patterns provided. +* `+(pattern|pattern|pattern)` Matches one or more occurrences of the + patterns provided. +* `*(a|b|c)` Matches zero or more occurrences of the patterns provided +* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns + provided +* `**` If a "globstar" is alone in a path portion, then it matches + zero or more directories and subdirectories searching for matches. + It does not crawl symlinked directories. + +### Dots + +If a file or directory path portion has a `.` as the first character, +then it will not match any glob pattern unless that pattern's +corresponding path part also has a `.` as its first character. + +For example, the pattern `a/.*/c` would match the file at `a/.b/c`. +However the pattern `a/*/c` would not, because `*` does not start with +a dot character. + +You can make glob treat dots as normal characters by setting +`dot:true` in the options. + +### Basename Matching + +If you set `matchBase:true` in the options, and the pattern has no +slashes in it, then it will seek for any file anywhere in the tree +with a matching basename. For example, `*.js` would match +`test/simple/basic.js`. + +### Negation + +The intent for negation would be for a pattern starting with `!` to +match everything that *doesn't* match the supplied pattern. However, +the implementation is weird, and for the time being, this should be +avoided. The behavior will change or be deprecated in version 5. + +### Empty Sets + +If no matching files are found, then an empty array is returned. This +differs from the shell, where the pattern itself is returned. For +example: + + $ echo a*s*d*f + a*s*d*f + +To get the bash-style behavior, set the `nonull:true` in the options. + +### See Also: + +* `man sh` +* `man bash` (Search for "Pattern Matching") +* `man 3 fnmatch` +* `man 5 gitignore` +* [minimatch documentation](https://github.com/isaacs/minimatch) + +## glob.hasMagic(pattern, [options]) + +Returns `true` if there are any special characters in the pattern, and +`false` otherwise. + +Note that the options affect the results. If `noext:true` is set in +the options object, then `+(a|b)` will not be considered a magic +pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}` +then that is considered magical, unless `nobrace:true` is set in the +options. + +## glob(pattern, [options], cb) + +* `pattern` {String} Pattern to be matched +* `options` {Object} +* `cb` {Function} + * `err` {Error | null} + * `matches` {Array} filenames found matching the pattern + +Perform an asynchronous glob search. + +## glob.sync(pattern, [options]) + +* `pattern` {String} Pattern to be matched +* `options` {Object} +* return: {Array} filenames found matching the pattern + +Perform a synchronous glob search. + +## Class: glob.Glob + +Create a Glob object by instantiating the `glob.Glob` class. + +```javascript +var Glob = require("glob").Glob +var mg = new Glob(pattern, options, cb) +``` + +It's an EventEmitter, and starts walking the filesystem to find matches +immediately. + +### new glob.Glob(pattern, [options], [cb]) + +* `pattern` {String} pattern to search for +* `options` {Object} +* `cb` {Function} Called when an error occurs, or matches are found + * `err` {Error | null} + * `matches` {Array} filenames found matching the pattern + +Note that if the `sync` flag is set in the options, then matches will +be immediately available on the `g.found` member. + +### Properties + +* `minimatch` The minimatch object that the glob uses. +* `options` The options object passed in. +* `aborted` Boolean which is set to true when calling `abort()`. There + is no way at this time to continue a glob search after aborting, but + you can re-use the statCache to avoid having to duplicate syscalls. +* `statCache` Collection of all the stat results the glob search + performed. +* `cache` Convenience object. Each field has the following possible + values: + * `false` - Path does not exist + * `true` - Path exists + * `'DIR'` - Path exists, and is not a directory + * `'FILE'` - Path exists, and is a directory + * `[file, entries, ...]` - Path exists, is a directory, and the + array value is the results of `fs.readdir` +* `statCache` Cache of `fs.stat` results, to prevent statting the same + path multiple times. +* `symlinks` A record of which paths are symbolic links, which is + relevant in resolving `**` patterns. +* `realpathCache` An optional object which is passed to `fs.realpath` + to minimize unnecessary syscalls. It is stored on the instantiated + Glob object, and may be re-used. + +### Events + +* `end` When the matching is finished, this is emitted with all the + matches found. If the `nonull` option is set, and no match was found, + then the `matches` list contains the original pattern. The matches + are sorted, unless the `nosort` flag is set. +* `match` Every time a match is found, this is emitted with the matched. +* `error` Emitted when an unexpected error is encountered, or whenever + any fs error occurs if `options.strict` is set. +* `abort` When `abort()` is called, this event is raised. + +### Methods + +* `pause` Temporarily stop the search +* `resume` Resume the search +* `abort` Stop the search forever + +### Options + +All the options that can be passed to Minimatch can also be passed to +Glob to change pattern matching behavior. Also, some have been added, +or have glob-specific ramifications. + +All options are false by default, unless otherwise noted. + +All options are added to the Glob object, as well. + +If you are running many `glob` operations, you can pass a Glob object +as the `options` argument to a subsequent operation to shortcut some +`stat` and `readdir` calls. At the very least, you may pass in shared +`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that +parallel glob operations will be sped up by sharing information about +the filesystem. + +* `cwd` The current working directory in which to search. Defaults + to `process.cwd()`. +* `root` The place where patterns starting with `/` will be mounted + onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix + systems, and `C:\` or some such on Windows.) +* `dot` Include `.dot` files in normal matches and `globstar` matches. + Note that an explicit dot in a portion of the pattern will always + match dot files. +* `nomount` By default, a pattern starting with a forward-slash will be + "mounted" onto the root setting, so that a valid filesystem path is + returned. Set this flag to disable that behavior. +* `mark` Add a `/` character to directory matches. Note that this + requires additional stat calls. +* `nosort` Don't sort the results. +* `stat` Set to true to stat *all* results. This reduces performance + somewhat, and is completely unnecessary, unless `readdir` is presumed + to be an untrustworthy indicator of file existence. +* `silent` When an unusual error is encountered when attempting to + read a directory, a warning will be printed to stderr. Set the + `silent` option to true to suppress these warnings. +* `strict` When an unusual error is encountered when attempting to + read a directory, the process will just continue on in search of + other matches. Set the `strict` option to raise an error in these + cases. +* `cache` See `cache` property above. Pass in a previously generated + cache object to save some fs calls. +* `statCache` A cache of results of filesystem information, to prevent + unnecessary stat calls. While it should not normally be necessary + to set this, you may pass the statCache from one glob() call to the + options object of another, if you know that the filesystem will not + change between calls. (See "Race Conditions" below.) +* `symlinks` A cache of known symbolic links. You may pass in a + previously generated `symlinks` object to save `lstat` calls when + resolving `**` matches. +* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead. +* `nounique` In some cases, brace-expanded patterns can result in the + same file showing up multiple times in the result set. By default, + this implementation prevents duplicates in the result set. Set this + flag to disable that behavior. +* `nonull` Set to never return an empty set, instead returning a set + containing the pattern itself. This is the default in glob(3). +* `debug` Set to enable debug logging in minimatch and glob. +* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. +* `noglobstar` Do not match `**` against multiple filenames. (Ie, + treat it as a normal `*` instead.) +* `noext` Do not match `+(a|b)` "extglob" patterns. +* `nocase` Perform a case-insensitive match. Note: on + case-insensitive filesystems, non-magic patterns will match by + default, since `stat` and `readdir` will not raise errors. +* `matchBase` Perform a basename-only match if the pattern does not + contain any slash characters. That is, `*.js` would be treated as + equivalent to `**/*.js`, matching all js files in all directories. +* `nonegate` Suppress `negate` behavior. (See below.) +* `nocomment` Suppress `comment` behavior. (See below.) +* `nonull` Return the pattern when no matches are found. +* `nodir` Do not match directories, only files. (Note: to match + *only* directories, simply put a `/` at the end of the pattern.) +* `ignore` Add a pattern or an array of patterns to exclude matches. +* `follow` Follow symlinked directories when expanding `**` patterns. + Note that this can result in a lot of duplicate references in the + presence of cyclic links. +* `realpath` Set to true to call `fs.realpath` on all of the results. + In the case of a symlink that cannot be resolved, the full absolute + path to the matched entry is returned (though it will usually be a + broken symlink) + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between node-glob and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.3, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +Note that symlinked directories are not crawled as part of a `**`, +though their contents may match against subsequent portions of the +pattern. This prevents infinite loops and duplicates and the like. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then glob returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only `/` +characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes will always +be interpreted as escape characters, not path separators. + +Results from absolute patterns such as `/foo/*` are mounted onto the +root setting using `path.join`. On windows, this will by default result +in `/foo/*` matching `C:\foo\bar.txt`. + +## Race Conditions + +Glob searching, by its very nature, is susceptible to race conditions, +since it relies on directory walking and such. + +As a result, it is possible that a file that exists when glob looks for +it may have been deleted or modified by the time it returns the result. + +As part of its internal implementation, this program caches all stat +and readdir calls that it makes, in order to cut down on system +overhead. However, this also makes it even more susceptible to races, +especially if the cache or statCache objects are reused between glob +calls. + +Users are thus advised not to use a glob result as a guarantee of +filesystem state in the face of rapid changes. For the vast majority +of operations, this is never a problem. + +## Contributing + +Any change to behavior (including bugfixes) must come with a test. + +Patches that fail tests or reduce performance will be rejected. + +``` +# to run tests +npm test + +# to re-generate test fixtures +npm run test-regen + +# to benchmark against bash/zsh +npm run bench + +# to profile javascript +npm run prof +``` diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/common.js b/deps/npm/node_modules/node-gyp/node_modules/glob/common.js new file mode 100644 index 00000000000..cd7c8244812 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/common.js @@ -0,0 +1,237 @@ +exports.alphasort = alphasort +exports.alphasorti = alphasorti +exports.isAbsolute = process.platform === "win32" ? absWin : absUnix +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored + +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) +} + +var path = require("path") +var minimatch = require("minimatch") +var Minimatch = minimatch.Minimatch + +function absWin (p) { + if (absUnix(p)) return true + // pull off the device/UNC bit from a windows path. + // from node's lib/path.js + var splitDeviceRe = + /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/ + var result = splitDeviceRe.exec(p) + var device = result[1] || '' + var isUnc = device && device.charAt(1) !== ':' + var isAbsolute = !!result[2] || isUnc // UNC paths are always absolute + + return isAbsolute +} + +function absUnix (p) { + return p.charAt(0) === "/" || p === "" +} + +function alphasorti (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()) +} + +function alphasort (a, b) { + return a.localeCompare(b) +} + +function setupIgnores (self, options) { + self.ignore = options.ignore || [] + + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] + + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } +} + +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern, { nonegate: true }) + } + + return { + matcher: new Minimatch(pattern, { nonegate: true }), + gmatcher: gmatcher + } +} + +function setopts (self, pattern, options) { + if (!options) + options = {} + + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } + + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) + + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = cwd + else { + self.cwd = options.cwd + self.changedCwd = path.resolve(options.cwd) !== cwd + } + + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + if (process.platform === "win32") + self.root = self.root.replace(/\\/g, "/") + + self.nomount = !!options.nomount + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options +} + +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) + + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) + else + m.forEach(function (m) { + all[m] = true + }) + } + } + + if (!nou) + all = Object.keys(all) + + if (!self.nosort) + all = all.sort(self.nocase ? alphasorti : alphasort) + + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + return !(/\/$/.test(e)) + }) + } + } + + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) + + self.found = all +} + +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' + + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) + + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } + } + + return m +} + +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (exports.isAbsolute(f)) { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else if (self.realpath) { + abs = path.resolve(f) + } + return abs +} + + +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} + +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/glob.js b/deps/npm/node_modules/node-gyp/node_modules/glob/glob.js new file mode 100644 index 00000000000..eac0693cc6c --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/glob.js @@ -0,0 +1,740 @@ +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. + +module.exports = glob + +var fs = require('fs') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var inherits = require('inherits') +var EE = require('events').EventEmitter +var path = require('path') +var assert = require('assert') +var globSync = require('./sync.js') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var isAbsolute = common.isAbsolute +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = require('inflight') +var util = require('util') +var childrenIgnored = common.childrenIgnored + +var once = require('once') + +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} + + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) + } + + return new Glob(pattern, options, cb) +} + +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync + +// old api surface +glob.glob = glob + +glob.hasMagic = function (pattern, options_) { + var options = util._extend({}, options_) + options.noprocess = true + + var g = new Glob(pattern, options) + var set = g.minimatch.set + if (set.length > 1) + return true + + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true + } + + return false +} + +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) + } + + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) + + setopts(this, pattern, options) + this._didRealPath = false + + // process each pattern in the minimatch set + var n = this.minimatch.set.length + + // The matches are stored as {: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) + + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) + } + + var self = this + var n = this.minimatch.set.length + this._processing = 0 + this.matches = new Array(n) + + this._emitQueue = [] + this._processQueue = [] + this.paused = false + + if (this.noprocess) + return this + + if (n === 0) + return done() + + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) + } + + function done () { + --self._processing + if (self._processing <= 0) + self._finish() + } +} + +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return + + if (this.realpath && !this._didRealpath) + return this._realpath() + + common.finish(this) + this.emit('end', this.found) +} + +Glob.prototype._realpath = function () { + if (this._didRealpath) + return + + this._didRealpath = true + + var n = this.matches.length + if (n === 0) + return this._finish() + + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) + + function next () { + if (--n === 0) + self._finish() + } +} + +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() + + var found = Object.keys(matchset) + var self = this + var n = found.length + + if (n === 0) + return cb() + + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + fs.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + + if (--n === 0) { + self.matches[index] = set + cb() + } + }) + }) +} + +Glob.prototype._mark = function (p) { + return common.mark(this, p) +} + +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} + +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') + } +} + +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } + } + } +} + +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') + + if (this.aborted) + return + + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} + +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return cb() + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + this._process([e].concat(remain), index, inGlobStar, cb) + } + cb() +} + +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return + + if (this.matches[index][e]) + return + + if (this.paused) { + this._emitQueue.push([index, e]) + return + } + + var abs = this._makeAbs(e) + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + if (this.mark) + e = this._mark(e) + + this.matches[index][e] = true + + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) + + this.emit('match', e) +} + +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return + + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) + + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) + + if (lstatcb) + fs.lstat(abs, lstatcb) + + function lstatcb_ (er, lstat) { + if (er) + return cb() + + var isSym = lstat.isSymbolicLink() + self.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) + } +} + +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return + + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() + + if (Array.isArray(c)) + return cb(null, c) + } + + var self = this + fs.readdir(abs, readdirCb(this, abs, cb)) +} + +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) + } +} + +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return + + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + return cb(null, entries) +} + +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return + + // handle errors, and cache the information + switch (er.code) { + case 'ENOTDIR': // totally normal. means it *does* exist. + this.cache[this._makeAbs(f)] = 'FILE' + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) return this.emit('error', er) + if (!this.silent) console.error('glob error', er) + break + } + return cb() +} + +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + + +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) + + var isSym = this.symlinks[abs] + var len = entries.length + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) + } + + cb() +} + +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) + cb() +} + +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return cb() + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) + + if (needDir && c === 'FILE') + return cb() + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } + + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + fs.lstat(abs, statcb) + + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } + } +} + +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er) { + this.statCache[abs] = false + return cb() + } + + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat + + if (abs.slice(-1) === '/' && !stat.isDirectory()) + return cb(null, false, stat) + + var c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c !== 'DIR') + return cb() + + return cb(null, c, stat) +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/LICENSE b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/LICENSE new file mode 100644 index 00000000000..19129e315fe --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/README.md b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/README.md new file mode 100644 index 00000000000..d458bc2e0a6 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/README.md @@ -0,0 +1,216 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.png)](http://travis-ci.org/isaacs/minimatch) + + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Usage + +```javascript +var minimatch = require("minimatch") + +minimatch("bar.foo", "*.foo") // true! +minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +* Brace Expansion +* Extended glob matching +* "Globstar" `**` matching + +See: + +* `man sh` +* `man bash` +* `man 3 fnmatch` +* `man 5 gitignore` + +## Minimatch Class + +Create a minimatch object by instanting the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require("minimatch").Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +* `pattern` The original pattern the minimatch object represents. +* `options` The options supplied to the constructor. +* `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +* `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +* `negate` True if the pattern is negated. +* `comment` True if the pattern is a comment. +* `empty` True if the pattern is `""`. + +### Methods + +* `makeRe` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +* `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +* `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. + +All other methods are internal, and will be called as necessary. + +## Functions + +The top-level exported function has a `cache` property, which is an LRU +cache set to store 100 items. So, calling these methods repeatedly +with the same pattern and options will use the same Minimatch object, +saving the cost of parsing it multiple times. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, "*.js", { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) +``` + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/browser.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/browser.js new file mode 100644 index 00000000000..967b45c0d67 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/browser.js @@ -0,0 +1,1113 @@ +(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 any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + if (typeof pattern === 'undefined') { + throw new Error('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var plType + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + plType = stateChar + patternListStack.push({ type: plType, start: i - 1, reStart: re.length }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + re += ')' + plType = patternListStack.pop().type + // negation is (?:(?!js)[^/]*) + // The others are (?:) + switch (plType) { + case '!': + re += '[^/]*?)' + break + case '?': + case '+': + case '*': + re += plType + break + case '@': break // the default anyway + } + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (var pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + 3) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) re = '(?=.)' + re + + if (addPatternStart) re = patternStart + re + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + var regExp = new RegExp('^' + re + '$', flags) + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } + + // should be unreachable. + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} + +},{"brace-expansion":2,"path":undefined}],2:[function(require,module,exports){ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + var expansions = expand(escapeBraces(str)); + return expansions.filter(identity).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = /^(.*,)+(.+)?$/.test(m.body); + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0]).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + expansions.push([pre, N[j], post[k]].join('')) + } + } + + return expansions; +} + + +},{"balanced-match":3,"concat-map":4}],3:[function(require,module,exports){ +module.exports = balanced; +function balanced(a, b, str) { + var bal = 0; + var m = {}; + var ended = false; + + for (var i = 0; i < str.length; i++) { + if (a == str.substr(i, a.length)) { + if (!('start' in m)) m.start = i; + bal++; + } + else if (b == str.substr(i, b.length) && 'start' in m) { + ended = true; + bal--; + if (!bal) { + m.end = i; + m.pre = str.substr(0, m.start); + m.body = (m.end - m.start > 1) + ? str.substring(m.start + a.length, m.end) + : ''; + m.post = str.slice(m.end + b.length); + return m; + } + } + } + + // if we opened more than we closed, find the one we closed + if (bal && ended) { + var start = m.start + a.length; + m = balanced(a, b, str.substr(start)); + if (m) { + m.start += start; + m.end += start; + m.pre = str.slice(0, start) + m.pre; + } + return m; + } +} + +},{}],4:[function(require,module,exports){ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (Array.isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +},{}]},{},[1]); diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/minimatch.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/minimatch.js new file mode 100644 index 00000000000..5e13d6d5b2e --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/minimatch.js @@ -0,0 +1,867 @@ +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = { sep: '/' } +try { + path = require('path') +} catch (er) {} + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = require('brace-expansion') + +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + if (typeof pattern === 'undefined') { + throw new Error('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var plType + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + plType = stateChar + patternListStack.push({ type: plType, start: i - 1, reStart: re.length }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + re += ')' + plType = patternListStack.pop().type + // negation is (?:(?!js)[^/]*) + // The others are (?:) + switch (plType) { + case '!': + re += '[^/]*?)' + break + case '?': + case '+': + case '*': + re += plType + break + case '@': break // the default anyway + } + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (var pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + 3) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) re = '(?=.)' + re + + if (addPatternStart) re = patternStart + re + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + var regExp = new RegExp('^' + re + '$', flags) + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } + + // should be unreachable. + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore new file mode 100644 index 00000000000..249bc20eb55 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore @@ -0,0 +1,2 @@ +node_modules +*.sw* diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml new file mode 100644 index 00000000000..6e5919de39a --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "0.10" diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md new file mode 100644 index 00000000000..62bc7bae3fe --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md @@ -0,0 +1,121 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma seperated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## 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/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js new file mode 100644 index 00000000000..60ecfc74d41 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js @@ -0,0 +1,8 @@ +var expand = require('./'); + +console.log(expand('http://any.org/archive{1996..1999}/vol{1..4}/part{a,b,c}.html')); +console.log(expand('http://www.numericals.com/file{1..100..10}.txt')); +console.log(expand('http://www.letters.com/file{a..z..2}.txt')); +console.log(expand('mkdir /usr/local/src/bash/{old,new,dist,bugs}')); +console.log(expand('chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}')); + diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js new file mode 100644 index 00000000000..a23104e9550 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js @@ -0,0 +1,191 @@ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = /^(.*,)+(.+)?$/.test(m.body); + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} + diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore new file mode 100644 index 00000000000..fd4f2b066b3 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore @@ -0,0 +1,2 @@ +node_modules +.DS_Store diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml new file mode 100644 index 00000000000..cc4dba29d95 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile new file mode 100644 index 00000000000..fa5da71a6d0 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile @@ -0,0 +1,6 @@ + +test: + @node_modules/.bin/tape test/*.js + +.PHONY: test + diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md new file mode 100644 index 00000000000..2aff0ebff44 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md @@ -0,0 +1,80 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `` and ``. + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## 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/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js new file mode 100644 index 00000000000..c02ad348e69 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js @@ -0,0 +1,5 @@ +var balanced = require('./'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); + diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js new file mode 100644 index 00000000000..d165ae8174c --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js @@ -0,0 +1,38 @@ +module.exports = balanced; +function balanced(a, b, str) { + var bal = 0; + var m = {}; + var ended = false; + + for (var i = 0; i < str.length; i++) { + if (a == str.substr(i, a.length)) { + if (!('start' in m)) m.start = i; + bal++; + } + else if (b == str.substr(i, b.length) && 'start' in m) { + ended = true; + bal--; + if (!bal) { + m.end = i; + m.pre = str.substr(0, m.start); + m.body = (m.end - m.start > 1) + ? str.substring(m.start + a.length, m.end) + : ''; + m.post = str.slice(m.end + b.length); + return m; + } + } + } + + // if we opened more than we closed, find the one we closed + if (bal && ended) { + var start = m.start + a.length; + m = balanced(a, b, str.substr(start)); + if (m) { + m.start += start; + m.end += start; + m.pre = str.slice(0, start) + m.pre; + } + return m; + } +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json new file mode 100644 index 00000000000..ede6efefa07 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json @@ -0,0 +1,73 @@ +{ + "name": "balanced-match", + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "version": "0.2.0", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "main": "index.js", + "scripts": { + "test": "make test" + }, + "dependencies": {}, + "devDependencies": { + "tape": "~1.1.1" + }, + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "gitHead": "ba40ed78e7114a4a67c51da768a100184dead39c", + "bugs": { + "url": "https://github.com/juliangruber/balanced-match/issues" + }, + "_id": "balanced-match@0.2.0", + "_shasum": "38f6730c03aab6d5edbb52bd934885e756d71674", + "_from": "balanced-match@>=0.2.0 <0.3.0", + "_npmVersion": "2.1.8", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + "maintainers": [ + { + "name": "juliangruber", + "email": "julian@juliangruber.com" + } + ], + "dist": { + "shasum": "38f6730c03aab6d5edbb52bd934885e756d71674", + "tarball": "http://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js new file mode 100644 index 00000000000..36bfd399548 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js @@ -0,0 +1,56 @@ +var test = require('tape'); +var balanced = require('..'); + +test('balanced', function(t) { + t.deepEqual(balanced('{', '}', 'pre{in{nest}}post'), { + start: 3, + end: 12, + pre: 'pre', + body: 'in{nest}', + post: 'post' + }); + t.deepEqual(balanced('{', '}', '{{{{{{{{{in}post'), { + start: 8, + end: 11, + pre: '{{{{{{{{', + body: 'in', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre{body{in}post'), { + start: 8, + end: 11, + pre: 'pre{body', + body: 'in', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre}{in{nest}}post'), { + start: 4, + end: 13, + pre: 'pre}', + body: 'in{nest}', + post: 'post' + }); + t.deepEqual(balanced('{', '}', 'pre{body}between{body2}post'), { + start: 3, + end: 8, + pre: 'pre', + body: 'body', + post: 'between{body2}post' + }); + t.notOk(balanced('{', '}', 'nope'), 'should be notOk'); + t.deepEqual(balanced('', '', 'preinnestpost'), { + start: 3, + end: 19, + pre: 'pre', + body: 'innest', + post: 'post' + }); + t.deepEqual(balanced('', '', 'preinnestpost'), { + start: 7, + end: 23, + pre: 'pre', + body: 'innest', + post: 'post' + }); + t.end(); +}); diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml new file mode 100644 index 00000000000..f1d0f13c8a5 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE new file mode 100644 index 00000000000..ee27ba4b441 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +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/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown new file mode 100644 index 00000000000..408f70a1be4 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown @@ -0,0 +1,62 @@ +concat-map +========== + +Concatenative mapdashery. + +[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) + +[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) + +example +======= + +``` js +var concatMap = require('concat-map'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); +``` + +*** + +``` +[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] +``` + +methods +======= + +``` js +var concatMap = require('concat-map') +``` + +concatMap(xs, fn) +----------------- + +Return an array of concatenated elements by calling `fn(x, i)` for each element +`x` and each index `i` in the array `xs`. + +When `fn(x, i)` returns an array, its result will be concatenated with the +result array. If `fn(x, i)` returns anything else, that value will be pushed +onto the end of the result array. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install concat-map +``` + +license +======= + +MIT + +notes +===== + +This module was written while sitting high above the ground in a tree. diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js new file mode 100644 index 00000000000..33656217b61 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js @@ -0,0 +1,6 @@ +var concatMap = require('../'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js new file mode 100644 index 00000000000..b29a7812e50 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js @@ -0,0 +1,13 @@ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json new file mode 100644 index 00000000000..b516138098f --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json @@ -0,0 +1,83 @@ +{ + "name": "concat-map", + "description": "concatenative mapdashery", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "git://github.com/substack/node-concat-map.git" + }, + "main": "index.js", + "keywords": [ + "concat", + "concatMap", + "map", + "functional", + "higher-order" + ], + "directories": { + "example": "example", + "test": "test" + }, + "scripts": { + "test": "tape test/*.js" + }, + "devDependencies": { + "tape": "~2.4.0" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "testling": { + "files": "test/*.js", + "browsers": { + "ie": [ + 6, + 7, + 8, + 9 + ], + "ff": [ + 3.5, + 10, + 15 + ], + "chrome": [ + 10, + 22 + ], + "safari": [ + 5.1 + ], + "opera": [ + 12 + ] + } + }, + "bugs": { + "url": "https://github.com/substack/node-concat-map/issues" + }, + "homepage": "https://github.com/substack/node-concat-map", + "_id": "concat-map@0.0.1", + "dist": { + "shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", + "tarball": "http://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + }, + "_from": "concat-map@0.0.1", + "_npmVersion": "1.3.21", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "_shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", + "_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js new file mode 100644 index 00000000000..fdbd7022f6d --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js @@ -0,0 +1,39 @@ +var concatMap = require('../'); +var test = require('tape'); + +test('empty or not', function (t) { + var xs = [ 1, 2, 3, 4, 5, 6 ]; + var ixes = []; + var ys = concatMap(xs, function (x, ix) { + ixes.push(ix); + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; + }); + t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); + t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); + t.end(); +}); + +test('always something', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('scalars', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : x; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('undefs', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function () {}); + t.same(ys, [ undefined, undefined, undefined, undefined ]); + t.end(); +}); diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json new file mode 100644 index 00000000000..5f1866c8b5a --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json @@ -0,0 +1,75 @@ +{ + "name": "brace-expansion", + "description": "Brace expansion as known from sh/bash", + "version": "1.1.0", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "main": "index.js", + "scripts": { + "test": "tape test/*.js", + "gentest": "bash test/generate.sh" + }, + "dependencies": { + "balanced-match": "^0.2.0", + "concat-map": "0.0.1" + }, + "devDependencies": { + "tape": "^3.0.3" + }, + "keywords": [], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "gitHead": "b5fa3b1c74e5e2dba2d0efa19b28335641bc1164", + "bugs": { + "url": "https://github.com/juliangruber/brace-expansion/issues" + }, + "_id": "brace-expansion@1.1.0", + "_shasum": "c9b7d03c03f37bc704be100e522b40db8f6cfcd9", + "_from": "brace-expansion@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.10", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + "maintainers": [ + { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + { + "name": "isaacs", + "email": "isaacs@npmjs.com" + } + ], + "dist": { + "shasum": "c9b7d03c03f37bc704be100e522b40db8f6cfcd9", + "tarball": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js new file mode 100644 index 00000000000..5fe2b8ad48c --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js @@ -0,0 +1,32 @@ +var test = require('tape'); +var expand = require('..'); +var fs = require('fs'); +var resfile = __dirname + '/bash-results.txt'; +var cases = fs.readFileSync(resfile, 'utf8').split('><><><><'); + +// throw away the EOF marker +cases.pop() + +test('matches bash expansions', function(t) { + cases.forEach(function(testcase) { + var set = testcase.split('\n'); + var pattern = set.shift(); + var actual = expand(pattern); + + // If it expands to the empty string, then it's actually + // just nothing, but Bash is a singly typed language, so + // "nothing" is the same as "". + if (set.length === 1 && set[0] === '') { + set = [] + } else { + // otherwise, strip off the [] that were added so that + // "" expansions would be preserved properly. + set = set.map(function (s) { + return s.replace(/^\[|\]$/g, '') + }) + } + + t.same(actual, set, pattern); + }); + t.end(); +}) diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt new file mode 100644 index 00000000000..958148d26aa --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt @@ -0,0 +1,1075 @@ +A{b,{d,e},{f,g}}Z +[AbZ] +[AdZ] +[AeZ] +[AfZ] +[AgZ]><><><><><><><\{a,b}{{a,b},a,b} +[{a,b}a] +[{a,b}b] +[{a,b}a] +[{a,b}b]><><><><{{a,b} +[{a] +[{b]><><><><{a,b}} +[a}] +[b}]><><><><{,} +><><><><><><><{,}b +[b] +[b]><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><{-01..5} +[-01] +[000] +[001] +[002] +[003] +[004] +[005]><><><><{-05..100..5} +[-05] +[000] +[005] +[010] +[015] +[020] +[025] +[030] +[035] +[040] +[045] +[050] +[055] +[060] +[065] +[070] +[075] +[080] +[085] +[090] +[095] +[100]><><><><{-05..100} +[-05] +[-04] +[-03] +[-02] +[-01] +[000] +[001] +[002] +[003] +[004] +[005] +[006] +[007] +[008] +[009] +[010] +[011] +[012] +[013] +[014] +[015] +[016] +[017] +[018] +[019] +[020] +[021] +[022] +[023] +[024] +[025] +[026] +[027] +[028] +[029] +[030] +[031] +[032] +[033] +[034] +[035] +[036] +[037] +[038] +[039] +[040] +[041] +[042] +[043] +[044] +[045] +[046] +[047] +[048] +[049] +[050] +[051] +[052] +[053] +[054] +[055] +[056] +[057] +[058] +[059] +[060] +[061] +[062] +[063] +[064] +[065] +[066] +[067] +[068] +[069] +[070] +[071] +[072] +[073] +[074] +[075] +[076] +[077] +[078] +[079] +[080] +[081] +[082] +[083] +[084] +[085] +[086] +[087] +[088] +[089] +[090] +[091] +[092] +[093] +[094] +[095] +[096] +[097] +[098] +[099] +[100]><><><><{0..5..2} +[0] +[2] +[4]><><><><{0001..05..2} +[0001] +[0003] +[0005]><><><><{0001..-5..2} +[0001] +[-001] +[-003] +[-005]><><><><{0001..-5..-2} +[0001] +[-001] +[-003] +[-005]><><><><{0001..5..-2} +[0001] +[0003] +[0005]><><><><{01..5} +[01] +[02] +[03] +[04] +[05]><><><><{1..05} +[01] +[02] +[03] +[04] +[05]><><><><{1..05..3} +[01] +[04]><><><><{05..100} +[005] +[006] +[007] +[008] +[009] +[010] +[011] +[012] +[013] +[014] +[015] +[016] +[017] +[018] +[019] +[020] +[021] +[022] +[023] +[024] +[025] +[026] +[027] +[028] +[029] +[030] +[031] +[032] +[033] +[034] +[035] +[036] +[037] +[038] +[039] +[040] +[041] +[042] +[043] +[044] +[045] +[046] +[047] +[048] +[049] +[050] +[051] +[052] +[053] +[054] +[055] +[056] +[057] +[058] +[059] +[060] +[061] +[062] +[063] +[064] +[065] +[066] +[067] +[068] +[069] +[070] +[071] +[072] +[073] +[074] +[075] +[076] +[077] +[078] +[079] +[080] +[081] +[082] +[083] +[084] +[085] +[086] +[087] +[088] +[089] +[090] +[091] +[092] +[093] +[094] +[095] +[096] +[097] +[098] +[099] +[100]><><><><{0a..0z} +[{0a..0z}]><><><><{a,b\}c,d} +[a] +[b}c] +[d]><><><><{a,b{c,d} +[{a,bc] +[{a,bd]><><><><{a,b}c,d} +[ac,d}] +[bc,d}]><><><><{a..F} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F]><><><><{A..f} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a] +[b] +[c] +[d] +[e] +[f]><><><><{a..Z} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z]><><><><{A..z} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a] +[b] +[c] +[d] +[e] +[f] +[g] +[h] +[i] +[j] +[k] +[l] +[m] +[n] +[o] +[p] +[q] +[r] +[s] +[t] +[u] +[v] +[w] +[x] +[y] +[z]><><><><{z..A} +[z] +[y] +[x] +[w] +[v] +[u] +[t] +[s] +[r] +[q] +[p] +[o] +[n] +[m] +[l] +[k] +[j] +[i] +[h] +[g] +[f] +[e] +[d] +[c] +[b] +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F] +[E] +[D] +[C] +[B] +[A]><><><><{Z..a} +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a]><><><><{a..F..2} +[a] +[_] +[]] +[[] +[Y] +[W] +[U] +[S] +[Q] +[O] +[M] +[K] +[I] +[G]><><><><{A..f..02} +[A] +[C] +[E] +[G] +[I] +[K] +[M] +[O] +[Q] +[S] +[U] +[W] +[Y] +[[] +[]] +[_] +[a] +[c] +[e]><><><><{a..Z..5} +[a] +[]><><><><><><><{A..z..10} +[A] +[K] +[U] +[_] +[i] +[s]><><><><{z..A..-2} +[z] +[x] +[v] +[t] +[r] +[p] +[n] +[l] +[j] +[h] +[f] +[d] +[b] +[`] +[^] +[] +[Z] +[X] +[V] +[T] +[R] +[P] +[N] +[L] +[J] +[H] +[F] +[D] +[B]><><><><{Z..a..20} +[Z]><><><><{a{,b} +[{a] +[{ab]><><><><{a},b} +[a}] +[b]><><><><{x,y{,}g} +[x] +[yg] +[yg]><><><><{x,y{}g} +[x] +[y{}g]><><><><{{a,b} +[{a] +[{b]><><><><{{a,b},c} +[a] +[b] +[c]><><><><{{a,b}c} +[{ac}] +[{bc}]><><><><{{a,b},} +[a] +[b]><><><><><><><{{a,b},}c +[ac] +[bc] +[c]><><><><{{a,b}.} +[{a.}] +[{b.}]><><><><{{a,b}} +[{a}] +[{b}]><><><><><><>< +><><><><{-10..00} +[-10] +[-09] +[-08] +[-07] +[-06] +[-05] +[-04] +[-03] +[-02] +[-01] +[000]><><><><{a,\\{a,b}c} +[a] +[\ac] +[\bc]><><><><{a,\{a,b}c} +[ac}] +[{ac}] +[bc}]><><><><><><><{-10.\.00} +[{-10..00}]><><><><><><><><><><{l,n,m}xyz +[lxyz] +[nxyz] +[mxyz]><><><><{abc\,def} +[{abc,def}]><><><><{abc} +[{abc}]><><><><{x\,y,\{abc\},trie} +[x,y] +[{abc}] +[trie]><><><><{} +[{}]><><><><} +[}]><><><><{ +[{]><><><><><><><{1..10} +[1] +[2] +[3] +[4] +[5] +[6] +[7] +[8] +[9] +[10]><><><><{0..10,braces} +[0..10] +[braces]><><><><{{0..10},braces} +[0] +[1] +[2] +[3] +[4] +[5] +[6] +[7] +[8] +[9] +[10] +[braces]><><><><><><><{3..3} +[3]><><><><><><><{10..1} +[10] +[9] +[8] +[7] +[6] +[5] +[4] +[3] +[2] +[1]><><><><{10..1}y +[10y] +[9y] +[8y] +[7y] +[6y] +[5y] +[4y] +[3y] +[2y] +[1y]><><><><><><><{a..f} +[a] +[b] +[c] +[d] +[e] +[f]><><><><{f..a} +[f] +[e] +[d] +[c] +[b] +[a]><><><><{a..A} +[a] +[`] +[_] +[^] +[]] +[] +[[] +[Z] +[Y] +[X] +[W] +[V] +[U] +[T] +[S] +[R] +[Q] +[P] +[O] +[N] +[M] +[L] +[K] +[J] +[I] +[H] +[G] +[F] +[E] +[D] +[C] +[B] +[A]><><><><{A..a} +[A] +[B] +[C] +[D] +[E] +[F] +[G] +[H] +[I] +[J] +[K] +[L] +[M] +[N] +[O] +[P] +[Q] +[R] +[S] +[T] +[U] +[V] +[W] +[X] +[Y] +[Z] +[[] +[] +[]] +[^] +[_] +[`] +[a]><><><><{f..f} +[f]><><><><{1..f} +[{1..f}]><><><><{f..1} +[{f..1}]><><><><{-1..-10} +[-1] +[-2] +[-3] +[-4] +[-5] +[-6] +[-7] +[-8] +[-9] +[-10]><><><><{-20..0} +[-20] +[-19] +[-18] +[-17] +[-16] +[-15] +[-14] +[-13] +[-12] +[-11] +[-10] +[-9] +[-8] +[-7] +[-6] +[-5] +[-4] +[-3] +[-2] +[-1] +[0]><><><><><><><><><><{klklkl}{1,2,3} +[{klklkl}1] +[{klklkl}2] +[{klklkl}3]><><><><{1..10..2} +[1] +[3] +[5] +[7] +[9]><><><><{-1..-10..2} +[-1] +[-3] +[-5] +[-7] +[-9]><><><><{-1..-10..-2} +[-1] +[-3] +[-5] +[-7] +[-9]><><><><{10..1..-2} +[10] +[8] +[6] +[4] +[2]><><><><{10..1..2} +[10] +[8] +[6] +[4] +[2]><><><><{1..20..2} +[1] +[3] +[5] +[7] +[9] +[11] +[13] +[15] +[17] +[19]><><><><{1..20..20} +[1]><><><><{100..0..5} +[100] +[95] +[90] +[85] +[80] +[75] +[70] +[65] +[60] +[55] +[50] +[45] +[40] +[35] +[30] +[25] +[20] +[15] +[10] +[5] +[0]><><><><{100..0..-5} +[100] +[95] +[90] +[85] +[80] +[75] +[70] +[65] +[60] +[55] +[50] +[45] +[40] +[35] +[30] +[25] +[20] +[15] +[10] +[5] +[0]><><><><{a..z} +[a] +[b] +[c] +[d] +[e] +[f] +[g] +[h] +[i] +[j] +[k] +[l] +[m] +[n] +[o] +[p] +[q] +[r] +[s] +[t] +[u] +[v] +[w] +[x] +[y] +[z]><><><><{a..z..2} +[a] +[c] +[e] +[g] +[i] +[k] +[m] +[o] +[q] +[s] +[u] +[w] +[y]><><><><{z..a..-2} +[z] +[x] +[v] +[t] +[r] +[p] +[n] +[l] +[j] +[h] +[f] +[d] +[b]><><><><{2147483645..2147483649} +[2147483645] +[2147483646] +[2147483647] +[2147483648] +[2147483649]><><><><{10..0..2} +[10] +[8] +[6] +[4] +[2] +[0]><><><><{10..0..-2} +[10] +[8] +[6] +[4] +[2] +[0]><><><><{-50..-0..5} +[-50] +[-45] +[-40] +[-35] +[-30] +[-25] +[-20] +[-15] +[-10] +[-5] +[0]><><><><{1..10.f} +[{1..10.f}]><><><><{1..ff} +[{1..ff}]><><><><{1..10..ff} +[{1..10..ff}]><><><><{1.20..2} +[{1.20..2}]><><><><{1..20..f2} +[{1..20..f2}]><><><><{1..20..2f} +[{1..20..2f}]><><><><{1..2f..2} +[{1..2f..2}]><><><><{1..ff..2} +[{1..ff..2}]><><><><{1..ff} +[{1..ff}]><><><><{1..f} +[{1..f}]><><><><{1..0f} +[{1..0f}]><><><><{1..10f} +[{1..10f}]><><><><{1..10.f} +[{1..10.f}]><><><><{1..10.f} +[{1..10.f}]><><><>< \ No newline at end of file diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt new file mode 100644 index 00000000000..e5161c3da86 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt @@ -0,0 +1,182 @@ +# skip quotes for now +# "{x,x}" +# {"x,x"} +# {x","x} +# '{a,b}{{a,b},a,b}' +A{b,{d,e},{f,g}}Z +PRE-{a,b}{{a,b},a,b}-POST +\\{a,b}{{a,b},a,b} +{{a,b} +{a,b}} +{,} +a{,} +{,}b +a{,}b +a{b}c +a{1..5}b +a{01..5}b +a{-01..5}b +a{-01..5..3}b +a{001..9}b +a{b,c{d,e},{f,g}h}x{y,z +a{b,c{d,e},{f,g}h}x{y,z\\} +a{b,c{d,e},{f,g}h}x{y,z} +a{b{c{d,e}f{x,y{{g}h +a{b{c{d,e}f{x,y{}g}h +a{b{c{d,e}f{x,y}}g}h +a{b{c{d,e}f}g}h +a{{x,y},z}b +f{x,y{g,z}}h +f{x,y{{g,z}}h +f{x,y{{g,z}}h} +f{x,y{{g}h +f{x,y{{g}}h +f{x,y{}g}h +z{a,b{,c}d +z{a,b},c}d +{-01..5} +{-05..100..5} +{-05..100} +{0..5..2} +{0001..05..2} +{0001..-5..2} +{0001..-5..-2} +{0001..5..-2} +{01..5} +{1..05} +{1..05..3} +{05..100} +{0a..0z} +{a,b\\}c,d} +{a,b{c,d} +{a,b}c,d} +{a..F} +{A..f} +{a..Z} +{A..z} +{z..A} +{Z..a} +{a..F..2} +{A..f..02} +{a..Z..5} +d{a..Z..5}b +{A..z..10} +{z..A..-2} +{Z..a..20} +{a{,b} +{a},b} +{x,y{,}g} +{x,y{}g} +{{a,b} +{{a,b},c} +{{a,b}c} +{{a,b},} +X{{a,b},}X +{{a,b},}c +{{a,b}.} +{{a,b}} +X{a..#}X +# this next one is an empty string + +{-10..00} +# Need to escape slashes in here for reasons i guess. +{a,\\\\{a,b}c} +{a,\\{a,b}c} +a,\\{b,c} +{-10.\\.00} +#### bash tests/braces.tests +# Note that some tests are edited out because some features of +# bash are intentionally not supported in this brace expander. +ff{c,b,a} +f{d,e,f}g +{l,n,m}xyz +{abc\\,def} +{abc} +{x\\,y,\\{abc\\},trie} +# not impementing back-ticks obviously +# XXXX\\{`echo a b c | tr ' ' ','`\\} +{} +# We only ever have to worry about parsing a single argument, +# not a command line, so spaces have a different meaning than bash. +# { } +} +{ +abcd{efgh +# spaces +# foo {1,2} bar +# not impementing back-ticks obviously +# `zecho foo {1,2} bar` +# $(zecho foo {1,2} bar) +# ${var} is not a variable here, like it is in bash. omit. +# foo{bar,${var}.} +# foo{bar,${var}} +# isaacs: skip quotes for now +# "${var}"{x,y} +# $var{x,y} +# ${var}{x,y} +# new sequence brace operators +{1..10} +# this doesn't work yet +{0..10,braces} +# but this does +{{0..10},braces} +x{{0..10},braces}y +{3..3} +x{3..3}y +{10..1} +{10..1}y +x{10..1}y +{a..f} +{f..a} +{a..A} +{A..a} +{f..f} +# mixes are incorrectly-formed brace expansions +{1..f} +{f..1} +# spaces +# 0{1..9} {10..20} +# do negative numbers work? +{-1..-10} +{-20..0} +# weirdly-formed brace expansions -- fixed in post-bash-3.1 +a-{b{d,e}}-c +a-{bdef-{g,i}-c +# isaacs: skip quotes for now +# {"klklkl"}{1,2,3} +# isaacs: this is a valid test, though +{klklkl}{1,2,3} +# {"x,x"} +{1..10..2} +{-1..-10..2} +{-1..-10..-2} +{10..1..-2} +{10..1..2} +{1..20..2} +{1..20..20} +{100..0..5} +{100..0..-5} +{a..z} +{a..z..2} +{z..a..-2} +# make sure brace expansion handles ints > 2**31 - 1 using intmax_t +{2147483645..2147483649} +# unwanted zero-padding -- fixed post-bash-4.0 +{10..0..2} +{10..0..-2} +{-50..-0..5} +# bad +{1..10.f} +{1..ff} +{1..10..ff} +{1.20..2} +{1..20..f2} +{1..20..2f} +{1..2f..2} +{1..ff..2} +{1..ff} +{1..f} +{1..0f} +{1..10f} +{1..10.f} +{1..10.f} diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js new file mode 100644 index 00000000000..3fcc185a7d6 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js @@ -0,0 +1,9 @@ +var test = require('tape'); +var expand = require('..'); + +test('ignores ${', function(t) { + t.deepEqual(expand('${1..3}'), ['${1..3}']); + t.deepEqual(expand('${a,b}${c,d}'), ['${a,b}${c,d}']); + t.deepEqual(expand('x${a,b}x${c,d}x'), ['x${a,b}x${c,d}x']); + t.end(); +}); diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js new file mode 100644 index 00000000000..e429121eab8 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js @@ -0,0 +1,10 @@ +var test = require('tape'); +var expand = require('..'); + +test('empty option', function(t) { + t.deepEqual(expand('-v{,,,,}'), [ + '-v', '-v', '-v', '-v', '-v' + ]); + t.end(); +}); + diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh new file mode 100644 index 00000000000..e040e664d9f --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -e + +# Bash 4.3 because of arbitrary need to pick a single standard. + +if [ "${BASH_VERSINFO[0]}" != "4" ] || [ "${BASH_VERSINFO[1]}" != "3" ]; then + echo "this script requires bash 4.3" >&2 + exit 1 +fi + +CDPATH= cd "$(dirname "$0")" + +js='require("./")(process.argv[1]).join(" ")' + +cat cases.txt | \ + while read case; do + if [ "${case:0:1}" = "#" ]; then + continue; + fi; + b="$($BASH -c 'for c in '"$case"'; do echo ["$c"]; done')" + echo "$case" + echo -n "$b><><><><"; + done > bash-results.txt diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js new file mode 100644 index 00000000000..8d434c23d45 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js @@ -0,0 +1,15 @@ +var test = require('tape'); +var expand = require('..'); + +test('negative increment', function(t) { + t.deepEqual(expand('{3..1}'), ['3', '2', '1']); + t.deepEqual(expand('{10..8}'), ['10', '9', '8']); + t.deepEqual(expand('{10..08}'), ['10', '09', '08']); + t.deepEqual(expand('{c..a}'), ['c', 'b', 'a']); + + t.deepEqual(expand('{4..0..2}'), ['4', '2', '0']); + t.deepEqual(expand('{4..0..-2}'), ['4', '2', '0']); + t.deepEqual(expand('{e..a..2}'), ['e', 'c', 'a']); + + t.end(); +}); diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js new file mode 100644 index 00000000000..0862dc51f90 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js @@ -0,0 +1,16 @@ +var test = require('tape'); +var expand = require('..'); + +test('nested', function(t) { + t.deepEqual(expand('{a,b{1..3},c}'), [ + 'a', 'b1', 'b2', 'b3', 'c' + ]); + t.deepEqual(expand('{{A..Z},{a..z}}'), + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('') + ); + t.deepEqual(expand('ppp{,config,oe{,conf}}'), [ + 'ppp', 'pppconfig', 'pppoe', 'pppoeconf' + ]); + t.end(); +}); + diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js new file mode 100644 index 00000000000..c00ad155fe6 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js @@ -0,0 +1,10 @@ +var test = require('tape'); +var expand = require('..'); + +test('order', function(t) { + t.deepEqual(expand('a{d,c,b}e'), [ + 'ade', 'ace', 'abe' + ]); + t.end(); +}); + diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js new file mode 100644 index 00000000000..e4158775f1b --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js @@ -0,0 +1,13 @@ +var test = require('tape'); +var expand = require('..'); + +test('pad', function(t) { + t.deepEqual(expand('{9..11}'), [ + '9', '10', '11' + ]); + t.deepEqual(expand('{09..11}'), [ + '09', '10', '11' + ]); + t.end(); +}); + diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js new file mode 100644 index 00000000000..3038fba7416 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js @@ -0,0 +1,7 @@ +var test = require('tape'); +var expand = require('..'); + +test('x and y of same type', function(t) { + t.deepEqual(expand('{a..9}'), ['{a..9}']); + t.end(); +}); diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js new file mode 100644 index 00000000000..f73a9579ab3 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js @@ -0,0 +1,50 @@ +var test = require('tape'); +var expand = require('..'); + +test('numeric sequences', function(t) { + t.deepEqual(expand('a{1..2}b{2..3}c'), [ + 'a1b2c', 'a1b3c', 'a2b2c', 'a2b3c' + ]); + t.deepEqual(expand('{1..2}{2..3}'), [ + '12', '13', '22', '23' + ]); + t.end(); +}); + +test('numeric sequences with step count', function(t) { + t.deepEqual(expand('{0..8..2}'), [ + '0', '2', '4', '6', '8' + ]); + t.deepEqual(expand('{1..8..2}'), [ + '1', '3', '5', '7' + ]); + t.end(); +}); + +test('numeric sequence with negative x / y', function(t) { + t.deepEqual(expand('{3..-2}'), [ + '3', '2', '1', '0', '-1', '-2' + ]); + t.end(); +}); + +test('alphabetic sequences', function(t) { + t.deepEqual(expand('1{a..b}2{b..c}3'), [ + '1a2b3', '1a2c3', '1b2b3', '1b2c3' + ]); + t.deepEqual(expand('{a..b}{b..c}'), [ + 'ab', 'ac', 'bb', 'bc' + ]); + t.end(); +}); + +test('alphabetic sequences with step count', function(t) { + t.deepEqual(expand('{a..k..2}'), [ + 'a', 'c', 'e', 'g', 'i', 'k' + ]); + t.deepEqual(expand('{b..k..2}'), [ + 'b', 'd', 'f', 'h', 'j' + ]); + t.end(); +}); + diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/package.json b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/package.json new file mode 100644 index 00000000000..986de93892a --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/package.json @@ -0,0 +1,63 @@ +{ + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, + "name": "minimatch", + "description": "a glob matcher in javascript", + "version": "2.0.8", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "main": "minimatch.js", + "scripts": { + "pretest": "standard minimatch.js test/*.js", + "test": "tap test/*.js", + "prepublish": "browserify -o browser.js -e minimatch.js --bare" + }, + "engines": { + "node": "*" + }, + "dependencies": { + "brace-expansion": "^1.0.0" + }, + "devDependencies": { + "browserify": "^9.0.3", + "standard": "^3.7.2", + "tap": "" + }, + "license": "ISC", + "files": [ + "minimatch.js", + "browser.js" + ], + "gitHead": "0bc7d9c4b2bc816502184862b45bd090de3406a3", + "bugs": { + "url": "https://github.com/isaacs/minimatch/issues" + }, + "homepage": "https://github.com/isaacs/minimatch#readme", + "_id": "minimatch@2.0.8", + "_shasum": "0bc20f6bf3570a698ef0ddff902063c6cabda6bf", + "_from": "minimatch@>=2.0.1 <3.0.0", + "_npmVersion": "2.10.0", + "_nodeVersion": "2.0.1", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "0bc20f6bf3570a698ef0ddff902063c6cabda6bf", + "tarball": "http://registry.npmjs.org/minimatch/-/minimatch-2.0.8.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.8.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/package.json b/deps/npm/node_modules/node-gyp/node_modules/glob/package.json new file mode 100644 index 00000000000..434e4696f8f --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/package.json @@ -0,0 +1,72 @@ +{ + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "name": "glob", + "description": "a little globber", + "version": "4.5.3", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-glob.git" + }, + "main": "glob.js", + "files": [ + "glob.js", + "sync.js", + "common.js" + ], + "engines": { + "node": "*" + }, + "dependencies": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^2.0.1", + "once": "^1.3.0" + }, + "devDependencies": { + "mkdirp": "0", + "rimraf": "^2.2.8", + "tap": "^0.5.0", + "tick": "0.0.6" + }, + "scripts": { + "prepublish": "npm run benchclean", + "profclean": "rm -f v8.log profile.txt", + "test": "npm run profclean && tap test/*.js", + "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js", + "bench": "bash benchmark.sh", + "prof": "bash prof.sh && cat profile.txt", + "benchclean": "bash benchclean.sh" + }, + "license": "ISC", + "gitHead": "a4e461ab59a837eee80a4d8dbdbf5ae1054a646f", + "bugs": { + "url": "https://github.com/isaacs/node-glob/issues" + }, + "homepage": "https://github.com/isaacs/node-glob", + "_id": "glob@4.5.3", + "_shasum": "c6cb73d3226c1efef04de3c56d012f03377ee15f", + "_from": "glob@>=3.0.0 <4.0.0||>=4.0.0 <5.0.0", + "_npmVersion": "2.7.1", + "_nodeVersion": "1.4.2", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "c6cb73d3226c1efef04de3c56d012f03377ee15f", + "tarball": "http://registry.npmjs.org/glob/-/glob-4.5.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/glob/-/glob-4.5.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/glob/sync.js b/deps/npm/node_modules/node-gyp/node_modules/glob/sync.js new file mode 100644 index 00000000000..f4f5e36d4be --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/glob/sync.js @@ -0,0 +1,457 @@ +module.exports = globSync +globSync.GlobSync = GlobSync + +var fs = require('fs') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var Glob = require('./glob.js').Glob +var util = require('util') +var path = require('path') +var assert = require('assert') +var common = require('./common.js') +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var isAbsolute = common.isAbsolute +var setopts = common.setopts +var ownProp = common.ownProp +var childrenIgnored = common.childrenIgnored + +function globSync (pattern, options) { + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + return new GlobSync(pattern, options).found +} + +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') + + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) + + setopts(this, pattern, options) + + if (this.noprocess) + return this + + var n = this.minimatch.set.length + this.matches = new Array(n) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false) + } + this._finish() +} + +GlobSync.prototype._finish = function () { + assert(this instanceof GlobSync) + if (this.realpath) { + var self = this + this.matches.forEach(function (matchset, index) { + var set = self.matches[index] = Object.create(null) + for (var p in matchset) { + try { + p = self._makeAbs(p) + var real = fs.realpathSync(p, this.realpathCache) + set[real] = true + } catch (er) { + if (er.syscall === 'stat') + set[self._makeAbs(p)] = true + else + throw er + } + } + }) + } + common.finish(this) +} + + +GlobSync.prototype._process = function (pattern, index, inGlobStar) { + assert(this instanceof GlobSync) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // See if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip processing + if (childrenIgnored(this, read)) + return + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar) +} + + +GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar) + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix.slice(-1) !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this.matches[index][e] = true + } + // This was the last one, and no stats were needed + return + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) + newPattern = [prefix, e] + else + newPattern = [e] + this._process(newPattern.concat(remain), index, inGlobStar) + } +} + + +GlobSync.prototype._emitMatch = function (index, e) { + var abs = this._makeAbs(e) + if (this.mark) + e = this._mark(e) + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[this._makeAbs(e)] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + if (this.stat) + this._stat(e) +} + + +GlobSync.prototype._readdirInGlobStar = function (abs) { + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false) + + var entries + var lstat + var stat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + // lstat failed, doesn't exist + return null + } + + var isSym = lstat.isSymbolicLink() + this.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && !lstat.isDirectory()) + this.cache[abs] = 'FILE' + else + entries = this._readdir(abs, false) + + return entries +} + +GlobSync.prototype._readdir = function (abs, inGlobStar) { + var entries + + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return null + + if (Array.isArray(c)) + return c + } + + try { + return this._readdirEntries(abs, fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er) + return null + } +} + +GlobSync.prototype._readdirEntries = function (abs, entries) { + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + + // mark and cache dir-ness + return entries +} + +GlobSync.prototype._readdirError = function (f, er) { + // handle errors, and cache the information + switch (er.code) { + case 'ENOTDIR': // totally normal. means it *does* exist. + this.cache[this._makeAbs(f)] = 'FILE' + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) throw er + if (!this.silent) console.error('glob error', er) + break + } +} + +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { + + var entries = this._readdir(abs, inGlobStar) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false) + + var len = entries.length + var isSym = this.symlinks[abs] + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true) + } +} + +GlobSync.prototype._processSimple = function (prefix, index) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var exists = this._stat(prefix) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this.matches[index][prefix] = true +} + +// Returns either 'DIR', 'FILE', or false +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return false + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return c + + if (needDir && c === 'FILE') + return false + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = fs.lstatSync(abs) + } catch (er) { + return false + } + + if (lstat.isSymbolicLink()) { + try { + stat = fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } + } + + this.statCache[abs] = stat + + var c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c !== 'DIR') + return false + + return c +} + +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} + +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} diff --git a/deps/npm/node_modules/ini/.npmignore b/deps/npm/node_modules/node-gyp/node_modules/minimatch/.npmignore similarity index 100% rename from deps/npm/node_modules/ini/.npmignore rename to deps/npm/node_modules/node-gyp/node_modules/minimatch/.npmignore diff --git a/deps/npm/node_modules/glob/.travis.yml b/deps/npm/node_modules/node-gyp/node_modules/minimatch/.travis.yml similarity index 100% rename from deps/npm/node_modules/glob/.travis.yml rename to deps/npm/node_modules/node-gyp/node_modules/minimatch/.travis.yml diff --git a/deps/npm/node_modules/node-gyp/node_modules/minimatch/LICENSE b/deps/npm/node_modules/node-gyp/node_modules/minimatch/LICENSE new file mode 100644 index 00000000000..05a4010949c --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/minimatch/LICENSE @@ -0,0 +1,23 @@ +Copyright 2009, 2010, 2011 Isaac Z. Schlueter. +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/deps/npm/node_modules/node-gyp/node_modules/minimatch/README.md b/deps/npm/node_modules/node-gyp/node_modules/minimatch/README.md new file mode 100644 index 00000000000..5b3967ea998 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/minimatch/README.md @@ -0,0 +1,218 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.png)](http://travis-ci.org/isaacs/minimatch) + + +This is the matching library used internally by npm. + +Eventually, it will replace the C binding in node-glob. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Usage + +```javascript +var minimatch = require("minimatch") + +minimatch("bar.foo", "*.foo") // true! +minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +* Brace Expansion +* Extended glob matching +* "Globstar" `**` matching + +See: + +* `man sh` +* `man bash` +* `man 3 fnmatch` +* `man 5 gitignore` + +## Minimatch Class + +Create a minimatch object by instanting the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require("minimatch").Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +* `pattern` The original pattern the minimatch object represents. +* `options` The options supplied to the constructor. +* `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +* `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +* `negate` True if the pattern is negated. +* `comment` True if the pattern is a comment. +* `empty` True if the pattern is `""`. + +### Methods + +* `makeRe` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +* `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +* `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. + +All other methods are internal, and will be called as necessary. + +## Functions + +The top-level exported function has a `cache` property, which is an LRU +cache set to store 100 items. So, calling these methods repeatedly +with the same pattern and options will use the same Minimatch object, +saving the cost of parsing it multiple times. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, "*.js", { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) +``` + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. diff --git a/deps/npm/node_modules/node-gyp/node_modules/minimatch/minimatch.js b/deps/npm/node_modules/node-gyp/node_modules/minimatch/minimatch.js new file mode 100644 index 00000000000..47617868b99 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/minimatch/minimatch.js @@ -0,0 +1,1073 @@ +;(function (require, exports, module, platform) { + +if (module) module.exports = minimatch +else exports.minimatch = minimatch + +if (!require) { + require = function (id) { + switch (id) { + case "sigmund": return function sigmund (obj) { + return JSON.stringify(obj) + } + case "path": return { basename: function (f) { + f = f.split(/[\/\\]/) + var e = f.pop() + if (!e) e = f.pop() + return e + }} + case "lru-cache": return function LRUCache () { + // not quite an LRU, but still space-limited. + var cache = {} + var cnt = 0 + this.set = function (k, v) { + cnt ++ + if (cnt >= 100) cache = {} + cache[k] = v + } + this.get = function (k) { return cache[k] } + } + } + } +} + +minimatch.Minimatch = Minimatch + +var LRU = require("lru-cache") + , cache = minimatch.cache = new LRU({max: 100}) + , GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} + , sigmund = require("sigmund") + +var path = require("path") + // any single thing other than / + // don't need to escape / when using new RegExp() + , qmark = "[^/]" + + // * => any number of characters + , star = qmark + "*?" + + // ** when dots are allowed. Anything goes, except .. and . + // not (^ or / followed by one or two dots followed by $ or /), + // followed by anything, any number of times. + , twoStarDot = "(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?" + + // not a ^ or / followed by a dot, + // followed by anything, any number of times. + , twoStarNoDot = "(?:(?!(?:\\\/|^)\\.).)*?" + + // characters that need to be escaped in RegExp. + , reSpecials = charSet("().*{}+?[]^$\\!") + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split("").reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + + +function minimatch (p, pattern, options) { + if (typeof pattern !== "string") { + throw new TypeError("glob pattern string required") + } + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === "#") { + return false + } + + // "" only matches "" + if (pattern.trim() === "") return p === "" + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options, cache) + } + + if (typeof pattern !== "string") { + throw new TypeError("glob pattern string required") + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows: need to use /, not \ + // On other platforms, \ is a valid (albeit bad) filename char. + if (platform === "win32") { + pattern = pattern.split("\\").join("/") + } + + // lru storage. + // these things aren't particularly big, but walking down the string + // and turning it into a regexp can get pretty costly. + var cacheKey = pattern + "\n" + sigmund(options) + var cached = minimatch.cache.get(cacheKey) + if (cached) return cached + minimatch.cache.set(cacheKey, this) + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function() {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === "#") { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return -1 === s.indexOf(false) + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + , negate = false + , options = this.options + , negateOffset = 0 + + if (options.nonegate) return + + for ( var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === "!" + ; i ++) { + negate = !negate + negateOffset ++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return new Minimatch(pattern, options).braceExpand() +} + +Minimatch.prototype.braceExpand = braceExpand + +function pad(n, width, z) { + z = z || '0'; + n = n + ''; + return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n; +} + +function braceExpand (pattern, options) { + options = options || this.options + pattern = typeof pattern === "undefined" + ? this.pattern : pattern + + if (typeof pattern === "undefined") { + throw new Error("undefined pattern") + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + var escaping = false + + // examples and comments refer to this crazy pattern: + // a{b,c{d,e},{f,g}h}x{y,z} + // expected: + // abxy + // abxz + // acdxy + // acdxz + // acexy + // acexz + // afhxy + // afhxz + // aghxy + // aghxz + + // everything before the first \{ is just a prefix. + // So, we pluck that off, and work with the rest, + // and then prepend it to everything we find. + if (pattern.charAt(0) !== "{") { + this.debug(pattern) + var prefix = null + for (var i = 0, l = pattern.length; i < l; i ++) { + var c = pattern.charAt(i) + this.debug(i, c) + if (c === "\\") { + escaping = !escaping + } else if (c === "{" && !escaping) { + prefix = pattern.substr(0, i) + break + } + } + + // actually no sets, all { were escaped. + if (prefix === null) { + this.debug("no sets") + return [pattern] + } + + var tail = braceExpand.call(this, pattern.substr(i), options) + return tail.map(function (t) { + return prefix + t + }) + } + + // now we have something like: + // {b,c{d,e},{f,g}h}x{y,z} + // walk through the set, expanding each part, until + // the set ends. then, we'll expand the suffix. + // If the set only has a single member, then'll put the {} back + + // first, handle numeric sets, since they're easier + var numset = pattern.match(/^\{(-?[0-9]+)\.\.(-?[0-9]+)\}/) + if (numset) { + this.debug("numset", numset[1], numset[2]) + var suf = braceExpand.call(this, pattern.substr(numset[0].length), options) + , start = +numset[1] + , needPadding = numset[1][0] === '0' + , startWidth = numset[1].length + , padded + , end = +numset[2] + , inc = start > end ? -1 : 1 + , set = [] + + for (var i = start; i != (end + inc); i += inc) { + padded = needPadding ? pad(i, startWidth) : i + '' + // append all the suffixes + for (var ii = 0, ll = suf.length; ii < ll; ii ++) { + set.push(padded + suf[ii]) + } + } + return set + } + + // ok, walk through the set + // We hope, somewhat optimistically, that there + // will be a } at the end. + // If the closing brace isn't found, then the pattern is + // interpreted as braceExpand("\\" + pattern) so that + // the leading \{ will be interpreted literally. + var i = 1 // skip the \{ + , depth = 1 + , set = [] + , member = "" + , sawEnd = false + , escaping = false + + function addMember () { + set.push(member) + member = "" + } + + this.debug("Entering for") + FOR: for (i = 1, l = pattern.length; i < l; i ++) { + var c = pattern.charAt(i) + this.debug("", i, c) + + if (escaping) { + escaping = false + member += "\\" + c + } else { + switch (c) { + case "\\": + escaping = true + continue + + case "{": + depth ++ + member += "{" + continue + + case "}": + depth -- + // if this closes the actual set, then we're done + if (depth === 0) { + addMember() + // pluck off the close-brace + i ++ + break FOR + } else { + member += c + continue + } + + case ",": + if (depth === 1) { + addMember() + } else { + member += c + } + continue + + default: + member += c + continue + } // switch + } // else + } // for + + // now we've either finished the set, and the suffix is + // pattern.substr(i), or we have *not* closed the set, + // and need to escape the leading brace + if (depth !== 0) { + this.debug("didn't close", pattern) + return braceExpand.call(this, "\\" + pattern, options) + } + + // x{y,z} -> ["xy", "xz"] + this.debug("set", set) + this.debug("suffix", pattern.substr(i)) + var suf = braceExpand.call(this, pattern.substr(i), options) + // ["b", "c{d,e}","{f,g}h"] -> + // [["b"], ["cd", "ce"], ["fh", "gh"]] + var addBraces = set.length === 1 + this.debug("set pre-expanded", set) + set = set.map(function (p) { + return braceExpand.call(this, p, options) + }, this) + this.debug("set expanded", set) + + + // [["b"], ["cd", "ce"], ["fh", "gh"]] -> + // ["b", "cd", "ce", "fh", "gh"] + set = set.reduce(function (l, r) { + return l.concat(r) + }) + + if (addBraces) { + set = set.map(function (s) { + return "{" + s + "}" + }) + } + + // now attach the suffixes. + var ret = [] + for (var i = 0, l = set.length; i < l; i ++) { + for (var ii = 0, ll = suf.length; ii < ll; ii ++) { + ret.push(set[i] + suf[ii]) + } + } + return ret +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === "**") return GLOBSTAR + if (pattern === "") return "" + + var re = "" + , hasMagic = !!options.nocase + , escaping = false + // ? => one single character + , patternListStack = [] + , plType + , stateChar + , inClass = false + , reClassStart = -1 + , classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + , patternStart = pattern.charAt(0) === "." ? "" // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? "(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))" + : "(?!\\.)" + , self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case "*": + re += star + hasMagic = true + break + case "?": + re += qmark + hasMagic = true + break + default: + re += "\\"+stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for ( var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i ++ ) { + + this.debug("%s\t%s %s %j", pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += "\\" + c + escaping = false + continue + } + + SWITCH: switch (c) { + case "/": + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case "\\": + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case "?": + case "*": + case "+": + case "@": + case "!": + this.debug("%s\t%s %s %j <-- stateChar", pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === "!" && i === classStart + 1) c = "^" + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case "(": + if (inClass) { + re += "(" + continue + } + + if (!stateChar) { + re += "\\(" + continue + } + + plType = stateChar + patternListStack.push({ type: plType + , start: i - 1 + , reStart: re.length }) + // negation is (?:(?!js)[^/]*) + re += stateChar === "!" ? "(?:(?!" : "(?:" + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ")": + if (inClass || !patternListStack.length) { + re += "\\)" + continue + } + + clearStateChar() + hasMagic = true + re += ")" + plType = patternListStack.pop().type + // negation is (?:(?!js)[^/]*) + // The others are (?:) + switch (plType) { + case "!": + re += "[^/]*?)" + break + case "?": + case "+": + case "*": re += plType + case "@": break // the default anyway + } + continue + + case "|": + if (inClass || !patternListStack.length || escaping) { + re += "\\|" + escaping = false + continue + } + + clearStateChar() + re += "|" + continue + + // these are mostly the same in regexp and glob + case "[": + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += "\\" + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case "]": + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += "\\" + c + escaping = false + continue + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === "^" && inClass)) { + re += "\\" + } + + re += c + + } // switch + } // for + + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + var cs = pattern.substr(classStart + 1) + , sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + "\\[" + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + var pl + while (pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + 3) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = "\\" + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + "|" + }) + + this.debug("tail=%j\n %s", tail, tail) + var t = pl.type === "*" ? star + : pl.type === "?" ? qmark + : "\\" + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + + t + "\\(" + + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += "\\\\" + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case ".": + case "[": + case "(": addPatternStart = true + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== "" && hasMagic) re = "(?=.)" + re + + if (addPatternStart) re = patternStart + re + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [ re, hasMagic ] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? "i" : "" + , regExp = new RegExp("^" + re + "$", flags) + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) return this.regexp = false + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + , flags = options.nocase ? "i" : "" + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === "string") ? regExpEscape(p) + : p._src + }).join("\\\/") + }).join("|") + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = "^(?:" + re + ")$" + + // can match anything, as long as it's not this. + if (this.negate) re = "^(?!" + re + ").*$" + + try { + return this.regexp = new RegExp(re, flags) + } catch (ex) { + return this.regexp = false + } +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug("match", f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === "" + + if (f === "/" && partial) return true + + var options = this.options + + // windows: need to use /, not \ + // On other platforms, \ is a valid (albeit bad) filename char. + if (platform === "win32") { + f = f.split("\\").join("/") + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, "split", f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, "set", set) + + // Find the basename of the path by looking for the last non-empty segment + var filename; + for (var i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (var i = 0, l = set.length; i < l; i ++) { + var pattern = set[i], file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug("matchOne", + { "this": this + , file: file + , pattern: pattern }) + + this.debug("matchOne", file.length, pattern.length) + + for ( var fi = 0 + , pi = 0 + , fl = file.length + , pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi ++, pi ++ ) { + + this.debug("matchOne loop") + var p = pattern[pi] + , f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + , pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for ( ; fi < fl; fi ++) { + if (file[fi] === "." || file[fi] === ".." || + (!options.dot && file[fi].charAt(0) === ".")) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + WHILE: while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', + file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === "." || swallowee === ".." || + (!options.dot && swallowee.charAt(0) === ".")) { + this.debug("dot detected!", file, fr, pattern, pr) + break WHILE + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr ++ + } + } + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug("\n>>> no match, partial?", file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === "string") { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug("string match", p, f, hit) + } else { + hit = f.match(p) + this.debug("pattern match", p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === "") + return emptyFileEnd + } + + // should be unreachable. + throw new Error("wtf?") +} + + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, "$1") +} + + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") +} + +})( typeof require === "function" ? require : null, + this, + typeof module === "object" ? module : null, + typeof process === "object" ? process.platform : "win32" + ) diff --git a/deps/npm/node_modules/node-gyp/node_modules/minimatch/node_modules/sigmund/LICENSE b/deps/npm/node_modules/node-gyp/node_modules/minimatch/node_modules/sigmund/LICENSE new file mode 100644 index 00000000000..19129e315fe --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/minimatch/node_modules/sigmund/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/node-gyp/node_modules/minimatch/node_modules/sigmund/README.md b/deps/npm/node_modules/node-gyp/node_modules/minimatch/node_modules/sigmund/README.md new file mode 100644 index 00000000000..25a38a53fe2 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/minimatch/node_modules/sigmund/README.md @@ -0,0 +1,53 @@ +# sigmund + +Quick and dirty signatures for Objects. + +This is like a much faster `deepEquals` comparison, which returns a +string key suitable for caches and the like. + +## Usage + +```javascript +function doSomething (someObj) { + var key = sigmund(someObj, maxDepth) // max depth defaults to 10 + var cached = cache.get(key) + if (cached) return cached + + var result = expensiveCalculation(someObj) + cache.set(key, result) + return result +} +``` + +The resulting key will be as unique and reproducible as calling +`JSON.stringify` or `util.inspect` on the object, but is much faster. +In order to achieve this speed, some differences are glossed over. +For example, the object `{0:'foo'}` will be treated identically to the +array `['foo']`. + +Also, just as there is no way to summon the soul from the scribblings +of a cocaine-addled psychoanalyst, there is no way to revive the object +from the signature string that sigmund gives you. In fact, it's +barely even readable. + +As with `util.inspect` and `JSON.stringify`, larger objects will +produce larger signature strings. + +Because sigmund is a bit less strict than the more thorough +alternatives, the strings will be shorter, and also there is a +slightly higher chance for collisions. For example, these objects +have the same signature: + + var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]} + var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']} + +Like a good Freudian, sigmund is most effective when you already have +some understanding of what you're looking for. It can help you help +yourself, but you must be willing to do some work as well. + +Cycles are handled, and cyclical objects are silently omitted (though +the key is included in the signature output.) + +The second argument is the maximum depth, which defaults to 10, +because that is the maximum object traversal depth covered by most +insurance carriers. diff --git a/deps/npm/node_modules/minimatch/node_modules/sigmund/bench.js b/deps/npm/node_modules/node-gyp/node_modules/minimatch/node_modules/sigmund/bench.js similarity index 100% rename from deps/npm/node_modules/minimatch/node_modules/sigmund/bench.js rename to deps/npm/node_modules/node-gyp/node_modules/minimatch/node_modules/sigmund/bench.js diff --git a/deps/npm/node_modules/node-gyp/node_modules/minimatch/node_modules/sigmund/package.json b/deps/npm/node_modules/node-gyp/node_modules/minimatch/node_modules/sigmund/package.json new file mode 100644 index 00000000000..4255e77a933 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/minimatch/node_modules/sigmund/package.json @@ -0,0 +1,60 @@ +{ + "name": "sigmund", + "version": "1.0.1", + "description": "Quick and dirty signatures for Objects.", + "main": "sigmund.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "~0.3.0" + }, + "scripts": { + "test": "tap test/*.js", + "bench": "node bench.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/sigmund.git" + }, + "keywords": [ + "object", + "signature", + "key", + "data", + "psychoanalysis" + ], + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "ISC", + "gitHead": "527f97aa5bb253d927348698c0cd3bb267d098c6", + "bugs": { + "url": "https://github.com/isaacs/sigmund/issues" + }, + "homepage": "https://github.com/isaacs/sigmund#readme", + "_id": "sigmund@1.0.1", + "_shasum": "3ff21f198cad2175f9f3b781853fd94d0d19b590", + "_from": "sigmund@>=1.0.0 <1.1.0", + "_npmVersion": "2.10.0", + "_nodeVersion": "2.0.1", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "3ff21f198cad2175f9f3b781853fd94d0d19b590", + "tarball": "http://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "_resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/minimatch/node_modules/sigmund/sigmund.js b/deps/npm/node_modules/node-gyp/node_modules/minimatch/node_modules/sigmund/sigmund.js similarity index 100% rename from deps/npm/node_modules/minimatch/node_modules/sigmund/sigmund.js rename to deps/npm/node_modules/node-gyp/node_modules/minimatch/node_modules/sigmund/sigmund.js diff --git a/deps/npm/node_modules/minimatch/node_modules/sigmund/test/basic.js b/deps/npm/node_modules/node-gyp/node_modules/minimatch/node_modules/sigmund/test/basic.js similarity index 100% rename from deps/npm/node_modules/minimatch/node_modules/sigmund/test/basic.js rename to deps/npm/node_modules/node-gyp/node_modules/minimatch/node_modules/sigmund/test/basic.js diff --git a/deps/npm/node_modules/node-gyp/node_modules/minimatch/package.json b/deps/npm/node_modules/node-gyp/node_modules/minimatch/package.json new file mode 100644 index 00000000000..8bf46ccae0c --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/minimatch/package.json @@ -0,0 +1,58 @@ +{ + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, + "name": "minimatch", + "description": "a glob matcher in javascript", + "version": "1.0.0", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "main": "minimatch.js", + "scripts": { + "test": "tap test/*.js" + }, + "engines": { + "node": "*" + }, + "dependencies": { + "lru-cache": "2", + "sigmund": "~1.0.0" + }, + "devDependencies": { + "tap": "" + }, + "license": { + "type": "MIT", + "url": "http://github.com/isaacs/minimatch/raw/master/LICENSE" + }, + "gitHead": "b374a643976eb55cdc19c60b6dd51ebe9bcc607a", + "bugs": { + "url": "https://github.com/isaacs/minimatch/issues" + }, + "homepage": "https://github.com/isaacs/minimatch", + "_id": "minimatch@1.0.0", + "_shasum": "e0dd2120b49e1b724ce8d714c520822a9438576d", + "_from": "minimatch@>=1.0.0 <2.0.0", + "_npmVersion": "1.4.21", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "dist": { + "shasum": "e0dd2120b49e1b724ce8d714c520822a9438576d", + "tarball": "http://registry.npmjs.org/minimatch/-/minimatch-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/minimatch/test/basic.js b/deps/npm/node_modules/node-gyp/node_modules/minimatch/test/basic.js similarity index 100% rename from deps/npm/node_modules/minimatch/test/basic.js rename to deps/npm/node_modules/node-gyp/node_modules/minimatch/test/basic.js diff --git a/deps/npm/node_modules/minimatch/test/brace-expand.js b/deps/npm/node_modules/node-gyp/node_modules/minimatch/test/brace-expand.js similarity index 100% rename from deps/npm/node_modules/minimatch/test/brace-expand.js rename to deps/npm/node_modules/node-gyp/node_modules/minimatch/test/brace-expand.js diff --git a/deps/npm/node_modules/minimatch/test/caching.js b/deps/npm/node_modules/node-gyp/node_modules/minimatch/test/caching.js similarity index 100% rename from deps/npm/node_modules/minimatch/test/caching.js rename to deps/npm/node_modules/node-gyp/node_modules/minimatch/test/caching.js diff --git a/deps/npm/node_modules/minimatch/test/defaults.js b/deps/npm/node_modules/node-gyp/node_modules/minimatch/test/defaults.js similarity index 100% rename from deps/npm/node_modules/minimatch/test/defaults.js rename to deps/npm/node_modules/node-gyp/node_modules/minimatch/test/defaults.js diff --git a/deps/npm/node_modules/minimatch/test/extglob-ending-with-state-char.js b/deps/npm/node_modules/node-gyp/node_modules/minimatch/test/extglob-ending-with-state-char.js similarity index 100% rename from deps/npm/node_modules/minimatch/test/extglob-ending-with-state-char.js rename to deps/npm/node_modules/node-gyp/node_modules/minimatch/test/extglob-ending-with-state-char.js diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/.npmignore b/deps/npm/node_modules/node-gyp/node_modules/path-array/.npmignore new file mode 100644 index 00000000000..07e6e472cc7 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/.npmignore @@ -0,0 +1 @@ +/node_modules diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/.travis.yml b/deps/npm/node_modules/node-gyp/node_modules/path-array/.travis.yml new file mode 100644 index 00000000000..c7d8e3d83c6 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - 0.8 + - 0.9 + - 0.10 + - 0.11 diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/History.md b/deps/npm/node_modules/node-gyp/node_modules/path-array/History.md new file mode 100644 index 00000000000..ff93a2a28f2 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/History.md @@ -0,0 +1,22 @@ + +1.0.0 / 2014-11-11 +================== + + * index: add support for a configrable `property` name to use + * README: fix Travis badge + +0.0.2 / 2013-12-22 +================== + + * README++ + * test: add unshift() test + * test: add more tests + * index: ensure that the indexed getters/setters are set up in the constructor + * add .travis.yml file + * add initial tests + +0.0.1 / 2013-12-21 +================== + + * add README.md + * initial commit diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/README.md b/deps/npm/node_modules/node-gyp/node_modules/path-array/README.md new file mode 100644 index 00000000000..2595316a191 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/README.md @@ -0,0 +1,92 @@ +path-array +========== +### Treat your `$PATH` like a JavaScript Array +[![Build Status](https://travis-ci.org/TooTallNate/path-array.svg?branch=master)](https://travis-ci.org/TooTallNate/path-array) + +This module provides a JavaScript `Array` implementation that is backed by your +`$PATH` env variable. That is, you can use regular Array functions like `shift()`, +`pop()`, `push()`, `unshift()`, etc. to mutate your `$PATH`. + +Also works for preparing an `env` object for passing to +[`child_process.spawn()`][cp.spawn]. + + +Installation +------------ + +Install with `npm`: + +``` bash +$ npm install path-array +``` + + +Example +------- + +Interacting with your own `$PATH` env variable: + +``` js +var PathArray = require('path-array'); + +// no args uses `process.env` by default +var p = new PathArray(); + +console.log(p); +// [ './node_modules/.bin', +// '/opt/local/bin', +// '/opt/local/sbin', +// '/usr/local/bin', +// '/usr/local/sbin', +// '/usr/bin', +// '/bin', +// '/usr/sbin', +// '/sbin', +// '/usr/local/bin', +// '/opt/X11/bin' ] + +// push another path entry. this function mutates the `process.env.PATH` +p.unshift('/foo'); + +console.log(process.env.PATH); +// '/foo:./node_modules/.bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin' +``` + + +API +--- + +### new PathArray([env]) → PathArray + +Creates and returns a new `PathArray` instance with the given `env` object. If no +`env` is specified, then [`process.env`][process.env] is used by default. + + +License +------- + +(The MIT License) + +Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net> + +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. + +[process.env]: http://nodejs.org/docs/latest/api/process.html#process_process_env +[cp.spawn]: http://nodejs.org/docs/latest/api/child_process.html#child_process_child_process_spawn_command_args_options diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/index.js b/deps/npm/node_modules/node-gyp/node_modules/path-array/index.js new file mode 100644 index 00000000000..40b982d2f17 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/index.js @@ -0,0 +1,137 @@ + +/** + * Module dependencies. + */ + +var inherits = require('util').inherits; +var delimiter = require('path').delimiter || ':'; +var ArrayIndex = require('array-index'); + +/** + * Module exports. + */ + +module.exports = PathArray; + +/** + * `PathArray` constructor. Treat your `$PATH` like a mutable JavaScript Array! + * + * @param {Env} env - `process.env` object to use. + * @param {String} [property] - optional property name to use (`PATH` by default). + * @public + */ + +function PathArray (env, property) { + if (!(this instanceof PathArray)) return new PathArray(env); + ArrayIndex.call(this); + + this.property = property || 'PATH'; + + // overwrite only the `get` operator of the ".length" property + Object.defineProperty(this, 'length', { + get: this._getLength + }); + + // store the `process.env` object as a non-enumerable `_env` + Object.defineProperty(this, '_env', { + value: env || process.env, + writable: true, + enumerable: false, + configurable: true + }); + + // need to invoke the `length` getter to ensure that the + // indexed getters/setters are set up at this point + void(this.length); +} + +// inherit from ArrayIndex +inherits(PathArray, ArrayIndex); + +/** + * Returns the current $PATH representation as an Array. + * + * @api private + */ + +PathArray.prototype._array = function () { + var path = this._env[this.property]; + if (!path) return []; + return path.split(delimiter); +}; + +/** + * Sets the `env` object's `PATH` string to the values in the passed in Array + * instance. + * + * @api private + */ + +PathArray.prototype._setArray = function (arr) { + // mutate the $PATH + this._env[this.property] = arr.join(delimiter); +}; + +/** + * `.length` getter operation implementation. + * + * @api private + */ + +PathArray.prototype._getLength = function () { + var length = this._array().length; + + // invoke the ArrayIndex internal `set` operator to ensure that + // there's getters/setters defined for the determined length so far... + this.length = length; + + return length; +}; + +/** + * ArrayIndex [0] getter operator implementation. + * + * @api private + */ + +PathArray.prototype.__get__ = function get (index) { + return this._array()[index]; +}; + +/** + * ArrayIndex [0]= setter operator implementation. + * + * @api private + */ + +PathArray.prototype.__set__ = function set (index, value) { + var arr = this._array(); + arr[index] = value; + this._setArray(arr); + return value; +}; + +/** + * `toString()` returns the current $PATH string. + * + * @api public + */ + +PathArray.prototype.toString = function toString () { + return this._env[this.property] || ''; +}; + +// proxy the JavaScript Array functions, and mutate the $PATH +Object.getOwnPropertyNames(Array.prototype).forEach(function (name) { + if ('constructor' == name) return; + if ('function' != typeof Array.prototype[name]) return; + if (/to(Locale)?String/.test(name)) return; + //console.log('proxy %s', name); + + PathArray.prototype[name] = function () { + var arr = this._array(); + var rtn = arr[name].apply(arr, arguments); + this._setArray(arr); + return rtn; + }; +}); diff --git a/deps/npm/node_modules/minimatch/.npmignore b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/.npmignore similarity index 100% rename from deps/npm/node_modules/minimatch/.npmignore rename to deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/.npmignore diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/.travis.yml b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/.travis.yml new file mode 100644 index 00000000000..99cdc7439aa --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - "0.8" + - "0.10" + - "0.11" diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/History.md b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/History.md new file mode 100644 index 00000000000..20b03e9a836 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/History.md @@ -0,0 +1,39 @@ + +0.1.1 / 2014-11-03 +================== + + * index: use `%o` debug formatters + * .travis: don't test node v0.9.x + * README: use svg for Travis badge + * add .jshintrc file + +0.1.0 / 2013-12-01 +================== + + * add `History.md` file + * .travis.yml: test node v0.8-v0.11 + * add component.json + * package: update "main" field + * package: beautify + +0.0.4 / 2013-09-27 +================== + + * ensure that the `length` property has the same maximum as regular Arrays + +0.0.3 / 2013-09-15 +================== + + * add `toArray()`, `toJSON()`, and `toString()` functions + * add an `inspect()` function + +0.0.2 / 2013-09-15 +================== + + * use "configurable: true" + * add `travis.yml` file + +0.0.1 / 2013-06-14 +================== + + * Initial release diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/Makefile b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/Makefile new file mode 100644 index 00000000000..0f14dac306f --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/Makefile @@ -0,0 +1,11 @@ + +build: components index.js + @component build --dev + +components: component.json + @component install --dev + +clean: + rm -fr build components template.js + +.PHONY: clean diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/README.md b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/README.md new file mode 100644 index 00000000000..ecd3498dd11 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/README.md @@ -0,0 +1,156 @@ +array-index +=========== +### Invoke getter/setter functions on array-like objects +[![Build Status](https://secure.travis-ci.org/TooTallNate/array-index.svg)](http://travis-ci.org/TooTallNate/array-index) + + +This little module provides an `ArrayIndex` constructor function that you can +inherit from with your own objects. When a numbered property gets read, then the +`__get__` function on the object will be invoked. When a numbered property gets +set, then the `__set__` function on the object will be invoked. + + +Installation +------------ + +Install with `npm`: + +``` bash +$ npm install array-index +``` + + +Examples +-------- + +A quick silly example, using `Math.sqrt()` for the "getter": + +``` js +var ArrayIndex = require('array-index') + +// let's just create a singleton instance. +var a = new ArrayIndex() + +// the "__get__" function is invoked for each "a[n]" access. +// it is given a single argument, the "index" currently being accessed. +// so here, we're passing in the `Math.sqrt()` function, so accessing +// "a[9]" will return `Math.sqrt(9)`. +a.__get__ = Math.sqrt + +// the "__get__" and "__set__" functions are only invoked up +// to "a.length", so we must set that manually. +a.length = 10 + +console.log(a) +// [ 0, +// 1, +// 1.4142135623730951, +// 1.7320508075688772, +// 2, +// 2.23606797749979, +// 2.449489742783178, +// 2.6457513110645907, +// 2.8284271247461903, +// 3, +// __get__: [Function: sqrt] ] +``` + +Here's an example of creating a subclass of `ArrayIndex` using `util.inherits()`: + +``` js +var ArrayIndex = require('array-index') +var inherits = require('util').inherits + +function MyArray (length) { + // be sure to call the ArrayIndex constructor in your own constructor + ArrayIndex.call(this, length) + + // the "set" object will contain values at indexes previously set, + // so that they can be returned in the "getter" function. This is just a + // silly example, your subclass will have more meaningful logic. + Object.defineProperty(this, 'set', { + value: Object.create(null), + enumerable: false + }) +} + +// inherit from the ArrayIndex's prototype +inherits(MyArray, ArrayIndex) + +MyArray.prototype.__get__ = function (index) { + if (index in this.set) return this.set[index] + return index * 2 +} + +MyArray.prototype.__set__ = function (index, v) { + this.set[index] = v +} + + +// and now you can create some instances +var a = new MyArray(15) +a[9] = a[10] = a[14] = '_' +a[0] = 'nate' + +console.log(a) +// [ 'nate', 2, 4, 6, 8, 10, 12, 14, 16, '_', '_', 22, 24, 26, '_' ] +``` + +API +--- + +The `ArrayIndex` base class is meant to be subclassed, but it also has a few +convenient functions built-in. + +### "length" -> Number + +The length of the ArrayIndex instance. The `__get__` and `__set__` functions will +only be invoked on the object up to this "length". You may set this length at any +time to adjust the amount range where the getters/setters will be invoked. + +### "toArray()" -> Array + +Returns a new regular Array instance with the same values that this ArrayIndex +class would have. This function calls the `__get__` function repeatedly from +`0...length-1` and returns the "flattened" array instance. + +### "toJSON()" -> Array + +All `ArrayIndex` instances get basic support for `JSON.stringify()`, which is +the same as a "flattened" Array being stringified. + +### "toString()" -> String + +The `toString()` override is basically just `array.toArray().toString()`. + +### "format()" -> String + +The `inspect()` implementation for the REPL attempts to mimic what a regular +Array looks like in the REPL. + + +License +------- + +(The MIT License) + +Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net> + +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/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/component.json b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/component.json new file mode 100644 index 00000000000..390d7a7fe88 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/component.json @@ -0,0 +1,22 @@ +{ + "name": "array-index", + "repo": "TooTallNate/array-index", + "description": "Invoke getter/setter functions on array-like objects", + "keywords": [ + "index", + "array", + "getter", + "setter", + "proxy" + ], + "version": "0.1.1", + "dependencies": { + "visionmedia/debug": "*" + }, + "development": {}, + "license": "MIT", + "main": "index.js", + "scripts": [ + "index.js" + ] +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/index.js b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/index.js new file mode 100644 index 00000000000..18069c6bcd4 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/index.js @@ -0,0 +1,180 @@ + +/** + * Module dependencies. + */ + +var util = require('util') +var debug = require('debug')('array-index') + +/** + * JavaScript Array "length" is bound to an unsigned 32-bit int. + * See: http://stackoverflow.com/a/6155063/376773 + */ + +var MAX_LENGTH = Math.pow(2, 32) + +/** + * Module exports. + */ + +module.exports = ArrayIndex + +/** + * Subclass this. + */ + +function ArrayIndex (length) { + Object.defineProperty(this, 'length', { + get: getLength, + set: setLength, + enumerable: false, + configurable: true + }) + + Object.defineProperty(this, '__length', { + value: 0, + writable: true, + enumerable: false, + configurable: true + }) + + if (arguments.length > 0) { + this.length = length + } +} + +/** + * You overwrite the "__get__" function in your subclass. + */ + +ArrayIndex.prototype.__get__ = function () { + throw new Error('you must implement the __get__ function') +} + +/** + * You overwrite the "__set__" function in your subclass. + */ + +ArrayIndex.prototype.__set__ = function () { + throw new Error('you must implement the __set__ function') +} + +/** + * Converts this array class into a real JavaScript Array. Note that this + * is a "flattened" array and your defined getters and setters won't be invoked + * when you interact with the returned Array. This function will call the + * getter on every array index of the object. + * + * @return {Array} The flattened array + * @api public + */ + +ArrayIndex.prototype.toArray = function toArray () { + var i = 0, l = this.length, array = new Array(l) + for (; i < l; i++) { + array[i] = this[i] + } + return array +} + +/** + * Basic support for `JSON.stringify()`. + */ + +ArrayIndex.prototype.toJSON = function toJSON () { + return this.toArray() +} + +/** + * toString() override. Use Array.prototype.toString(). + */ + +ArrayIndex.prototype.toString = function toString () { + var a = this.toArray() + return a.toString.apply(a, arguments) +} + +/** + * inspect() override. For the REPL. + */ + +ArrayIndex.prototype.inspect = function inspect () { + var a = this.toArray() + Object.keys(this).forEach(function (k) { + a[k] = this[k] + }, this) + return util.inspect(a) +} + +/** + * Getter for the "length" property. + * Returns the value of the "__length" property. + */ + +function getLength () { + debug('getting "length": %o', this.__length) + return this.__length +} + +/** + * Setter for the "length" property. + * Calls "ensureLength()", then sets the "__length" property. + */ + +function setLength (v) { + debug('setting "length": %o', v) + return this.__length = ensureLength(v) +} + +/** + * Ensures that getters/setters from 0 up to "_length" have been defined + * on `ArrayIndex.prototype`. + * + * @api private + */ + +function ensureLength (_length) { + var length + if (_length > MAX_LENGTH) { + length = MAX_LENGTH + } else { + length = _length | 0 + } + var cur = ArrayIndex.prototype.__length__ | 0 + var num = length - cur + if (num > 0) { + var desc = {} + debug('creating a descriptor object with %o entries', num) + for (var i = cur; i < length; i++) { + desc[i] = setup(i) + } + debug('done creating descriptor object') + debug('calling `Object.defineProperties()` with %o entries', num) + Object.defineProperties(ArrayIndex.prototype, desc) + debug('finished `Object.defineProperties()`') + ArrayIndex.prototype.__length__ = length + } + return length +} + +/** + * Returns a property descriptor for the given "index", with "get" and "set" + * functions created within the closure. + * + * @api private + */ + +function setup (index) { + function get () { + return this.__get__(index) + } + function set (v) { + return this.__set__(index, v) + } + return { + enumerable: true + , configurable: true + , get: get + , set: set + } +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/.npmignore b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/.npmignore new file mode 100644 index 00000000000..7e6163db02e --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/.npmignore @@ -0,0 +1,6 @@ +support +test +examples +example +*.sock +dist diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/History.md b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/History.md new file mode 100644 index 00000000000..854c9711c6f --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/History.md @@ -0,0 +1,195 @@ + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +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/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/Makefile b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/Makefile new file mode 100644 index 00000000000..5cf4a5962b8 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/Makefile @@ -0,0 +1,36 @@ + +# 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 dist + +dist: + @mkdir -p $@ + +dist/debug.js: node_modules browser.js debug.js dist + @$(BROWSERIFY) \ + --standalone debug \ + . > $@ + +distclean: clean + @rm -rf node_modules + +node_modules: package.json + @NODE_ENV= $(NPM) install + @touch node_modules + +.PHONY: all install clean distclean diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/Readme.md b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/Readme.md new file mode 100644 index 00000000000..b4f45e3cc6a --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/Readme.md @@ -0,0 +1,188 @@ +# 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) + +#### Windows note + + On Windows the environment variable is set using the `set` command. + + ```cmd + set DEBUG=*,-not_this + ``` + +Then, run the program to be debugged as usual. + +## 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`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. Somewhere in the code on your page, include: + +```js +window.myDebug = require("debug"); +``` + + ("debug" is a global object in the browser so we give this object a different name.) When your page is open in the browser, type the following in the console: + +```js +myDebug.enable("worker:*") +``` + + Refresh the page. Debug output will continue to be sent to the console until it is disabled by typing `myDebug.disable()` in the console. + +```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 _stdout.js_: + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +### Save debug output to a file + +You can save all debug statements to a file by piping them. + +Example: + +```bash +$ DEBUG_FD=3 node your-app.js 3> whatever.log +``` + +## 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/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/bower.json b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/bower.json new file mode 100644 index 00000000000..6af573ff5c2 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/bower.json @@ -0,0 +1,28 @@ +{ + "name": "visionmedia-debug", + "main": "dist/debug.js", + "version": "2.2.0", + "homepage": "https://github.com/visionmedia/debug", + "authors": [ + "TJ Holowaychuk " + ], + "description": "visionmedia-debug", + "moduleType": [ + "amd", + "es6", + "globals", + "node" + ], + "keywords": [ + "visionmedia", + "debug" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/browser.js b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/browser.js new file mode 100644 index 00000000000..7c764522199 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/browser.js @@ -0,0 +1,168 @@ + +/** + * 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; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * 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/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage(){ + try { + return window.localStorage; + } catch (e) {} +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/component.json b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/component.json new file mode 100644 index 00000000000..ca1063724a4 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/component.json @@ -0,0 +1,19 @@ +{ + "name": "debug", + "repo": "visionmedia/debug", + "description": "small debugging utility", + "version": "2.2.0", + "keywords": [ + "debug", + "log", + "debugger" + ], + "main": "browser.js", + "scripts": [ + "browser.js", + "debug.js" + ], + "dependencies": { + "rauchg/ms.js": "0.7.1" + } +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/debug.js b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/debug.js new file mode 100644 index 00000000000..7571a86058a --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/debug.js @@ -0,0 +1,197 @@ + +/** + * 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/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node.js b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node.js new file mode 100644 index 00000000000..1d392a81d6c --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node.js @@ -0,0 +1,209 @@ + +/** + * 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[3' + c + ';1m' + 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/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/.npmignore b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/.npmignore new file mode 100644 index 00000000000..d1aa0ce42e1 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/.npmignore @@ -0,0 +1,5 @@ +node_modules +test +History.md +Makefile +component.json diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/History.md b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/History.md new file mode 100644 index 00000000000..32fdfc17623 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/History.md @@ -0,0 +1,66 @@ + +0.7.1 / 2015-04-20 +================== + + * prevent extraordinary long inputs (@evilpacket) + * Fixed broken readme link + +0.7.0 / 2014-11-24 +================== + + * add time abbreviations, updated tests and readme for the new units + * fix example in the readme. + * add LICENSE file + +0.6.2 / 2013-12-05 +================== + + * Adding repository section to package.json to suppress warning from NPM. + +0.6.1 / 2013-05-10 +================== + + * fix singularization [visionmedia] + +0.6.0 / 2013-03-15 +================== + + * fix minutes + +0.5.1 / 2013-02-24 +================== + + * add component namespace + +0.5.0 / 2012-11-09 +================== + + * add short formatting as default and .long option + * add .license property to component.json + * add version to component.json + +0.4.0 / 2012-10-22 +================== + + * add rounding to fix crazy decimals + +0.3.0 / 2012-09-07 +================== + + * fix `ms()` [visionmedia] + +0.2.0 / 2012-09-03 +================== + + * add component.json [visionmedia] + * add days support [visionmedia] + * add hours support [visionmedia] + * add minutes support [visionmedia] + * add seconds support [visionmedia] + * add ms string support [visionmedia] + * refactor tests to facilitate ms(number) [visionmedia] + +0.1.0 / 2012-03-07 +================== + + * Initial release diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/LICENSE b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/LICENSE new file mode 100644 index 00000000000..6c07561b62d --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +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. diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/README.md b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/README.md new file mode 100644 index 00000000000..9b4fd03581b --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/README.md @@ -0,0 +1,35 @@ +# ms.js: miliseconds conversion utility + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +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`](https://www.npmjs.org/package/ms) in [NPM](http://nodejs.org/download). +- 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 diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/index.js b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/index.js new file mode 100644 index 00000000000..4f927716967 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/index.js @@ -0,0 +1,125 @@ +/** + * 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) { + str = '' + str; + if (str.length > 10000) return; + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|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 'yrs': + case 'yr': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + 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/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/package.json b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/package.json new file mode 100644 index 00000000000..253335e6234 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/node_modules/ms/package.json @@ -0,0 +1,48 @@ +{ + "name": "ms", + "version": "0.7.1", + "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" + } + }, + "gitHead": "713dcf26d9e6fd9dbc95affe7eff9783b7f1b909", + "bugs": { + "url": "https://github.com/guille/ms.js/issues" + }, + "homepage": "https://github.com/guille/ms.js", + "_id": "ms@0.7.1", + "scripts": {}, + "_shasum": "9cd13c03adbff25b65effde7ce864ee952017098", + "_from": "ms@0.7.1", + "_npmVersion": "2.7.5", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "rauchg", + "email": "rauchg@gmail.com" + }, + "maintainers": [ + { + "name": "rauchg", + "email": "rauchg@gmail.com" + } + ], + "dist": { + "shasum": "9cd13c03adbff25b65effde7ce864ee952017098", + "tarball": "http://registry.npmjs.org/ms/-/ms-0.7.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/package.json b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/package.json new file mode 100644 index 00000000000..7e6d9fc59a1 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/debug/package.json @@ -0,0 +1,73 @@ +{ + "name": "debug", + "version": "2.2.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.7.1" + }, + "devDependencies": { + "browserify": "9.0.3", + "mocha": "*" + }, + "main": "./node.js", + "browser": "./browser.js", + "component": { + "scripts": { + "debug/index.js": "browser.js", + "debug/debug.js": "debug.js" + } + }, + "gitHead": "b38458422b5aa8aa6d286b10dfe427e8a67e2b35", + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "homepage": "https://github.com/visionmedia/debug", + "_id": "debug@2.2.0", + "scripts": {}, + "_shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", + "_from": "debug@*", + "_npmVersion": "2.7.4", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "maintainers": [ + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + }, + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "dist": { + "shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", + "tarball": "http://registry.npmjs.org/debug/-/debug-2.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/package.json b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/package.json new file mode 100644 index 00000000000..6ba9df72c29 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/package.json @@ -0,0 +1,58 @@ +{ + "name": "array-index", + "description": "Invoke getter/setter functions on array-like objects", + "keywords": [ + "index", + "array", + "getter", + "setter", + "proxy" + ], + "version": "0.1.1", + "author": { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://tootallnate.net" + }, + "repository": { + "type": "git", + "url": "git://github.com/TooTallNate/array-index.git" + }, + "main": "index.js", + "scripts": { + "test": "node test" + }, + "dependencies": { + "debug": "*" + }, + "engines": { + "node": "*" + }, + "gitHead": "65a5d884f25b4b7a1608e367d715d713dbd3b3d6", + "bugs": { + "url": "https://github.com/TooTallNate/array-index/issues" + }, + "homepage": "https://github.com/TooTallNate/array-index", + "_id": "array-index@0.1.1", + "_shasum": "4d5eaf06cc3d925847cd73d1535c217ba306d3e1", + "_from": "array-index@>=0.1.0 <0.2.0", + "_npmVersion": "2.1.3", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "maintainers": [ + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "dist": { + "shasum": "4d5eaf06cc3d925847cd73d1535c217ba306d3e1", + "tarball": "http://registry.npmjs.org/array-index/-/array-index-0.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/array-index/-/array-index-0.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/test.js b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/test.js new file mode 100644 index 00000000000..d9e9c182813 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/test.js @@ -0,0 +1,76 @@ + +var ArrayIndex = require('./') +var inherits = require('util').inherits +var assert = require('assert') + + +/** + * Create a "subclass". + */ + +function Arrayish (length) { + ArrayIndex.call(this, length) + this.sets = Object.create(null) +} + +// inherit from `ArrayIndex` +inherits(Arrayish, ArrayIndex) + + +// create an instance and run some tests +var a = new Arrayish(11) + +assert.throws(function () { + a[0] +}, /__get__/) + +assert.throws(function () { + a[0] = 0 +}, /__set__/) + + +/** + * This "getter" function checks if the index has previosly been "set", and if so + * returns the index * the value previously set. If the index hasn't been set, + * return the index as-is. + */ + +Arrayish.prototype.__get__ = function get (index) { + if (index in this.sets) { + return +this.sets[index] * index + } else { + return index + } +} + +/** + * Store the last value set for this index. + */ + +Arrayish.prototype.__set__ = function set (index, value) { + this.sets[index] = value +} + + +// test getters without being "set" +assert.equal(0, a[0]) +assert.equal(1, a[1]) +assert.equal(2, a[2]) +assert.equal(3, a[3]) +assert.equal(4, a[4]) + +// test setters, followed by getters +a[10] = 1 +assert.equal(10, a[10]) +a[10] = 2 +assert.equal(20, a[10]) +a[10] = 3 +assert.equal(30, a[10]) + +// test "length" +assert.equal(11, a.length) + +a[4] = 20 +a[6] = 5.55432 +var b = [0, 1, 2, 3, 80, 5, 33.325919999999996, 7, 8, 9, 30] +assert.equal(JSON.stringify(b), JSON.stringify(a)) diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/package.json b/deps/npm/node_modules/node-gyp/node_modules/path-array/package.json new file mode 100644 index 00000000000..41d25482b86 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/package.json @@ -0,0 +1,56 @@ +{ + "name": "path-array", + "version": "1.0.0", + "description": "Treat your $PATH like a JavaScript Array", + "main": "index.js", + "scripts": { + "test": "mocha --reporter spec" + }, + "repository": { + "type": "git", + "url": "git://github.com/TooTallNate/node-path-array.git" + }, + "keywords": [ + "PATH", + "env", + "array" + ], + "author": { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io/" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/TooTallNate/node-path-array/issues" + }, + "homepage": "https://github.com/TooTallNate/node-path-array", + "dependencies": { + "array-index": "~0.1.0" + }, + "devDependencies": { + "mocha": "~1.16.1" + }, + "gitHead": "5d1fedd54e4413459f67e4a4babb024144cd00d0", + "_id": "path-array@1.0.0", + "_shasum": "6c14130c33084f0150553c657b38397ab67aaa4e", + "_from": "path-array@>=1.0.0 <2.0.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + "maintainers": [ + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + } + ], + "dist": { + "shasum": "6c14130c33084f0150553c657b38397ab67aaa4e", + "tarball": "http://registry.npmjs.org/path-array/-/path-array-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/path-array/-/path-array-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/path-array/test/test.js b/deps/npm/node_modules/node-gyp/node_modules/path-array/test/test.js new file mode 100644 index 00000000000..fc1f3736fa6 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/path-array/test/test.js @@ -0,0 +1,68 @@ + +/** + * Module dependencies. + */ + +var assert = require('assert'); +var PathArray = require('../'); +var delimiter = require('path').delimiter || ':'; + +describe('PathArray', function () { + it('should use `process.env` by default', function () { + var p = new PathArray(); + assert.equal(p._env, process.env); + }); + it('should return the $PATH string for .toString()', function () { + var p = new PathArray(); + assert.equal(p.toString(), process.env.PATH); + }); + it('should accept an arbitrary `env` object', function () { + var env = { PATH: '/foo' + delimiter + '/bar' }; + var p = new PathArray(env); + assert.equal(p.toString(), env.PATH); + }); + it('should work for [n] getter syntax', function () { + var env = { PATH: '/foo' + delimiter + '/bar' }; + var p = new PathArray(env); + assert.equal('/foo', p[0]); + assert.equal('/bar', p[1]); + }); + it('should work for [n]= setter syntax', function () { + var env = { PATH: '/foo' + delimiter + '/bar' }; + var p = new PathArray(env); + p[0] = '/baz'; + assert.equal('/baz' + delimiter + '/bar', env.PATH); + }); + it('should work with .push()', function () { + var env = { PATH: '/foo' + delimiter + '/bar' }; + var p = new PathArray(env); + p.push('/baz'); + assert.equal('/foo' + delimiter + '/bar' + delimiter + '/baz', env.PATH); + }); + it('should work with .shift()', function () { + var env = { PATH: '/foo' + delimiter + '/bar' }; + var p = new PathArray(env); + assert.equal('/foo', p.shift()); + assert.equal('/bar', env.PATH); + }); + it('should work with .pop()', function () { + var env = { PATH: '/foo' + delimiter + '/bar' }; + var p = new PathArray(env); + assert.equal('/bar', p.pop()); + assert.equal('/foo', env.PATH); + }); + it('should work with .unshift()', function () { + var env = { PATH: '/foo' + delimiter + '/bar' }; + var p = new PathArray(env); + p.unshift('/baz'); + assert.equal('/baz' + delimiter + '/foo' + delimiter + '/bar', env.PATH); + }); + it('should be able to specify property name to use with second argument', function () { + var env = { PYTHONPATH: '/foo' }; + var p = new PathArray(env, 'PYTHONPATH'); + assert.equal(1, p.length); + p.push('/baz'); + assert.equal(2, p.length); + assert.equal('/foo' + delimiter + '/baz', env.PYTHONPATH); + }); +}); diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/.npmignore b/deps/npm/node_modules/node-gyp/node_modules/tar/.npmignore new file mode 100644 index 00000000000..c167ad5b1c1 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/.npmignore @@ -0,0 +1,5 @@ +.*.swp +node_modules +examples/extract/ +test/tmp/ +test/fixtures/ diff --git a/deps/npm/node_modules/minimatch/.travis.yml b/deps/npm/node_modules/node-gyp/node_modules/tar/.travis.yml similarity index 100% rename from deps/npm/node_modules/minimatch/.travis.yml rename to deps/npm/node_modules/node-gyp/node_modules/tar/.travis.yml diff --git a/deps/npm/node_modules/tar/LICENCE b/deps/npm/node_modules/node-gyp/node_modules/tar/LICENCE similarity index 100% rename from deps/npm/node_modules/tar/LICENCE rename to deps/npm/node_modules/node-gyp/node_modules/tar/LICENCE diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/README.md b/deps/npm/node_modules/node-gyp/node_modules/tar/README.md new file mode 100644 index 00000000000..424a2782bf7 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/README.md @@ -0,0 +1,48 @@ +# node-tar + +Tar for Node.js. + +[![NPM](https://nodei.co/npm/tar.png)](https://nodei.co/npm/tar/) + +## API + +See `examples/` for usage examples. + +### var tar = require('tar') + +Returns an object with `.Pack`, `.Extract` and `.Parse` methods. + +### tar.Pack([properties]) + +Returns a through stream. Use +[fstream](https://npmjs.org/package/fstream) to write files into the +pack stream and you will receive tar archive data from the pack +stream. + +This only works with directories, it does not work with individual files. + +The optional `properties` object are used to set properties in the tar +'Global Extended Header'. + +### tar.Extract([options]) + +Returns a through stream. Write tar data to the stream and the files +in the tarball will be extracted onto the filesystem. + +`options` can be: + +```js +{ + path: '/path/to/extract/tar/into', + strip: 0, // how many path segments to strip from the root when extracting +} +``` + +`options` also get passed to the `fstream.Writer` instance that `tar` +uses internally. + +### tar.Parse() + +Returns a writable stream. Write tar data to it and it will emit +`entry` events for each entry parsed from the tarball. This is used by +`tar.Extract`. diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/examples/extracter.js b/deps/npm/node_modules/node-gyp/node_modules/tar/examples/extracter.js new file mode 100644 index 00000000000..f6253a72c5c --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/examples/extracter.js @@ -0,0 +1,19 @@ +var tar = require("../tar.js") + , fs = require("fs") + + +function onError(err) { + console.error('An error occurred:', err) +} + +function onEnd() { + console.log('Extracted!') +} + +var extractor = tar.Extract({path: __dirname + "/extract"}) + .on('error', onError) + .on('end', onEnd); + +fs.createReadStream(__dirname + "/../test/fixtures/c.tar") + .on('error', onError) + .pipe(extractor); diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/examples/packer.js b/deps/npm/node_modules/node-gyp/node_modules/tar/examples/packer.js new file mode 100644 index 00000000000..039969ce300 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/examples/packer.js @@ -0,0 +1,24 @@ +var tar = require("../tar.js") + , fstream = require("fstream") + , fs = require("fs") + +var dirDest = fs.createWriteStream('dir.tar') + + +function onError(err) { + console.error('An error occurred:', err) +} + +function onEnd() { + console.log('Packed!') +} + +var packer = tar.Pack({ noProprietary: true }) + .on('error', onError) + .on('end', onEnd); + +// This must be a "directory" +fstream.Reader({ path: __dirname, type: "Directory" }) + .on('error', onError) + .pipe(packer) + .pipe(dirDest) diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/examples/reader.js b/deps/npm/node_modules/node-gyp/node_modules/tar/examples/reader.js new file mode 100644 index 00000000000..39f3f0888a2 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/examples/reader.js @@ -0,0 +1,36 @@ +var tar = require("../tar.js") + , fs = require("fs") + +fs.createReadStream(__dirname + "/../test/fixtures/c.tar") + .pipe(tar.Parse()) + .on("extendedHeader", function (e) { + console.error("extended pax header", e.props) + e.on("end", function () { + console.error("extended pax fields:", e.fields) + }) + }) + .on("ignoredEntry", function (e) { + console.error("ignoredEntry?!?", e.props) + }) + .on("longLinkpath", function (e) { + console.error("longLinkpath entry", e.props) + e.on("end", function () { + console.error("value=%j", e.body.toString()) + }) + }) + .on("longPath", function (e) { + console.error("longPath entry", e.props) + e.on("end", function () { + console.error("value=%j", e.body.toString()) + }) + }) + .on("entry", function (e) { + console.error("entry", e.props) + e.on("data", function (c) { + console.error(" >>>" + c.toString().replace(/\n/g, "\\n")) + }) + e.on("end", function () { + console.error(" << 0 + return !this._needDrain +} + +EntryWriter.prototype.end = function (c) { + // console.error(".. ew end") + if (c) this._buffer.push(c) + this._buffer.push(EOF) + this._ended = true + this._process() + this._needDrain = this._buffer.length > 0 +} + +EntryWriter.prototype.pause = function () { + // console.error(".. ew pause") + this._paused = true + this.emit("pause") +} + +EntryWriter.prototype.resume = function () { + // console.error(".. ew resume") + this._paused = false + this.emit("resume") + this._process() +} + +EntryWriter.prototype.add = function (entry) { + // console.error(".. ew add") + if (!this.parent) return this.emit("error", new Error("no parent")) + + // make sure that the _header and such is emitted, and clear out + // the _currentEntry link on the parent. + if (!this._ended) this.end() + + return this.parent.add(entry) +} + +EntryWriter.prototype._header = function () { + // console.error(".. ew header") + if (this._didHeader) return + this._didHeader = true + + var headerBlock = TarHeader.encode(this.props) + + if (this.props.needExtended && !this._meta) { + var me = this + + ExtendedHeaderWriter = ExtendedHeaderWriter || + require("./extended-header-writer.js") + + ExtendedHeaderWriter(this.props) + .on("data", function (c) { + me.emit("data", c) + }) + .on("error", function (er) { + me.emit("error", er) + }) + .end() + } + + // console.error(".. .. ew headerBlock emitting") + this.emit("data", headerBlock) + this.emit("header") +} + +EntryWriter.prototype._process = function () { + // console.error(".. .. ew process") + if (!this._didHeader && !this._meta) { + this._header() + } + + if (this._paused || this._processing) { + // console.error(".. .. .. paused=%j, processing=%j", this._paused, this._processing) + return + } + + this._processing = true + + var buf = this._buffer + for (var i = 0; i < buf.length; i ++) { + // console.error(".. .. .. i=%d", i) + + var c = buf[i] + + if (c === EOF) this._stream.end() + else this._stream.write(c) + + if (this._paused) { + // console.error(".. .. .. paused mid-emission") + this._processing = false + if (i < buf.length) { + this._needDrain = true + this._buffer = buf.slice(i + 1) + } + return + } + } + + // console.error(".. .. .. emitted") + this._buffer.length = 0 + this._processing = false + + // console.error(".. .. .. emitting drain") + this.emit("drain") +} + +EntryWriter.prototype.destroy = function () {} diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/lib/entry.js b/deps/npm/node_modules/node-gyp/node_modules/tar/lib/entry.js new file mode 100644 index 00000000000..4af5c410838 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/lib/entry.js @@ -0,0 +1,213 @@ +// A passthrough read/write stream that sets its properties +// based on a header, extendedHeader, and globalHeader +// +// Can be either a file system object of some sort, or +// a pax/ustar metadata entry. + +module.exports = Entry + +var TarHeader = require("./header.js") + , tar = require("../tar") + , assert = require("assert").ok + , Stream = require("stream").Stream + , inherits = require("inherits") + , fstream = require("fstream").Abstract + +function Entry (header, extended, global) { + Stream.call(this) + this.readable = true + this.writable = true + + this._needDrain = false + this._paused = false + this._reading = false + this._ending = false + this._ended = false + this._remaining = 0 + this._queue = [] + this._index = 0 + this._queueLen = 0 + + this._read = this._read.bind(this) + + this.props = {} + this._header = header + this._extended = extended || {} + + // globals can change throughout the course of + // a file parse operation. Freeze it at its current state. + this._global = {} + var me = this + Object.keys(global || {}).forEach(function (g) { + me._global[g] = global[g] + }) + + this._setProps() +} + +inherits(Entry, Stream) + +Entry.prototype.write = function (c) { + if (this._ending) this.error("write() after end()", null, true) + if (this._remaining === 0) { + this.error("invalid bytes past eof") + } + + // often we'll get a bunch of \0 at the end of the last write, + // since chunks will always be 512 bytes when reading a tarball. + if (c.length > this._remaining) { + c = c.slice(0, this._remaining) + } + this._remaining -= c.length + + // put it on the stack. + var ql = this._queueLen + this._queue.push(c) + this._queueLen ++ + + this._read() + + // either paused, or buffered + if (this._paused || ql > 0) { + this._needDrain = true + return false + } + + return true +} + +Entry.prototype.end = function (c) { + if (c) this.write(c) + this._ending = true + this._read() +} + +Entry.prototype.pause = function () { + this._paused = true + this.emit("pause") +} + +Entry.prototype.resume = function () { + // console.error(" Tar Entry resume", this.path) + this.emit("resume") + this._paused = false + this._read() + return this._queueLen - this._index > 1 +} + + // This is bound to the instance +Entry.prototype._read = function () { + // console.error(" Tar Entry _read", this.path) + + if (this._paused || this._reading || this._ended) return + + // set this flag so that event handlers don't inadvertently + // get multiple _read() calls running. + this._reading = true + + // have any data to emit? + while (this._index < this._queueLen && !this._paused) { + var chunk = this._queue[this._index ++] + this.emit("data", chunk) + } + + // check if we're drained + if (this._index >= this._queueLen) { + this._queue.length = this._queueLen = this._index = 0 + if (this._needDrain) { + this._needDrain = false + this.emit("drain") + } + if (this._ending) { + this._ended = true + this.emit("end") + } + } + + // if the queue gets too big, then pluck off whatever we can. + // this should be fairly rare. + var mql = this._maxQueueLen + if (this._queueLen > mql && this._index > 0) { + mql = Math.min(this._index, mql) + this._index -= mql + this._queueLen -= mql + this._queue = this._queue.slice(mql) + } + + this._reading = false +} + +Entry.prototype._setProps = function () { + // props = extended->global->header->{} + var header = this._header + , extended = this._extended + , global = this._global + , props = this.props + + // first get the values from the normal header. + var fields = tar.fields + for (var f = 0; fields[f] !== null; f ++) { + var field = fields[f] + , val = header[field] + if (typeof val !== "undefined") props[field] = val + } + + // next, the global header for this file. + // numeric values, etc, will have already been parsed. + ;[global, extended].forEach(function (p) { + Object.keys(p).forEach(function (f) { + if (typeof p[f] !== "undefined") props[f] = p[f] + }) + }) + + // no nulls allowed in path or linkpath + ;["path", "linkpath"].forEach(function (p) { + if (props.hasOwnProperty(p)) { + props[p] = props[p].split("\0")[0] + } + }) + + + // set date fields to be a proper date + ;["mtime", "ctime", "atime"].forEach(function (p) { + if (props.hasOwnProperty(p)) { + props[p] = new Date(props[p] * 1000) + } + }) + + // set the type so that we know what kind of file to create + var type + switch (tar.types[props.type]) { + case "OldFile": + case "ContiguousFile": + type = "File" + break + + case "GNUDumpDir": + type = "Directory" + break + + case undefined: + type = "Unknown" + break + + case "Link": + case "SymbolicLink": + case "CharacterDevice": + case "BlockDevice": + case "Directory": + case "FIFO": + default: + type = tar.types[props.type] + } + + this.type = type + this.path = props.path + this.size = props.size + + // size is special, since it signals when the file needs to end. + this._remaining = props.size +} + +Entry.prototype.warn = fstream.warn +Entry.prototype.error = fstream.error diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/lib/extended-header-writer.js b/deps/npm/node_modules/node-gyp/node_modules/tar/lib/extended-header-writer.js new file mode 100644 index 00000000000..1728c4583ae --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/lib/extended-header-writer.js @@ -0,0 +1,191 @@ + +module.exports = ExtendedHeaderWriter + +var inherits = require("inherits") + , EntryWriter = require("./entry-writer.js") + +inherits(ExtendedHeaderWriter, EntryWriter) + +var tar = require("../tar.js") + , path = require("path") + , TarHeader = require("./header.js") + +// props is the props of the thing we need to write an +// extended header for. +// Don't be shy with it. Just encode everything. +function ExtendedHeaderWriter (props) { + // console.error(">> ehw ctor") + var me = this + + if (!(me instanceof ExtendedHeaderWriter)) { + return new ExtendedHeaderWriter(props) + } + + me.fields = props + + var p = + { path : ("PaxHeader" + path.join("/", props.path || "")) + .replace(/\\/g, "/").substr(0, 100) + , mode : props.mode || 0666 + , uid : props.uid || 0 + , gid : props.gid || 0 + , size : 0 // will be set later + , mtime : props.mtime || Date.now() / 1000 + , type : "x" + , linkpath : "" + , ustar : "ustar\0" + , ustarver : "00" + , uname : props.uname || "" + , gname : props.gname || "" + , devmaj : props.devmaj || 0 + , devmin : props.devmin || 0 + } + + + EntryWriter.call(me, p) + // console.error(">> ehw props", me.props) + me.props = p + + me._meta = true +} + +ExtendedHeaderWriter.prototype.end = function () { + // console.error(">> ehw end") + var me = this + + if (me._ended) return + me._ended = true + + me._encodeFields() + + if (me.props.size === 0) { + // nothing to write! + me._ready = true + me._stream.end() + return + } + + me._stream.write(TarHeader.encode(me.props)) + me.body.forEach(function (l) { + me._stream.write(l) + }) + me._ready = true + + // console.error(">> ehw _process calling end()", me.props) + this._stream.end() +} + +ExtendedHeaderWriter.prototype._encodeFields = function () { + // console.error(">> ehw _encodeFields") + this.body = [] + if (this.fields.prefix) { + this.fields.path = this.fields.prefix + "/" + this.fields.path + this.fields.prefix = "" + } + encodeFields(this.fields, "", this.body, this.fields.noProprietary) + var me = this + this.body.forEach(function (l) { + me.props.size += l.length + }) +} + +function encodeFields (fields, prefix, body, nop) { + // console.error(">> >> ehw encodeFields") + // "%d %s=%s\n", , , + // The length is a decimal number, and includes itself and the \n + // Numeric values are decimal strings. + + Object.keys(fields).forEach(function (k) { + var val = fields[k] + , numeric = tar.numeric[k] + + if (prefix) k = prefix + "." + k + + // already including NODETAR.type, don't need File=true also + if (k === fields.type && val === true) return + + switch (k) { + // don't include anything that's always handled just fine + // in the normal header, or only meaningful in the context + // of nodetar + case "mode": + case "cksum": + case "ustar": + case "ustarver": + case "prefix": + case "basename": + case "dirname": + case "needExtended": + case "block": + case "filter": + return + + case "rdev": + if (val === 0) return + break + + case "nlink": + case "dev": // Truly a hero among men, Creator of Star! + case "ino": // Speak his name with reverent awe! It is: + k = "SCHILY." + k + break + + default: break + } + + if (val && typeof val === "object" && + !Buffer.isBuffer(val)) encodeFields(val, k, body, nop) + else if (val === null || val === undefined) return + else body.push.apply(body, encodeField(k, val, nop)) + }) + + return body +} + +function encodeField (k, v, nop) { + // lowercase keys must be valid, otherwise prefix with + // "NODETAR." + if (k.charAt(0) === k.charAt(0).toLowerCase()) { + var m = k.split(".")[0] + if (!tar.knownExtended[m]) k = "NODETAR." + k + } + + // no proprietary + if (nop && k.charAt(0) !== k.charAt(0).toLowerCase()) { + return [] + } + + if (typeof val === "number") val = val.toString(10) + + var s = new Buffer(" " + k + "=" + v + "\n") + , digits = Math.floor(Math.log(s.length) / Math.log(10)) + 1 + + // console.error("1 s=%j digits=%j s.length=%d", s.toString(), digits, s.length) + + // if adding that many digits will make it go over that length, + // then add one to it. For example, if the string is: + // " foo=bar\n" + // then that's 9 characters. With the "9", that bumps the length + // up to 10. However, this is invalid: + // "10 foo=bar\n" + // but, since that's actually 11 characters, since 10 adds another + // character to the length, and the length includes the number + // itself. In that case, just bump it up again. + if (s.length + digits >= Math.pow(10, digits)) digits += 1 + // console.error("2 s=%j digits=%j s.length=%d", s.toString(), digits, s.length) + + var len = digits + s.length + // console.error("3 s=%j digits=%j s.length=%d len=%d", s.toString(), digits, s.length, len) + var lenBuf = new Buffer("" + len) + if (lenBuf.length + s.length !== len) { + throw new Error("Bad length calculation\n"+ + "len="+len+"\n"+ + "lenBuf="+JSON.stringify(lenBuf.toString())+"\n"+ + "lenBuf.length="+lenBuf.length+"\n"+ + "digits="+digits+"\n"+ + "s="+JSON.stringify(s.toString())+"\n"+ + "s.length="+s.length) + } + + return [lenBuf, s] +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/lib/extended-header.js b/deps/npm/node_modules/node-gyp/node_modules/tar/lib/extended-header.js new file mode 100644 index 00000000000..74f432ceee5 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/lib/extended-header.js @@ -0,0 +1,140 @@ +// An Entry consisting of: +// +// "%d %s=%s\n", , , +// +// The length is a decimal number, and includes itself and the \n +// \0 does not terminate anything. Only the length terminates the string. +// Numeric values are decimal strings. + +module.exports = ExtendedHeader + +var Entry = require("./entry.js") + , inherits = require("inherits") + , tar = require("../tar.js") + , numeric = tar.numeric + , keyTrans = { "SCHILY.dev": "dev" + , "SCHILY.ino": "ino" + , "SCHILY.nlink": "nlink" } + +function ExtendedHeader () { + Entry.apply(this, arguments) + this.on("data", this._parse) + this.fields = {} + this._position = 0 + this._fieldPos = 0 + this._state = SIZE + this._sizeBuf = [] + this._keyBuf = [] + this._valBuf = [] + this._size = -1 + this._key = "" +} + +inherits(ExtendedHeader, Entry) +ExtendedHeader.prototype._parse = parse + +var s = 0 + , states = ExtendedHeader.states = {} + , SIZE = states.SIZE = s++ + , KEY = states.KEY = s++ + , VAL = states.VAL = s++ + , ERR = states.ERR = s++ + +Object.keys(states).forEach(function (s) { + states[states[s]] = states[s] +}) + +states[s] = null + +// char code values for comparison +var _0 = "0".charCodeAt(0) + , _9 = "9".charCodeAt(0) + , point = ".".charCodeAt(0) + , a = "a".charCodeAt(0) + , Z = "Z".charCodeAt(0) + , a = "a".charCodeAt(0) + , z = "z".charCodeAt(0) + , space = " ".charCodeAt(0) + , eq = "=".charCodeAt(0) + , cr = "\n".charCodeAt(0) + +function parse (c) { + if (this._state === ERR) return + + for ( var i = 0, l = c.length + ; i < l + ; this._position++, this._fieldPos++, i++) { + // console.error("top of loop, size="+this._size) + + var b = c[i] + + if (this._size >= 0 && this._fieldPos > this._size) { + error(this, "field exceeds length="+this._size) + return + } + + switch (this._state) { + case ERR: return + + case SIZE: + // console.error("parsing size, b=%d, rest=%j", b, c.slice(i).toString()) + if (b === space) { + this._state = KEY + // this._fieldPos = this._sizeBuf.length + this._size = parseInt(new Buffer(this._sizeBuf).toString(), 10) + this._sizeBuf.length = 0 + continue + } + if (b < _0 || b > _9) { + error(this, "expected [" + _0 + ".." + _9 + "], got " + b) + return + } + this._sizeBuf.push(b) + continue + + case KEY: + // can be any char except =, not > size. + if (b === eq) { + this._state = VAL + this._key = new Buffer(this._keyBuf).toString() + if (keyTrans[this._key]) this._key = keyTrans[this._key] + this._keyBuf.length = 0 + continue + } + this._keyBuf.push(b) + continue + + case VAL: + // field must end with cr + if (this._fieldPos === this._size - 1) { + // console.error("finished with "+this._key) + if (b !== cr) { + error(this, "expected \\n at end of field") + return + } + var val = new Buffer(this._valBuf).toString() + if (numeric[this._key]) { + val = parseFloat(val) + } + this.fields[this._key] = val + + this._valBuf.length = 0 + this._state = SIZE + this._size = -1 + this._fieldPos = -1 + continue + } + this._valBuf.push(b) + continue + } + } +} + +function error (me, msg) { + msg = "invalid header: " + msg + + "\nposition=" + me._position + + "\nfield position=" + me._fieldPos + + me.error(msg) + me.state = ERR +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/lib/extract.js b/deps/npm/node_modules/node-gyp/node_modules/tar/lib/extract.js new file mode 100644 index 00000000000..9fb1e6fb1b5 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/lib/extract.js @@ -0,0 +1,86 @@ +// give it a tarball and a path, and it'll dump the contents + +module.exports = Extract + +var tar = require("../tar.js") + , fstream = require("fstream") + , inherits = require("inherits") + , path = require("path") + +function Extract (opts) { + if (!(this instanceof Extract)) return new Extract(opts) + tar.Parse.apply(this) + + // have to dump into a directory + opts.type = "Directory" + opts.Directory = true + + if (typeof opts !== "object") { + opts = { path: opts } + } + + // better to drop in cwd? seems more standard. + opts.path = opts.path || path.resolve("node-tar-extract") + opts.type = "Directory" + opts.Directory = true + + // similar to --strip or --strip-components + opts.strip = +opts.strip + if (!opts.strip || opts.strip <= 0) opts.strip = 0 + + this._fst = fstream.Writer(opts) + + this.pause() + var me = this + + // Hardlinks in tarballs are relative to the root + // of the tarball. So, they need to be resolved against + // the target directory in order to be created properly. + me.on("entry", function (entry) { + // if there's a "strip" argument, then strip off that many + // path components. + if (opts.strip) { + var p = entry.path.split("/").slice(opts.strip).join("/") + entry.path = entry.props.path = p + if (entry.linkpath) { + var lp = entry.linkpath.split("/").slice(opts.strip).join("/") + entry.linkpath = entry.props.linkpath = lp + } + } + if (entry.type !== "Link") return + entry.linkpath = entry.props.linkpath = + path.join(opts.path, path.join("/", entry.props.linkpath)) + }) + + this._fst.on("ready", function () { + me.pipe(me._fst, { end: false }) + me.resume() + }) + + this._fst.on('error', function(err) { + me.emit('error', err) + }) + + this._fst.on('drain', function() { + me.emit('drain') + }) + + // this._fst.on("end", function () { + // console.error("\nEEEE Extract End", me._fst.path) + // }) + + this._fst.on("close", function () { + // console.error("\nEEEE Extract End", me._fst.path) + me.emit("end") + me.emit("close") + }) +} + +inherits(Extract, tar.Parse) + +Extract.prototype._streamEnd = function () { + var me = this + if (!me._ended) me.error("unexpected eof") + me._fst.end() + // my .end() is coming later. +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/lib/global-header-writer.js b/deps/npm/node_modules/node-gyp/node_modules/tar/lib/global-header-writer.js new file mode 100644 index 00000000000..0bfc7b80aa7 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/lib/global-header-writer.js @@ -0,0 +1,14 @@ +module.exports = GlobalHeaderWriter + +var ExtendedHeaderWriter = require("./extended-header-writer.js") + , inherits = require("inherits") + +inherits(GlobalHeaderWriter, ExtendedHeaderWriter) + +function GlobalHeaderWriter (props) { + if (!(this instanceof GlobalHeaderWriter)) { + return new GlobalHeaderWriter(props) + } + ExtendedHeaderWriter.call(this, props) + this.props.type = "g" +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/lib/header.js b/deps/npm/node_modules/node-gyp/node_modules/tar/lib/header.js new file mode 100644 index 00000000000..05b237c0c7b --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/lib/header.js @@ -0,0 +1,385 @@ +// parse a 512-byte header block to a data object, or vice-versa +// If the data won't fit nicely in a simple header, then generate +// the appropriate extended header file, and return that. + +module.exports = TarHeader + +var tar = require("../tar.js") + , fields = tar.fields + , fieldOffs = tar.fieldOffs + , fieldEnds = tar.fieldEnds + , fieldSize = tar.fieldSize + , numeric = tar.numeric + , assert = require("assert").ok + , space = " ".charCodeAt(0) + , slash = "/".charCodeAt(0) + , bslash = process.platform === "win32" ? "\\".charCodeAt(0) : null + +function TarHeader (block) { + if (!(this instanceof TarHeader)) return new TarHeader(block) + if (block) this.decode(block) +} + +TarHeader.prototype = + { decode : decode + , encode: encode + , calcSum: calcSum + , checkSum: checkSum + } + +TarHeader.parseNumeric = parseNumeric +TarHeader.encode = encode +TarHeader.decode = decode + +// note that this will only do the normal ustar header, not any kind +// of extended posix header file. If something doesn't fit comfortably, +// then it will set obj.needExtended = true, and set the block to +// the closest approximation. +function encode (obj) { + if (!obj && !(this instanceof TarHeader)) throw new Error( + "encode must be called on a TarHeader, or supplied an object") + + obj = obj || this + var block = obj.block = new Buffer(512) + + // if the object has a "prefix", then that's actually an extension of + // the path field. + if (obj.prefix) { + // console.error("%% header encoding, got a prefix", obj.prefix) + obj.path = obj.prefix + "/" + obj.path + // console.error("%% header encoding, prefixed path", obj.path) + obj.prefix = "" + } + + obj.needExtended = false + + if (obj.mode) { + if (typeof obj.mode === "string") obj.mode = parseInt(obj.mode, 8) + obj.mode = obj.mode & 0777 + } + + for (var f = 0; fields[f] !== null; f ++) { + var field = fields[f] + , off = fieldOffs[f] + , end = fieldEnds[f] + , ret + + switch (field) { + case "cksum": + // special, done below, after all the others + break + + case "prefix": + // special, this is an extension of the "path" field. + // console.error("%% header encoding, skip prefix later") + break + + case "type": + // convert from long name to a single char. + var type = obj.type || "0" + if (type.length > 1) { + type = tar.types[obj.type] + if (!type) type = "0" + } + writeText(block, off, end, type) + break + + case "path": + // uses the "prefix" field if > 100 bytes, but <= 255 + var pathLen = Buffer.byteLength(obj.path) + , pathFSize = fieldSize[fields.path] + , prefFSize = fieldSize[fields.prefix] + + // paths between 100 and 255 should use the prefix field. + // longer than 255 + if (pathLen > pathFSize && + pathLen <= pathFSize + prefFSize) { + // need to find a slash somewhere in the middle so that + // path and prefix both fit in their respective fields + var searchStart = pathLen - 1 - pathFSize + , searchEnd = prefFSize + , found = false + , pathBuf = new Buffer(obj.path) + + for ( var s = searchStart + ; (s <= searchEnd) + ; s ++ ) { + if (pathBuf[s] === slash || pathBuf[s] === bslash) { + found = s + break + } + } + + if (found !== false) { + prefix = pathBuf.slice(0, found).toString("utf8") + path = pathBuf.slice(found + 1).toString("utf8") + + ret = writeText(block, off, end, path) + off = fieldOffs[fields.prefix] + end = fieldEnds[fields.prefix] + // console.error("%% header writing prefix", off, end, prefix) + ret = writeText(block, off, end, prefix) || ret + break + } + } + + // paths less than 100 chars don't need a prefix + // and paths longer than 255 need an extended header and will fail + // on old implementations no matter what we do here. + // Null out the prefix, and fallthrough to default. + // console.error("%% header writing no prefix") + var poff = fieldOffs[fields.prefix] + , pend = fieldEnds[fields.prefix] + writeText(block, poff, pend, "") + // fallthrough + + // all other fields are numeric or text + default: + ret = numeric[field] + ? writeNumeric(block, off, end, obj[field]) + : writeText(block, off, end, obj[field] || "") + break + } + obj.needExtended = obj.needExtended || ret + } + + var off = fieldOffs[fields.cksum] + , end = fieldEnds[fields.cksum] + + writeNumeric(block, off, end, calcSum.call(this, block)) + + return block +} + +// if it's a negative number, or greater than will fit, +// then use write256. +var MAXNUM = { 12: 077777777777 + , 11: 07777777777 + , 8 : 07777777 + , 7 : 0777777 } +function writeNumeric (block, off, end, num) { + var writeLen = end - off + , maxNum = MAXNUM[writeLen] || 0 + + num = num || 0 + // console.error(" numeric", num) + + if (num instanceof Date || + Object.prototype.toString.call(num) === "[object Date]") { + num = num.getTime() / 1000 + } + + if (num > maxNum || num < 0) { + write256(block, off, end, num) + // need an extended header if negative or too big. + return true + } + + // god, tar is so annoying + // if the string is small enough, you should put a space + // between the octal string and the \0, but if it doesn't + // fit, then don't. + var numStr = Math.floor(num).toString(8) + if (num < MAXNUM[writeLen - 1]) numStr += " " + + // pad with "0" chars + if (numStr.length < writeLen) { + numStr = (new Array(writeLen - numStr.length).join("0")) + numStr + } + + if (numStr.length !== writeLen - 1) { + throw new Error("invalid length: " + JSON.stringify(numStr) + "\n" + + "expected: "+writeLen) + } + block.write(numStr, off, writeLen, "utf8") + block[end - 1] = 0 +} + +function write256 (block, off, end, num) { + var buf = block.slice(off, end) + var positive = num >= 0 + buf[0] = positive ? 0x80 : 0xFF + + // get the number as a base-256 tuple + if (!positive) num *= -1 + var tuple = [] + do { + var n = num % 256 + tuple.push(n) + num = (num - n) / 256 + } while (num) + + var bytes = tuple.length + + var fill = buf.length - bytes + for (var i = 1; i < fill; i ++) { + buf[i] = positive ? 0 : 0xFF + } + + // tuple is a base256 number, with [0] as the *least* significant byte + // if it's negative, then we need to flip all the bits once we hit the + // first non-zero bit. The 2's-complement is (0x100 - n), and the 1's- + // complement is (0xFF - n). + var zero = true + for (i = bytes; i > 0; i --) { + var byte = tuple[bytes - i] + if (positive) buf[fill + i] = byte + else if (zero && byte === 0) buf[fill + i] = 0 + else if (zero) { + zero = false + buf[fill + i] = 0x100 - byte + } else buf[fill + i] = 0xFF - byte + } +} + +function writeText (block, off, end, str) { + // strings are written as utf8, then padded with \0 + var strLen = Buffer.byteLength(str) + , writeLen = Math.min(strLen, end - off) + // non-ascii fields need extended headers + // long fields get truncated + , needExtended = strLen !== str.length || strLen > writeLen + + // write the string, and null-pad + if (writeLen > 0) block.write(str, off, writeLen, "utf8") + for (var i = off + writeLen; i < end; i ++) block[i] = 0 + + return needExtended +} + +function calcSum (block) { + block = block || this.block + assert(Buffer.isBuffer(block) && block.length === 512) + + if (!block) throw new Error("Need block to checksum") + + // now figure out what it would be if the cksum was " " + var sum = 0 + , start = fieldOffs[fields.cksum] + , end = fieldEnds[fields.cksum] + + for (var i = 0; i < fieldOffs[fields.cksum]; i ++) { + sum += block[i] + } + + for (var i = start; i < end; i ++) { + sum += space + } + + for (var i = end; i < 512; i ++) { + sum += block[i] + } + + return sum +} + + +function checkSum (block) { + var sum = calcSum.call(this, block) + block = block || this.block + + var cksum = block.slice(fieldOffs[fields.cksum], fieldEnds[fields.cksum]) + cksum = parseNumeric(cksum) + + return cksum === sum +} + +function decode (block) { + block = block || this.block + assert(Buffer.isBuffer(block) && block.length === 512) + + this.block = block + this.cksumValid = this.checkSum() + + var prefix = null + + // slice off each field. + for (var f = 0; fields[f] !== null; f ++) { + var field = fields[f] + , val = block.slice(fieldOffs[f], fieldEnds[f]) + + switch (field) { + case "ustar": + // if not ustar, then everything after that is just padding. + if (val.toString() !== "ustar\0") { + this.ustar = false + return + } else { + // console.error("ustar:", val, val.toString()) + this.ustar = val.toString() + } + break + + // prefix is special, since it might signal the xstar header + case "prefix": + var atime = parseNumeric(val.slice(131, 131 + 12)) + , ctime = parseNumeric(val.slice(131 + 12, 131 + 12 + 12)) + if ((val[130] === 0 || val[130] === space) && + typeof atime === "number" && + typeof ctime === "number" && + val[131 + 12] === space && + val[131 + 12 + 12] === space) { + this.atime = atime + this.ctime = ctime + val = val.slice(0, 130) + } + prefix = val.toString("utf8").replace(/\0+$/, "") + // console.error("%% header reading prefix", prefix) + break + + // all other fields are null-padding text + // or a number. + default: + if (numeric[field]) { + this[field] = parseNumeric(val) + } else { + this[field] = val.toString("utf8").replace(/\0+$/, "") + } + break + } + } + + // if we got a prefix, then prepend it to the path. + if (prefix) { + this.path = prefix + "/" + this.path + // console.error("%% header got a prefix", this.path) + } +} + +function parse256 (buf) { + // first byte MUST be either 80 or FF + // 80 for positive, FF for 2's comp + var positive + if (buf[0] === 0x80) positive = true + else if (buf[0] === 0xFF) positive = false + else return null + + // build up a base-256 tuple from the least sig to the highest + var zero = false + , tuple = [] + for (var i = buf.length - 1; i > 0; i --) { + var byte = buf[i] + if (positive) tuple.push(byte) + else if (zero && byte === 0) tuple.push(0) + else if (zero) { + zero = false + tuple.push(0x100 - byte) + } else tuple.push(0xFF - byte) + } + + for (var sum = 0, i = 0, l = tuple.length; i < l; i ++) { + sum += tuple[i] * Math.pow(256, i) + } + + return positive ? sum : -1 * sum +} + +function parseNumeric (f) { + if (f[0] & 0x80) return parse256(f) + + var str = f.toString("utf8").split("\0")[0].trim() + , res = parseInt(str, 8) + + return isNaN(res) ? null : res +} + diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/lib/pack.js b/deps/npm/node_modules/node-gyp/node_modules/tar/lib/pack.js new file mode 100644 index 00000000000..3ff14dd6951 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/lib/pack.js @@ -0,0 +1,231 @@ +// pipe in an fstream, and it'll make a tarball. +// key-value pair argument is global extended header props. + +module.exports = Pack + +var EntryWriter = require("./entry-writer.js") + , Stream = require("stream").Stream + , path = require("path") + , inherits = require("inherits") + , GlobalHeaderWriter = require("./global-header-writer.js") + , collect = require("fstream").collect + , eof = new Buffer(512) + +for (var i = 0; i < 512; i ++) eof[i] = 0 + +inherits(Pack, Stream) + +function Pack (props) { + // console.error("-- p ctor") + var me = this + if (!(me instanceof Pack)) return new Pack(props) + + if (props) me._noProprietary = props.noProprietary + else me._noProprietary = false + + me._global = props + + me.readable = true + me.writable = true + me._buffer = [] + // console.error("-- -- set current to null in ctor") + me._currentEntry = null + me._processing = false + + me._pipeRoot = null + me.on("pipe", function (src) { + if (src.root === me._pipeRoot) return + me._pipeRoot = src + src.on("end", function () { + me._pipeRoot = null + }) + me.add(src) + }) +} + +Pack.prototype.addGlobal = function (props) { + // console.error("-- p addGlobal") + if (this._didGlobal) return + this._didGlobal = true + + var me = this + GlobalHeaderWriter(props) + .on("data", function (c) { + me.emit("data", c) + }) + .end() +} + +Pack.prototype.add = function (stream) { + if (this._global && !this._didGlobal) this.addGlobal(this._global) + + if (this._ended) return this.emit("error", new Error("add after end")) + + collect(stream) + this._buffer.push(stream) + this._process() + this._needDrain = this._buffer.length > 0 + return !this._needDrain +} + +Pack.prototype.pause = function () { + this._paused = true + if (this._currentEntry) this._currentEntry.pause() + this.emit("pause") +} + +Pack.prototype.resume = function () { + this._paused = false + if (this._currentEntry) this._currentEntry.resume() + this.emit("resume") + this._process() +} + +Pack.prototype.end = function () { + this._ended = true + this._buffer.push(eof) + this._process() +} + +Pack.prototype._process = function () { + var me = this + if (me._paused || me._processing) { + return + } + + var entry = me._buffer.shift() + + if (!entry) { + if (me._needDrain) { + me.emit("drain") + } + return + } + + if (entry.ready === false) { + // console.error("-- entry is not ready", entry) + me._buffer.unshift(entry) + entry.on("ready", function () { + // console.error("-- -- ready!", entry) + me._process() + }) + return + } + + me._processing = true + + if (entry === eof) { + // need 2 ending null blocks. + me.emit("data", eof) + me.emit("data", eof) + me.emit("end") + me.emit("close") + return + } + + // Change the path to be relative to the root dir that was + // added to the tarball. + // + // XXX This should be more like how -C works, so you can + // explicitly set a root dir, and also explicitly set a pathname + // in the tarball to use. That way we can skip a lot of extra + // work when resolving symlinks for bundled dependencies in npm. + + var root = path.dirname((entry.root || entry).path) + var wprops = {} + + Object.keys(entry.props || {}).forEach(function (k) { + wprops[k] = entry.props[k] + }) + + if (me._noProprietary) wprops.noProprietary = true + + wprops.path = path.relative(root, entry.path || '') + + // actually not a matter of opinion or taste. + if (process.platform === "win32") { + wprops.path = wprops.path.replace(/\\/g, "/") + } + + if (!wprops.type) + wprops.type = 'Directory' + + switch (wprops.type) { + // sockets not supported + case "Socket": + return + + case "Directory": + wprops.path += "/" + wprops.size = 0 + break + + case "Link": + var lp = path.resolve(path.dirname(entry.path), entry.linkpath) + wprops.linkpath = path.relative(root, lp) || "." + wprops.size = 0 + break + + case "SymbolicLink": + var lp = path.resolve(path.dirname(entry.path), entry.linkpath) + wprops.linkpath = path.relative(path.dirname(entry.path), lp) || "." + wprops.size = 0 + break + } + + // console.error("-- new writer", wprops) + // if (!wprops.type) { + // // console.error("-- no type?", entry.constructor.name, entry) + // } + + // console.error("-- -- set current to new writer", wprops.path) + var writer = me._currentEntry = EntryWriter(wprops) + + writer.parent = me + + // writer.on("end", function () { + // // console.error("-- -- writer end", writer.path) + // }) + + writer.on("data", function (c) { + me.emit("data", c) + }) + + writer.on("header", function () { + Buffer.prototype.toJSON = function () { + return this.toString().split(/\0/).join(".") + } + // console.error("-- -- writer header %j", writer.props) + if (writer.props.size === 0) nextEntry() + }) + writer.on("close", nextEntry) + + var ended = false + function nextEntry () { + if (ended) return + ended = true + + // console.error("-- -- writer close", writer.path) + // console.error("-- -- set current to null", wprops.path) + me._currentEntry = null + me._processing = false + me._process() + } + + writer.on("error", function (er) { + // console.error("-- -- writer error", writer.path) + me.emit("error", er) + }) + + // if it's the root, then there's no need to add its entries, + // or data, since they'll be added directly. + if (entry === me._pipeRoot) { + // console.error("-- is the root, don't auto-add") + writer.add = null + } + + entry.pipe(writer) +} + +Pack.prototype.destroy = function () {} +Pack.prototype.write = function () {} diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/lib/parse.js b/deps/npm/node_modules/node-gyp/node_modules/tar/lib/parse.js new file mode 100644 index 00000000000..8517c481bc6 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/lib/parse.js @@ -0,0 +1,271 @@ + +// A writable stream. +// It emits "entry" events, which provide a readable stream that has +// header info attached. + +module.exports = Parse.create = Parse + +var stream = require("stream") + , Stream = stream.Stream + , BlockStream = require("block-stream") + , tar = require("../tar.js") + , TarHeader = require("./header.js") + , Entry = require("./entry.js") + , BufferEntry = require("./buffer-entry.js") + , ExtendedHeader = require("./extended-header.js") + , assert = require("assert").ok + , inherits = require("inherits") + , fstream = require("fstream") + +// reading a tar is a lot like reading a directory +// However, we're actually not going to run the ctor, +// since it does a stat and various other stuff. +// This inheritance gives us the pause/resume/pipe +// behavior that is desired. +inherits(Parse, fstream.Reader) + +function Parse () { + var me = this + if (!(me instanceof Parse)) return new Parse() + + // doesn't apply fstream.Reader ctor? + // no, becasue we don't want to stat/etc, we just + // want to get the entry/add logic from .pipe() + Stream.apply(me) + + me.writable = true + me.readable = true + me._stream = new BlockStream(512) + me.position = 0 + me._ended = false + + me._stream.on("error", function (e) { + me.emit("error", e) + }) + + me._stream.on("data", function (c) { + me._process(c) + }) + + me._stream.on("end", function () { + me._streamEnd() + }) + + me._stream.on("drain", function () { + me.emit("drain") + }) +} + +// overridden in Extract class, since it needs to +// wait for its DirWriter part to finish before +// emitting "end" +Parse.prototype._streamEnd = function () { + var me = this + if (!me._ended) me.error("unexpected eof") + me.emit("end") +} + +// a tar reader is actually a filter, not just a readable stream. +// So, you should pipe a tarball stream into it, and it needs these +// write/end methods to do that. +Parse.prototype.write = function (c) { + if (this._ended) { + // gnutar puts a LOT of nulls at the end. + // you can keep writing these things forever. + // Just ignore them. + for (var i = 0, l = c.length; i > l; i ++) { + if (c[i] !== 0) return this.error("write() after end()") + } + return + } + return this._stream.write(c) +} + +Parse.prototype.end = function (c) { + this._ended = true + return this._stream.end(c) +} + +// don't need to do anything, since we're just +// proxying the data up from the _stream. +// Just need to override the parent's "Not Implemented" +// error-thrower. +Parse.prototype._read = function () {} + +Parse.prototype._process = function (c) { + assert(c && c.length === 512, "block size should be 512") + + // one of three cases. + // 1. A new header + // 2. A part of a file/extended header + // 3. One of two or more EOF null blocks + + if (this._entry) { + var entry = this._entry + entry.write(c) + if (entry._remaining === 0) { + entry.end() + this._entry = null + } + } else { + // either zeroes or a header + var zero = true + for (var i = 0; i < 512 && zero; i ++) { + zero = c[i] === 0 + } + + // eof is *at least* 2 blocks of nulls, and then the end of the + // file. you can put blocks of nulls between entries anywhere, + // so appending one tarball to another is technically valid. + // ending without the eof null blocks is not allowed, however. + if (zero) { + if (this._eofStarted) + this._ended = true + this._eofStarted = true + } else { + this._eofStarted = false + this._startEntry(c) + } + } + + this.position += 512 +} + +// take a header chunk, start the right kind of entry. +Parse.prototype._startEntry = function (c) { + var header = new TarHeader(c) + , self = this + , entry + , ev + , EntryType + , onend + , meta = false + + if (null === header.size || !header.cksumValid) { + var e = new Error("invalid tar file") + e.header = header + e.tar_file_offset = this.position + e.tar_block = this.position / 512 + return this.emit("error", e) + } + + switch (tar.types[header.type]) { + case "File": + case "OldFile": + case "Link": + case "SymbolicLink": + case "CharacterDevice": + case "BlockDevice": + case "Directory": + case "FIFO": + case "ContiguousFile": + case "GNUDumpDir": + // start a file. + // pass in any extended headers + // These ones consumers are typically most interested in. + EntryType = Entry + ev = "entry" + break + + case "GlobalExtendedHeader": + // extended headers that apply to the rest of the tarball + EntryType = ExtendedHeader + onend = function () { + self._global = self._global || {} + Object.keys(entry.fields).forEach(function (k) { + self._global[k] = entry.fields[k] + }) + } + ev = "globalExtendedHeader" + meta = true + break + + case "ExtendedHeader": + case "OldExtendedHeader": + // extended headers that apply to the next entry + EntryType = ExtendedHeader + onend = function () { + self._extended = entry.fields + } + ev = "extendedHeader" + meta = true + break + + case "NextFileHasLongLinkpath": + // set linkpath= in extended header + EntryType = BufferEntry + onend = function () { + self._extended = self._extended || {} + self._extended.linkpath = entry.body + } + ev = "longLinkpath" + meta = true + break + + case "NextFileHasLongPath": + case "OldGnuLongPath": + // set path= in file-extended header + EntryType = BufferEntry + onend = function () { + self._extended = self._extended || {} + self._extended.path = entry.body + } + ev = "longPath" + meta = true + break + + default: + // all the rest we skip, but still set the _entry + // member, so that we can skip over their data appropriately. + // emit an event to say that this is an ignored entry type? + EntryType = Entry + ev = "ignoredEntry" + break + } + + var global, extended + if (meta) { + global = extended = null + } else { + var global = this._global + var extended = this._extended + + // extendedHeader only applies to one entry, so once we start + // an entry, it's over. + this._extended = null + } + entry = new EntryType(header, extended, global) + entry.meta = meta + + // only proxy data events of normal files. + if (!meta) { + entry.on("data", function (c) { + me.emit("data", c) + }) + } + + if (onend) entry.on("end", onend) + + this._entry = entry + var me = this + + entry.on("pause", function () { + me.pause() + }) + + entry.on("resume", function () { + me.resume() + }) + + if (this.listeners("*").length) { + this.emit("*", ev, entry) + } + + this.emit(ev, entry) + + // Zero-byte entry. End immediately. + if (entry.props.size === 0) { + entry.end() + this._entry = null + } +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/package.json b/deps/npm/node_modules/node-gyp/node_modules/tar/package.json new file mode 100644 index 00000000000..7fab5394cd6 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/package.json @@ -0,0 +1,61 @@ +{ + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "name": "tar", + "description": "tar for node", + "version": "1.0.3", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-tar.git" + }, + "main": "tar.js", + "scripts": { + "test": "tap test/*.js" + }, + "dependencies": { + "block-stream": "*", + "fstream": "^1.0.2", + "inherits": "2" + }, + "devDependencies": { + "graceful-fs": "^3.0.2", + "rimraf": "1.x", + "tap": "0.x", + "mkdirp": "^0.5.0" + }, + "license": "BSD", + "gitHead": "f4151128c585da236c6b1e278b762ecaedc20c15", + "bugs": { + "url": "https://github.com/isaacs/node-tar/issues" + }, + "homepage": "https://github.com/isaacs/node-tar", + "_id": "tar@1.0.3", + "_shasum": "15bcdab244fa4add44e4244a0176edb8aa9a2b44", + "_from": "tar@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.10", + "_nodeVersion": "0.10.33", + "_npmUser": { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + }, + { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + } + ], + "dist": { + "shasum": "15bcdab244fa4add44e4244a0176edb8aa9a2b44", + "tarball": "http://registry.npmjs.org/tar/-/tar-1.0.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/tar/-/tar-1.0.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/tar.js b/deps/npm/node_modules/node-gyp/node_modules/tar/tar.js new file mode 100644 index 00000000000..a81298b9a0b --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/tar.js @@ -0,0 +1,173 @@ +// field paths that every tar file must have. +// header is padded to 512 bytes. +var f = 0 + , fields = {} + , path = fields.path = f++ + , mode = fields.mode = f++ + , uid = fields.uid = f++ + , gid = fields.gid = f++ + , size = fields.size = f++ + , mtime = fields.mtime = f++ + , cksum = fields.cksum = f++ + , type = fields.type = f++ + , linkpath = fields.linkpath = f++ + , headerSize = 512 + , blockSize = 512 + , fieldSize = [] + +fieldSize[path] = 100 +fieldSize[mode] = 8 +fieldSize[uid] = 8 +fieldSize[gid] = 8 +fieldSize[size] = 12 +fieldSize[mtime] = 12 +fieldSize[cksum] = 8 +fieldSize[type] = 1 +fieldSize[linkpath] = 100 + +// "ustar\0" may introduce another bunch of headers. +// these are optional, and will be nulled out if not present. + +var ustar = fields.ustar = f++ + , ustarver = fields.ustarver = f++ + , uname = fields.uname = f++ + , gname = fields.gname = f++ + , devmaj = fields.devmaj = f++ + , devmin = fields.devmin = f++ + , prefix = fields.prefix = f++ + , fill = fields.fill = f++ + +// terminate fields. +fields[f] = null + +fieldSize[ustar] = 6 +fieldSize[ustarver] = 2 +fieldSize[uname] = 32 +fieldSize[gname] = 32 +fieldSize[devmaj] = 8 +fieldSize[devmin] = 8 +fieldSize[prefix] = 155 +fieldSize[fill] = 12 + +// nb: prefix field may in fact be 130 bytes of prefix, +// a null char, 12 bytes for atime, 12 bytes for ctime. +// +// To recognize this format: +// 1. prefix[130] === ' ' or '\0' +// 2. atime and ctime are octal numeric values +// 3. atime and ctime have ' ' in their last byte + +var fieldEnds = {} + , fieldOffs = {} + , fe = 0 +for (var i = 0; i < f; i ++) { + fieldOffs[i] = fe + fieldEnds[i] = (fe += fieldSize[i]) +} + +// build a translation table of field paths. +Object.keys(fields).forEach(function (f) { + if (fields[f] !== null) fields[fields[f]] = f +}) + +// different values of the 'type' field +// paths match the values of Stats.isX() functions, where appropriate +var types = + { 0: "File" + , "\0": "OldFile" // like 0 + , "": "OldFile" + , 1: "Link" + , 2: "SymbolicLink" + , 3: "CharacterDevice" + , 4: "BlockDevice" + , 5: "Directory" + , 6: "FIFO" + , 7: "ContiguousFile" // like 0 + // posix headers + , g: "GlobalExtendedHeader" // k=v for the rest of the archive + , x: "ExtendedHeader" // k=v for the next file + // vendor-specific stuff + , A: "SolarisACL" // skip + , D: "GNUDumpDir" // like 5, but with data, which should be skipped + , I: "Inode" // metadata only, skip + , K: "NextFileHasLongLinkpath" // data = link path of next file + , L: "NextFileHasLongPath" // data = path of next file + , M: "ContinuationFile" // skip + , N: "OldGnuLongPath" // like L + , S: "SparseFile" // skip + , V: "TapeVolumeHeader" // skip + , X: "OldExtendedHeader" // like x + } + +Object.keys(types).forEach(function (t) { + types[types[t]] = types[types[t]] || t +}) + +// values for the mode field +var modes = + { suid: 04000 // set uid on extraction + , sgid: 02000 // set gid on extraction + , svtx: 01000 // set restricted deletion flag on dirs on extraction + , uread: 0400 + , uwrite: 0200 + , uexec: 0100 + , gread: 040 + , gwrite: 020 + , gexec: 010 + , oread: 4 + , owrite: 2 + , oexec: 1 + , all: 07777 + } + +var numeric = + { mode: true + , uid: true + , gid: true + , size: true + , mtime: true + , devmaj: true + , devmin: true + , cksum: true + , atime: true + , ctime: true + , dev: true + , ino: true + , nlink: true + } + +Object.keys(modes).forEach(function (t) { + modes[modes[t]] = modes[modes[t]] || t +}) + +var knownExtended = + { atime: true + , charset: true + , comment: true + , ctime: true + , gid: true + , gname: true + , linkpath: true + , mtime: true + , path: true + , realtime: true + , security: true + , size: true + , uid: true + , uname: true } + + +exports.fields = fields +exports.fieldSize = fieldSize +exports.fieldOffs = fieldOffs +exports.fieldEnds = fieldEnds +exports.types = types +exports.modes = modes +exports.numeric = numeric +exports.headerSize = headerSize +exports.blockSize = blockSize +exports.knownExtended = knownExtended + +exports.Pack = require("./lib/pack.js") +exports.Parse = require("./lib/parse.js") +exports.Extract = require("./lib/extract.js") diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/test/00-setup-fixtures.js b/deps/npm/node_modules/node-gyp/node_modules/tar/test/00-setup-fixtures.js new file mode 100644 index 00000000000..1524ff7af05 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/test/00-setup-fixtures.js @@ -0,0 +1,53 @@ +// the fixtures have some weird stuff that is painful +// to include directly in the repo for various reasons. +// +// So, unpack the fixtures with the system tar first. +// +// This means, of course, that it'll only work if you +// already have a tar implementation, and some of them +// will not properly unpack the fixtures anyway. +// +// But, since usually those tests will fail on Windows +// and other systems with less capable filesystems anyway, +// at least this way we don't cause inconveniences by +// merely cloning the repo or installing the package. + +var tap = require("tap") +, child_process = require("child_process") +, rimraf = require("rimraf") +, test = tap.test +, path = require("path") + +test("clean fixtures", function (t) { + rimraf(path.resolve(__dirname, "fixtures"), function (er) { + t.ifError(er, "rimraf ./fixtures/") + t.end() + }) +}) + +test("clean tmp", function (t) { + rimraf(path.resolve(__dirname, "tmp"), function (er) { + t.ifError(er, "rimraf ./tmp/") + t.end() + }) +}) + +test("extract fixtures", function (t) { + var c = child_process.spawn("tar" + ,["xzvf", "fixtures.tgz"] + ,{ cwd: __dirname }) + + c.stdout.on("data", errwrite) + c.stderr.on("data", errwrite) + function errwrite (chunk) { + process.stderr.write(chunk) + } + + c.on("exit", function (code) { + t.equal(code, 0, "extract fixtures should exit with 0") + if (code) { + t.comment("Note, all tests from here on out will fail because of this.") + } + t.end() + }) +}) diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/test/extract-move.js b/deps/npm/node_modules/node-gyp/node_modules/tar/test/extract-move.js new file mode 100644 index 00000000000..45400cd9bb8 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/test/extract-move.js @@ -0,0 +1,132 @@ +// Set the umask, so that it works the same everywhere. +process.umask(parseInt('22', 8)) + +var tap = require("tap") + , tar = require("../tar.js") + , fs = require("fs") + , gfs = require("graceful-fs") + , path = require("path") + , file = path.resolve(__dirname, "fixtures/dir.tar") + , target = path.resolve(__dirname, "tmp/extract-test") + , index = 0 + , fstream = require("fstream") + , rimraf = require("rimraf") + , mkdirp = require("mkdirp") + + , ee = 0 + , expectEntries = [ + { + "path" : "dir/", + "mode" : "750", + "type" : "5", + "depth" : undefined, + "size" : 0, + "linkpath" : "", + "nlink" : undefined, + "dev" : undefined, + "ino" : undefined + }, + { + "path" : "dir/sub/", + "mode" : "750", + "type" : "5", + "depth" : undefined, + "size" : 0, + "linkpath" : "", + "nlink" : undefined, + "dev" : undefined, + "ino" : undefined + } ] + +function slow (fs, method, t1, t2) { + var orig = fs[method] + if (!orig) return null + fs[method] = function () { + var args = [].slice.call(arguments) + console.error("slow", method, args[0]) + var cb = args.pop() + + setTimeout(function () { + orig.apply(fs, args.concat(function(er, data) { + setTimeout(function() { + cb(er, data) + }, t2) + })) + }, t1) + } +} + +// Make sure we get the graceful-fs that fstream is using. +var gfs2 +try { + gfs2 = require("fstream/node_modules/graceful-fs") +} catch (er) {} + +var slowMethods = ["chown", "chmod", "utimes", "lutimes"] +slowMethods.forEach(function (method) { + var t1 = 500 + var t2 = 0 + slow(fs, method, t1, t2) + slow(gfs, method, t1, t2) + if (gfs2) { + slow(gfs2, method, t1, t2) + } +}) + + + +// The extract class basically just pipes the input +// to a Reader, and then to a fstream.DirWriter + +// So, this is as much a test of fstream.Reader and fstream.Writer +// as it is of tar.Extract, but it sort of makes sense. + +tap.test("preclean", function (t) { + rimraf.sync(target) + /mkdirp.sync(target) + t.pass("cleaned!") + t.end() +}) + +tap.test("extract test", function (t) { + var extract = tar.Extract(target) + var inp = fs.createReadStream(file) + + // give it a weird buffer size to try to break in odd places + inp.bufferSize = 1234 + + inp.pipe(extract) + + extract.on("end", function () { + rimraf.sync(target) + + t.equal(ee, expectEntries.length, "should see "+ee+" entries") + + // should get no more entries after end + extract.removeAllListeners("entry") + extract.on("entry", function (e) { + t.fail("Should not get entries after end!") + }) + + t.end() + }) + + + extract.on("entry", function (entry) { + var found = + { path: entry.path + , mode: entry.props.mode.toString(8) + , type: entry.props.type + , depth: entry.props.depth + , size: entry.props.size + , linkpath: entry.props.linkpath + , nlink: entry.props.nlink + , dev: entry.props.dev + , ino: entry.props.ino + } + + var wanted = expectEntries[ee ++] + + t.equivalent(found, wanted, "tar entry " + ee + " " + wanted.path) + }) +}) diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/test/extract.js b/deps/npm/node_modules/node-gyp/node_modules/tar/test/extract.js new file mode 100644 index 00000000000..eca4e7cc962 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/test/extract.js @@ -0,0 +1,367 @@ +// Set the umask, so that it works the same everywhere. +process.umask(parseInt('22', 8)) + +var tap = require("tap") + , tar = require("../tar.js") + , fs = require("fs") + , path = require("path") + , file = path.resolve(__dirname, "fixtures/c.tar") + , target = path.resolve(__dirname, "tmp/extract-test") + , index = 0 + , fstream = require("fstream") + + , ee = 0 + , expectEntries = +[ { path: 'c.txt', + mode: '644', + type: '0', + depth: undefined, + size: 513, + linkpath: '', + nlink: undefined, + dev: undefined, + ino: undefined }, + { path: 'cc.txt', + mode: '644', + type: '0', + depth: undefined, + size: 513, + linkpath: '', + nlink: undefined, + dev: undefined, + ino: undefined }, + { path: 'r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: '644', + type: '0', + depth: undefined, + size: 100, + linkpath: '', + nlink: undefined, + dev: undefined, + ino: undefined }, + { path: 'Ω.txt', + mode: '644', + type: '0', + depth: undefined, + size: 2, + linkpath: '', + nlink: undefined, + dev: undefined, + ino: undefined }, + { path: 'Ω.txt', + mode: '644', + type: '0', + depth: undefined, + size: 2, + linkpath: '', + nlink: 1, + dev: 234881026, + ino: 51693379 }, + { path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: '644', + type: '0', + depth: undefined, + size: 200, + linkpath: '', + nlink: 1, + dev: 234881026, + ino: 51681874 }, + { path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: '644', + type: '0', + depth: undefined, + size: 201, + linkpath: '', + nlink: undefined, + dev: undefined, + ino: undefined }, + { path: '200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL', + mode: '777', + type: '2', + depth: undefined, + size: 0, + linkpath: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + nlink: undefined, + dev: undefined, + ino: undefined }, + { path: '200-hard', + mode: '644', + type: '0', + depth: undefined, + size: 200, + linkpath: '', + nlink: 2, + dev: 234881026, + ino: 51681874 }, + { path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: '644', + type: '1', + depth: undefined, + size: 0, + linkpath: path.resolve(target, '200-hard'), + nlink: 2, + dev: 234881026, + ino: 51681874 } ] + + , ef = 0 + , expectFiles = +[ { path: '', + mode: '40755', + type: 'Directory', + depth: 0, + linkpath: undefined }, + { path: '/200-hard', + mode: '100644', + type: 'File', + depth: 1, + size: 200, + linkpath: undefined, + nlink: 2 }, + { path: '/200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL', + mode: '120777', + type: 'SymbolicLink', + depth: 1, + size: 200, + linkpath: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + nlink: 1 }, + { path: '/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: '100644', + type: 'Link', + depth: 1, + size: 200, + linkpath: path.join(target, '200-hard'), + nlink: 2 }, + { path: '/c.txt', + mode: '100644', + type: 'File', + depth: 1, + size: 513, + linkpath: undefined, + nlink: 1 }, + { path: '/cc.txt', + mode: '100644', + type: 'File', + depth: 1, + size: 513, + linkpath: undefined, + nlink: 1 }, + { path: '/r', + mode: '40755', + type: 'Directory', + depth: 1, + linkpath: undefined }, + { path: '/r/e', + mode: '40755', + type: 'Directory', + depth: 2, + linkpath: undefined }, + { path: '/r/e/a', + mode: '40755', + type: 'Directory', + depth: 3, + linkpath: undefined }, + { path: '/r/e/a/l', + mode: '40755', + type: 'Directory', + depth: 4, + linkpath: undefined }, + { path: '/r/e/a/l/l', + mode: '40755', + type: 'Directory', + depth: 5, + linkpath: undefined }, + { path: '/r/e/a/l/l/y', + mode: '40755', + type: 'Directory', + depth: 6, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-', + mode: '40755', + type: 'Directory', + depth: 7, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d', + mode: '40755', + type: 'Directory', + depth: 8, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d/e', + mode: '40755', + type: 'Directory', + depth: 9, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d/e/e', + mode: '40755', + type: 'Directory', + depth: 10, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d/e/e/p', + mode: '40755', + type: 'Directory', + depth: 11, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d/e/e/p/-', + mode: '40755', + type: 'Directory', + depth: 12, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d/e/e/p/-/f', + mode: '40755', + type: 'Directory', + depth: 13, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o', + mode: '40755', + type: 'Directory', + depth: 14, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l', + mode: '40755', + type: 'Directory', + depth: 15, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d', + mode: '40755', + type: 'Directory', + depth: 16, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e', + mode: '40755', + type: 'Directory', + depth: 17, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r', + mode: '40755', + type: 'Directory', + depth: 18, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-', + mode: '40755', + type: 'Directory', + depth: 19, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p', + mode: '40755', + type: 'Directory', + depth: 20, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a', + mode: '40755', + type: 'Directory', + depth: 21, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t', + mode: '40755', + type: 'Directory', + depth: 22, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h', + mode: '40755', + type: 'Directory', + depth: 23, + linkpath: undefined }, + { path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: '100644', + type: 'File', + depth: 24, + size: 100, + linkpath: undefined, + nlink: 1 }, + { path: '/Ω.txt', + mode: '100644', + type: 'File', + depth: 1, + size: 2, + linkpath: undefined, + nlink: 1 } ] + + + +// The extract class basically just pipes the input +// to a Reader, and then to a fstream.DirWriter + +// So, this is as much a test of fstream.Reader and fstream.Writer +// as it is of tar.Extract, but it sort of makes sense. + +tap.test("preclean", function (t) { + require("rimraf").sync(__dirname + "/tmp/extract-test") + t.pass("cleaned!") + t.end() +}) + +tap.test("extract test", function (t) { + var extract = tar.Extract(target) + var inp = fs.createReadStream(file) + + // give it a weird buffer size to try to break in odd places + inp.bufferSize = 1234 + + inp.pipe(extract) + + extract.on("end", function () { + t.equal(ee, expectEntries.length, "should see "+ee+" entries") + + // should get no more entries after end + extract.removeAllListeners("entry") + extract.on("entry", function (e) { + t.fail("Should not get entries after end!") + }) + + next() + }) + + extract.on("entry", function (entry) { + var found = + { path: entry.path + , mode: entry.props.mode.toString(8) + , type: entry.props.type + , depth: entry.props.depth + , size: entry.props.size + , linkpath: entry.props.linkpath + , nlink: entry.props.nlink + , dev: entry.props.dev + , ino: entry.props.ino + } + + var wanted = expectEntries[ee ++] + + t.equivalent(found, wanted, "tar entry " + ee + " " + wanted.path) + }) + + function next () { + var r = fstream.Reader({ path: target + , type: "Directory" + // this is just to encourage consistency + , sort: "alpha" }) + + r.on("ready", function () { + foundEntry(r) + }) + + r.on("end", finish) + + function foundEntry (entry) { + var p = entry.path.substr(target.length) + var found = + { path: p + , mode: entry.props.mode.toString(8) + , type: entry.props.type + , depth: entry.props.depth + , size: entry.props.size + , linkpath: entry.props.linkpath + , nlink: entry.props.nlink + } + + var wanted = expectFiles[ef ++] + + t.has(found, wanted, "unpacked file " + ef + " " + wanted.path) + + entry.on("entry", foundEntry) + } + + function finish () { + t.equal(ef, expectFiles.length, "should have "+ef+" items") + t.end() + } + } +}) diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/test/fixtures.tgz b/deps/npm/node_modules/node-gyp/node_modules/tar/test/fixtures.tgz new file mode 100644 index 00000000000..f1676023afa Binary files /dev/null and b/deps/npm/node_modules/node-gyp/node_modules/tar/test/fixtures.tgz differ diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/test/header.js b/deps/npm/node_modules/node-gyp/node_modules/tar/test/header.js new file mode 100644 index 00000000000..8ea6f79500d --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/test/header.js @@ -0,0 +1,183 @@ +var tap = require("tap") +var TarHeader = require("../lib/header.js") +var tar = require("../tar.js") +var fs = require("fs") + + +var headers = + { "a.txt file header": + [ "612e747874000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030303430312031313635313336303333332030313234353100203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + , { cksumValid: true + , path: 'a.txt' + , mode: 420 + , uid: 24561 + , gid: 20 + , size: 257 + , mtime: 1319493851 + , cksum: 5417 + , type: '0' + , linkpath: '' + , ustar: 'ustar\0' + , ustarver: '00' + , uname: 'isaacs' + , gname: 'staff' + , devmaj: 0 + , devmin: 0 + , fill: '' } + ] + + , "omega pax": // the extended header from omega tar. + [ "5061784865616465722fcea92e74787400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030303137302031313534333731303631312030313530353100207800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + , { cksumValid: true + , path: 'PaxHeader/Ω.txt' + , mode: 420 + , uid: 24561 + , gid: 20 + , size: 120 + , mtime: 1301254537 + , cksum: 6697 + , type: 'x' + , linkpath: '' + , ustar: 'ustar\0' + , ustarver: '00' + , uname: 'isaacs' + , gname: 'staff' + , devmaj: 0 + , devmin: 0 + , fill: '' } ] + + , "omega file header": + [ "cea92e7478740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030303030322031313534333731303631312030313330373200203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + , { cksumValid: true + , path: 'Ω.txt' + , mode: 420 + , uid: 24561 + , gid: 20 + , size: 2 + , mtime: 1301254537 + , cksum: 5690 + , type: '0' + , linkpath: '' + , ustar: 'ustar\0' + , ustarver: '00' + , uname: 'isaacs' + , gname: 'staff' + , devmaj: 0 + , devmin: 0 + , fill: '' } ] + + , "foo.js file header": + [ "666f6f2e6a730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030303030342031313534333637303734312030313236313700203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + , { cksumValid: true + , path: 'foo.js' + , mode: 420 + , uid: 24561 + , gid: 20 + , size: 4 + , mtime: 1301246433 + , cksum: 5519 + , type: '0' + , linkpath: '' + , ustar: 'ustar\0' + , ustarver: '00' + , uname: 'isaacs' + , gname: 'staff' + , devmaj: 0 + , devmin: 0 + , fill: '' } + ] + + , "b.txt file header": + [ "622e747874000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030313030302031313635313336303637372030313234363100203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + , { cksumValid: true + , path: 'b.txt' + , mode: 420 + , uid: 24561 + , gid: 20 + , size: 512 + , mtime: 1319494079 + , cksum: 5425 + , type: '0' + , linkpath: '' + , ustar: 'ustar\0' + , ustarver: '00' + , uname: 'isaacs' + , gname: 'staff' + , devmaj: 0 + , devmin: 0 + , fill: '' } + ] + + , "deep nested file": + [ "636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363633030303634342000303537373631200030303030323420003030303030303030313434203131363532313531353333203034333331340020300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000075737461720030306973616163730000000000000000000000000000000000000000000000000000737461666600000000000000000000000000000000000000000000000000000030303030303020003030303030302000722f652f612f6c2f6c2f792f2d2f642f652f652f702f2d2f662f6f2f6c2f642f652f722f2d2f702f612f742f680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + , { cksumValid: true, + path: 'r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' + , mode: 420 + , uid: 24561 + , gid: 20 + , size: 100 + , mtime: 1319687003 + , cksum: 18124 + , type: '0' + , linkpath: '' + , ustar: 'ustar\0' + , ustarver: '00' + , uname: 'isaacs' + , gname: 'staff' + , devmaj: 0 + , devmin: 0 + , fill: '' } + ] + } + +tap.test("parsing", function (t) { + Object.keys(headers).forEach(function (name) { + var h = headers[name] + , header = new Buffer(h[0], "hex") + , expect = h[1] + , parsed = new TarHeader(header) + + // console.error(parsed) + t.has(parsed, expect, "parse " + name) + }) + t.end() +}) + +tap.test("encoding", function (t) { + Object.keys(headers).forEach(function (name) { + var h = headers[name] + , expect = new Buffer(h[0], "hex") + , encoded = TarHeader.encode(h[1]) + + // might have slightly different bytes, since the standard + // isn't very strict, but should have the same semantics + // checkSum will be different, but cksumValid will be true + + var th = new TarHeader(encoded) + delete h[1].block + delete h[1].needExtended + delete h[1].cksum + t.has(th, h[1], "fields "+name) + }) + t.end() +}) + +// test these manually. they're a bit rare to find in the wild +tap.test("parseNumeric tests", function (t) { + var parseNumeric = TarHeader.parseNumeric + , numbers = + { "303737373737373700": 2097151 + , "30373737373737373737373700": 8589934591 + , "303030303036343400": 420 + , "800000ffffffffffff": 281474976710655 + , "ffffff000000000001": -281474976710654 + , "ffffff000000000000": -281474976710655 + , "800000000000200000": 2097152 + , "8000000000001544c5": 1393861 + , "ffffffffffff1544c5": -15383354 } + Object.keys(numbers).forEach(function (n) { + var b = new Buffer(n, "hex") + t.equal(parseNumeric(b), numbers[n], n + " === " + numbers[n]) + }) + t.end() +}) diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/test/pack-no-proprietary.js b/deps/npm/node_modules/node-gyp/node_modules/tar/test/pack-no-proprietary.js new file mode 100644 index 00000000000..d4b03a1fe93 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/test/pack-no-proprietary.js @@ -0,0 +1,886 @@ +// This is exactly like test/pack.js, except that it's excluding +// any proprietary headers. +// +// This loses some information about the filesystem, but creates +// tarballs that are supported by more versions of tar, especially +// old non-spec-compliant copies of gnutar. + +// the symlink file is excluded from git, because it makes +// windows freak the hell out. +var fs = require("fs") + , path = require("path") + , symlink = path.resolve(__dirname, "fixtures/symlink") +try { fs.unlinkSync(symlink) } catch (e) {} +fs.symlinkSync("./hardlink-1", symlink) +process.on("exit", function () { + fs.unlinkSync(symlink) +}) + +var tap = require("tap") + , tar = require("../tar.js") + , pkg = require("../package.json") + , Pack = tar.Pack + , fstream = require("fstream") + , Reader = fstream.Reader + , Writer = fstream.Writer + , input = path.resolve(__dirname, "fixtures/") + , target = path.resolve(__dirname, "tmp/pack.tar") + , uid = process.getuid ? process.getuid() : 0 + , gid = process.getgid ? process.getgid() : 0 + + , entries = + + // the global header and root fixtures/ dir are going to get + // a different date each time, so omit that bit. + // Also, dev/ino values differ across machines, so that's not + // included. + [ [ 'entry', + { path: 'fixtures/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'extendedHeader', + { path: 'PaxHeader/fixtures/200cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: 420, + uid: uid, + gid: gid, + type: 'x', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' }, + { path: 'fixtures/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + uid: uid, + gid: gid, + size: 200 } ] + + , [ 'entry', + { path: 'fixtures/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: 420, + uid: uid, + gid: gid, + size: 200, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/a.txt', + mode: 420, + uid: uid, + gid: gid, + size: 257, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/b.txt', + mode: 420, + uid: uid, + gid: gid, + size: 512, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/c.txt', + mode: 420, + uid: uid, + gid: gid, + size: 513, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/cc.txt', + mode: 420, + uid: uid, + gid: gid, + size: 513, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/dir/', + mode: 488, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/dir/sub/', + mode: 488, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/foo.js', + mode: 420, + uid: uid, + gid: gid, + size: 4, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/hardlink-1', + mode: 420, + uid: uid, + gid: gid, + size: 200, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/hardlink-2', + mode: 420, + uid: uid, + gid: gid, + size: 0, + type: '1', + linkpath: 'fixtures/hardlink-1', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/omega.txt', + mode: 420, + uid: uid, + gid: gid, + size: 2, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/packtest/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/packtest/omega.txt', + mode: 420, + uid: uid, + gid: gid, + size: 2, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/packtest/star.4.html', + mode: 420, + uid: uid, + gid: gid, + size: 54081, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'extendedHeader', + { path: 'PaxHeader/fixtures/packtest/Ω.txt', + mode: 420, + uid: uid, + gid: gid, + type: 'x', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' }, + { path: 'fixtures/packtest/Ω.txt', + uid: uid, + gid: gid, + size: 2 } ] + + , [ 'entry', + { path: 'fixtures/packtest/Ω.txt', + mode: 420, + uid: uid, + gid: gid, + size: 2, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: 420, + uid: uid, + gid: gid, + size: 100, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/symlink', + uid: uid, + gid: gid, + size: 0, + type: '2', + linkpath: 'hardlink-1', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'extendedHeader', + { path: 'PaxHeader/fixtures/Ω.txt', + mode: 420, + uid: uid, + gid: gid, + type: 'x', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' }, + { path: "fixtures/Ω.txt" + , uid: uid + , gid: gid + , size: 2 } ] + + , [ 'entry', + { path: 'fixtures/Ω.txt', + mode: 420, + uid: uid, + gid: gid, + size: 2, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + ] + + +// first, make sure that the hardlinks are actually hardlinks, or this +// won't work. Git has a way of replacing them with a copy. +var hard1 = path.resolve(__dirname, "fixtures/hardlink-1") + , hard2 = path.resolve(__dirname, "fixtures/hardlink-2") + , fs = require("fs") + +try { fs.unlinkSync(hard2) } catch (e) {} +fs.linkSync(hard1, hard2) + +tap.test("with global header", { timeout: 10000 }, function (t) { + runTest(t, true) +}) + +tap.test("without global header", { timeout: 10000 }, function (t) { + runTest(t, false) +}) + +function alphasort (a, b) { + return a === b ? 0 + : a.toLowerCase() > b.toLowerCase() ? 1 + : a.toLowerCase() < b.toLowerCase() ? -1 + : a > b ? 1 + : -1 +} + + +function runTest (t, doGH) { + var reader = Reader({ path: input + , filter: function () { + return !this.path.match(/\.(tar|hex)$/) + } + , sort: alphasort + }) + + var props = doGH ? pkg : {} + props.noProprietary = true + var pack = Pack(props) + var writer = Writer(target) + + // global header should be skipped regardless, since it has no content. + var entry = 0 + + t.ok(reader, "reader ok") + t.ok(pack, "pack ok") + t.ok(writer, "writer ok") + + pack.pipe(writer) + + var parse = tar.Parse() + t.ok(parse, "parser should be ok") + + pack.on("data", function (c) { + // console.error("PACK DATA") + if (c.length !== 512) { + // this one is too noisy, only assert if it'll be relevant + t.equal(c.length, 512, "parser should emit data in 512byte blocks") + } + parse.write(c) + }) + + pack.on("end", function () { + // console.error("PACK END") + t.pass("parser ends") + parse.end() + }) + + pack.on("error", function (er) { + t.fail("pack error", er) + }) + + parse.on("error", function (er) { + t.fail("parse error", er) + }) + + writer.on("error", function (er) { + t.fail("writer error", er) + }) + + reader.on("error", function (er) { + t.fail("reader error", er) + }) + + parse.on("*", function (ev, e) { + var wanted = entries[entry++] + if (!wanted) { + t.fail("unexpected event: "+ev) + return + } + t.equal(ev, wanted[0], "event type should be "+wanted[0]) + + if (ev !== wanted[0] || e.path !== wanted[1].path) { + console.error("wanted", wanted) + console.error([ev, e.props]) + e.on("end", function () { + console.error(e.fields) + throw "break" + }) + } + + t.has(e.props, wanted[1], "properties "+wanted[1].path) + if (wanted[2]) { + e.on("end", function () { + if (!e.fields) { + t.ok(e.fields, "should get fields") + } else { + t.has(e.fields, wanted[2], "should get expected fields") + } + }) + } + }) + + reader.pipe(pack) + + writer.on("close", function () { + t.equal(entry, entries.length, "should get all expected entries") + t.pass("it finished") + t.end() + }) + +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/test/pack.js b/deps/npm/node_modules/node-gyp/node_modules/tar/test/pack.js new file mode 100644 index 00000000000..bf033c12987 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/test/pack.js @@ -0,0 +1,934 @@ + +// the symlink file is excluded from git, because it makes +// windows freak the hell out. +var fs = require("fs") + , path = require("path") + , symlink = path.resolve(__dirname, "fixtures/symlink") +try { fs.unlinkSync(symlink) } catch (e) {} +fs.symlinkSync("./hardlink-1", symlink) +process.on("exit", function () { + fs.unlinkSync(symlink) +}) + + +var tap = require("tap") + , tar = require("../tar.js") + , pkg = require("../package.json") + , Pack = tar.Pack + , fstream = require("fstream") + , Reader = fstream.Reader + , Writer = fstream.Writer + , input = path.resolve(__dirname, "fixtures/") + , target = path.resolve(__dirname, "tmp/pack.tar") + , uid = process.getuid ? process.getuid() : 0 + , gid = process.getgid ? process.getgid() : 0 + + , entries = + + // the global header and root fixtures/ dir are going to get + // a different date each time, so omit that bit. + // Also, dev/ino values differ across machines, so that's not + // included. + [ [ 'globalExtendedHeader', + { path: 'PaxHeader/', + mode: 438, + uid: 0, + gid: 0, + type: 'g', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' }, + { "NODETAR.author": pkg.author, + "NODETAR.name": pkg.name, + "NODETAR.description": pkg.description, + "NODETAR.version": pkg.version, + "NODETAR.repository.type": pkg.repository.type, + "NODETAR.repository.url": pkg.repository.url, + "NODETAR.main": pkg.main, + "NODETAR.scripts.test": pkg.scripts.test } ] + + , [ 'entry', + { path: 'fixtures/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'extendedHeader', + { path: 'PaxHeader/fixtures/200cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: 420, + uid: uid, + gid: gid, + type: 'x', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' }, + { path: 'fixtures/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + 'NODETAR.depth': '1', + 'NODETAR.type': 'File', + nlink: 1, + uid: uid, + gid: gid, + size: 200, + 'NODETAR.blksize': '4096', + 'NODETAR.blocks': '8' } ] + + , [ 'entry', + { path: 'fixtures/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: 420, + uid: uid, + gid: gid, + size: 200, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '', + 'NODETAR.depth': '1', + 'NODETAR.type': 'File', + nlink: 1, + 'NODETAR.blksize': '4096', + 'NODETAR.blocks': '8' } ] + + , [ 'entry', + { path: 'fixtures/a.txt', + mode: 420, + uid: uid, + gid: gid, + size: 257, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/b.txt', + mode: 420, + uid: uid, + gid: gid, + size: 512, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/c.txt', + mode: 420, + uid: uid, + gid: gid, + size: 513, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/cc.txt', + mode: 420, + uid: uid, + gid: gid, + size: 513, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/dir/', + mode: 488, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/dir/sub/', + mode: 488, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + + , [ 'entry', + { path: 'fixtures/foo.js', + mode: 420, + uid: uid, + gid: gid, + size: 4, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/hardlink-1', + mode: 420, + uid: uid, + gid: gid, + size: 200, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/hardlink-2', + mode: 420, + uid: uid, + gid: gid, + size: 0, + type: '1', + linkpath: 'fixtures/hardlink-1', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/omega.txt', + mode: 420, + uid: uid, + gid: gid, + size: 2, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/packtest/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/packtest/omega.txt', + mode: 420, + uid: uid, + gid: gid, + size: 2, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/packtest/star.4.html', + mode: 420, + uid: uid, + gid: gid, + size: 54081, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'extendedHeader', + { path: 'PaxHeader/fixtures/packtest/Ω.txt', + mode: 420, + uid: uid, + gid: gid, + type: 'x', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' }, + { path: 'fixtures/packtest/Ω.txt', + 'NODETAR.depth': '2', + 'NODETAR.type': 'File', + nlink: 1, + uid: uid, + gid: gid, + size: 2, + 'NODETAR.blksize': '4096', + 'NODETAR.blocks': '8' } ] + + , [ 'entry', + { path: 'fixtures/packtest/Ω.txt', + mode: 420, + uid: uid, + gid: gid, + size: 2, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '', + 'NODETAR.depth': '2', + 'NODETAR.type': 'File', + nlink: 1, + 'NODETAR.blksize': '4096', + 'NODETAR.blocks': '8' } ] + + , [ 'entry', + { path: 'fixtures/r/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/', + mode: 493, + uid: uid, + gid: gid, + size: 0, + type: '5', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: 420, + uid: uid, + gid: gid, + size: 100, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'entry', + { path: 'fixtures/symlink', + uid: uid, + gid: gid, + size: 0, + type: '2', + linkpath: 'hardlink-1', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' } ] + + , [ 'extendedHeader', + { path: 'PaxHeader/fixtures/Ω.txt', + mode: 420, + uid: uid, + gid: gid, + type: 'x', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '' }, + { path: "fixtures/Ω.txt" + , "NODETAR.depth": "1" + , "NODETAR.type": "File" + , nlink: 1 + , uid: uid + , gid: gid + , size: 2 + , "NODETAR.blksize": "4096" + , "NODETAR.blocks": "8" } ] + + , [ 'entry', + { path: 'fixtures/Ω.txt', + mode: 420, + uid: uid, + gid: gid, + size: 2, + type: '0', + linkpath: '', + ustar: 'ustar\u0000', + ustarver: '00', + uname: '', + gname: '', + devmaj: 0, + devmin: 0, + fill: '', + 'NODETAR.depth': '1', + 'NODETAR.type': 'File', + nlink: 1, + 'NODETAR.blksize': '4096', + 'NODETAR.blocks': '8' } ] + ] + + +// first, make sure that the hardlinks are actually hardlinks, or this +// won't work. Git has a way of replacing them with a copy. +var hard1 = path.resolve(__dirname, "fixtures/hardlink-1") + , hard2 = path.resolve(__dirname, "fixtures/hardlink-2") + , fs = require("fs") + +try { fs.unlinkSync(hard2) } catch (e) {} +fs.linkSync(hard1, hard2) + +tap.test("with global header", { timeout: 10000 }, function (t) { + runTest(t, true) +}) + +tap.test("without global header", { timeout: 10000 }, function (t) { + runTest(t, false) +}) + +function alphasort (a, b) { + return a === b ? 0 + : a.toLowerCase() > b.toLowerCase() ? 1 + : a.toLowerCase() < b.toLowerCase() ? -1 + : a > b ? 1 + : -1 +} + + +function runTest (t, doGH) { + var reader = Reader({ path: input + , filter: function () { + return !this.path.match(/\.(tar|hex)$/) + } + , sort: alphasort + }) + + var pack = Pack(doGH ? pkg : null) + var writer = Writer(target) + + // skip the global header if we're not doing that. + var entry = doGH ? 0 : 1 + + t.ok(reader, "reader ok") + t.ok(pack, "pack ok") + t.ok(writer, "writer ok") + + pack.pipe(writer) + + var parse = tar.Parse() + t.ok(parse, "parser should be ok") + + pack.on("data", function (c) { + // console.error("PACK DATA") + if (c.length !== 512) { + // this one is too noisy, only assert if it'll be relevant + t.equal(c.length, 512, "parser should emit data in 512byte blocks") + } + parse.write(c) + }) + + pack.on("end", function () { + // console.error("PACK END") + t.pass("parser ends") + parse.end() + }) + + pack.on("error", function (er) { + t.fail("pack error", er) + }) + + parse.on("error", function (er) { + t.fail("parse error", er) + }) + + writer.on("error", function (er) { + t.fail("writer error", er) + }) + + reader.on("error", function (er) { + t.fail("reader error", er) + }) + + parse.on("*", function (ev, e) { + var wanted = entries[entry++] + if (!wanted) { + t.fail("unexpected event: "+ev) + return + } + t.equal(ev, wanted[0], "event type should be "+wanted[0]) + + if (ev !== wanted[0] || e.path !== wanted[1].path) { + console.error("wanted", wanted) + console.error([ev, e.props]) + e.on("end", function () { + console.error(e.fields) + throw "break" + }) + } + + + t.has(e.props, wanted[1], "properties "+wanted[1].path) + if (wanted[2]) { + e.on("end", function () { + if (!e.fields) { + t.ok(e.fields, "should get fields") + } else { + t.has(e.fields, wanted[2], "should get expected fields") + } + }) + } + }) + + reader.pipe(pack) + + writer.on("close", function () { + t.equal(entry, entries.length, "should get all expected entries") + t.pass("it finished") + t.end() + }) + +} diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/test/parse.js b/deps/npm/node_modules/node-gyp/node_modules/tar/test/parse.js new file mode 100644 index 00000000000..f765a50129b --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/test/parse.js @@ -0,0 +1,359 @@ +var tap = require("tap") + , tar = require("../tar.js") + , fs = require("fs") + , path = require("path") + , file = path.resolve(__dirname, "fixtures/c.tar") + , index = 0 + + , expect = +[ [ 'entry', + { path: 'c.txt', + mode: 420, + uid: 24561, + gid: 20, + size: 513, + mtime: new Date('Wed, 26 Oct 2011 01:10:58 GMT'), + cksum: 5422, + type: '0', + linkpath: '', + ustar: 'ustar\0', + ustarver: '00', + uname: 'isaacs', + gname: 'staff', + devmaj: 0, + devmin: 0, + fill: '' }, + undefined ], + [ 'entry', + { path: 'cc.txt', + mode: 420, + uid: 24561, + gid: 20, + size: 513, + mtime: new Date('Wed, 26 Oct 2011 01:11:02 GMT'), + cksum: 5525, + type: '0', + linkpath: '', + ustar: 'ustar\0', + ustarver: '00', + uname: 'isaacs', + gname: 'staff', + devmaj: 0, + devmin: 0, + fill: '' }, + undefined ], + [ 'entry', + { path: 'r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: 420, + uid: 24561, + gid: 20, + size: 100, + mtime: new Date('Thu, 27 Oct 2011 03:43:23 GMT'), + cksum: 18124, + type: '0', + linkpath: '', + ustar: 'ustar\0', + ustarver: '00', + uname: 'isaacs', + gname: 'staff', + devmaj: 0, + devmin: 0, + fill: '' }, + undefined ], + [ 'entry', + { path: 'Ω.txt', + mode: 420, + uid: 24561, + gid: 20, + size: 2, + mtime: new Date('Thu, 27 Oct 2011 17:51:49 GMT'), + cksum: 5695, + type: '0', + linkpath: '', + ustar: 'ustar\0', + ustarver: '00', + uname: 'isaacs', + gname: 'staff', + devmaj: 0, + devmin: 0, + fill: '' }, + undefined ], + [ 'extendedHeader', + { path: 'PaxHeader/Ω.txt', + mode: 420, + uid: 24561, + gid: 20, + size: 120, + mtime: new Date('Thu, 27 Oct 2011 17:51:49 GMT'), + cksum: 6702, + type: 'x', + linkpath: '', + ustar: 'ustar\0', + ustarver: '00', + uname: 'isaacs', + gname: 'staff', + devmaj: 0, + devmin: 0, + fill: '' }, + { path: 'Ω.txt', + ctime: 1319737909, + atime: 1319739061, + dev: 234881026, + ino: 51693379, + nlink: 1 } ], + [ 'entry', + { path: 'Ω.txt', + mode: 420, + uid: 24561, + gid: 20, + size: 2, + mtime: new Date('Thu, 27 Oct 2011 17:51:49 GMT'), + cksum: 5695, + type: '0', + linkpath: '', + ustar: 'ustar\0', + ustarver: '00', + uname: 'isaacs', + gname: 'staff', + devmaj: 0, + devmin: 0, + fill: '', + ctime: new Date('Thu, 27 Oct 2011 17:51:49 GMT'), + atime: new Date('Thu, 27 Oct 2011 18:11:01 GMT'), + dev: 234881026, + ino: 51693379, + nlink: 1 }, + undefined ], + [ 'extendedHeader', + { path: 'PaxHeader/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: 420, + uid: 24561, + gid: 20, + size: 353, + mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'), + cksum: 14488, + type: 'x', + linkpath: '', + ustar: 'ustar\0', + ustarver: '00', + uname: 'isaacs', + gname: 'staff', + devmaj: 0, + devmin: 0, + fill: '' }, + { path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + ctime: 1319686868, + atime: 1319741254, + 'LIBARCHIVE.creationtime': '1319686852', + dev: 234881026, + ino: 51681874, + nlink: 1 } ], + [ 'entry', + { path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: 420, + uid: 24561, + gid: 20, + size: 200, + mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'), + cksum: 14570, + type: '0', + linkpath: '', + ustar: 'ustar\0', + ustarver: '00', + uname: 'isaacs', + gname: 'staff', + devmaj: 0, + devmin: 0, + fill: '', + ctime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'), + atime: new Date('Thu, 27 Oct 2011 18:47:34 GMT'), + 'LIBARCHIVE.creationtime': '1319686852', + dev: 234881026, + ino: 51681874, + nlink: 1 }, + undefined ], + [ 'longPath', + { path: '././@LongLink', + mode: 0, + uid: 0, + gid: 0, + size: 201, + mtime: new Date('Thu, 01 Jan 1970 00:00:00 GMT'), + cksum: 4976, + type: 'L', + linkpath: '', + ustar: false }, + '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' ], + [ 'entry', + { path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: 420, + uid: 1000, + gid: 1000, + size: 201, + mtime: new Date('Thu, 27 Oct 2011 22:21:50 GMT'), + cksum: 14086, + type: '0', + linkpath: '', + ustar: false }, + undefined ], + [ 'longLinkpath', + { path: '././@LongLink', + mode: 0, + uid: 0, + gid: 0, + size: 201, + mtime: new Date('Thu, 01 Jan 1970 00:00:00 GMT'), + cksum: 4975, + type: 'K', + linkpath: '', + ustar: false }, + '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' ], + [ 'longPath', + { path: '././@LongLink', + mode: 0, + uid: 0, + gid: 0, + size: 201, + mtime: new Date('Thu, 01 Jan 1970 00:00:00 GMT'), + cksum: 4976, + type: 'L', + linkpath: '', + ustar: false }, + '200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL' ], + [ 'entry', + { path: '200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL', + mode: 511, + uid: 1000, + gid: 1000, + size: 0, + mtime: new Date('Fri, 28 Oct 2011 23:05:17 GMT'), + cksum: 21603, + type: '2', + linkpath: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + ustar: false }, + undefined ], + [ 'extendedHeader', + { path: 'PaxHeader/200-hard', + mode: 420, + uid: 24561, + gid: 20, + size: 143, + mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'), + cksum: 6533, + type: 'x', + linkpath: '', + ustar: 'ustar\0', + ustarver: '00', + uname: 'isaacs', + gname: 'staff', + devmaj: 0, + devmin: 0, + fill: '' }, + { ctime: 1320617144, + atime: 1320617232, + 'LIBARCHIVE.creationtime': '1319686852', + dev: 234881026, + ino: 51681874, + nlink: 2 } ], + [ 'entry', + { path: '200-hard', + mode: 420, + uid: 24561, + gid: 20, + size: 200, + mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'), + cksum: 5526, + type: '0', + linkpath: '', + ustar: 'ustar\0', + ustarver: '00', + uname: 'isaacs', + gname: 'staff', + devmaj: 0, + devmin: 0, + fill: '', + ctime: new Date('Sun, 06 Nov 2011 22:05:44 GMT'), + atime: new Date('Sun, 06 Nov 2011 22:07:12 GMT'), + 'LIBARCHIVE.creationtime': '1319686852', + dev: 234881026, + ino: 51681874, + nlink: 2 }, + undefined ], + [ 'extendedHeader', + { path: 'PaxHeader/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: 420, + uid: 24561, + gid: 20, + size: 353, + mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'), + cksum: 14488, + type: 'x', + linkpath: '', + ustar: 'ustar\0', + ustarver: '00', + uname: 'isaacs', + gname: 'staff', + devmaj: 0, + devmin: 0, + fill: '' }, + { path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + ctime: 1320617144, + atime: 1320617406, + 'LIBARCHIVE.creationtime': '1319686852', + dev: 234881026, + ino: 51681874, + nlink: 2 } ], + [ 'entry', + { path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', + mode: 420, + uid: 24561, + gid: 20, + size: 0, + mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'), + cksum: 15173, + type: '1', + linkpath: '200-hard', + ustar: 'ustar\0', + ustarver: '00', + uname: 'isaacs', + gname: 'staff', + devmaj: 0, + devmin: 0, + fill: '', + ctime: new Date('Sun, 06 Nov 2011 22:05:44 GMT'), + atime: new Date('Sun, 06 Nov 2011 22:10:06 GMT'), + 'LIBARCHIVE.creationtime': '1319686852', + dev: 234881026, + ino: 51681874, + nlink: 2 }, + undefined ] ] + + +tap.test("parser test", function (t) { + var parser = tar.Parse() + + parser.on("end", function () { + t.equal(index, expect.length, "saw all expected events") + t.end() + }) + + fs.createReadStream(file) + .pipe(parser) + .on("*", function (ev, entry) { + var wanted = expect[index] + if (!wanted) { + return t.fail("Unexpected event: " + ev) + } + var result = [ev, entry.props] + entry.on("end", function () { + result.push(entry.fields || entry.body) + + t.equal(ev, wanted[0], index + " event type") + t.equivalent(entry.props, wanted[1], wanted[1].path + " entry properties") + if (wanted[2]) { + t.equivalent(result[2], wanted[2], "metadata values") + } + index ++ + }) + }) +}) diff --git a/deps/npm/node_modules/node-gyp/node_modules/tar/test/zz-cleanup.js b/deps/npm/node_modules/node-gyp/node_modules/tar/test/zz-cleanup.js new file mode 100644 index 00000000000..a00ff7faa03 --- /dev/null +++ b/deps/npm/node_modules/node-gyp/node_modules/tar/test/zz-cleanup.js @@ -0,0 +1,20 @@ +// clean up the fixtures + +var tap = require("tap") +, rimraf = require("rimraf") +, test = tap.test +, path = require("path") + +test("clean fixtures", function (t) { + rimraf(path.resolve(__dirname, "fixtures"), function (er) { + t.ifError(er, "rimraf ./fixtures/") + t.end() + }) +}) + +test("clean tmp", function (t) { + rimraf(path.resolve(__dirname, "tmp"), function (er) { + t.ifError(er, "rimraf ./tmp/") + t.end() + }) +}) diff --git a/deps/npm/node_modules/node-gyp/package.json b/deps/npm/node_modules/node-gyp/package.json index 2e2e47c7a37..98e08d5045f 100644 --- a/deps/npm/node_modules/node-gyp/package.json +++ b/deps/npm/node_modules/node-gyp/package.json @@ -1,6 +1,7 @@ { "name": "node-gyp", "description": "Node.js native addon build tool", + "license": "MIT", "keywords": [ "native", "addon", @@ -10,7 +11,7 @@ "bindings", "gyp" ], - "version": "1.0.2", + "version": "2.0.1", "installVersion": 9, "author": { "name": "Nathan Rajlich", @@ -33,8 +34,9 @@ "minimatch": "1", "mkdirp": "^0.5.0", "nopt": "2 || 3", - "npmlog": "0", + "npmlog": "0 || 1", "osenv": "0", + "path-array": "^1.0.0", "request": "2", "rimraf": "2", "semver": "2.x || 3.x || 4", @@ -44,19 +46,20 @@ "engines": { "node": ">= 0.8.0" }, - "gitHead": "1e399b471945b35f3bfbca4a10fba31a6739b5db", + "gitHead": "0b9790ab6b885e2020e83936e402ac23c9e84726", "bugs": { "url": "https://github.com/TooTallNate/node-gyp/issues" }, - "homepage": "https://github.com/TooTallNate/node-gyp", - "_id": "node-gyp@1.0.2", + "homepage": "https://github.com/TooTallNate/node-gyp#readme", + "_id": "node-gyp@2.0.1", "scripts": {}, - "_shasum": "b0bb6d2d762271408dd904853e7aa3000ed2eb57", - "_from": "node-gyp@>=1.0.1-0 <1.1.0-0", - "_npmVersion": "2.0.0-beta.3", + "_shasum": "38e9c5b54df7115cd0953cee67863f839d0c7888", + "_from": "node-gyp@>=2.0.1 <2.1.0", + "_npmVersion": "2.9.1", + "_nodeVersion": "0.12.3", "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" + "name": "tootallnate", + "email": "nathan@tootallnate.net" }, "maintainers": [ { @@ -73,9 +76,9 @@ } ], "dist": { - "shasum": "b0bb6d2d762271408dd904853e7aa3000ed2eb57", - "tarball": "http://registry.npmjs.org/node-gyp/-/node-gyp-1.0.2.tgz" + "shasum": "38e9c5b54df7115cd0953cee67863f839d0c7888", + "tarball": "http://registry.npmjs.org/node-gyp/-/node-gyp-2.0.1.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-1.0.2.tgz" + "_resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-2.0.1.tgz" } diff --git a/deps/npm/node_modules/node-gyp/src/win_delay_load_hook.c b/deps/npm/node_modules/node-gyp/src/win_delay_load_hook.c new file mode 100644 index 00000000000..f397cfa195e --- /dev/null +++ b/deps/npm/node_modules/node-gyp/src/win_delay_load_hook.c @@ -0,0 +1,33 @@ +/* + * When this file is linked to a DLL, it sets up a delay-load hook that + * intervenes when the DLL is trying to load 'node.exe' or 'iojs.exe' + * dynamically. Instead of trying to locate the .exe file it'll just return + * a handle to the process image. + * + * This allows compiled addons to work when node.exe or iojs.exe is renamed. + */ + +#ifdef _MSC_VER + +#define WIN32_LEAN_AND_MEAN +#include + +#include +#include + +static FARPROC WINAPI load_exe_hook(unsigned int event, DelayLoadInfo* info) { + HMODULE m; + if (event != dliNotePreLoadLibrary) + return NULL; + + if (_stricmp(info->szDll, "iojs.exe") != 0 && + _stricmp(info->szDll, "node.exe") != 0) + return NULL; + + m = GetModuleHandle(NULL); + return (FARPROC) m; +} + +PfnDliHook __pfnDliNotifyHook2 = load_exe_hook; + +#endif diff --git a/deps/npm/node_modules/nopt/LICENSE b/deps/npm/node_modules/nopt/LICENSE index 05a4010949c..19129e315fe 100644 --- a/deps/npm/node_modules/nopt/LICENSE +++ b/deps/npm/node_modules/nopt/LICENSE @@ -1,23 +1,15 @@ -Copyright 2009, 2010, 2011 Isaac Z. Schlueter. -All rights reserved. +The ISC License -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: +Copyright (c) Isaac Z. Schlueter and Contributors -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/nopt/package.json b/deps/npm/node_modules/nopt/package.json index 874f1128c0f..97c090b2f51 100644 --- a/deps/npm/node_modules/nopt/package.json +++ b/deps/npm/node_modules/nopt/package.json @@ -1,6 +1,6 @@ { "name": "nopt", - "version": "3.0.1", + "version": "3.0.2", "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.", "author": { "name": "Isaac Z. Schlueter", @@ -13,29 +13,43 @@ }, "repository": { "type": "git", - "url": "http://github.com/isaacs/nopt" + "url": "git+ssh://git@github.com/isaacs/nopt.git" }, "bin": { "nopt": "./bin/nopt.js" }, - "license": { - "type": "MIT", - "url": "https://github.com/isaacs/nopt/raw/master/LICENSE" - }, + "license": "ISC", "dependencies": { "abbrev": "1" }, "devDependencies": { "tap": "~0.4.8" }, - "readme": "If you want to write an option parser, and have it be good, there are\ntwo ways to do it. The Right Way, and the Wrong Way.\n\nThe Wrong Way is to sit down and write an option parser. We've all done\nthat.\n\nThe Right Way is to write some complex configurable program with so many\noptions that you go half-insane just trying to manage them all, and put\nit off with duct-tape solutions until you see exactly to the core of the\nproblem, and finally snap and write an awesome option parser.\n\nIf you want to write an option parser, don't write an option parser.\nWrite a package manager, or a source control system, or a service\nrestarter, or an operating system. You probably won't end up with a\ngood one of those, but if you don't give up, and you are relentless and\ndiligent enough in your procrastination, you may just end up with a very\nnice option parser.\n\n## USAGE\n\n // my-program.js\n var nopt = require(\"nopt\")\n , Stream = require(\"stream\").Stream\n , path = require(\"path\")\n , knownOpts = { \"foo\" : [String, null]\n , \"bar\" : [Stream, Number]\n , \"baz\" : path\n , \"bloo\" : [ \"big\", \"medium\", \"small\" ]\n , \"flag\" : Boolean\n , \"pick\" : Boolean\n , \"many\" : [String, Array]\n }\n , shortHands = { \"foofoo\" : [\"--foo\", \"Mr. Foo\"]\n , \"b7\" : [\"--bar\", \"7\"]\n , \"m\" : [\"--bloo\", \"medium\"]\n , \"p\" : [\"--pick\"]\n , \"f\" : [\"--flag\"]\n }\n // everything is optional.\n // knownOpts and shorthands default to {}\n // arg list defaults to process.argv\n // slice defaults to 2\n , parsed = nopt(knownOpts, shortHands, process.argv, 2)\n console.log(parsed)\n\nThis would give you support for any of the following:\n\n```bash\n$ node my-program.js --foo \"blerp\" --no-flag\n{ \"foo\" : \"blerp\", \"flag\" : false }\n\n$ node my-program.js ---bar 7 --foo \"Mr. Hand\" --flag\n{ bar: 7, foo: \"Mr. Hand\", flag: true }\n\n$ node my-program.js --foo \"blerp\" -f -----p\n{ foo: \"blerp\", flag: true, pick: true }\n\n$ node my-program.js -fp --foofoo\n{ foo: \"Mr. Foo\", flag: true, pick: true }\n\n$ node my-program.js --foofoo -- -fp # -- stops the flag parsing.\n{ foo: \"Mr. Foo\", argv: { remain: [\"-fp\"] } }\n\n$ node my-program.js --blatzk -fp # unknown opts are ok.\n{ blatzk: true, flag: true, pick: true }\n\n$ node my-program.js --blatzk=1000 -fp # but you need to use = if they have a value\n{ blatzk: 1000, flag: true, pick: true }\n\n$ node my-program.js --no-blatzk -fp # unless they start with \"no-\"\n{ blatzk: false, flag: true, pick: true }\n\n$ node my-program.js --baz b/a/z # known paths are resolved.\n{ baz: \"/Users/isaacs/b/a/z\" }\n\n# if Array is one of the types, then it can take many\n# values, and will always be an array. The other types provided\n# specify what types are allowed in the list.\n\n$ node my-program.js --many 1 --many null --many foo\n{ many: [\"1\", \"null\", \"foo\"] }\n\n$ node my-program.js --many foo\n{ many: [\"foo\"] }\n```\n\nRead the tests at the bottom of `lib/nopt.js` for more examples of\nwhat this puppy can do.\n\n## Types\n\nThe following types are supported, and defined on `nopt.typeDefs`\n\n* String: A normal string. No parsing is done.\n* path: A file system path. Gets resolved against cwd if not absolute.\n* url: A url. If it doesn't parse, it isn't accepted.\n* Number: Must be numeric.\n* Date: Must parse as a date. If it does, and `Date` is one of the options,\n then it will return a Date object, not a string.\n* Boolean: Must be either `true` or `false`. If an option is a boolean,\n then it does not need a value, and its presence will imply `true` as\n the value. To negate boolean flags, do `--no-whatever` or `--whatever\n false`\n* NaN: Means that the option is strictly not allowed. Any value will\n fail.\n* Stream: An object matching the \"Stream\" class in node. Valuable\n for use when validating programmatically. (npm uses this to let you\n supply any WriteStream on the `outfd` and `logfd` config options.)\n* Array: If `Array` is specified as one of the types, then the value\n will be parsed as a list of options. This means that multiple values\n can be specified, and that the value will always be an array.\n\nIf a type is an array of values not on this list, then those are\nconsidered valid values. For instance, in the example above, the\n`--bloo` option can only be one of `\"big\"`, `\"medium\"`, or `\"small\"`,\nand any other value will be rejected.\n\nWhen parsing unknown fields, `\"true\"`, `\"false\"`, and `\"null\"` will be\ninterpreted as their JavaScript equivalents.\n\nYou can also mix types and values, or multiple types, in a list. For\ninstance `{ blah: [Number, null] }` would allow a value to be set to\neither a Number or null. When types are ordered, this implies a\npreference, and the first type that can be used to properly interpret\nthe value will be used.\n\nTo define a new type, add it to `nopt.typeDefs`. Each item in that\nhash is an object with a `type` member and a `validate` method. The\n`type` member is an object that matches what goes in the type list. The\n`validate` method is a function that gets called with `validate(data,\nkey, val)`. Validate methods should assign `data[key]` to the valid\nvalue of `val` if it can be handled properly, or return boolean\n`false` if it cannot.\n\nYou can also call `nopt.clean(data, types, typeDefs)` to clean up a\nconfig object and remove its invalid properties.\n\n## Error Handling\n\nBy default, nopt outputs a warning to standard error when invalid\noptions are found. You can change this behavior by assigning a method\nto `nopt.invalidHandler`. This method will be called with\nthe offending `nopt.invalidHandler(key, val, types)`.\n\nIf no `nopt.invalidHandler` is assigned, then it will console.error\nits whining. If it is assigned to boolean `false` then the warning is\nsuppressed.\n\n## Abbreviations\n\nYes, they are supported. If you define options like this:\n\n```javascript\n{ \"foolhardyelephants\" : Boolean\n, \"pileofmonkeys\" : Boolean }\n```\n\nThen this will work:\n\n```bash\nnode program.js --foolhar --pil\nnode program.js --no-f --pileofmon\n# etc.\n```\n\n## Shorthands\n\nShorthands are a hash of shorter option names to a snippet of args that\nthey expand to.\n\nIf multiple one-character shorthands are all combined, and the\ncombination does not unambiguously match any other option or shorthand,\nthen they will be broken up into their constituent parts. For example:\n\n```json\n{ \"s\" : [\"--loglevel\", \"silent\"]\n, \"g\" : \"--global\"\n, \"f\" : \"--force\"\n, \"p\" : \"--parseable\"\n, \"l\" : \"--long\"\n}\n```\n\n```bash\nnpm ls -sgflp\n# just like doing this:\nnpm ls --loglevel silent --global --force --long --parseable\n```\n\n## The Rest of the args\n\nThe config object returned by nopt is given a special member called\n`argv`, which is an object with the following fields:\n\n* `remain`: The remaining args after all the parsing has occurred.\n* `original`: The args as they originally appeared.\n* `cooked`: The args after flags and shorthands are expanded.\n\n## Slicing\n\nNode programs are called with more or less the exact argv as it appears\nin C land, after the v8 and node-specific options have been plucked off.\nAs such, `argv[0]` is always `node` and `argv[1]` is always the\nJavaScript program being run.\n\nThat's usually not very useful to you. So they're sliced off by\ndefault. If you want them, then you can pass in `0` as the last\nargument, or any other number that you'd like to slice off the start of\nthe list.\n", - "readmeFilename": "README.md", - "gitHead": "4296f7aba7847c198fea2da594f9e1bec02817ec", + "gitHead": "a0ff8dcbb29ae9da68769c9f782bd4d70746b02d", "bugs": { "url": "https://github.com/isaacs/nopt/issues" }, - "homepage": "https://github.com/isaacs/nopt", - "_id": "nopt@3.0.1", - "_shasum": "bce5c42446a3291f47622a370abbf158fbbacbfd", - "_from": "nopt@latest" + "homepage": "https://github.com/isaacs/nopt#readme", + "_id": "nopt@3.0.2", + "_shasum": "a82a87f9d8c3df140fe78fb29657a7a774403b5e", + "_from": "nopt@>=3.0.2 <3.1.0", + "_npmVersion": "2.10.0", + "_nodeVersion": "2.0.1", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "a82a87f9d8c3df140fe78fb29657a7a774403b5e", + "tarball": "http://registry.npmjs.org/nopt/-/nopt-3.0.2.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.2.tgz", + "readme": "ERROR: No README data found!" } diff --git a/deps/npm/node_modules/normalize-git-url/.eslintrc b/deps/npm/node_modules/normalize-git-url/.eslintrc new file mode 100644 index 00000000000..b54e30fd2aa --- /dev/null +++ b/deps/npm/node_modules/normalize-git-url/.eslintrc @@ -0,0 +1,19 @@ +{ + "env" : { + "node" : true + }, + "rules" : { + "semi": [2, "never"], + "strict": 0, + "quotes": [1, "double", "avoid-escape"], + "no-use-before-define": 0, + "curly": 0, + "no-underscore-dangle": 0, + "no-lonely-if": 1, + "no-unused-vars": [2, {"vars" : "all", "args" : "after-used"}], + "no-mixed-requires": 0, + "space-infix-ops": 0, + "key-spacing": 0, + "no-multi-spaces": 0 + } +} diff --git a/deps/npm/node_modules/normalize-git-url/.npmignore b/deps/npm/node_modules/normalize-git-url/.npmignore new file mode 100644 index 00000000000..c2658d7d1b3 --- /dev/null +++ b/deps/npm/node_modules/normalize-git-url/.npmignore @@ -0,0 +1 @@ +node_modules/ diff --git a/deps/npm/node_modules/normalize-git-url/CHANGELOG.md b/deps/npm/node_modules/normalize-git-url/CHANGELOG.md new file mode 100644 index 00000000000..f2d2b94bedb --- /dev/null +++ b/deps/npm/node_modules/normalize-git-url/CHANGELOG.md @@ -0,0 +1,5 @@ +### 1.0.0 (2014-12-25): + +* [`8b3d874`](https://github.com/npm/normalize-git-url/commit/8b3d874afd14f4cdde65d418e0a35a615c746bba) + Initial version, with simple tests. + ([@othiym23](https://github.com/othiym23)) diff --git a/deps/npm/node_modules/normalize-git-url/LICENSE b/deps/npm/node_modules/normalize-git-url/LICENSE new file mode 100644 index 00000000000..d21147bf196 --- /dev/null +++ b/deps/npm/node_modules/normalize-git-url/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2014-2015, Forrest L Norvell + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/normalize-git-url/README.md b/deps/npm/node_modules/normalize-git-url/README.md new file mode 100644 index 00000000000..da3d78ed25c --- /dev/null +++ b/deps/npm/node_modules/normalize-git-url/README.md @@ -0,0 +1,40 @@ +# normalize-git-url + +You have a bunch of Git URLs. You want to convert them to a canonical +representation, probably for use inside npm so that it doesn't end up creating +a bunch of superfluous cached origins. You use this package. + +## Usage + +```javascript +var ngu = require('normalize-git-url'); +var normalized = ngu("git+ssh://git@github.com:organization/repo.git#hashbrowns") +// get back: +// { +// url : "ssh://git@github.com/organization/repo.git", +// branch : "hashbrowns" // did u know hashbrowns are delicious? +// } +``` + +## API + +There's just the one function, and all it takes is a single parameter, a non-normalized Git URL. + +### normalizeGitUrl(url) + +* `url` {String} The Git URL (very loosely speaking) to be normalized. + +Returns an object with the following format: + +* `url` {String} The normalized URL. +* `branch` {String} The treeish to be checked out once the repo at `url` is + cloned. It doesn't have to be a branch, but it's a lot easier to intuit what + the output is for with that name. + +## Limitations + +Right now this doesn't try to special-case GitHub too much -- it doesn't ensure +that `.git` is added to the end of URLs, it doesn't prefer `https:` over +`http:` or `ssh:`, it doesn't deal with redirects, and it doesn't try to +resolve symbolic names to treeish hashcodes. For now, it just tries to account +for minor differences in representation. diff --git a/deps/npm/node_modules/normalize-git-url/normalize-git-url.js b/deps/npm/node_modules/normalize-git-url/normalize-git-url.js new file mode 100644 index 00000000000..7662037940f --- /dev/null +++ b/deps/npm/node_modules/normalize-git-url/normalize-git-url.js @@ -0,0 +1,27 @@ +var url = require("url") + +module.exports = function normalize (u) { + var parsed = url.parse(u, true) + + // git is so tricky! + // if the path is like ssh://foo:22/some/path then it works, but + // it needs the ssh:// + // If the path is like ssh://foo:some/path then it works, but + // only if you remove the ssh:// + if (parsed.protocol) { + parsed.protocol = parsed.protocol.replace(/^git\+/, "") + + // ssh paths that are scp-style urls don't need the ssh:// + parsed.pathname = parsed.pathname.replace(/^\/?:/, "/") + } + + // figure out what we should check out. + var checkout = parsed.hash && parsed.hash.substr(1) || "master" + parsed.hash = "" + + u = url.format(parsed) + return { + url : u, + branch : checkout + } +} diff --git a/deps/npm/node_modules/normalize-git-url/package.json b/deps/npm/node_modules/normalize-git-url/package.json new file mode 100644 index 00000000000..6008db67536 --- /dev/null +++ b/deps/npm/node_modules/normalize-git-url/package.json @@ -0,0 +1,42 @@ +{ + "name": "normalize-git-url", + "version": "1.0.1", + "description": "Normalizes Git URLs. For npm, but you can use it too.", + "main": "normalize-git-url.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^1.1.0" + }, + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/normalize-git-url.git" + }, + "keywords": [ + "git", + "github", + "url", + "normalize", + "npm" + ], + "author": { + "name": "Forrest L Norvell", + "email": "ogd@aoaioxxysz.net" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/normalize-git-url/issues" + }, + "homepage": "https://github.com/npm/normalize-git-url", + "readme": "# normalize-git-url\n\nYou have a bunch of Git URLs. You want to convert them to a canonical\nrepresentation, probably for use inside npm so that it doesn't end up creating\na bunch of superfluous cached origins. You use this package.\n\n## Usage\n\n```javascript\nvar ngu = require('normalize-git-url');\nvar normalized = ngu(\"git+ssh://git@github.com:organization/repo.git#hashbrowns\")\n// get back:\n// {\n// url : \"ssh://git@github.com/organization/repo.git\",\n// branch : \"hashbrowns\" // did u know hashbrowns are delicious?\n// }\n```\n\n## API\n\nThere's just the one function, and all it takes is a single parameter, a non-normalized Git URL.\n\n### normalizeGitUrl(url)\n\n* `url` {String} The Git URL (very loosely speaking) to be normalized.\n\nReturns an object with the following format:\n\n* `url` {String} The normalized URL.\n* `branch` {String} The treeish to be checked out once the repo at `url` is\n cloned. It doesn't have to be a branch, but it's a lot easier to intuit what\n the output is for with that name.\n\n## Limitations\n\nRight now this doesn't try to special-case GitHub too much -- it doesn't ensure\nthat `.git` is added to the end of URLs, it doesn't prefer `https:` over\n`http:` or `ssh:`, it doesn't deal with redirects, and it doesn't try to\nresolve symbolic names to treeish hashcodes. For now, it just tries to account\nfor minor differences in representation.\n", + "readmeFilename": "README.md", + "gitHead": "d87bf42e845ed664e4a8bab3490052fb44c90433", + "_id": "normalize-git-url@1.0.1", + "_shasum": "1b561345d66e3a3bc5513a5ace85f155ca42613e", + "_from": "normalize-git-url@>=1.0.1 <1.1.0" +} diff --git a/deps/npm/node_modules/normalize-git-url/test/basic.js b/deps/npm/node_modules/normalize-git-url/test/basic.js new file mode 100644 index 00000000000..f8f199f6506 --- /dev/null +++ b/deps/npm/node_modules/normalize-git-url/test/basic.js @@ -0,0 +1,56 @@ +var test = require("tap").test + +var normalize = require("../normalize-git-url.js") + +test("basic normalization tests", function (t) { + t.same( + normalize("git+ssh://user@hostname:project.git#commit-ish"), + { url : "ssh://user@hostname/project.git", branch : "commit-ish" } + ) + t.same( + normalize("git+http://user@hostname/project/blah.git#commit-ish"), + { url : "http://user@hostname/project/blah.git", branch : "commit-ish" } + ) + t.same( + normalize("git+https://user@hostname/project/blah.git#commit-ish"), + { url : "https://user@hostname/project/blah.git", branch : "commit-ish" } + ) + t.same( + normalize("git+ssh://git@github.com:npm/npm.git#v1.0.27"), + { url : "ssh://git@github.com/npm/npm.git", branch : "v1.0.27" } + ) + t.same( + normalize("git+ssh://git@github.com:org/repo#dev"), + { url : "ssh://git@github.com/org/repo", branch : "dev" } + ) + t.same( + normalize("git+ssh://git@github.com/org/repo#dev"), + { url : "ssh://git@github.com/org/repo", branch : "dev" } + ) + t.same( + normalize("git+ssh://foo:22/some/path"), + { url : "ssh://foo:22/some/path", branch : "master" } + ) + t.same( + normalize("git@github.com:org/repo#dev"), + { url : "git@github.com:org/repo", branch : "dev" } + ) + t.same( + normalize("git+https://github.com/KenanY/node-uuid"), + { url : "https://github.com/KenanY/node-uuid", branch : "master" } + ) + t.same( + normalize("git+https://github.com/KenanY/node-uuid#7a018f2d075b03a73409e8356f9b29c9ad4ea2c5"), + { url : "https://github.com/KenanY/node-uuid", branch : "7a018f2d075b03a73409e8356f9b29c9ad4ea2c5" } + ) + t.same( + normalize("git+ssh://git@git.example.com:b/b.git#v1.0.0"), + { url : "ssh://git@git.example.com/b/b.git", branch : "v1.0.0" } + ) + t.same( + normalize("git+ssh://git@github.com:npm/npm-proto.git#othiym23/organized"), + { url : "ssh://git@github.com/npm/npm-proto.git", branch : "othiym23/organized" } + ) + + t.end() +}) diff --git a/deps/npm/node_modules/normalize-package-data/README.md b/deps/npm/node_modules/normalize-package-data/README.md index 1429e404208..0b9d7b5b423 100644 --- a/deps/npm/node_modules/normalize-package-data/README.md +++ b/deps/npm/node_modules/normalize-package-data/README.md @@ -1,4 +1,4 @@ -# normalize-package-data [![Build Status](https://travis-ci.org/meryn/normalize-package-data.png?branch=master)](https://travis-ci.org/meryn/normalize-package-data) +# normalize-package-data [![Build Status](https://travis-ci.org/npm/normalize-package-data.png?branch=master)](https://travis-ci.org/npm/normalize-package-data) normalize-package data exports a function that normalizes package metadata. This data is typically found in a package.json file, but in principle could come from any source - for example the npm registry. @@ -68,9 +68,11 @@ If the supplied data has an invalid name or version vield, `normalizeData` will * If `bundledDependencies` field (a typo) exists and `bundleDependencies` field does not, `bundledDependencies` will get renamed to `bundleDependencies`. * If the value of any of the dependencies fields (`dependencies`, `devDependencies`, `optionalDependencies`) is a string, it gets converted into an object with familiar `name=>value` pairs. * The values in `optionalDependencies` get added to `dependencies`. The `optionalDependencies` array is left untouched. +* As of v2: Dependencies that point at known hosted git providers (currently: github, bitbucket, gitlab) will have their URLs canonicalized, but protocols will be preserved. +* As of v2: Dependencies that use shortcuts for hosted git providers (`org/proj`, `github:org/proj`, `bitbucket:org/proj`, `gitlab:org/proj`, `gist:docid`) will have the shortcut left in place. (In the case of github, the `org/proj` form will be expanded to `github:org/proj`.) THIS MARKS A BREAKING CHANGE FROM V1, where the shorcut was previously expanded to a URL. * If `description` field does not exist, but `readme` field does, then (more or less) the first paragraph of text that's found in the readme is taken as value for `description`. * If `repository` field is a string, it will become an object with `url` set to the original string value, and `type` set to `"git"`. -* If `repository.url` is not a valid url, but in the style of "[owner-name]/[repo-name]", `repository.url` will be set to git://github.com/[owner-name]/[repo-name] +* If `repository.url` is not a valid url, but in the style of "[owner-name]/[repo-name]", `repository.url` will be set to https://github.com/[owner-name]/[repo-name] * If `bugs` field is a string, the value of `bugs` field is changed into an object with `url` set to the original string value. * If `bugs` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `bugs` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]/issues . If the repository field points to a GitHub Gist repo url, the associated http url is chosen. * If `bugs` field is an object, the resulting value only has email and url properties. If email and url properties are not strings, they are ignored. If no valid values for either email or url is found, bugs field will be removed. @@ -91,6 +93,10 @@ If `name` field is given, the value of the name field must be a string. The stri If `version` field is given, the value of the version field must be a valid *semver* string, as determined by the `semver.valid` method. See [documentation for the semver module](https://github.com/isaacs/node-semver). +### Rules for license field + +The `license` field should be a valid *SDPDX license expression* string, as determined by the `spdx.valid` method. See [documentation for the spdx module](https://github.com/kemitchell/spdx.js). + ## Credits This package contains code based on read-package-json written by Isaac Z. Schlueter. Used with permisson. diff --git a/deps/npm/node_modules/normalize-package-data/lib/fixer.js b/deps/npm/node_modules/normalize-package-data/lib/fixer.js index 14c0abc8e91..3d9380b6e43 100644 --- a/deps/npm/node_modules/normalize-package-data/lib/fixer.js +++ b/deps/npm/node_modules/normalize-package-data/lib/fixer.js @@ -1,11 +1,11 @@ var semver = require("semver") -var parseGitHubURL = require("github-url-from-git") +var spdx = require('spdx'); +var hostedGitInfo = require("hosted-git-info") var depTypes = ["dependencies","devDependencies","optionalDependencies"] var extractDescription = require("./extract_description") var url = require("url") var typos = require("./typos") var coreModuleNames = require("./core_module_names") -var githubUserRepo = require("github-url-from-username-repo") var fixer = module.exports = { // default warning function @@ -25,12 +25,10 @@ var fixer = module.exports = { } var r = data.repository.url || "" if (r) { - var ghurl = parseGitHubURL(r) - if (ghurl) { - r = ghurl.replace(/^https?:\/\//, 'git://') - } else if (githubUserRepo(r)) { - // repo has 'user/reponame' filled in as repo - data.repository.url = githubUserRepo(r) + var hosted = hostedGitInfo.fromUrl(r) + if (hosted) { + r = data.repository.url + = hosted.getDefaultRepresentation() == "shortcut" ? hosted.https() : hosted.toString() } } @@ -52,12 +50,13 @@ var fixer = module.exports = { if (typeof data.scripts !== "object") { this.warn("nonObjectScripts") delete data.scripts + return } Object.keys(data.scripts).forEach(function (k) { if (typeof data.scripts[k] !== "string") { this.warn("nonStringScript") delete data.scripts[k] - } else if (typos.script[k]) { + } else if (typos.script[k] && !data.scripts[typos.script[k]]) { this.warn("typo", k, typos.script[k], "scripts") } }, this) @@ -143,11 +142,8 @@ var fixer = module.exports = { this.warn("nonStringDependency", d, JSON.stringify(r)) delete data[deps][d] } - // "/" is not allowed as packagename for publishing, but for git-urls - // normalize shorthand-urls - if (githubUserRepo(data[deps][d])) { - data[deps][d] = 'git+' + githubUserRepo(data[deps][d]) - } + var hosted = hostedGitInfo.fromUrl(data[deps][d]) + if (hosted) data[deps][d] = hosted.toString() }, this) }, this) } @@ -198,7 +194,10 @@ var fixer = module.exports = { modifyPeople(data, parsePerson) } -, fixNameField: function(data, strict) { +, fixNameField: function(data, options) { + if (typeof options === "boolean") options = {strict: options} + else if (typeof options === "undefined") options = {} + var strict = options.strict if (!data.name && !strict) { data.name = "" return @@ -208,7 +207,7 @@ var fixer = module.exports = { } if (!strict) data.name = data.name.trim() - ensureValidName(data.name, strict) + ensureValidName(data.name, strict, options.allowLegacyCase) if (coreModuleNames.indexOf(data.name) !== -1) this.warn("conflictingName", data.name) } @@ -234,12 +233,9 @@ var fixer = module.exports = { , fixBugsField: function(data) { if (!data.bugs && data.repository && data.repository.url) { - var gh = parseGitHubURL(data.repository.url) - if(gh) { - if(gh.match(/^https:\/\/github.com\//)) - data.bugs = {url: gh + "/issues"} - else // gist url - data.bugs = {url: gh} + var hosted = hostedGitInfo.fromUrl(data.repository.url) + if(hosted && hosted.bugs()) { + data.bugs = {url: hosted.bugs()} } } else if(data.bugs) { @@ -278,13 +274,10 @@ var fixer = module.exports = { , fixHomepageField: function(data) { if (!data.homepage && data.repository && data.repository.url) { - var gh = parseGitHubURL(data.repository.url) - if (gh) - data.homepage = gh - else - return true - } else if (!data.homepage) - return true + var hosted = hostedGitInfo.fromUrl(data.repository.url) + if (hosted && hosted.docs()) data.homepage = hosted.docs() + } + if (!data.homepage) return if(typeof data.homepage !== "string") { this.warn("nonUrlHomepage") @@ -295,6 +288,18 @@ var fixer = module.exports = { data.homepage = "http://" + data.homepage } } + +, fixLicenseField: function(data) { + if (!data.license) { + return this.warn("missingLicense") + } else if ( + typeof(data.license) !== 'string' || + data.license.length < 1 || + !spdx.valid(data.license) + ) { + this.warn("nonSPDXLicense") + } + } } function isValidScopedPackageName(spec) { @@ -313,10 +318,10 @@ function isCorrectlyEncodedName(spec) { spec === encodeURIComponent(spec) } -function ensureValidName (name, strict) { +function ensureValidName (name, strict, allowLegacyCase) { if (name.charAt(0) === "." || !(isValidScopedPackageName(name) || isCorrectlyEncodedName(name)) || - (strict && name !== name.toLowerCase()) || + (strict && (!allowLegacyCase) && name !== name.toLowerCase()) || name.toLowerCase() === "node_modules" || name.toLowerCase() === "favicon.ico") { throw new Error("Invalid name: " + JSON.stringify(name)) diff --git a/deps/npm/node_modules/normalize-package-data/lib/normalize.js b/deps/npm/node_modules/normalize-package-data/lib/normalize.js index 7e6beefdae8..7e68c69a944 100644 --- a/deps/npm/node_modules/normalize-package-data/lib/normalize.js +++ b/deps/npm/node_modules/normalize-package-data/lib/normalize.js @@ -1,10 +1,12 @@ module.exports = normalize var fixer = require("./fixer") +normalize.fixer = fixer + var makeWarning = require("./make_warning") var fieldsToFix = ['name','version','description','repository','modules','scripts' - ,'files','bin','man','bugs','keywords','readme','homepage'] + ,'files','bin','man','bugs','keywords','readme','homepage','license'] var otherThingsToFix = ['dependencies','people', 'typos'] var thingsToFix = fieldsToFix.map(function(fieldName) { diff --git a/deps/npm/node_modules/normalize-package-data/lib/warning_messages.json b/deps/npm/node_modules/normalize-package-data/lib/warning_messages.json index 1877fe5de39..3bfce72cd4d 100644 --- a/deps/npm/node_modules/normalize-package-data/lib/warning_messages.json +++ b/deps/npm/node_modules/normalize-package-data/lib/warning_messages.json @@ -19,11 +19,13 @@ ,"nonStringDescription": "'description' field should be a string" ,"missingDescription": "No description" ,"missingReadme": "No README data" + ,"missingLicense": "No license field." ,"nonEmailUrlBugsString": "Bug string field must be url, email, or {email,url}" ,"nonUrlBugsUrlField": "bugs.url field must be a string url. Deleted." ,"nonEmailBugsEmailField": "bugs.email field must be a string email. Deleted." ,"emptyNormalizedBugs": "Normalized value of bugs field is an empty object. Deleted." ,"nonUrlHomepage": "homepage field must be a string url. Deleted." + ,"nonSPDXLicense": "license should be a valid SPDX license expression" ,"missingProtocolHomepage": "homepage field must start with a protocol." ,"typo": "%s should probably be %s." } diff --git a/deps/npm/node_modules/normalize-package-data/package.json b/deps/npm/node_modules/normalize-package-data/package.json index 6da54694c2f..44ca4d58675 100644 --- a/deps/npm/node_modules/normalize-package-data/package.json +++ b/deps/npm/node_modules/normalize-package-data/package.json @@ -1,28 +1,29 @@ { "name": "normalize-package-data", - "version": "1.0.3", + "version": "2.2.1", "author": { "name": "Meryn Stol", "email": "merynstol@gmail.com" }, "description": "Normalizes data that can be found in package.json files.", + "license": "BSD-2-Clause", "repository": { "type": "git", - "url": "git://github.com/meryn/normalize-package-data.git" + "url": "git://github.com/npm/normalize-package-data.git" }, "main": "lib/normalize.js", "scripts": { "test": "tap test/*.js" }, "dependencies": { - "github-url-from-git": "^1.3.0", - "github-url-from-username-repo": "^1.0.0", - "semver": "2 || 3 || 4" + "hosted-git-info": "^2.0.2", + "semver": "2 || 3 || 4", + "spdx": "^0.4.0" }, "devDependencies": { - "tap": "~0.2.5", - "underscore": "~1.4.4", - "async": "~0.9.0" + "async": "~0.9.0", + "tap": "^1.1.0", + "underscore": "~1.4.4" }, "contributors": [ { @@ -38,38 +39,14 @@ "email": "rok@kowalski.gd" } ], - "gitHead": "8c30091c83b1a41e113757148c4543ef61ff863d", + "readme": "# normalize-package-data [![Build Status](https://travis-ci.org/npm/normalize-package-data.png?branch=master)](https://travis-ci.org/npm/normalize-package-data)\n\nnormalize-package data exports a function that normalizes package metadata. This data is typically found in a package.json file, but in principle could come from any source - for example the npm registry.\n\nnormalize-package-data is used by [read-package-json](https://npmjs.org/package/read-package-json) to normalize the data it reads from a package.json file. In turn, read-package-json is used by [npm](https://npmjs.org/package/npm) and various npm-related tools.\n\n## Installation\n\n```\nnpm install normalize-package-data\n```\n\n## Usage\n\nBasic usage is really simple. You call the function that normalize-package-data exports. Let's call it `normalizeData`.\n\n```javascript\nnormalizeData = require('normalize-package-data')\npackageData = fs.readFileSync(\"package.json\")\nnormalizeData(packageData)\n// packageData is now normalized\n```\n\n#### Strict mode\n\nYou may activate strict validation by passing true as the second argument.\n\n```javascript\nnormalizeData = require('normalize-package-data')\npackageData = fs.readFileSync(\"package.json\")\nwarnFn = function(msg) { console.error(msg) }\nnormalizeData(packageData, true)\n// packageData is now normalized\n```\n\nIf strict mode is activated, only Semver 2.0 version strings are accepted. Otherwise, Semver 1.0 strings are accepted as well. Packages must have a name, and the name field must not have contain leading or trailing whitespace.\n\n#### Warnings\n\nOptionally, you may pass a \"warning\" function. It gets called whenever the `normalizeData` function encounters something that doesn't look right. It indicates less than perfect input data.\n\n```javascript\nnormalizeData = require('normalize-package-data')\npackageData = fs.readFileSync(\"package.json\")\nwarnFn = function(msg) { console.error(msg) }\nnormalizeData(packageData, warnFn)\n// packageData is now normalized. Any number of warnings may have been logged.\n```\n\nYou may combine strict validation with warnings by passing `true` as the second argument, and `warnFn` as third.\n\nWhen `private` field is set to `true`, warnings will be suppressed.\n\n### Potential exceptions\n\nIf the supplied data has an invalid name or version vield, `normalizeData` will throw an error. Depending on where you call `normalizeData`, you may want to catch these errors so can pass them to a callback.\n\n## What normalization (currently) entails\n\n* The value of `name` field gets trimmed (unless in strict mode).\n* The value of the `version` field gets cleaned by `semver.clean`. See [documentation for the semver module](https://github.com/isaacs/node-semver).\n* If `name` and/or `version` fields are missing, they are set to empty strings.\n* If `files` field is not an array, it will be removed.\n* If `bin` field is a string, then `bin` field will become an object with `name` set to the value of the `name` field, and `bin` set to the original string value.\n* If `man` field is a string, it will become an array with the original string as its sole member.\n* If `keywords` field is string, it is considered to be a list of keywords separated by one or more white-space characters. It gets converted to an array by splitting on `\\s+`.\n* All people fields (`author`, `maintainers`, `contributors`) get converted into objects with name, email and url properties.\n* If `bundledDependencies` field (a typo) exists and `bundleDependencies` field does not, `bundledDependencies` will get renamed to `bundleDependencies`.\n* If the value of any of the dependencies fields (`dependencies`, `devDependencies`, `optionalDependencies`) is a string, it gets converted into an object with familiar `name=>value` pairs.\n* The values in `optionalDependencies` get added to `dependencies`. The `optionalDependencies` array is left untouched.\n* As of v2: Dependencies that point at known hosted git providers (currently: github, bitbucket, gitlab) will have their URLs canonicalized, but protocols will be preserved.\n* As of v2: Dependencies that use shortcuts for hosted git providers (`org/proj`, `github:org/proj`, `bitbucket:org/proj`, `gitlab:org/proj`, `gist:docid`) will have the shortcut left in place. (In the case of github, the `org/proj` form will be expanded to `github:org/proj`.) THIS MARKS A BREAKING CHANGE FROM V1, where the shorcut was previously expanded to a URL.\n* If `description` field does not exist, but `readme` field does, then (more or less) the first paragraph of text that's found in the readme is taken as value for `description`.\n* If `repository` field is a string, it will become an object with `url` set to the original string value, and `type` set to `\"git\"`.\n* If `repository.url` is not a valid url, but in the style of \"[owner-name]/[repo-name]\", `repository.url` will be set to https://github.com/[owner-name]/[repo-name]\n* If `bugs` field is a string, the value of `bugs` field is changed into an object with `url` set to the original string value.\n* If `bugs` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `bugs` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]/issues . If the repository field points to a GitHub Gist repo url, the associated http url is chosen.\n* If `bugs` field is an object, the resulting value only has email and url properties. If email and url properties are not strings, they are ignored. If no valid values for either email or url is found, bugs field will be removed.\n* If `homepage` field is not a string, it will be removed.\n* If the url in the `homepage` field does not specify a protocol, then http is assumed. For example, `myproject.org` will be changed to `http://myproject.org`.\n* If `homepage` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `homepage` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]/ . If the repository field points to a GitHub Gist repo url, the associated http url is chosen.\n\n### Rules for name field\n\nIf `name` field is given, the value of the name field must be a string. The string may not:\n\n* start with a period.\n* contain the following characters: `/@\\s+%`\n* contain and characters that would need to be encoded for use in urls.\n* resemble the word `node_modules` or `favicon.ico` (case doesn't matter).\n\n### Rules for version field\n\nIf `version` field is given, the value of the version field must be a valid *semver* string, as determined by the `semver.valid` method. See [documentation for the semver module](https://github.com/isaacs/node-semver).\n\n### Rules for license field\n\nThe `license` field should be a valid *SDPDX license expression* string, as determined by the `spdx.valid` method. See [documentation for the spdx module](https://github.com/kemitchell/spdx.js).\n\n## Credits\n\nThis package contains code based on read-package-json written by Isaac Z. Schlueter. Used with permisson.\n\n## License\n\nnormalize-package-data is released under the [BSD 2-Clause License](http://opensource.org/licenses/MIT). \nCopyright (c) 2013 Meryn Stol \n", + "readmeFilename": "README.md", + "gitHead": "e319259b7ebac34c470ae0dc55610befa711dbb6", "bugs": { - "url": "https://github.com/meryn/normalize-package-data/issues" + "url": "https://github.com/npm/normalize-package-data/issues" }, - "homepage": "https://github.com/meryn/normalize-package-data", - "_id": "normalize-package-data@1.0.3", - "_shasum": "8be955b8907af975f1a4584ea8bb9b41492312f5", - "_from": "normalize-package-data@>=1.0.3 <1.1.0", - "_npmVersion": "2.1.0", - "_nodeVersion": "0.10.31", - "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" - }, - "maintainers": [ - { - "name": "meryn", - "email": "merynstol@gmail.com" - }, - { - "name": "isaacs", - "email": "i@izs.me" - }, - { - "name": "othiym23", - "email": "ogd@aoaioxxysz.net" - } - ], - "dist": { - "shasum": "8be955b8907af975f1a4584ea8bb9b41492312f5", - "tarball": "http://registry.npmjs.org/normalize-package-data/-/normalize-package-data-1.0.3.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-1.0.3.tgz" + "homepage": "https://github.com/npm/normalize-package-data#readme", + "_id": "normalize-package-data@2.2.1", + "_shasum": "0e00ebd73ac065eb19092fd313531dd291a0e045", + "_from": "normalize-package-data@latest" } diff --git a/deps/npm/node_modules/normalize-package-data/test/fixtures/badscripts.json b/deps/npm/node_modules/normalize-package-data/test/fixtures/badscripts.json new file mode 100644 index 00000000000..25feb4c8f4e --- /dev/null +++ b/deps/npm/node_modules/normalize-package-data/test/fixtures/badscripts.json @@ -0,0 +1,5 @@ +{ + "name": "bad-scripts-package", + "version": "0.0.1", + "scripts": "foo" +} diff --git a/deps/npm/node_modules/normalize-package-data/test/fixtures/read-package-json.json b/deps/npm/node_modules/normalize-package-data/test/fixtures/read-package-json.json index f4a2b96f47c..7d0dae1d57a 100644 --- a/deps/npm/node_modules/normalize-package-data/test/fixtures/read-package-json.json +++ b/deps/npm/node_modules/normalize-package-data/test/fixtures/read-package-json.json @@ -7,6 +7,7 @@ "type": "git", "url": "git://github.com/isaacs/read-package-json.git" }, + "license": "MIT", "main": "read-json.js", "scripts": { "test": "tap test/*.js" @@ -24,4 +25,4 @@ "npmlog": "0", "graceful-fs": "~1.1.8" } -} \ No newline at end of file +} diff --git a/deps/npm/node_modules/normalize-package-data/test/mixedcase-names.js b/deps/npm/node_modules/normalize-package-data/test/mixedcase-names.js new file mode 100644 index 00000000000..a62b69938db --- /dev/null +++ b/deps/npm/node_modules/normalize-package-data/test/mixedcase-names.js @@ -0,0 +1,32 @@ +var test = require('tap').test + +var normalize = require('../') +var fixer = normalize.fixer + +test('mixedcase', function (t) { + t.doesNotThrow(function () { + fixer.fixNameField({name: 'foo'}, true) + }) + + t.doesNotThrow(function () { + fixer.fixNameField({name: 'foo'}, false) + }) + + t.doesNotThrow(function () { + fixer.fixNameField({name: 'foo'}) + }) + + t.throws(function () { + fixer.fixNameField({name: 'Foo'}, true) + }, new Error('Invalid name: "Foo"'), 'should throw an error') + + t.throws(function () { + fixer.fixNameField({name: 'Foo'}, {strict: true}) + }, new Error('Invalid name: "Foo"'), 'should throw an error') + + t.doesNotThrow(function () { + fixer.fixNameField({name: 'Foo'}, {strict: true, allowLegacyCase: true}) + }) + + t.end() +}) diff --git a/deps/npm/node_modules/normalize-package-data/test/normalize.js b/deps/npm/node_modules/normalize-package-data/test/normalize.js index b35eed7659c..3dce3c05771 100644 --- a/deps/npm/node_modules/normalize-package-data/test/normalize.js +++ b/deps/npm/node_modules/normalize-package-data/test/normalize.js @@ -9,6 +9,7 @@ var warningMessages = require("../lib/warning_messages.json") var safeFormat = require("../lib/safe_format") var rpjPath = path.resolve(__dirname,"./fixtures/read-package-json.json") + tap.test("normalize some package data", function(t) { var packageData = require(rpjPath) var warnings = [] @@ -52,7 +53,8 @@ tap.test("empty object", function(t) { t.same(warnings, [ warningMessages.missingDescription, warningMessages.missingRepository, - warningMessages.missingReadme + warningMessages.missingReadme, + warningMessages.missingLicense ]) t.end() }) @@ -75,7 +77,8 @@ tap.test("core module name", function(t) { safeFormat(warningMessages.conflictingName, 'http'), warningMessages.nonEmailUrlBugsString, warningMessages.emptyNormalizedBugs, - warningMessages.nonUrlHomepage + warningMessages.nonUrlHomepage, + warningMessages.missingLicense ] t.same(warnings, expect) t.end() @@ -109,9 +112,11 @@ tap.test("urls required", function(t) { warningMessages.nonEmailBugsEmailField, warningMessages.emptyNormalizedBugs, warningMessages.missingReadme, + warningMessages.missingLicense, warningMessages.nonEmailUrlBugsString, warningMessages.emptyNormalizedBugs, - warningMessages.nonUrlHomepage ] + warningMessages.nonUrlHomepage, + warningMessages.missingLicense] t.same(warnings, expect) t.end() }) @@ -132,18 +137,40 @@ tap.test("homepage field must start with a protocol.", function(t) { [ warningMessages.missingDescription, warningMessages.missingRepository, warningMessages.missingReadme, - warningMessages.missingProtocolHomepage ] + warningMessages.missingProtocolHomepage, + warningMessages.missingLicense] t.same(warnings, expect) t.same(a.homepage, 'http://example.org') t.end() }) +tap.test("license field should be a valid SPDX expression", function(t) { + var warnings = [] + function warn(w) { + warnings.push(w) + } + var a + normalize(a={ + license: 'Apache 2' + }, warn) + + console.error(a) + + var expect = + [ warningMessages.missingDescription, + warningMessages.missingRepository, + warningMessages.missingReadme, + warningMessages.nonSPDXLicense] + t.same(warnings, expect) + t.end() +}) + tap.test("gist bugs url", function(t) { var d = { repository: "git@gist.github.com:123456.git" } normalize(d) - t.same(d.repository, { type: 'git', url: 'git@gist.github.com:123456.git' }) + t.same(d.repository, { type: 'git', url: 'git+ssh://git@gist.github.com/123456.git' }) t.same(d.bugs, { url: 'https://gist.github.com/123456' }) t.end(); }); @@ -151,21 +178,21 @@ tap.test("gist bugs url", function(t) { tap.test("singularize repositories", function(t) { var d = {repositories:["git@gist.github.com:123456.git"]} normalize(d) - t.same(d.repository, { type: 'git', url: 'git@gist.github.com:123456.git' }) + t.same(d.repository, { type: 'git', url: 'git+ssh://git@gist.github.com/123456.git' }) t.end() }); tap.test("treat visionmedia/express as github repo", function(t) { var d = {repository: {type: "git", url: "visionmedia/express"}} normalize(d) - t.same(d.repository, { type: "git", url: "https://github.com/visionmedia/express" }) + t.same(d.repository, { type: "git", url: "git+https://github.com/visionmedia/express.git" }) t.end() }); tap.test("treat isaacs/node-graceful-fs as github repo", function(t) { var d = {repository: {type: "git", url: "isaacs/node-graceful-fs"}} normalize(d) - t.same(d.repository, { type: "git", url: "https://github.com/isaacs/node-graceful-fs" }) + t.same(d.repository, { type: "git", url: "git+https://github.com/isaacs/node-graceful-fs.git" }) t.end() }); @@ -174,7 +201,7 @@ tap.test("homepage field will set to github url if repository is a github repo", normalize(a={ repository: { type: "git", url: "https://github.com/isaacs/node-graceful-fs" } }) - t.same(a.homepage, 'https://github.com/isaacs/node-graceful-fs') + t.same(a.homepage, 'https://github.com/isaacs/node-graceful-fs#readme') t.end() }) @@ -192,14 +219,14 @@ tap.test("homepage field will set to github gist url if repository is a shorthan normalize(a={ repository: { type: "git", url: "sindresorhus/chalk" } }) - t.same(a.homepage, 'https://github.com/sindresorhus/chalk') + t.same(a.homepage, 'https://github.com/sindresorhus/chalk#readme') t.end() }) -tap.test("treat isaacs/node-graceful-fs as github repo in dependencies", function(t) { +tap.test("don't mangle github shortcuts in dependencies", function(t) { var d = {dependencies: {"node-graceful-fs": "isaacs/node-graceful-fs"}} normalize(d) - t.same(d.dependencies, {"node-graceful-fs": "git+https://github.com/isaacs/node-graceful-fs" }) + t.same(d.dependencies, {"node-graceful-fs": "github:isaacs/node-graceful-fs" }) t.end() }); diff --git a/deps/npm/node_modules/normalize-package-data/test/scripts.js b/deps/npm/node_modules/normalize-package-data/test/scripts.js new file mode 100644 index 00000000000..473596eef2c --- /dev/null +++ b/deps/npm/node_modules/normalize-package-data/test/scripts.js @@ -0,0 +1,24 @@ +var tap = require("tap") +var normalize = require("../lib/normalize") +var path = require("path") +var fs = require("fs") + +tap.test("bad scripts", function (t) { + var p = path.resolve(__dirname, "./fixtures/badscripts.json") + fs.readFile (p, function (err, contents) { + if (err) throw err + var originalData = JSON.parse(contents.toString()) + var data = JSON.parse(contents.toString()) + normalize(data) + t.ok(data) + verifyFields(t, data, originalData) + t.end() + }) +}) + +function verifyFields (t, normalized, original) { + t.equal(normalized.version, original.version, "Version field stays same") + t.equal(normalized.name, original.name, "Name stays the same.") + // scripts is not an object, so it should be deleted + t.notOk(normalized.scripts) +} diff --git a/deps/npm/node_modules/normalize-package-data/test/typo.js b/deps/npm/node_modules/normalize-package-data/test/typo.js index eda75545e92..0cd3eb49d00 100644 --- a/deps/npm/node_modules/normalize-package-data/test/typo.js +++ b/deps/npm/node_modules/normalize-package-data/test/typo.js @@ -15,6 +15,7 @@ test('typos', function(t) { var expect = [ warningMessages.missingRepository, + warningMessages.missingLicense, typoMessage('dependancies', 'dependencies'), typoMessage('dependecies', 'dependencies'), typoMessage('depdenencies', 'dependencies'), @@ -66,7 +67,8 @@ test('typos', function(t) { typoMessage("bugs['name']", "bugs['url']"), warningMessages.nonUrlBugsUrlField, warningMessages.emptyNormalizedBugs, - warningMessages.missingReadme ] + warningMessages.missingReadme, + warningMessages.missingLicense] normalize({name:"name" ,version:"1.2.5" @@ -79,6 +81,7 @@ test('typos', function(t) { [ warningMessages.missingDescription, warningMessages.missingRepository, warningMessages.missingReadme, + warningMessages.missingLicense, typoMessage('script', 'scripts') ] normalize({name:"name" @@ -93,7 +96,8 @@ test('typos', function(t) { warningMessages.missingRepository, typoMessage("scripts['server']", "scripts['start']"), typoMessage("scripts['tests']", "scripts['test']"), - warningMessages.missingReadme ] + warningMessages.missingReadme, + warningMessages.missingLicense] normalize({name:"name" ,version:"1.2.5" @@ -101,6 +105,20 @@ test('typos', function(t) { t.same(warnings, expect) + warnings.length = 0 + expect = + [ warningMessages.missingDescription, + warningMessages.missingRepository, + warningMessages.missingReadme, + warningMessages.missingLicense] + + normalize({name:"name" + ,version:"1.2.5" + ,scripts:{server:"start",tests:"test" + ,start:"start",test:"test"}}, warn) + + t.same(warnings, expect) + warnings.length = 0 expect = [] diff --git a/deps/npm/node_modules/npm-install-checks/package.json b/deps/npm/node_modules/npm-install-checks/package.json index 06ca052e410..cc9f206d146 100644 --- a/deps/npm/node_modules/npm-install-checks/package.json +++ b/deps/npm/node_modules/npm-install-checks/package.json @@ -1,10 +1,10 @@ { "name": "npm-install-checks", - "version": "1.0.4", + "version": "1.0.5", "description": "checks that npm runs during the installation of a module", "main": "index.js", "dependencies": { - "npmlog": "0.1", + "npmlog": "0.1 || 1", "semver": "^2.3.0 || 3.x || 4" }, "devDependencies": { @@ -32,14 +32,15 @@ "bugs": { "url": "https://github.com/npm/npm-install-checks/issues" }, - "gitHead": "05944f95860b0ac3769667551c4b7aa3d3fcdc32", - "_id": "npm-install-checks@1.0.4", - "_shasum": "9757c6f9d4d493c2489465da6d07a8ed416d44c8", - "_from": "npm-install-checks@>=1.0.2-0 <1.1.0-0", - "_npmVersion": "2.0.0-beta.3", + "gitHead": "c36e052a0a54ad82932689fa86fd59197277f80d", + "_id": "npm-install-checks@1.0.5", + "_shasum": "a1b5beabfd60e0535b14f763157c410cb6bdae56", + "_from": "npm-install-checks@>=1.0.5 <1.1.0", + "_npmVersion": "2.1.11", + "_nodeVersion": "0.10.33", "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" + "name": "iarna", + "email": "me@re-becca.org" }, "maintainers": [ { @@ -49,12 +50,16 @@ { "name": "isaacs", "email": "i@izs.me" + }, + { + "name": "iarna", + "email": "me@re-becca.org" } ], "dist": { - "shasum": "9757c6f9d4d493c2489465da6d07a8ed416d44c8", - "tarball": "http://registry.npmjs.org/npm-install-checks/-/npm-install-checks-1.0.4.tgz" + "shasum": "a1b5beabfd60e0535b14f763157c410cb6bdae56", + "tarball": "http://registry.npmjs.org/npm-install-checks/-/npm-install-checks-1.0.5.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-1.0.4.tgz" + "_resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-1.0.5.tgz" } diff --git a/deps/npm/node_modules/npm-package-arg/README.md b/deps/npm/node_modules/npm-package-arg/README.md index 602277a378d..d37b35533a8 100644 --- a/deps/npm/node_modules/npm-package-arg/README.md +++ b/deps/npm/node_modules/npm-package-arg/README.md @@ -1,26 +1,54 @@ # npm-package-arg -Parse the things that can be arguments to `npm install` +Parse package name and specifier passed to commands like `npm install` or +`npm cache add`. This just parses the text given-- it's worth noting that +`npm` has further logic it applies by looking at your disk to figure out +what ambiguous specifiers are. If you want that logic, please see +[realize-package-specifier]. -Takes an argument like `foo@1.2`, or `foo@user/foo`, or -`http://x.com/foo.tgz`, or `git+https://github.com/user/foo`, and -figures out what type of thing it is. +[realize-package-specifier]: https://www.npmjs.org/package/realize-package-specifier -## USAGE +Arguments look like: `foo@1.2`, `@bar/foo@1.2`, `foo@user/foo`, `http://x.com/foo.tgz`, +`git+https://github.com/user/foo`, `bitbucket:user/foo`, `foo.tar.gz` or `bar` + +## EXAMPLES ```javascript var assert = require("assert") var npa = require("npm-package-arg") // Pass in the descriptor, and it'll return an object -var parsed = npa("foo@1.2") +var parsed = npa("@bar/foo@1.2") + +// Returns an object like: +{ + raw: '@bar/foo@1.2', // what was passed in + name: "@bar/foo", // the name of the package + scope: "@bar", // the private scope of the package, or null + type: "range", // the type of specifier this is + spec: ">=1.2.0 <1.3.0" // the expanded specifier + rawSpec: "1.2" // the specifier as passed in + } + +// Parsing urls pointing at hosted git services produces a variation: +var parsed = npa("git+https://github.com/user/foo") // Returns an object like: -// { -// name: "foo", // The bit in front of the @ -// type: "range", // the type of descriptor this is -// spec: "1.2" // the specifier for this descriptor -// } +{ + raw: 'git+https://github.com/user/foo', + scope: null, + name: null, + rawSpec: 'git+https://github.com/user/foo', + spec: 'user/foo', + type: 'hosted', + hosted: { + type: 'github', + ssh: 'git@github.com:user/foo.git', + sshurl: 'git+ssh://git@github.com/user/foo.git', + https: 'https://github.com/user/foo.git', + directUrl: 'https://raw.githubusercontent.com/user/foo/master/package.json' + } +} // Completely unreasonable invalid garbage throws an error // Make sure you wrap this in a try/catch if you have not @@ -30,23 +58,41 @@ assert.throws(function() { }) ``` -For more examples, see the test file. +## USING + +`var npa = require('npm-package-arg')` + +* var result = npa(*arg*) + +Parses *arg* and returns a result object detailing what *arg* is. + +*arg* -- a package descriptor, like: `foo@1.2`, or `foo@user/foo`, or +`http://x.com/foo.tgz`, or `git+https://github.com/user/foo` -## Result Objects +## RESULT OBJECT The objects that are returned by npm-package-arg contain the following -fields: +keys: * `name` - If known, the `name` field expected in the resulting pkg. * `type` - One of the following strings: * `git` - A git repo - * `github` - A github shorthand, like `user/project` + * `hosted` - A hosted project, from github, bitbucket or gitlab. Originally + either a full url pointing at one of these services or a shorthand like + `user/project` or `github:user/project` for github or `bitbucket:user/project` + for bitbucket. * `tag` - A tagged version, like `"foo@latest"` * `version` - A specific version number, like `"foo@1.2.3"` * `range` - A version range, like `"foo@2.x"` * `local` - A local file or folder path * `remote` - An http url (presumably to a tgz) * `spec` - The "thing". URL, the range, git repo, etc. +* `hosted` - If type=hosted this will be an object with the following keys: + * `type` - github, bitbucket or gitlab + * `ssh` - The ssh path for this git repo + * `sshUrl` - The ssh URL for this git repo + * `httpsUrl` - The HTTPS URL for this git repo + * `directUrl` - The URL for the package.json in this git repo * `raw` - The original un-modified string that was provided. * `rawSpec` - The part after the `name@...`, as it was originally provided. diff --git a/deps/npm/node_modules/npm-package-arg/npa.js b/deps/npm/node_modules/npm-package-arg/npa.js index 8333c75f442..2cba4cfb159 100644 --- a/deps/npm/node_modules/npm-package-arg/npa.js +++ b/deps/npm/node_modules/npm-package-arg/npa.js @@ -3,14 +3,15 @@ var assert = require("assert") var util = require("util") var semver = require("semver") var path = require("path") +var HostedGit = require("hosted-git-info") module.exports = npa var isWindows = process.platform === "win32" || global.FAKE_WINDOWS -var slashRe = isWindows ? /\\|\// : /\// +var slashRe = isWindows ? /\\|[/]/ : /[/]/ -var parseName = /^(?:@([^\/]+?)\/)?([^\/]+?)$/ -var nameAt = /^(@([^\/]+?)\/)?([^\/]+?)@/ +var parseName = /^(?:@([^/]+?)[/])?([^/]+?)$/ +var nameAt = /^(@([^/]+?)[/])?([^/]+?)@/ var debug = util.debuglog ? util.debuglog("npa") : /\bnpa\b/i.test(process.env.NODE_DEBUG || "") ? function () { @@ -25,7 +26,7 @@ function validName (name) { var n = name.trim() if (!n || n.charAt(0) === "." || !n.match(/^[a-zA-Z0-9]/) - || n.match(/[\/\(\)&\?#\|<>@:%\s\\\*'"!~`]/) + || n.match(/[/()&?#|<>@:%\s\\*'"!~`]/) || n.toLowerCase() === "node_modules" || n !== encodeURIComponent(n) || n.toLowerCase() === "favicon.ico") { @@ -70,20 +71,11 @@ function npa (arg) { urlparse = {} } - if (urlparse.protocol) { + if (urlparse.protocol || HostedGit.fromUrl(arg)) { return parseUrl(res, arg, urlparse) } - // parse git stuff - // parse tag/range/local/remote - - if (maybeGitHubShorthand(arg)) { - res.type = "github" - res.spec = arg - return res - } - - // at this point, it's not a url, and not github + // at this point, it's not a url, and not hosted // If it's a valid name, and doesn't already have a name, then assume // $name@"" range // @@ -132,19 +124,22 @@ function parseLocal (res, arg) { res.spec = path.resolve(arg) } -function maybeGitHubShorthand (arg) { - // Note: This does not fully test the git ref format. - // See https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html - // - // The only way to do this properly would be to shell out to - // git-check-ref-format, and as this is a fast sync function, - // we don't want to do that. Just let git fail if it turns - // out that the commit-ish is invalid. - // GH usernames cannot start with . or - - return /^[^@%\/\s\.-][^@%\/\s]*\/[^@\s\/%]+(?:#.*)?$/.test(arg) -} - function parseUrl (res, arg, urlparse) { + var gitHost = HostedGit.fromUrl(arg) + if (gitHost) { + res.type = "hosted" + res.spec = gitHost.toString(), + res.hosted = { + type: gitHost.type, + ssh: gitHost.ssh(), + sshUrl: gitHost.sshurl(), + httpsUrl: gitHost.https(), + gitUrl: gitHost.git(), + shortcut: gitHost.shortcut(), + directUrl: gitHost.file("package.json") + } + return res + } // check the protocol, and then see if it's git or not switch (urlparse.protocol) { case "git:": @@ -154,23 +149,23 @@ function parseUrl (res, arg, urlparse) { case "git+ftp:": case "git+ssh:": case "git+file:": - res.type = 'git' - res.spec = arg.replace(/^git\+/, '') + res.type = "git" + res.spec = arg.replace(/^git[+]/, "") break - case 'http:': - case 'https:': - res.type = 'remote' + case "http:": + case "https:": + res.type = "remote" res.spec = arg break - case 'file:': - res.type = 'local' + case "file:": + res.type = "local" res.spec = urlparse.pathname - break; + break default: - throw new Error('Unsupported URL Type: ' + arg) + throw new Error("Unsupported URL Type: " + arg) break } @@ -181,7 +176,8 @@ function parseUrl (res, arg, urlparse) { function Result () { if (!(this instanceof Result)) return new Result } -Result.prototype.name = null -Result.prototype.type = null -Result.prototype.spec = null -Result.prototype.raw = null +Result.prototype.name = null +Result.prototype.type = null +Result.prototype.spec = null +Result.prototype.raw = null +Result.prototype.hosted = null diff --git a/deps/npm/node_modules/npm-package-arg/package.json b/deps/npm/node_modules/npm-package-arg/package.json index babbd7312a0..0be06bb0526 100644 --- a/deps/npm/node_modules/npm-package-arg/package.json +++ b/deps/npm/node_modules/npm-package-arg/package.json @@ -1,12 +1,13 @@ { "name": "npm-package-arg", - "version": "2.1.3", + "version": "4.0.1", "description": "Parse the things that can be arguments to `npm install`", "main": "npa.js", "directories": { "test": "test" }, "dependencies": { + "hosted-git-info": "^2.1.4", "semver": "4" }, "devDependencies": { @@ -17,7 +18,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/npm-package-arg" + "url": "git+https://github.com/npm/npm-package-arg.git" }, "author": { "name": "Isaac Z. Schlueter", @@ -29,10 +30,10 @@ "url": "https://github.com/npm/npm-package-arg/issues" }, "homepage": "https://github.com/npm/npm-package-arg", - "readme": "# npm-package-arg\n\nParse the things that can be arguments to `npm install`\n\nTakes an argument like `foo@1.2`, or `foo@user/foo`, or\n`http://x.com/foo.tgz`, or `git+https://github.com/user/foo`, and\nfigures out what type of thing it is.\n\n## USAGE\n\n```javascript\nvar assert = require(\"assert\")\nvar npa = require(\"npm-package-arg\")\n\n// Pass in the descriptor, and it'll return an object\nvar parsed = npa(\"foo@1.2\")\n\n// Returns an object like:\n// {\n// name: \"foo\", // The bit in front of the @\n// type: \"range\", // the type of descriptor this is\n// spec: \"1.2\" // the specifier for this descriptor\n// }\n\n// Completely unreasonable invalid garbage throws an error\n// Make sure you wrap this in a try/catch if you have not\n// already sanitized the inputs!\nassert.throws(function() {\n npa(\"this is not \\0 a valid package name or url\")\n})\n```\n\nFor more examples, see the test file.\n\n## Result Objects\n\nThe objects that are returned by npm-package-arg contain the following\nfields:\n\n* `name` - If known, the `name` field expected in the resulting pkg.\n* `type` - One of the following strings:\n * `git` - A git repo\n * `github` - A github shorthand, like `user/project`\n * `tag` - A tagged version, like `\"foo@latest\"`\n * `version` - A specific version number, like `\"foo@1.2.3\"`\n * `range` - A version range, like `\"foo@2.x\"`\n * `local` - A local file or folder path\n * `remote` - An http url (presumably to a tgz)\n* `spec` - The \"thing\". URL, the range, git repo, etc.\n* `raw` - The original un-modified string that was provided.\n* `rawSpec` - The part after the `name@...`, as it was originally\n provided.\n* `scope` - If a name is something like `@org/module` then the `scope`\n field will be set to `org`. If it doesn't have a scoped name, then\n scope is `null`.\n", + "readme": "# npm-package-arg\n\nParse package name and specifier passed to commands like `npm install` or\n`npm cache add`. This just parses the text given-- it's worth noting that\n`npm` has further logic it applies by looking at your disk to figure out\nwhat ambiguous specifiers are. If you want that logic, please see\n[realize-package-specifier].\n\n[realize-package-specifier]: https://www.npmjs.org/package/realize-package-specifier\n\nArguments look like: `foo@1.2`, `@bar/foo@1.2`, `foo@user/foo`, `http://x.com/foo.tgz`,\n`git+https://github.com/user/foo`, `bitbucket:user/foo`, `foo.tar.gz` or `bar`\n\n## EXAMPLES\n\n```javascript\nvar assert = require(\"assert\")\nvar npa = require(\"npm-package-arg\")\n\n// Pass in the descriptor, and it'll return an object\nvar parsed = npa(\"@bar/foo@1.2\")\n\n// Returns an object like:\n{\n raw: '@bar/foo@1.2', // what was passed in\n name: \"@bar/foo\", // the name of the package\n scope: \"@bar\", // the private scope of the package, or null\n type: \"range\", // the type of specifier this is\n spec: \">=1.2.0 <1.3.0\" // the expanded specifier\n rawSpec: \"1.2\" // the specifier as passed in\n }\n\n// Parsing urls pointing at hosted git services produces a variation:\nvar parsed = npa(\"git+https://github.com/user/foo\")\n\n// Returns an object like:\n{\n raw: 'git+https://github.com/user/foo',\n scope: null,\n name: null,\n rawSpec: 'git+https://github.com/user/foo',\n spec: 'user/foo',\n type: 'hosted',\n hosted: {\n type: 'github',\n ssh: 'git@github.com:user/foo.git',\n sshurl: 'git+ssh://git@github.com/user/foo.git',\n https: 'https://github.com/user/foo.git',\n directUrl: 'https://raw.githubusercontent.com/user/foo/master/package.json'\n }\n}\n\n// Completely unreasonable invalid garbage throws an error\n// Make sure you wrap this in a try/catch if you have not\n// already sanitized the inputs!\nassert.throws(function() {\n npa(\"this is not \\0 a valid package name or url\")\n})\n```\n\n## USING\n\n`var npa = require('npm-package-arg')`\n\n* var result = npa(*arg*)\n\nParses *arg* and returns a result object detailing what *arg* is.\n\n*arg* -- a package descriptor, like: `foo@1.2`, or `foo@user/foo`, or\n`http://x.com/foo.tgz`, or `git+https://github.com/user/foo`\n\n## RESULT OBJECT\n\nThe objects that are returned by npm-package-arg contain the following\nkeys:\n\n* `name` - If known, the `name` field expected in the resulting pkg.\n* `type` - One of the following strings:\n * `git` - A git repo\n * `hosted` - A hosted project, from github, bitbucket or gitlab. Originally\n either a full url pointing at one of these services or a shorthand like\n `user/project` or `github:user/project` for github or `bitbucket:user/project`\n for bitbucket.\n * `tag` - A tagged version, like `\"foo@latest\"`\n * `version` - A specific version number, like `\"foo@1.2.3\"`\n * `range` - A version range, like `\"foo@2.x\"`\n * `local` - A local file or folder path\n * `remote` - An http url (presumably to a tgz)\n* `spec` - The \"thing\". URL, the range, git repo, etc.\n* `hosted` - If type=hosted this will be an object with the following keys:\n * `type` - github, bitbucket or gitlab\n * `ssh` - The ssh path for this git repo\n * `sshUrl` - The ssh URL for this git repo\n * `httpsUrl` - The HTTPS URL for this git repo\n * `directUrl` - The URL for the package.json in this git repo\n* `raw` - The original un-modified string that was provided.\n* `rawSpec` - The part after the `name@...`, as it was originally\n provided.\n* `scope` - If a name is something like `@org/module` then the `scope`\n field will be set to `org`. If it doesn't have a scoped name, then\n scope is `null`.\n", "readmeFilename": "README.md", - "gitHead": "9aaabc2aae746371a05f54cdb57a5f9ada003d8f", - "_id": "npm-package-arg@2.1.3", - "_shasum": "dfba34bd82dd327c10cb43a65c8db6ef0b812bf7", - "_from": "npm-package-arg@~2.1.3" + "gitHead": "794c9981033bb16bd4a88c7ba45c109107439172", + "_id": "npm-package-arg@4.0.1", + "_shasum": "bfbea17cd2b9fdc4fca2f02796794173dbf1877c", + "_from": "npm-package-arg@>=4.0.0 <4.1.0" } diff --git a/deps/npm/node_modules/npm-package-arg/test/basic.js b/deps/npm/node_modules/npm-package-arg/test/basic.js index 98206db205c..a3d58c88c50 100644 --- a/deps/npm/node_modules/npm-package-arg/test/basic.js +++ b/deps/npm/node_modules/npm-package-arg/test/basic.js @@ -63,11 +63,11 @@ require("tap").test("basic", function (t) { rawSpec: "=v1.2.3" }, - "git+ssh://git@github.com/user/foo#1.2.3": { + "git+ssh://git@notgithub.com/user/foo#1.2.3": { name: null, type: "git", - spec: "ssh://git@github.com/user/foo#1.2.3", - raw: "git+ssh://git@github.com/user/foo#1.2.3" + spec: "ssh://git@notgithub.com/user/foo#1.2.3", + raw: "git+ssh://git@notgithub.com/user/foo#1.2.3" }, "git+file://path/to/repo#1.2.3": { @@ -77,25 +77,25 @@ require("tap").test("basic", function (t) { raw: "git+file://path/to/repo#1.2.3" }, - "git://github.com/user/foo": { + "git://notgithub.com/user/foo": { name: null, type: "git", - spec: "git://github.com/user/foo", - raw: "git://github.com/user/foo" + spec: "git://notgithub.com/user/foo", + raw: "git://notgithub.com/user/foo" }, - "@foo/bar@git+ssh://github.com/user/foo": { + "@foo/bar@git+ssh://notgithub.com/user/foo": { name: "@foo/bar", scope: "@foo", - spec: "ssh://github.com/user/foo", - rawSpec: "git+ssh://github.com/user/foo", - raw: "@foo/bar@git+ssh://github.com/user/foo" + spec: "ssh://notgithub.com/user/foo", + rawSpec: "git+ssh://notgithub.com/user/foo", + raw: "@foo/bar@git+ssh://notgithub.com/user/foo" }, "/path/to/foo": { name: null, type: "local", - spec: "/path/to/foo", + spec: path.resolve(__dirname, "/path/to/foo"), raw: "/path/to/foo" }, @@ -134,41 +134,6 @@ require("tap").test("basic", function (t) { raw: "https://server.com/foo.tgz" }, - "user/foo-js": { - name: null, - type: "github", - spec: "user/foo-js", - raw: "user/foo-js" - }, - - "user/foo-js#bar/baz": { - name: null, - type: "github", - spec: "user/foo-js#bar/baz", - raw: "user/foo-js#bar/baz" - }, - - "user..blerg--/..foo-js# . . . . . some . tags / / /": { - name: null, - type: "github", - spec: "user..blerg--/..foo-js# . . . . . some . tags / / /", - raw: "user..blerg--/..foo-js# . . . . . some . tags / / /" - }, - - "user/foo-js#bar/baz/bin": { - name: null, - type: "github", - spec: "user/foo-js#bar/baz/bin", - raw: "user/foo-js#bar/baz/bin" - }, - - "foo@user/foo-js": { - name: "foo", - type: "github", - spec: "user/foo-js", - raw: "foo@user/foo-js" - }, - "foo@latest": { name: "foo", type: "tag", @@ -186,8 +151,8 @@ require("tap").test("basic", function (t) { Object.keys(tests).forEach(function (arg) { var res = npa(arg) - t.type(res, "Result") - t.has(res, tests[arg]) + t.type(res, "Result", arg + " is result") + t.has(res, tests[arg], arg + " matches expectations") }) // Completely unreasonable invalid garbage throws an error diff --git a/deps/npm/node_modules/npm-package-arg/test/bitbucket.js b/deps/npm/node_modules/npm-package-arg/test/bitbucket.js new file mode 100644 index 00000000000..1dff34ffa8a --- /dev/null +++ b/deps/npm/node_modules/npm-package-arg/test/bitbucket.js @@ -0,0 +1,82 @@ +var npa = require("../npa.js") +var path = require("path") + +require("tap").test("basic", function (t) { + t.setMaxListeners(999) + + var tests = { + "bitbucket:user/foo-js": { + name: null, + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "bitbucket:user/foo-js", + raw: "bitbucket:user/foo-js" + }, + + "bitbucket:user/foo-js#bar/baz": { + name: null, + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "bitbucket:user/foo-js#bar/baz", + raw: "bitbucket:user/foo-js#bar/baz" + }, + + "bitbucket:user..blerg--/..foo-js# . . . . . some . tags / / /": { + name: null, + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "bitbucket:user..blerg--/..foo-js# . . . . . some . tags / / /", + raw: "bitbucket:user..blerg--/..foo-js# . . . . . some . tags / / /" + }, + + "bitbucket:user/foo-js#bar/baz/bin": { + name: null, + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "bitbucket:user/foo-js#bar/baz/bin", + raw: "bitbucket:user/foo-js#bar/baz/bin" + }, + + "foo@bitbucket:user/foo-js": { + name: "foo", + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "bitbucket:user/foo-js", + raw: "foo@bitbucket:user/foo-js" + }, + + "git+ssh://git@bitbucket.org/user/foo#1.2.3": { + name: null, + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "git+ssh://git@bitbucket.org/user/foo.git#1.2.3", + raw: "git+ssh://git@bitbucket.org/user/foo#1.2.3" + }, + + "https://bitbucket.org/user/foo.git": { + name: null, + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "git+https://bitbucket.org/user/foo.git", + raw: "https://bitbucket.org/user/foo.git" + }, + + "@foo/bar@git+ssh://bitbucket.org/user/foo": { + name: "@foo/bar", + scope: "@foo", + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "git+ssh://git@bitbucket.org/user/foo.git", + rawSpec: "git+ssh://bitbucket.org/user/foo", + raw: "@foo/bar@git+ssh://bitbucket.org/user/foo" + } + } + + Object.keys(tests).forEach(function (arg) { + var res = npa(arg) + t.type(res, "Result", arg + " is a result") + t.has(res, tests[arg], arg + " matches expectations") + }) + + t.end() +}) diff --git a/deps/npm/node_modules/npm-package-arg/test/github.js b/deps/npm/node_modules/npm-package-arg/test/github.js new file mode 100644 index 00000000000..a2c146002b7 --- /dev/null +++ b/deps/npm/node_modules/npm-package-arg/test/github.js @@ -0,0 +1,106 @@ +var npa = require("../npa.js") +var path = require("path") + +require("tap").test("basic", function (t) { + t.setMaxListeners(999) + + var tests = { + "user/foo-js": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "github:user/foo-js", + raw: "user/foo-js" + }, + + "user/foo-js#bar/baz": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "github:user/foo-js#bar/baz", + raw: "user/foo-js#bar/baz" + }, + + "user..blerg--/..foo-js# . . . . . some . tags / / /": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "github:user..blerg--/..foo-js# . . . . . some . tags / / /", + raw: "user..blerg--/..foo-js# . . . . . some . tags / / /" + }, + + "user/foo-js#bar/baz/bin": { + name: null, + type: "hosted", + hosted: { type: "github" }, + raw: "github:user/foo-js#bar/baz/bin", + raw: "user/foo-js#bar/baz/bin" + }, + + "foo@user/foo-js": { + name: "foo", + type: "hosted", + hosted: { type: "github" }, + spec: "github:user/foo-js", + raw: "foo@user/foo-js" + }, + + "github:user/foo-js": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "github:user/foo-js", + raw: "github:user/foo-js" + }, + + "git+ssh://git@github.com/user/foo#1.2.3": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "git+ssh://git@github.com/user/foo.git#1.2.3", + raw: "git+ssh://git@github.com/user/foo#1.2.3" + }, + + "git://github.com/user/foo": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "git://github.com/user/foo.git", + raw: "git://github.com/user/foo" + }, + + "https://github.com/user/foo.git": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "git+https://github.com/user/foo.git", + raw: "https://github.com/user/foo.git" + }, + + "@foo/bar@git+ssh://github.com/user/foo": { + name: "@foo/bar", + scope: "@foo", + type: "hosted", + hosted: { type: "github" }, + spec: "git+ssh://git@github.com/user/foo.git", + rawSpec: "git+ssh://github.com/user/foo", + raw: "@foo/bar@git+ssh://github.com/user/foo" + }, + + "foo@bar/foo": { + name: "foo", + type: "hosted", + hosted: { type: "github" }, + spec: "github:bar/foo", + raw: "foo@bar/foo" + } + } + + Object.keys(tests).forEach(function (arg) { + var res = npa(arg) + t.type(res, "Result", arg + " is a result") + t.has(res, tests[arg], arg + " matches expectations") + }) + + t.end() +}) diff --git a/deps/npm/node_modules/npm-package-arg/test/gitlab.js b/deps/npm/node_modules/npm-package-arg/test/gitlab.js new file mode 100644 index 00000000000..c9a8ef9f25b --- /dev/null +++ b/deps/npm/node_modules/npm-package-arg/test/gitlab.js @@ -0,0 +1,82 @@ +var npa = require("../npa.js") +var path = require("path") + +require("tap").test("basic", function (t) { + t.setMaxListeners(999) + + var tests = { + "gitlab:user/foo-js": { + name: null, + type: "hosted", + hosted: { type: "gitlab" }, + raw: "gitlab:user/foo-js", + raw: "gitlab:user/foo-js" + }, + + "gitlab:user/foo-js#bar/baz": { + name: null, + type: "hosted", + hosted: { type: "gitlab" }, + raw: "gitlab:user/foo-js#bar/baz", + raw: "gitlab:user/foo-js#bar/baz" + }, + + "gitlab:user..blerg--/..foo-js# . . . . . some . tags / / /": { + name: null, + type: "hosted", + hosted: { type: "gitlab" }, + spec: "gitlab:user..blerg--/..foo-js# . . . . . some . tags / / /", + raw: "gitlab:user..blerg--/..foo-js# . . . . . some . tags / / /" + }, + + "gitlab:user/foo-js#bar/baz/bin": { + name: null, + type: "hosted", + hosted: { type: "gitlab" }, + spec: "gitlab:user/foo-js#bar/baz/bin", + raw: "gitlab:user/foo-js#bar/baz/bin" + }, + + "foo@gitlab:user/foo-js": { + name: "foo", + type: "hosted", + hosted: { type: "gitlab" }, + spec: "gitlab:user/foo-js", + raw: "foo@gitlab:user/foo-js" + }, + + "git+ssh://git@gitlab.com/user/foo#1.2.3": { + name: null, + type: "hosted", + hosted: { type: "gitlab" }, + spec: "git+ssh://git@gitlab.com/user/foo.git#1.2.3", + raw: "git+ssh://git@gitlab.com/user/foo#1.2.3" + }, + + "https://gitlab.com/user/foo.git": { + name: null, + type: "hosted", + hosted: { type: "gitlab" }, + spec: "git+https://gitlab.com/user/foo.git", + raw: "https://gitlab.com/user/foo.git" + }, + + "@foo/bar@git+ssh://gitlab.com/user/foo": { + name: "@foo/bar", + scope: "@foo", + type: "hosted", + hosted: { type: "gitlab" }, + spec: "git+ssh://git@gitlab.com/user/foo.git", + rawSpec: "git+ssh://gitlab.com/user/foo", + raw: "@foo/bar@git+ssh://gitlab.com/user/foo" + } + } + + Object.keys(tests).forEach(function (arg) { + var res = npa(arg) + t.type(res, "Result", arg + " is a result") + t.has(res, tests[arg], arg + " matches expectations") + }) + + t.end() +}) diff --git a/deps/npm/node_modules/npm-package-arg/test/windows.js b/deps/npm/node_modules/npm-package-arg/test/windows.js index 51629fe075e..e3c8ba6b591 100644 --- a/deps/npm/node_modules/npm-package-arg/test/windows.js +++ b/deps/npm/node_modules/npm-package-arg/test/windows.js @@ -6,28 +6,28 @@ var path = require("path") var cases = { "C:\\x\\y\\z": { - raw: 'C:\\x\\y\\z', + raw: "C:\\x\\y\\z", scope: null, name: null, - rawSpec: 'C:\\x\\y\\z', - spec: path.resolve('C:\\x\\y\\z'), - type: 'local' + rawSpec: "C:\\x\\y\\z", + spec: path.resolve("C:\\x\\y\\z"), + type: "local" }, "foo@C:\\x\\y\\z": { - raw: 'foo@C:\\x\\y\\z', + raw: "foo@C:\\x\\y\\z", scope: null, - name: 'foo', - rawSpec: 'C:\\x\\y\\z', - spec: path.resolve('C:\\x\\y\\z'), - type: 'local' + name: "foo", + rawSpec: "C:\\x\\y\\z", + spec: path.resolve("C:\\x\\y\\z"), + type: "local" }, "foo@/foo/bar/baz": { - raw: 'foo@/foo/bar/baz', + raw: "foo@/foo/bar/baz", scope: null, - name: 'foo', - rawSpec: '/foo/bar/baz', - spec: path.resolve('/foo/bar/baz'), - type: 'local' + name: "foo", + rawSpec: "/foo/bar/baz", + spec: path.resolve("/foo/bar/baz"), + type: "local" } } diff --git a/deps/npm/node_modules/npm-registry-client/.travis.yml b/deps/npm/node_modules/npm-registry-client/.travis.yml new file mode 100644 index 00000000000..686d9aecaf6 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/.travis.yml @@ -0,0 +1,10 @@ +language: node_js +node_js: + - "0.12" + - "0.10" + - iojs +before_install: + - "npm install -g npm@^2" +script: "npm test" +notifications: + slack: npm-inc:kRqQjto7YbINqHPb1X6nS3g8 diff --git a/deps/npm/node_modules/npm-registry-client/README.md b/deps/npm/node_modules/npm-registry-client/README.md index 6d15dadf7f5..fb3226cf401 100644 --- a/deps/npm/node_modules/npm-registry-client/README.md +++ b/deps/npm/node_modules/npm-registry-client/README.md @@ -9,10 +9,10 @@ It handles all the caching and HTTP calls. ```javascript var RegClient = require('npm-registry-client') var client = new RegClient(config) -var uri = "npm://registry.npmjs.org/npm" -var options = {timeout: 1000} +var uri = "https://registry.npmjs.org/npm" +var params = {timeout: 1000} -client.get(uri, options, function (error, data, raw, res) { +client.get(uri, params, function (error, data, raw, res) { // error is an error if there was a problem. // data is the parsed data object // raw is the json string @@ -23,124 +23,173 @@ client.get(uri, options, function (error, data, raw, res) { # Registry URLs The registry calls take either a full URL pointing to a resource in the -registry, or a base URL for the registry as a whole (for the base URL, any path -will be ignored). In addition to `http` and `https`, `npm` URLs are allowed. -`npm` URLs are `https` URLs with the additional restrictions that they will -always include authorization credentials, and the response is always registry -metadata (and not tarballs or other attachments). +registry, or a base URL for the registry as a whole (including the registry +path – but be sure to terminate the path with `/`). `http` and `https` URLs are +the only ones supported. -# Configuration +## Using the client -This program is designed to work with -[npmconf](https://npmjs.org/package/npmconf), but you can also pass in -a plain-jane object with the appropriate configs, and it'll shim it -for you. Any configuration thingie that has get/set/del methods will -also be accepted. - -* `cache` **Required** {String} Path to the cache folder -* `always-auth` {Boolean} Auth even for GET requests. -* `auth` {String} A base64-encoded `username:password` -* `email` {String} User's email address -* `tag` {String} The default tag to use when publishing new packages. - Default = `"latest"` -* `ca` {String} Cerficate signing authority certificates to trust. -* `cert` {String} Client certificate (PEM encoded). Enable access - to servers that require client certificates -* `key` {String} Private key (PEM encoded) for client certificate 'cert' -* `strict-ssl` {Boolean} Whether or not to be strict with SSL - certificates. Default = `true` -* `user-agent` {String} User agent header to send. Default = - `"node/{process.version} {process.platform} {process.arch}"` -* `log` {Object} The logger to use. Defaults to `require("npmlog")` if - that works, otherwise logs are disabled. -* `fetch-retries` {Number} Number of times to retry on GET failures. - Default=2 -* `fetch-retry-factor` {Number} `factor` setting for `node-retry`. Default=10 -* `fetch-retry-mintimeout` {Number} `minTimeout` setting for `node-retry`. - Default=10000 (10 seconds) -* `fetch-retry-maxtimeout` {Number} `maxTimeout` setting for `node-retry`. - Default=60000 (60 seconds) -* `proxy` {URL} The url to proxy requests through. -* `https-proxy` {URL} The url to proxy https requests through. - Defaults to be the same as `proxy` if unset. -* `_auth` {String} The base64-encoded authorization header. -* `username` `_password` {String} Username/password to use to generate - `_auth` if not supplied. -* `_token` {Object} A token for use with - [couch-login](https://npmjs.org/package/couch-login) - -# client.request(method, uri, options, cb) - -* `method` {String} HTTP method -* `uri` {String} URI pointing to the resource to request -* `options` {Object} Object containing optional per-request properties. - * `what` {Stream | Buffer | String | Object} The request body. Objects - that are not Buffers or Streams are encoded as JSON. - * `etag` {String} The cached ETag - * `follow` {Boolean} Follow 302/301 responses (defaults to true) -* `cb` {Function} - * `error` {Error | null} - * `data` {Object} the parsed data object - * `raw` {String} the json - * `res` {Response Object} response from couch +Every call to the client follows the same pattern: + +* `uri` {String} The *fully-qualified* URI of the registry API method being + invoked. +* `params` {Object} Per-request parameters. +* `callback` {Function} Callback to be invoked when the call is complete. -Make a request to the registry. All the other methods are wrappers around -`request`. +### Credentials -# client.adduser(base, username, password, email, cb) +Many requests to the registry can by authenticated, and require credentials +for authorization. These credentials always look the same: -* `base` {String} Base registry URL * `username` {String} * `password` {String} * `email` {String} +* `alwaysAuth` {Boolean} Whether calls to the target registry are always + authed. + +**or** + +* `token` {String} +* `alwaysAuth` {Boolean} Whether calls to the target registry are always + authed. + +## API + +### client.access(uri, params, cb) + +* `uri` {String} Registry URL for the package's access API endpoint. + Looks like `/-/package//access`. +* `params` {Object} Object containing per-request properties. + * `access` {String} New access level for the package. Can be either + `public` or `restricted`. Registry will raise an error if trying + to change the access level of an unscoped package. + * `auth` {Credentials} + +Set the access level for scoped packages. For now, there are only two +access levels: "public" and "restricted". + +### client.adduser(uri, params, cb) + +* `uri` {String} Base registry URL. +* `params` {Object} Object containing per-request properties. + * `auth` {Credentials} * `cb` {Function} + * `error` {Error | null} + * `data` {Object} the parsed data object + * `raw` {String} the json + * `res` {Response Object} response from couch Add a user account to the registry, or verify the credentials. -# client.deprecate(uri, version, message, cb) +### client.deprecate(uri, params, cb) -* `uri` {String} Full registry URI for the deprecated package -* `version` {String} Semver version range -* `message` {String} The message to use as a deprecation warning +* `uri` {String} Full registry URI for the deprecated package. +* `params` {Object} Object containing per-request properties. + * `version` {String} Semver version range. + * `message` {String} The message to use as a deprecation warning. + * `auth` {Credentials} * `cb` {Function} Deprecate a version of a package in the registry. -# client.bugs(uri, cb) +### client.distTags.fetch(uri, params, cb) + +* `uri` {String} Base URL for the registry. +* `params` {Object} Object containing per-request properties. + * `package` {String} Name of the package. + * `auth` {Credentials} +* `cb` {Function} + +Fetch all of the `dist-tags` for the named package. + +### client.distTags.add(uri, params, cb) + +* `uri` {String} Base URL for the registry. +* `params` {Object} Object containing per-request properties. + * `package` {String} Name of the package. + * `distTag` {String} Name of the new `dist-tag`. + * `version` {String} Exact version to be mapped to the `dist-tag`. + * `auth` {Credentials} +* `cb` {Function} + +Add (or replace) a single dist-tag onto the named package. + +### client.distTags.set(uri, params, cb) -* `uri` {String} Full registry URI for the package +* `uri` {String} Base URL for the registry. +* `params` {Object} Object containing per-request properties. + * `package` {String} Name of the package. + * `distTags` {Object} Object containing a map from tag names to package + versions. + * `auth` {Credentials} * `cb` {Function} -Get the url for bugs of a package +Set all of the `dist-tags` for the named package at once, creating any +`dist-tags` that do not already exit. Any `dist-tags` not included in the +`distTags` map will be removed. -# client.get(uri, options, cb) +### client.distTags.update(uri, params, cb) + +* `uri` {String} Base URL for the registry. +* `params` {Object} Object containing per-request properties. + * `package` {String} Name of the package. + * `distTags` {Object} Object containing a map from tag names to package + versions. + * `auth` {Credentials} +* `cb` {Function} + +Update the values of multiple `dist-tags`, creating any `dist-tags` that do +not already exist. Any pre-existing `dist-tags` not included in the `distTags` +map will be left alone. + +### client.distTags.rm(uri, params, cb) + +* `uri` {String} Base URL for the registry. +* `params` {Object} Object containing per-request properties. + * `package` {String} Name of the package. + * `distTag` {String} Name of the new `dist-tag`. + * `auth` {Credentials} +* `cb` {Function} + +Remove a single `dist-tag` from the named package. + +### client.get(uri, params, cb) * `uri` {String} The complete registry URI to fetch -* `options` {Object} Object containing optional per-request properties. - * `timeout` {Number} Duration before the request times out. - * `follow` {Boolean} Follow 302/301 responses (defaults to true) - * `staleOk` {Boolean} If there's cached data available, then return that - to the callback quickly, and update the cache the background. +* `params` {Object} Object containing per-request properties. + * `timeout` {Number} Duration before the request times out. Optional + (default: never). + * `follow` {Boolean} Follow 302/301 responses. Optional (default: true). + * `staleOk` {Boolean} If there's cached data available, then return that to + the callback quickly, and update the cache the background. Optional + (default: false). + * `auth` {Credentials} Optional. +* `cb` {Function} Fetches data from the registry via a GET request, saving it in the cache folder -with the ETag. +with the ETag or the "Last Modified" timestamp. -# client.publish(uri, data, tarball, cb) +### client.publish(uri, params, cb) -* `uri` {String} The registry URI to publish to -* `data` {Object} Package data -* `tarball` {String | Stream} Filename or stream of the package tarball +* `uri` {String} The registry URI for the package to publish. +* `params` {Object} Object containing per-request properties. + * `metadata` {Object} Package metadata. + * `access` {String} Access for the package. Can be `public` or `restricted` (no default). + * `body` {Stream} Stream of the package body / tarball. + * `auth` {Credentials} * `cb` {Function} Publish a package to the registry. -Note that this does not create the tarball from a folder. However, it can -accept a gzipped tar stream or a filename to a tarball. +Note that this does not create the tarball from a folder. -# client.star(uri, starred, cb) +### client.star(uri, params, cb) -* `uri` {String} The complete registry URI to star -* `starred` {Boolean} True to star the package, false to unstar it. +* `uri` {String} The complete registry URI for the package to star. +* `params` {Object} Object containing per-request properties. + * `starred` {Boolean} True to star the package, false to unstar it. Optional + (default: false). + * `auth` {Credentials} * `cb` {Function} Star or unstar a package. @@ -148,40 +197,118 @@ Star or unstar a package. Note that the user does not have to be the package owner to star or unstar a package, though other writes do require that the user be the package owner. -# client.stars(base, username, cb) +### client.stars(uri, params, cb) -* `base` {String} The base URL for the registry -* `username` {String} Name of user to fetch starred packages for. +* `uri` {String} The base URL for the registry. +* `params` {Object} Object containing per-request properties. + * `username` {String} Name of user to fetch starred packages for. Optional + (default: user in `auth`). + * `auth` {Credentials} Optional (required if `username` is omitted). * `cb` {Function} View your own or another user's starred packages. -# client.tag(uri, version, tag, cb) +### client.tag(uri, params, cb) * `uri` {String} The complete registry URI to tag -* `version` {String} Version to tag -* `tag` {String} Tag name to apply +* `params` {Object} Object containing per-request properties. + * `version` {String} Version to tag. + * `tag` {String} Tag name to apply. + * `auth` {Credentials} * `cb` {Function} Mark a version in the `dist-tags` hash, so that `pkg@tag` will fetch the specified version. -# client.unpublish(uri, [ver], cb) +### client.unpublish(uri, params, cb) -* `uri` {String} The complete registry URI to unpublish -* `ver` {String} version to unpublish. Leave blank to unpublish all - versions. +* `uri` {String} The complete registry URI of the package to unpublish. +* `params` {Object} Object containing per-request properties. + * `version` {String} version to unpublish. Optional – omit to unpublish all + versions. + * `auth` {Credentials} * `cb` {Function} Remove a version of a package (or all versions) from the registry. When the last version us unpublished, the entire document is removed from the database. -# client.upload(uri, file, [etag], [nofollow], cb) +### client.whoami(uri, params, cb) + +* `uri` {String} The base registry for the URI. +* `params` {Object} Object containing per-request properties. + * `auth` {Credentials} +* `cb` {Function} + +Simple call to see who the registry thinks you are. Especially useful with +token-based auth. + + +## PLUMBING + +The below are primarily intended for use by the rest of the API, or by the npm +caching logic directly. + +### client.request(uri, params, cb) + +* `uri` {String} URI pointing to the resource to request. +* `params` {Object} Object containing per-request properties. + * `method` {String} HTTP method. Optional (default: "GET"). + * `body` {Stream | Buffer | String | Object} The request body. Objects + that are not Buffers or Streams are encoded as JSON. Optional – body + only used for write operations. + * `etag` {String} The cached ETag. Optional. + * `lastModified` {String} The cached Last-Modified timestamp. Optional. + * `follow` {Boolean} Follow 302/301 responses. Optional (default: true). + * `auth` {Credentials} Optional. +* `cb` {Function} + * `error` {Error | null} + * `data` {Object} the parsed data object + * `raw` {String} the json + * `res` {Response Object} response from couch + +Make a generic request to the registry. All the other methods are wrappers +around `client.request`. + +### client.fetch(uri, params, cb) * `uri` {String} The complete registry URI to upload to -* `file` {String | Stream} Either the filename or a readable stream -* `etag` {String} Cache ETag -* `nofollow` {Boolean} Do not follow 301/302 responses +* `params` {Object} Object containing per-request properties. + * `headers` {Stream} HTTP headers to be included with the request. Optional. + * `auth` {Credentials} Optional. * `cb` {Function} -Upload an attachment. Mostly used by `client.publish()`. +Fetch a package from a URL, with auth set appropriately if included. Used to +cache remote tarballs as well as request package tarballs from the registry. + +# Configuration + +The client uses its own configuration, which is just passed in as a simple +nested object. The following are the supported values (with their defaults, if +any): + +* `proxy.http` {URL} The URL to proxy HTTP requests through. +* `proxy.https` {URL} The URL to proxy HTTPS requests through. Defaults to be + the same as `proxy.http` if unset. +* `proxy.localAddress` {IP} The local address to use on multi-homed systems. +* `ssl.ca` {String} Certificate signing authority certificates to trust. +* `ssl.certificate` {String} Client certificate (PEM encoded). Enable access + to servers that require client certificates. +* `ssl.key` {String} Private key (PEM encoded) for client certificate. +* `ssl.strict` {Boolean} Whether or not to be strict with SSL certificates. + Default = `true` +* `retry.count` {Number} Number of times to retry on GET failures. Default = 2. +* `retry.factor` {Number} `factor` setting for `node-retry`. Default = 10. +* `retry.minTimeout` {Number} `minTimeout` setting for `node-retry`. + Default = 10000 (10 seconds) +* `retry.maxTimeout` {Number} `maxTimeout` setting for `node-retry`. + Default = 60000 (60 seconds) +* `userAgent` {String} User agent header to send. Default = + `"node/{process.version}"` +* `log` {Object} The logger to use. Defaults to `require("npmlog")` if + that works, otherwise logs are disabled. +* `defaultTag` {String} The default tag to use when publishing new packages. + Default = `"latest"` +* `couchToken` {Object} A token for use with + [couch-login](https://npmjs.org/package/couch-login). +* `sessionToken` {string} A random identifier for this set of client requests. + Default = 8 random hexadecimal bytes. diff --git a/deps/npm/node_modules/npm-registry-client/index.js b/deps/npm/node_modules/npm-registry-client/index.js index a75e8bbdbeb..9b99a23738f 100644 --- a/deps/npm/node_modules/npm-registry-client/index.js +++ b/deps/npm/node_modules/npm-registry-client/index.js @@ -2,56 +2,77 @@ module.exports = RegClient -var url = require('url') -, npmlog -, cacheFile = require('npm-cache-filename') +var join = require('path').join +var fs = require('graceful-fs') +var npmlog try { - npmlog = require("npmlog") + npmlog = require('npmlog') } catch (er) { - npmlog = { error: noop, warn: noop, info: noop, - verbose: noop, silly: noop, http: noop, - pause: noop, resume: noop } + npmlog = { + error: noop, + warn: noop, + info: noop, + verbose: noop, + silly: noop, + http: noop, + pause: noop, + resume: noop + } } function noop () {} -function RegClient (conf) { - // accept either a plain-jane object, or a npmconf object - // with a "get" method. - if (typeof conf.get !== 'function') { - var data = conf - conf = { get: function (k) { return data[k] } - , set: function (k, v) { data[k] = v } - , del: function (k) { delete data[k] } } - } +function RegClient (config) { + this.config = Object.create(config || {}) - this.conf = conf - - // if provided, then the registry needs to be a url. - // if it's not provided, then we're just using the cache only. - var registry = conf.get('registry') - if (registry) { - registry = url.parse(registry) - if (!registry.protocol) throw new Error( - 'Invalid registry: ' + registry.url) - registry = registry.href - if (registry.slice(-1) !== '/') { - registry += '/' - } - this.conf.set('registry', registry) - } else { - registry = null + this.config.proxy = this.config.proxy || {} + if (!this.config.proxy.https && this.config.proxy.http) { + this.config.proxy.https = this.config.proxy.http } - this.registry = registry + this.config.ssl = this.config.ssl || {} + if (this.config.ssl.strict === undefined) this.config.ssl.strict = true + + this.config.retry = this.config.retry || {} + if (typeof this.config.retry.retries !== 'number') this.config.retry.retries = 2 + if (typeof this.config.retry.factor !== 'number') this.config.retry.factor = 10 + if (typeof this.config.retry.minTimeout !== 'number') this.config.retry.minTimeout = 10000 + if (typeof this.config.retry.maxTimeout !== 'number') this.config.retry.maxTimeout = 60000 + + this.config.userAgent = this.config.userAgent || 'node/' + process.version + this.config.defaultTag = this.config.defaultTag || 'latest' + + this.log = this.config.log || npmlog + delete this.config.log - if (!conf.get('cache')) throw new Error("Cache dir is required") - this.cacheFile = cacheFile(this.conf.get('cache')) - this.log = conf.log || conf.get('log') || npmlog + var client = this + fs.readdirSync(join(__dirname, 'lib')).forEach(function (f) { + var entry = join(__dirname, 'lib', f) + + // lib/group-name/operation.js -> client.groupName.operation + var stat = fs.statSync(entry) + if (stat.isDirectory()) { + var groupName = f.replace(/-([a-z])/, dashToCamel) + fs.readdirSync(entry).forEach(function (f) { + if (!f.match(/\.js$/)) return + + if (!client[groupName]) { + // keep client.groupName.operation from stomping client.operation + client[groupName] = Object.create(client) + } + var name = f.replace(/\.js$/, '').replace(/-([a-z])/, dashToCamel) + client[groupName][name] = require(join(entry, f)) + }) + return + } + + if (!f.match(/\.js$/)) return + var name = f.replace(/\.js$/, '').replace(/-([a-z])/, dashToCamel) + client[name] = require(entry) + }) } -require('fs').readdirSync(__dirname + "/lib").forEach(function (f) { - if (!f.match(/\.js$/)) return - RegClient.prototype[f.replace(/\.js$/, '')] = require('./lib/' + f) -}) +function dashToCamel (_, l) { + return l.toUpperCase() +} diff --git a/deps/npm/node_modules/npm-registry-client/lib/access.js b/deps/npm/node_modules/npm-registry-client/lib/access.js new file mode 100644 index 00000000000..b671f6b5f21 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/lib/access.js @@ -0,0 +1,30 @@ +module.exports = access + +var assert = require('assert') + +function access (uri, params, cb) { + assert(typeof uri === 'string', 'must pass registry URI to access') + assert(params && typeof params === 'object', 'must pass params to access') + assert(typeof cb === 'function', 'muss pass callback to access') + + assert(typeof params.level === 'string', 'must pass level to access') + assert( + ['public', 'restricted'].indexOf(params.level) !== -1, + "access level must be either 'public' or 'restricted'" + ) + assert( + params.auth && typeof params.auth === 'object', + 'must pass auth to access' + ) + + var body = { + access: params.level + } + + var options = { + method: 'POST', + body: JSON.stringify(body), + auth: params.auth + } + this.request(uri, options, cb) +} diff --git a/deps/npm/node_modules/npm-registry-client/lib/adduser.js b/deps/npm/node_modules/npm-registry-client/lib/adduser.js index e449c258089..a6a779d8ca9 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/adduser.js +++ b/deps/npm/node_modules/npm-registry-client/lib/adduser.js @@ -1,46 +1,51 @@ module.exports = adduser -var url = require("url") - -function adduser (base, username, password, email, cb) { - if (!base) return cb(new Error("Required base URI not supplied")) - - username = ("" + (username || "")).trim() - if (!username) return cb(new Error("No username supplied.")) - - password = ("" + (password || "")).trim() - if (!password) return cb(new Error("No password supplied.")) - - email = ("" + (email || "")).trim() - if (!email) return cb(new Error("No email address supplied.")) +var url = require('url') +var assert = require('assert') + +function adduser (uri, params, cb) { + assert(typeof uri === 'string', 'must pass registry URI to adduser') + assert( + params && typeof params === 'object', + 'must pass params to adduser' + ) + assert(typeof cb === 'function', 'must pass callback to adduser') + + assert(params.auth && typeof params.auth, 'must pass auth to adduser') + var auth = params.auth + assert(typeof auth.username === 'string', 'must include username in auth') + assert(typeof auth.password === 'string', 'must include password in auth') + assert(typeof auth.email === 'string', 'must include email in auth') + + // normalize registry URL + if (uri.slice(-1) !== '/') uri += '/' + + var username = auth.username.trim() + var password = auth.password.trim() + var email = auth.email.trim() + + // validation + if (!username) return cb(new Error('No username supplied.')) + if (!password) return cb(new Error('No password supplied.')) + if (!email) return cb(new Error('No email address supplied.')) if (!email.match(/^[^@]+@[^\.]+\.[^\.]+/)) { - return cb(new Error("Please use a real email address.")) + return cb(new Error('Please use a real email address.')) } - var userobj = - { name : username - , password : password - , email : email - , _id : 'org.couchdb.user:'+username - , type : "user" - , roles : [] - , date: new Date().toISOString() - } - - // pluck off any other username/password/token. it needs to be the - // same as the user we're becoming now. replace them on error. - var c = this.conf.getCredentialsByURI(base) - var pre = { username: c.username - , password: c.password - , email: c.email - , token: this.conf.get('_token') } - - this.conf.del('_token') - if (this.couchLogin) { - this.couchLogin.token = null + var userobj = { + _id: 'org.couchdb.user:' + username, + name: username, + password: password, + email: email, + type: 'user', + roles: [], + date: new Date().toISOString() } - cb = done.call(this, cb, pre) + var token = this.config.couchToken + if (this.couchLogin) this.couchLogin.token = null + + cb = done.call(this, token, cb) var logObj = Object.keys(userobj).map(function (k) { if (k === 'password') return [k, 'XXXXX'] @@ -50,87 +55,74 @@ function adduser (base, username, password, email, cb) { return s }, {}) - this.log.verbose("adduser", "before first PUT", logObj) - - var uri = url.resolve(base, '/-/user/org.couchdb.user:' + encodeURIComponent(username)) - this.request('PUT' - , uri - , { body : userobj } - , function (error, data, json, response) { - // if it worked, then we just created a new user, and all is well. - // but if we're updating a current record, then it'll 409 first - var c = this.conf.getCredentialsByURI(base) - if (error && !c.auth) { - // must be trying to re-auth on a new machine. - // use this info as auth - this.conf.setCredentialsByURI(base, { - username : username, - password : password, - email : email - }) - } + this.log.verbose('adduser', 'before first PUT', logObj) + + var client = this - if (!error || !response || response.statusCode !== 409) { - return cb(error, data, json, response) + uri = url.resolve(uri, '-/user/org.couchdb.user:' + encodeURIComponent(username)) + var options = { + method: 'PUT', + body: userobj, + auth: auth + } + this.request( + uri, + options, + function (error, data, json, response) { + if (!error || !response || response.statusCode !== 409) { + return cb(error, data, json, response) + } + + client.log.verbose('adduser', 'update existing user') + return client.request( + uri + '?write=true', + { auth: auth }, + function (er, data, json, response) { + if (er || data.error) { + return cb(er, data, json, response) + } + Object.keys(data).forEach(function (k) { + if (!userobj[k] || k === 'roles') { + userobj[k] = data[k] + } + }) + client.log.verbose('adduser', 'userobj', logObj) + client.request(uri + '/-rev/' + userobj._rev, options, cb) } + ) + } + ) - this.log.verbose("adduser", "update existing user") - return this.request('GET' - , uri + '?write=true' - , null - , function (er, data, json, response) { - if (er || data.error) { - return cb(er, data, json, response) - } - Object.keys(data).forEach(function (k) { - if (!userobj[k] || k === 'roles') { - userobj[k] = data[k] - } - }) - this.log.verbose("adduser", "userobj", logObj) - this.request('PUT' - , uri + "/-rev/" + userobj._rev - , { body : userobj } - , cb) - }.bind(this)) - }.bind(this)) - - function done (cb, pre) { + function done (token, cb) { return function (error, data, json, response) { if (!error && (!response || response.statusCode === 201)) { return cb(error, data, json, response) } - // there was some kind of error, re-instate previous auth/token/etc. - this.conf.set('_token', pre.token) - if (this.couchLogin) { - this.couchLogin.token = pre.token - if (this.couchLogin.tokenSet) { - this.couchLogin.tokenSet(pre.token) + // there was some kind of error, reinstate previous auth/token/etc. + if (client.couchLogin) { + client.couchLogin.token = token + if (client.couchLogin.tokenSet) { + client.couchLogin.tokenSet(token) } } - this.conf.setCredentialsByURI(base, { - username : pre.username, - password : pre.password, - email : pre.email - }) - this.log.verbose("adduser", "back", [error, data, json]) + client.log.verbose('adduser', 'back', [error, data, json]) if (!error) { error = new Error( - (response && response.statusCode || "") + " " + - "Could not create user\n" + JSON.stringify(data) + (response && response.statusCode || '') + ' ' + + 'Could not create user\n' + JSON.stringify(data) ) } if (response && (response.statusCode === 401 || response.statusCode === 403)) { - this.log.warn("adduser", "Incorrect username or password\n" + - "You can reset your account by visiting:\n" + - "\n" + - " https://npmjs.org/forgot\n") + client.log.warn('adduser', 'Incorrect username or password\n' + + 'You can reset your account by visiting:\n' + + '\n' + + ' https://npmjs.org/forgot\n') } return cb(error) - }.bind(this) + } } } diff --git a/deps/npm/node_modules/npm-registry-client/lib/attempt.js b/deps/npm/node_modules/npm-registry-client/lib/attempt.js index 0794fdc3bff..d41bbc4fae8 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/attempt.js +++ b/deps/npm/node_modules/npm-registry-client/lib/attempt.js @@ -1,21 +1,19 @@ -var retry = require("retry") +var retry = require('retry') module.exports = attempt -function attempt(cb) { +function attempt (cb) { // Tuned to spread 3 attempts over about a minute. // See formula at . - var operation = retry.operation({ - retries : this.conf.get("fetch-retries") || 2, - factor : this.conf.get("fetch-retry-factor"), - minTimeout : this.conf.get("fetch-retry-mintimeout") || 10000, - maxTimeout : this.conf.get("fetch-retry-maxtimeout") || 60000 - }) + var operation = retry.operation(this.config.retry) var client = this operation.attempt(function (currentAttempt) { - client.log.info("attempt", "registry request try #"+currentAttempt+ - " at "+(new Date()).toLocaleTimeString()) + client.log.info( + 'attempt', + 'registry request try #' + currentAttempt + + ' at ' + (new Date()).toLocaleTimeString() + ) cb(operation) }) diff --git a/deps/npm/node_modules/npm-registry-client/lib/authify.js b/deps/npm/node_modules/npm-registry-client/lib/authify.js index 2b0c7a2a33a..0a259757b30 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/authify.js +++ b/deps/npm/node_modules/npm-registry-client/lib/authify.js @@ -1,26 +1,21 @@ -var url = require("url") - module.exports = authify -function authify (authed, parsed, headers) { - var c = this.conf.getCredentialsByURI(url.format(parsed)) - - if (c && c.token) { - this.log.verbose("request", "using bearer token for auth") - headers.authorization = "Bearer " + c.token +function authify (authed, parsed, headers, credentials) { + if (credentials && credentials.token) { + this.log.verbose('request', 'using bearer token for auth') + headers.authorization = 'Bearer ' + credentials.token return null } if (authed) { - if (c && c.username && c.password) { - var username = encodeURIComponent(c.username) - var password = encodeURIComponent(c.password) - parsed.auth = username + ":" + password - } - else { + if (credentials && credentials.username && credentials.password) { + var username = encodeURIComponent(credentials.username) + var password = encodeURIComponent(credentials.password) + parsed.auth = username + ':' + password + } else { return new Error( - "This request requires auth credentials. Run `npm login` and repeat the request." + 'This request requires auth credentials. Run `npm login` and repeat the request.' ) } } diff --git a/deps/npm/node_modules/npm-registry-client/lib/bugs.js b/deps/npm/node_modules/npm-registry-client/lib/bugs.js deleted file mode 100644 index fd0365eed60..00000000000 --- a/deps/npm/node_modules/npm-registry-client/lib/bugs.js +++ /dev/null @@ -1,9 +0,0 @@ - -module.exports = bugs - -function bugs (uri, cb) { - this.get(uri + "/latest", 3600, function (er, d) { - if (er) return cb(er) - cb(null, d.bugs) - }) -} diff --git a/deps/npm/node_modules/npm-registry-client/lib/deprecate.js b/deps/npm/node_modules/npm-registry-client/lib/deprecate.js index f5fd597047b..04d311cc0c8 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/deprecate.js +++ b/deps/npm/node_modules/npm-registry-client/lib/deprecate.js @@ -1,27 +1,43 @@ module.exports = deprecate -var url = require("url") -var semver = require("semver") +var assert = require('assert') +var url = require('url') +var semver = require('semver') -function deprecate (uri, ver, message, cb) { - var c = this.conf.getCredentialsByURI(uri) - if (!(c.token || c.auth)) { - return cb(new Error("Must be logged in to deprecate a package")) - } +function deprecate (uri, params, cb) { + assert(typeof uri === 'string', 'must pass registry URI to deprecate') + assert(params && typeof params === 'object', 'must pass params to deprecate') + assert(typeof cb === 'function', 'must pass callback to deprecate') + + assert(typeof params.version === 'string', 'must pass version to deprecate') + assert(typeof params.message === 'string', 'must pass message to deprecate') + assert( + params.auth && typeof params.auth === 'object', + 'must pass auth to deprecate' + ) + + var version = params.version + var message = params.message + var auth = params.auth - if (semver.validRange(ver) === null) { - return cb(new Error("invalid version range: "+ver)) + if (semver.validRange(version) === null) { + return cb(new Error('invalid version range: ' + version)) } - this.get(uri + '?write=true', null, function (er, data) { + this.get(uri + '?write=true', { auth: auth }, function (er, data) { if (er) return cb(er) // filter all the versions that match Object.keys(data.versions).filter(function (v) { - return semver.satisfies(v, ver) + return semver.satisfies(v, version) }).forEach(function (v) { data.versions[v].deprecated = message }) // now update the doc on the registry - this.request('PUT', url.resolve(uri, data._id), { body : data }, cb) + var options = { + method: 'PUT', + body: data, + auth: auth + } + this.request(url.resolve(uri, data._id), options, cb) }.bind(this)) } diff --git a/deps/npm/node_modules/npm-registry-client/lib/dist-tags/add.js b/deps/npm/node_modules/npm-registry-client/lib/dist-tags/add.js new file mode 100644 index 00000000000..924199ad1e0 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/lib/dist-tags/add.js @@ -0,0 +1,43 @@ +module.exports = add + +var assert = require('assert') +var url = require('url') + +var npa = require('npm-package-arg') + +function add (uri, params, cb) { + assert(typeof uri === 'string', 'must pass registry URI to distTags.add') + assert( + params && typeof params === 'object', + 'must pass params to distTags.add' + ) + assert(typeof cb === 'function', 'muss pass callback to distTags.add') + + assert( + typeof params.package === 'string', + 'must pass package name to distTags.add' + ) + assert( + typeof params.distTag === 'string', + 'must pass package distTag name to distTags.add' + ) + assert( + typeof params.version === 'string', + 'must pass version to be mapped to distTag to distTags.add' + ) + assert( + params.auth && typeof params.auth === 'object', + 'must pass auth to distTags.add' + ) + + var p = npa(params.package) + var pkg = p.scope ? params.package.replace('/', '%2f') : params.package + var rest = '-/package/' + pkg + '/dist-tags/' + params.distTag + + var options = { + method: 'PUT', + body: JSON.stringify(params.version), + auth: params.auth + } + this.request(url.resolve(uri, rest), options, cb) +} diff --git a/deps/npm/node_modules/npm-registry-client/lib/dist-tags/fetch.js b/deps/npm/node_modules/npm-registry-client/lib/dist-tags/fetch.js new file mode 100644 index 00000000000..558e2cf8296 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/lib/dist-tags/fetch.js @@ -0,0 +1,37 @@ +module.exports = fetch + +var assert = require('assert') +var url = require('url') + +var npa = require('npm-package-arg') + +function fetch (uri, params, cb) { + assert(typeof uri === 'string', 'must pass registry URI to distTags.fetch') + assert( + params && typeof params === 'object', + 'must pass params to distTags.fetch' + ) + assert(typeof cb === 'function', 'muss pass callback to distTags.fetch') + + assert( + typeof params.package === 'string', + 'must pass package name to distTags.fetch' + ) + assert( + params.auth && typeof params.auth === 'object', + 'must pass auth to distTags.fetch' + ) + + var p = npa(params.package) + var pkg = p.scope ? params.package.replace('/', '%2f') : params.package + var rest = '-/package/' + pkg + '/dist-tags' + + var options = { + method: 'GET', + auth: params.auth + } + this.request(url.resolve(uri, rest), options, function (er, data) { + if (data && typeof data === 'object') delete data._etag + cb(er, data) + }) +} diff --git a/deps/npm/node_modules/npm-registry-client/lib/dist-tags/rm.js b/deps/npm/node_modules/npm-registry-client/lib/dist-tags/rm.js new file mode 100644 index 00000000000..d2bdda05dac --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/lib/dist-tags/rm.js @@ -0,0 +1,38 @@ +module.exports = rm + +var assert = require('assert') +var url = require('url') + +var npa = require('npm-package-arg') + +function rm (uri, params, cb) { + assert(typeof uri === 'string', 'must pass registry URI to distTags.rm') + assert( + params && typeof params === 'object', + 'must pass params to distTags.rm' + ) + assert(typeof cb === 'function', 'muss pass callback to distTags.rm') + + assert( + typeof params.package === 'string', + 'must pass package name to distTags.rm' + ) + assert( + typeof params.distTag === 'string', + 'must pass package distTag name to distTags.rm' + ) + assert( + params.auth && typeof params.auth === 'object', + 'must pass auth to distTags.rm' + ) + + var p = npa(params.package) + var pkg = p.scope ? params.package.replace('/', '%2f') : params.package + var rest = '-/package/' + pkg + '/dist-tags/' + params.distTag + + var options = { + method: 'DELETE', + auth: params.auth + } + this.request(url.resolve(uri, rest), options, cb) +} diff --git a/deps/npm/node_modules/npm-registry-client/lib/dist-tags/set.js b/deps/npm/node_modules/npm-registry-client/lib/dist-tags/set.js new file mode 100644 index 00000000000..7af351d6359 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/lib/dist-tags/set.js @@ -0,0 +1,39 @@ +module.exports = set + +var assert = require('assert') +var url = require('url') + +var npa = require('npm-package-arg') + +function set (uri, params, cb) { + assert(typeof uri === 'string', 'must pass registry URI to distTags.set') + assert( + params && typeof params === 'object', + 'must pass params to distTags.set' + ) + assert(typeof cb === 'function', 'muss pass callback to distTags.set') + + assert( + typeof params.package === 'string', + 'must pass package name to distTags.set' + ) + assert( + params.distTags && typeof params.distTags === 'object', + 'must pass distTags map to distTags.set' + ) + assert( + params.auth && typeof params.auth === 'object', + 'must pass auth to distTags.set' + ) + + var p = npa(params.package) + var pkg = p.scope ? params.package.replace('/', '%2f') : params.package + var rest = '-/package/' + pkg + '/dist-tags' + + var options = { + method: 'PUT', + body: JSON.stringify(params.distTags), + auth: params.auth + } + this.request(url.resolve(uri, rest), options, cb) +} diff --git a/deps/npm/node_modules/npm-registry-client/lib/dist-tags/update.js b/deps/npm/node_modules/npm-registry-client/lib/dist-tags/update.js new file mode 100644 index 00000000000..07ec3e5e75f --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/lib/dist-tags/update.js @@ -0,0 +1,39 @@ +module.exports = update + +var assert = require('assert') +var url = require('url') + +var npa = require('npm-package-arg') + +function update (uri, params, cb) { + assert(typeof uri === 'string', 'must pass registry URI to distTags.update') + assert( + params && typeof params === 'object', + 'must pass params to distTags.update' + ) + assert(typeof cb === 'function', 'muss pass callback to distTags.update') + + assert( + typeof params.package === 'string', + 'must pass package name to distTags.update' + ) + assert( + params.distTags && typeof params.distTags === 'object', + 'must pass distTags map to distTags.update' + ) + assert( + params.auth && typeof params.auth === 'object', + 'must pass auth to distTags.update' + ) + + var p = npa(params.package) + var pkg = p.scope ? params.package.replace('/', '%2f') : params.package + var rest = '-/package/' + pkg + '/dist-tags' + + var options = { + method: 'POST', + body: JSON.stringify(params.distTags), + auth: params.auth + } + this.request(url.resolve(uri, rest), options, cb) +} diff --git a/deps/npm/node_modules/npm-registry-client/lib/fetch.js b/deps/npm/node_modules/npm-registry-client/lib/fetch.js index 75c52de3ae9..e931d371ee7 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/fetch.js +++ b/deps/npm/node_modules/npm-registry-client/lib/fetch.js @@ -1,32 +1,33 @@ -var assert = require("assert") - , url = require("url") +var assert = require('assert') +var url = require('url') -var request = require("request") - , once = require("once") +var request = require('request') +var once = require('once') module.exports = fetch -function fetch (uri, headers, cb) { - assert(uri, "must pass resource to fetch") - assert(cb, "must pass callback") - - if (!headers) headers = {} +function fetch (uri, params, cb) { + assert(typeof uri === 'string', 'must pass uri to request') + assert(params && typeof params === 'object', 'must pass params to request') + assert(typeof cb === 'function', 'must pass callback to request') cb = once(cb) var client = this this.attempt(function (operation) { - makeRequest.call(client, uri, headers, function (er, req) { + makeRequest.call(client, uri, params, function (er, req) { if (er) return cb(er) - req.on("error", function (er) { + req.on('error', function (er) { if (operation.retry(er)) { - client.log.info("retry", "will retry, error on last attempt: " + er) + client.log.info('retry', 'will retry, error on last attempt: ' + er) + } else { + cb(er) } }) - req.on("response", function (res) { - client.log.http("fetch", "" + res.statusCode, uri) + req.on('response', function (res) { + client.log.http('fetch', '' + res.statusCode, uri) var er var statusCode = res && res.statusCode @@ -34,52 +35,53 @@ function fetch (uri, headers, cb) { // Work around bug in node v0.10.0 where the CryptoStream // gets stuck and never starts reading again. res.resume() - if (process.version === "v0.10.0") unstick(res) + if (process.version === 'v0.10.0') unstick(res) return cb(null, res) - } - // Only retry on 408, 5xx or no `response`. - else if (statusCode === 408) { - er = new Error("request timed out") - } - else if (statusCode >= 500) { - er = new Error("server error " + statusCode) + // Only retry on 408, 5xx or no `response`. + } else if (statusCode === 408) { + er = new Error('request timed out') + } else if (statusCode >= 500) { + er = new Error('server error ' + statusCode) } if (er && operation.retry(er)) { - client.log.info("retry", "will retry, error on last attempt: " + er) - } - else { - cb(new Error("fetch failed with status code " + statusCode)) + client.log.info('retry', 'will retry, error on last attempt: ' + er) + } else { + cb(new Error('fetch failed with status code ' + statusCode)) } }) }) }) } -function unstick(response) { - response.resume = function (orig) { return function() { - var ret = orig.apply(response, arguments) - if (response.socket.encrypted) response.socket.encrypted.read(0) - return ret - }}(response.resume) +function unstick (response) { + response.resume = (function (orig) { + return function () { + var ret = orig.apply(response, arguments) + if (response.socket.encrypted) response.socket.encrypted.read(0) + return ret + } + })(response.resume) } -function makeRequest (remote, headers, cb) { +function makeRequest (remote, params, cb) { var parsed = url.parse(remote) - this.log.http("fetch", "GET", parsed.href) + this.log.http('fetch', 'GET', parsed.href) + var headers = params.headers || {} var er = this.authify( - this.conf.getCredentialsByURI(remote).alwaysAuth, + params.auth && params.auth.alwaysAuth, parsed, - headers + headers, + params.auth ) if (er) return cb(er) var opts = this.initialize( parsed, - "GET", - "application/x-tar", + 'GET', + 'application/x-tar, application/vnd.github+json; q=0.1', headers ) // always want to follow redirects for fetch diff --git a/deps/npm/node_modules/npm-registry-client/lib/get.js b/deps/npm/node_modules/npm-registry-client/lib/get.js index d7b58092b7f..ab0eae10f01 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/get.js +++ b/deps/npm/node_modules/npm-registry-client/lib/get.js @@ -1,203 +1,22 @@ - module.exports = get -var fs = require("graceful-fs") - , assert = require("assert") - , path = require("path") - , mkdir = require("mkdirp") - , chownr = require("chownr") - , url = require("url") +var assert = require('assert') +var url = require('url') -/** - * options: - * - * timeout: request timeouts - * follow: follow redirects - * staleOk: stale results are OK - * stat: results of checking for cached metadata - * data: the cached metadata +/* + * This is meant to be overridden in specific implementations if you + * want specialized behavior for metadata (i.e. caching). */ -function get (uri, options, cb) { - assert(uri, "must have URL to fetch") - assert(cb, "must have callback") - if (!options) options = {} +function get (uri, params, cb) { + assert(typeof uri === 'string', 'must pass registry URI to get') + assert(params && typeof params === 'object', 'must pass params to get') + assert(typeof cb === 'function', 'must pass callback to get') var parsed = url.parse(uri) - assert(parsed.protocol, "must have a URL that starts with npm:, http:, or https:") - - var cache = this.cacheFile(uri) + "/.cache.json" - - // /-/all is special. - // It uses timestamp-based caching and partial updates, - // because it is a monster. - if (parsed.pathname === "/-/all") { - return requestAll.call(this, uri, cache, cb) - } - - // If the GET is part of a write operation (PUT or DELETE), then - // skip past the cache entirely, but still save the results. - if (uri.match(/\?write=true$/)) { - return get_.call(this, uri, cache, options, cb) - } - - fs.stat(cache, function (er, stat) { - if (!er) fs.readFile(cache, function (er, data) { - try { data = JSON.parse(data) } - catch (ex) { data = null } - options.stat = stat - options.data = data - get_.call(this, uri, cache, options, cb) - }.bind(this)) - else { - get_.call(this, uri, cache, options, cb) - } - }.bind(this)) -} - -function requestAll (uri, cache, cb) { - this.log.info("get", cache) - mkdir(path.dirname(cache), function (er) { - if (er) return cb(er) - fs.readFile(cache, function (er, data) { - if (er) return requestAll_.call(this, uri, 0, {}, cache, cb) - try { - data = JSON.parse(data) - } catch (ex) { - fs.writeFile(cache, "{}", function (er) { - if (er) return cb(new Error("Broken cache.")) - return requestAll_.call(this, uri, 0, {}, cache, cb) - }.bind(this)) - } - var t = +data._updated || 0 - requestAll_.call(this, uri, t, data, cache, cb) - }.bind(this)) - }.bind(this)) -} - -function requestAll_ (uri, c, data, cache, cb) { - // use the cache and update in the background if it's not too old - if (Date.now() - c < 60000) { - cb(null, data) - cb = function () {} - } - - if (c === 0) { - this.log.warn("", "Building the local index for the first time, please be patient") - uri = url.resolve(uri, "/-/all") - } - else { - uri = url.resolve(uri, "/-/all/since?stale=update_after&startkey=" + c) - } - - this.request('GET', uri, null, function (er, updates, _, res) { - if (er) return cb(er, data) - var headers = res.headers - , updated = updates._updated || Date.parse(headers.date) - Object.keys(updates).forEach(function (p) { - data[p] = updates[p] - }) - data._updated = updated - fs.writeFile( cache, JSON.stringify(data) - , function (er) { - delete data._updated - return cb(er, data) - }) - }) -} - -function get_ (uri, cache, options, cb) { - var staleOk = options.staleOk === undefined ? false : options.staleOk - , follow = options.follow - , data = options.data - , stat = options.stat - , etag - - var timeout = options.timeout === undefined ? -1 : options.timeout - timeout = Math.min(timeout, this.conf.get('cache-max') || 0) - timeout = Math.max(timeout, this.conf.get('cache-min') || -Infinity) - if (process.env.COMP_CWORD !== undefined && - process.env.COMP_LINE !== undefined && - process.env.COMP_POINT !== undefined) { - timeout = Math.max(timeout, 60000) - } - - if (data && data._etag) etag = data._etag - - if (timeout && timeout > 0 && options.stat && options.data) { - if ((Date.now() - stat.mtime.getTime())/1000 < timeout) { - this.log.verbose("registry.get", uri, "not expired, no request") - delete data._etag - return cb(null, data, JSON.stringify(data), {statusCode:304}) - } - if (staleOk) { - this.log.verbose("registry.get", uri, "staleOk, background update") - delete data._etag - process.nextTick(cb.bind( null, null, data, JSON.stringify(data) - , {statusCode: 304} )) - cb = function () {} - } - } - - this.request('GET', uri, { etag : etag, follow : follow }, function (er, remoteData, raw, response) { - // if we get an error talking to the registry, but we have it - // from the cache, then just pretend we got it. - if (er && cache && data && !data.error) { - er = null - response = {statusCode: 304} - } - - if (response) { - this.log.silly("registry.get", "cb", [response.statusCode, response.headers]) - if (response.statusCode === 304 && etag) { - remoteData = data - this.log.verbose("etag", uri+" from cache") - } - } - - data = remoteData - if (!data) { - er = er || new Error("failed to fetch from registry: " + uri) - } - - if (er) return cb(er, data, raw, response) - - // just give the write the old college try. if it fails, whatever. - function saved () { - delete data._etag - cb(er, data, raw, response) - } - - saveToCache.call(this, cache, data, saved) - }.bind(this)) -} - -function saveToCache (cache, data, saved) { - if (this._cacheStat) { - var cs = this._cacheStat - return saveToCache_.call(this, cache, data, cs.uid, cs.gid, saved) - } - fs.stat(this.conf.get('cache'), function (er, st) { - if (er) { - return fs.stat(process.env.HOME || "", function (er, st) { - // if this fails, oh well. - if (er) return saved() - this._cacheStat = st - return saveToCache.call(this, cache, data, saved) - }.bind(this)) - } - this._cacheStat = st || { uid: null, gid: null } - return saveToCache.call(this, cache, data, saved) - }.bind(this)) -} + assert( + parsed.protocol === 'http:' || parsed.protocol === 'https:', + 'must have a URL that starts with http: or https:' + ) -function saveToCache_ (cache, data, uid, gid, saved) { - mkdir(path.dirname(cache), function (er, made) { - if (er) return saved() - fs.writeFile(cache, JSON.stringify(data), function (er) { - if (er || uid === null || gid === null) { - return saved() - } - chownr(made || cache, uid, gid, saved) - }) - }) + this.request(uri, params, cb) } diff --git a/deps/npm/node_modules/npm-registry-client/lib/initialize.js b/deps/npm/node_modules/npm-registry-client/lib/initialize.js index b6e89ffe957..4a2160fbbda 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/initialize.js +++ b/deps/npm/node_modules/npm-registry-client/lib/initialize.js @@ -1,31 +1,47 @@ -var crypto = require("crypto") +var crypto = require('crypto') +var HttpAgent = require('http').Agent +var HttpsAgent = require('https').Agent -var pkg = require("../package.json") +var pkg = require('../package.json') + +var httpAgent +var httpsAgent module.exports = initialize function initialize (uri, method, accept, headers) { - if (!this.sessionToken) { - this.sessionToken = crypto.randomBytes(8).toString("hex") - this.log.verbose("request id", this.sessionToken) + if (!this.config.sessionToken) { + this.config.sessionToken = crypto.randomBytes(8).toString('hex') + this.log.verbose('request id', this.config.sessionToken) } - var strict = this.conf.get("strict-ssl") - if (strict === undefined) strict = true - - var p = this.conf.get("proxy") - var sp = this.conf.get("https-proxy") || p - var opts = { - url : uri, - method : method, - headers : headers, - proxy : uri.protocol === "https:" ? sp : p, - localAddress : this.conf.get("local-address"), - strictSSL : strict, - cert : this.conf.get("cert"), - key : this.conf.get("key"), - ca : this.conf.get("ca") + url: uri, + method: method, + headers: headers, + localAddress: this.config.proxy.localAddress, + strictSSL: this.config.ssl.strict, + cert: this.config.ssl.certificate, + key: this.config.ssl.key, + ca: this.config.ssl.ca, + agent: getAgent(uri.protocol, this.config) + } + + // allow explicit disabling of proxy in environment via CLI + // + // how false gets here is the CLI's problem (it's gross) + if (this.config.proxy.http === false) { + opts.proxy = null + } else { + // request will not pay attention to the NOPROXY environment variable if a + // config value named proxy is passed in, even if it's set to null. + var proxy + if (uri.protocol === 'https:') { + proxy = this.config.proxy.https + } else { + proxy = this.config.proxy.http + } + if (typeof proxy === 'string') opts.proxy = proxy } headers.version = this.version || pkg.version @@ -33,9 +49,34 @@ function initialize (uri, method, accept, headers) { if (this.refer) headers.referer = this.refer - headers["npm-session"] = this.sessionToken - headers["user-agent"] = this.conf.get("user-agent") || - "node/" + process.version + headers['npm-session'] = this.config.sessionToken + headers['user-agent'] = this.config.userAgent return opts } + +function getAgent (protocol, config) { + if (protocol === 'https:') { + if (!httpsAgent) { + httpsAgent = new HttpsAgent({ + keepAlive: true, + localAddress: config.proxy.localAddress, + rejectUnauthorized: config.ssl.strict, + ca: config.ssl.ca, + cert: config.ssl.certificate, + key: config.ssl.key + }) + } + + return httpsAgent + } else { + if (!httpAgent) { + httpAgent = new HttpAgent({ + keepAlive: true, + localAddress: config.proxy.localAddress + }) + } + + return httpAgent + } +} diff --git a/deps/npm/node_modules/npm-registry-client/lib/logout.js b/deps/npm/node_modules/npm-registry-client/lib/logout.js new file mode 100644 index 00000000000..e66e9b78ac5 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/lib/logout.js @@ -0,0 +1,23 @@ +module.exports = logout + +var assert = require('assert') +var url = require('url') + +function logout (uri, params, cb) { + assert(typeof uri === 'string', 'must pass registry URI to logout') + assert(params && typeof params === 'object', 'must pass params to logout') + assert(typeof cb === 'function', 'must pass callback to star') + + var auth = params.auth + assert(auth && typeof auth === 'object', 'must pass auth to logout') + assert(typeof auth.token === 'string', 'can only log out for token auth') + + uri = url.resolve(uri, '-/user/token/' + auth.token) + var options = { + method: 'DELETE', + auth: auth + } + + this.log.verbose('logout', 'invalidating session token for user') + this.request(uri, options, cb) +} diff --git a/deps/npm/node_modules/npm-registry-client/lib/publish.js b/deps/npm/node_modules/npm-registry-client/lib/publish.js index c3b2f3e1f2a..13e61debfd4 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/publish.js +++ b/deps/npm/node_modules/npm-registry-client/lib/publish.js @@ -1,121 +1,143 @@ - module.exports = publish -var url = require("url") - , semver = require("semver") - , crypto = require("crypto") - , fs = require("fs") - , fixNameField = require("normalize-package-data/lib/fixer.js").fixNameField +var url = require('url') +var semver = require('semver') +var crypto = require('crypto') +var Stream = require('stream').Stream +var assert = require('assert') +var fixer = require('normalize-package-data').fixer +var concat = require('concat-stream') -function escaped(name) { - return name.replace("/", "%2f") +function escaped (name) { + return name.replace('/', '%2f') } -function publish (uri, data, tarball, cb) { - var c = this.conf.getCredentialsByURI(uri) - if (!(c.token || (c.auth && c.username && c.email))) { - var er = new Error("auth and email required for publishing") +function publish (uri, params, cb) { + assert(typeof uri === 'string', 'must pass registry URI to publish') + assert(params && typeof params === 'object', 'must pass params to publish') + assert(typeof cb === 'function', 'must pass callback to publish') + + var access = params.access + assert( + (!access) || ['public', 'restricted'].indexOf(access) !== -1, + "if present, access level must be either 'public' or 'restricted'" + ) + + var auth = params.auth + assert(auth && typeof auth === 'object', 'must pass auth to publish') + if (!(auth.token || + (auth.password && auth.username && auth.email))) { + var er = new Error('auth required for publishing') er.code = 'ENEEDAUTH' return cb(er) } + var metadata = params.metadata + assert( + metadata && typeof metadata === 'object', + 'must pass package metadata to publish' + ) try { - fixNameField(data, true) - } - catch (er) { + fixer.fixNameField(metadata, {strict: true, allowLegacyCase: true}) + } catch (er) { return cb(er) } - - var ver = semver.clean(data.version) - if (!ver) - return cb(new Error('invalid semver: ' + data.version)) - data.version = ver - - var self = this - fs.stat(tarball, function(er, s) { - if (er) return cb(er) - fs.readFile(tarball, function(er, tarbuffer) { - if (er) return cb(er) - putFirst.call(self, uri, data, tarbuffer, s, c, cb) - }) + var version = semver.clean(metadata.version) + if (!version) return cb(new Error('invalid semver: ' + metadata.version)) + metadata.version = version + + var body = params.body + assert(body, 'must pass package body to publish') + assert(body instanceof Stream, 'package body passed to publish must be a stream') + var client = this + var sink = concat(function (tarbuffer) { + putFirst.call(client, uri, metadata, tarbuffer, access, auth, cb) }) + sink.on('error', cb) + body.pipe(sink) } -function putFirst (registry, data, tarbuffer, stat, creds, cb) { +function putFirst (registry, data, tarbuffer, access, auth, cb) { // optimistically try to PUT all in one single atomic thing. // If 409, then GET and merge, try again. // If other error, then fail. - var root = - { _id : data.name - , name : data.name - , description : data.description - , "dist-tags" : {} - , versions : {} - , readme: data.readme || "" - } + var root = { + _id: data.name, + name: data.name, + description: data.description, + 'dist-tags': {}, + versions: {}, + readme: data.readme || '' + } + + if (access) root.access = access - if (!creds.token) { - root.maintainers = [{name : creds.username, email : creds.email}] + if (!auth.token) { + root.maintainers = [{ name: auth.username, email: auth.email }] data.maintainers = JSON.parse(JSON.stringify(root.maintainers)) } root.versions[ data.version ] = data - var tag = data.tag || this.conf.get('tag') || "latest" - root["dist-tags"][tag] = data.version + var tag = data.tag || this.config.defaultTag + root['dist-tags'][tag] = data.version - var tbName = data.name + "-" + data.version + ".tgz" - , tbURI = data.name + "/-/" + tbName + var tbName = data.name + '-' + data.version + '.tgz' + var tbURI = data.name + '/-/' + tbName - data._id = data.name+"@"+data.version + data._id = data.name + '@' + data.version data.dist = data.dist || {} - data.dist.shasum = crypto.createHash("sha1").update(tarbuffer).digest("hex") + data.dist.shasum = crypto.createHash('sha1').update(tarbuffer).digest('hex') data.dist.tarball = url.resolve(registry, tbURI) - .replace(/^https:\/\//, "http://") + .replace(/^https:\/\//, 'http://') root._attachments = {} root._attachments[ tbName ] = { - "content_type": "application/octet-stream", - "data": tarbuffer.toString("base64"), - "length": stat.size + 'content_type': 'application/octet-stream', + 'data': tarbuffer.toString('base64'), + 'length': tarbuffer.length } var fixed = url.resolve(registry, escaped(data.name)) - this.request("PUT", fixed, { body : root }, function (er, parsed, json, res) { - var r409 = "must supply latest _rev to update existing package" - var r409b = "Document update conflict." + var client = this + var options = { + method: 'PUT', + body: root, + auth: auth + } + this.request(fixed, options, function (er, parsed, json, res) { + var r409 = 'must supply latest _rev to update existing package' + var r409b = 'Document update conflict.' var conflict = res && res.statusCode === 409 - if (parsed && (parsed.reason === r409 || parsed.reason === r409b)) + if (parsed && (parsed.reason === r409 || parsed.reason === r409b)) { conflict = true + } // a 409 is typical here. GET the data and merge in. if (er && !conflict) { - this.log.error("publish", "Failed PUT " - +(res && res.statusCode)) + client.log.error('publish', 'Failed PUT ' + (res && res.statusCode)) return cb(er) } - if (!er && !conflict) - return cb(er, parsed, json, res) + if (!er && !conflict) return cb(er, parsed, json, res) // let's see what versions are already published. - this.request("GET", fixed + "?write=true", null, function (er, current) { + client.request(fixed + '?write=true', { auth: auth }, function (er, current) { if (er) return cb(er) - putNext.call(this, registry, data.version, root, current, cb) - }.bind(this)) - }.bind(this)) + putNext.call(client, registry, data.version, root, current, auth, cb) + }) + }) } -function putNext(registry, newVersion, root, current, cb) { +function putNext (registry, newVersion, root, current, auth, cb) { // already have the tardata on the root object // just merge in existing stuff var curVers = Object.keys(current.versions || {}).map(function (v) { return semver.clean(v, true) - }).concat(Object.keys(current.time || {}).map(function(v) { - if (semver.valid(v, true)) - return semver.clean(v, true) - }).filter(function(v) { + }).concat(Object.keys(current.time || {}).map(function (v) { + if (semver.valid(v, true)) return semver.clean(v, true) + }).filter(function (v) { return v })) @@ -148,12 +170,17 @@ function putNext(registry, newVersion, root, current, cb) { root.versions[newVersion].maintainers = maint var uri = url.resolve(registry, escaped(root.name)) - this.request("PUT", uri, { body : current }, cb) + var options = { + method: 'PUT', + body: current, + auth: auth + } + this.request(uri, options, cb) } function conflictError (pkgid, version) { - var e = new Error("cannot modify pre-existing version") - e.code = "EPUBLISHCONFLICT" + var e = new Error('cannot modify pre-existing version') + e.code = 'EPUBLISHCONFLICT' e.pkgid = pkgid e.version = version return e diff --git a/deps/npm/node_modules/npm-registry-client/lib/request.js b/deps/npm/node_modules/npm-registry-client/lib/request.js index 910fe013142..168a9d160af 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/request.js +++ b/deps/npm/node_modules/npm-registry-client/lib/request.js @@ -1,108 +1,70 @@ -var assert = require("assert") - , url = require("url") - , zlib = require("zlib") - , Stream = require("stream").Stream - -var rm = require("rimraf") - , request = require("request") - , once = require("once") - module.exports = regRequest // npm: means // 1. https // 2. send authorization // 3. content-type is 'application/json' -- metadata -function regRequest (method, uri, options, cb_) { - assert(uri, "must pass resource to load") - assert(cb_, "must pass callback") +// +var assert = require('assert') +var url = require('url') +var zlib = require('zlib') +var Stream = require('stream').Stream - options = options || {} +var request = require('request') +var once = require('once') - var parsed = url.parse(uri) - var where = parsed.pathname - var what = options.body - var follow = (typeof options.follow === "boolean" ? options.follow : true) - this.log.verbose("request", "on initialization, where is", where) - - if (parsed.search) { - where = where + parsed.search - parsed.search = "" - } - parsed.pathname = "/" - this.log.verbose("request", "after pass 1, where is", where) +function regRequest (uri, params, cb_) { + assert(typeof uri === 'string', 'must pass uri to request') + assert(params && typeof params === 'object', 'must pass params to request') + assert(typeof cb_ === 'function', 'must pass callback to request') + + params.method = params.method || 'GET' + this.log.verbose('request', 'uri', uri) // Since there are multiple places where an error could occur, // don't let the cb be called more than once. var cb = once(cb_) - if (where.match(/^\/?favicon.ico/)) { + if (uri.match(/^\/?favicon.ico/)) { return cb(new Error("favicon.ico isn't a package, it's a picture.")) } - var adduserChange = /^\/?-\/user\/org\.couchdb\.user:([^\/]+)\/-rev/ - , isUserChange = where.match(adduserChange) - , adduserNew = /^\/?-\/user\/org\.couchdb\.user:([^\/]+)$/ - , isNewUser = where.match(adduserNew) - , registry = url.format(parsed) - , alwaysAuth = this.conf.getCredentialsByURI(registry).alwaysAuth - , isDelete = method === "DELETE" - , isWrite = what || isDelete + var adduserChange = /\/?-\/user\/org\.couchdb\.user:([^/]+)\/-rev/ + var isUserChange = uri.match(adduserChange) + var adduserNew = /\/?-\/user\/org\.couchdb\.user:([^/?]+)$/ + var isNewUser = uri.match(adduserNew) + var alwaysAuth = params.auth && params.auth.alwaysAuth + var isDelete = params.method === 'DELETE' + var isWrite = params.body || isDelete if (isUserChange && !isWrite) { - return cb(new Error("trying to change user document without writing(?!)")) - } - - // resolve to a full url on the registry - if (!where.match(/^https?:\/\//)) { - this.log.verbose("request", "url raw", where) - - var q = where.split("?") - where = q.shift() - q = q.join("?") - - if (where.charAt(0) !== "/") where = "/" + where - where = "." + where.split("/").map(function (p) { - p = p.trim() - if (p.match(/^org.couchdb.user/)) { - return p.replace(/\//g, encodeURIComponent("/")) - } - return p - }).join("/") - if (q) where += "?" + q - - this.log.verbose("request", "resolving registry", [registry, where]) - where = url.resolve(registry, where) - this.log.verbose("request", "after pass 2, where is", where) + return cb(new Error('trying to change user document without writing(?!)')) } - var authed // new users can *not* use auth, because they don't *have* auth yet - if (isNewUser) { - this.log.verbose("request", "new user, so can't send auth") - authed = false - } - else if (alwaysAuth) { - this.log.verbose("request", "always-auth set; sending authorization") - authed = true - } - else if (isWrite) { - this.log.verbose("request", "sending authorization for write operation") - authed = true - } - else { + if (isUserChange) { + this.log.verbose('request', 'updating existing user; sending authorization') + params.authed = true + } else if (isNewUser) { + this.log.verbose('request', "new user, so can't send auth") + params.authed = false + } else if (alwaysAuth) { + this.log.verbose('request', 'always-auth set; sending authorization') + params.authed = true + } else if (isWrite) { + this.log.verbose('request', 'sending authorization for write operation') + params.authed = true + } else { // most of the time we don't want to auth - this.log.verbose("request", "no auth needed") - authed = false + this.log.verbose('request', 'no auth needed') + params.authed = false } var self = this this.attempt(function (operation) { - makeRequest.call(self, method, where, what, options.etag, follow, authed - , function (er, parsed, raw, response) { + makeRequest.call(self, uri, params, function (er, parsed, raw, response) { if (!er || (er.message && er.message.match(/^SSL Error/))) { - if (er) - er.code = "ESSL" + if (er) er.code = 'ESSL' return cb(er, parsed, raw, response) } @@ -113,13 +75,13 @@ function regRequest (method, uri, options, cb_) { var serverError = statusCode >= 500 var statusRetry = !statusCode || timeout || serverError if (er && statusRetry && operation.retry(er)) { - self.log.info("retry", "will retry, error on last attempt: " + er) + self.log.info('retry', 'will retry, error on last attempt: ' + er) return undefined } if (response) { - self.log.verbose("headers", response.headers) - if (response.headers["npm-notice"]) { - self.log.warn("notice", response.headers["npm-notice"]) + self.log.verbose('headers', response.headers) + if (response.headers['npm-notice']) { + self.log.warn('notice', response.headers['npm-notice']) } } cb.apply(null, arguments) @@ -127,64 +89,74 @@ function regRequest (method, uri, options, cb_) { }) } -function makeRequest (method, where, what, etag, follow, authed, cb_) { +function makeRequest (uri, params, cb_) { var cb = once(cb_) - var parsed = url.parse(where) + var parsed = url.parse(uri) var headers = {} // metadata should be compressed - headers["accept-encoding"] = "gzip" + headers['accept-encoding'] = 'gzip' - var er = this.authify(authed, parsed, headers) + var er = this.authify(params.authed, parsed, headers, params.auth) if (er) return cb_(er) var opts = this.initialize( parsed, - method, - "application/json", + params.method, + 'application/json', headers ) - opts.followRedirect = follow + opts.followRedirect = (typeof params.follow === 'boolean' ? params.follow : true) opts.encoding = null // tell request let body be Buffer instance - if (etag) { - this.log.verbose("etag", etag) - headers[method === "GET" ? "if-none-match" : "if-match"] = etag + if (params.etag) { + this.log.verbose('etag', params.etag) + headers[params.method === 'GET' ? 'if-none-match' : 'if-match'] = params.etag } - // figure out wth "what" is - if (what) { - if (Buffer.isBuffer(what) || typeof what === "string") { - opts.body = what - headers["content-type"] = "application/json" - headers["content-length"] = Buffer.byteLength(what) - } else if (what instanceof Stream) { - headers["content-type"] = "application/octet-stream" - if (what.size) headers["content-length"] = what.size + if (params.lastModified && params.method === 'GET') { + this.log.verbose('lastModified', params.lastModified) + headers['if-modified-since'] = params.lastModified + } + + // figure out wth body is + if (params.body) { + if (Buffer.isBuffer(params.body)) { + opts.body = params.body + headers['content-type'] = 'application/json' + headers['content-length'] = params.body.length + } else if (typeof params.body === 'string') { + opts.body = params.body + headers['content-type'] = 'application/json' + headers['content-length'] = Buffer.byteLength(params.body) + } else if (params.body instanceof Stream) { + headers['content-type'] = 'application/octet-stream' + if (params.body.size) headers['content-length'] = params.body.size } else { - delete what._etag - opts.json = what + delete params.body._etag + delete params.body._lastModified + opts.json = params.body } } - this.log.http("request", method, parsed.href || "/") + this.log.http('request', params.method, parsed.href || '/') - var done = requestDone.call(this, method, where, cb) + var done = requestDone.call(this, params.method, uri, cb) var req = request(opts, decodeResponseBody(done)) - req.on("error", cb) - req.on("socket", function (s) { - s.on("error", cb) + req.on('error', cb) + req.on('socket', function (s) { + s.on('error', cb) }) - if (what && (what instanceof Stream)) { - what.pipe(req) + if (params.body && (params.body instanceof Stream)) { + params.body.pipe(req) } } -function decodeResponseBody(cb) { +function decodeResponseBody (cb) { return function (er, response, data) { if (er) return cb(er, response, data) @@ -194,7 +166,9 @@ function decodeResponseBody(cb) { response.socket.destroy() } - if (response.headers["content-encoding"] !== "gzip") return cb(er, response, data) + if (response.headers['content-encoding'] !== 'gzip') { + return cb(er, response, data) + } zlib.gunzip(data, function (er, buf) { if (er) return cb(er, response, data) @@ -210,23 +184,21 @@ function requestDone (method, where, cb) { if (er) return cb(er) var urlObj = url.parse(where) - if (urlObj.auth) - urlObj.auth = "***" + if (urlObj.auth) urlObj.auth = '***' this.log.http(response.statusCode, url.format(urlObj)) - var parsed - if (Buffer.isBuffer(data)) { data = data.toString() } - if (data && typeof data === "string" && response.statusCode !== 304) { + var parsed + if (data && typeof data === 'string' && response.statusCode !== 304) { try { parsed = JSON.parse(data) } catch (ex) { - ex.message += "\n" + data - this.log.verbose("bad json", data) - this.log.error("registry", "error parsing json") + ex.message += '\n' + data + this.log.verbose('bad json', data) + this.log.error('registry', 'error parsing json') return cb(ex, null, data, response) } } else if (data) { @@ -236,9 +208,12 @@ function requestDone (method, where, cb) { // expect data with any error codes if (!data && response.statusCode >= 400) { - return cb( response.statusCode + " " - + require("http").STATUS_CODES[response.statusCode] - , null, data, response ) + return cb( + response.statusCode + ' ' + require('http').STATUS_CODES[response.statusCode], + null, + data, + response + ) } er = null @@ -246,32 +221,36 @@ function requestDone (method, where, cb) { parsed._etag = response.headers.etag } - if (parsed && parsed.error && response.statusCode >= 400) { + if (parsed && response.headers['last-modified']) { + parsed._lastModified = response.headers['last-modified'] + } + + // for the search endpoint, the 'error' property can be an object + if (parsed && parsed.error && typeof parsed.error !== 'object' || + response.statusCode >= 400) { var w = url.parse(where).pathname.substr(1) var name if (!w.match(/^-/)) { - w = w.split("/") - name = w[w.indexOf("_rewrite") + 1] + w = w.split('/') + name = decodeURIComponent(w[w.indexOf('_rewrite') + 1]) } - if (name && parsed.error === "not_found") { - er = new Error("404 Not Found: " + name) + if (!parsed.error) { + er = new Error( + 'Registry returned ' + response.statusCode + + ' for ' + method + + ' on ' + where + ) + } else if (name && parsed.error === 'not_found') { + er = new Error('404 Not Found: ' + name) } else { er = new Error( - parsed.error + " " + (parsed.reason || "") + ": " + w) + parsed.error + ' ' + (parsed.reason || '') + ': ' + (name || w) + ) } if (name) er.pkgid = name er.statusCode = response.statusCode - er.code = "E" + er.statusCode - - } else if (method !== "HEAD" && method !== "GET") { - // invalidate cache - // This is irrelevant for commands that do etag caching, but - // ls and view also have a timed cache, so this keeps the user - // from thinking that it didn't work when it did. - // Note that failure is an acceptable option here, since the - // only result will be a stale cache for some helper commands. - rm(this.cacheFile(where), function() {}) + er.code = 'E' + er.statusCode } return cb(er, parsed, data, response) }.bind(this) diff --git a/deps/npm/node_modules/npm-registry-client/lib/star.js b/deps/npm/node_modules/npm-registry-client/lib/star.js index 97745851ea1..5c9224eaa21 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/star.js +++ b/deps/npm/node_modules/npm-registry-client/lib/star.js @@ -1,32 +1,51 @@ - module.exports = star -function star (uri, starred, cb) { - var c = this.conf.getCredentialsByURI(uri) - if (c.token) { - return cb(new Error("This operation is unsupported for token-based auth")) - } - else if (!c.auth) { - return cb(new Error("Must be logged in to star/unstar packages")) +var assert = require('assert') + +function star (uri, params, cb) { + assert(typeof uri === 'string', 'must pass registry URI to star') + assert(params && typeof params === 'object', 'must pass params to star') + assert(typeof cb === 'function', 'must pass callback to star') + + var starred = !!params.starred + + var auth = params.auth + assert(auth && typeof auth === 'object', 'must pass auth to star') + if (!(auth.token || (auth.password && auth.username && auth.email))) { + var er = new Error('Must be logged in to star/unstar packages') + er.code = 'ENEEDAUTH' + return cb(er) } - this.request("GET", uri + "?write=true", null, function (er, fullData) { + var client = this + this.request(uri + '?write=true', { auth: auth }, function (er, fullData) { if (er) return cb(er) - fullData = { _id: fullData._id - , _rev: fullData._rev - , users: fullData.users || {} } - - if (starred) { - this.log.info("starring", fullData._id) - fullData.users[c.username] = true - this.log.verbose("starring", fullData) - } else { - delete fullData.users[c.username] - this.log.info("unstarring", fullData._id) - this.log.verbose("unstarring", fullData) - } - - return this.request("PUT", uri, { body : fullData }, cb) - }.bind(this)) + client.whoami(uri, params, function (er, username) { + if (er) return cb(er) + + var data = { + _id: fullData._id, + _rev: fullData._rev, + users: fullData.users || {} + } + + if (starred) { + client.log.info('starring', data._id) + data.users[username] = true + client.log.verbose('starring', data) + } else { + delete data.users[username] + client.log.info('unstarring', data._id) + client.log.verbose('unstarring', data) + } + + var options = { + method: 'PUT', + body: data, + auth: auth + } + return client.request(uri, options, cb) + }) + }) } diff --git a/deps/npm/node_modules/npm-registry-client/lib/stars.js b/deps/npm/node_modules/npm-registry-client/lib/stars.js index 86a252efbb7..ba47f2c1efc 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/stars.js +++ b/deps/npm/node_modules/npm-registry-client/lib/stars.js @@ -1,9 +1,18 @@ -var url = require("url") - module.exports = stars -function stars (base, name, cb) { - name = encodeURIComponent(name) - var path = "/-/_view/starredByUser?key=\""+name+"\"" - this.request("GET", url.resolve(base, path), null, cb) +var assert = require('assert') +var url = require('url') + +function stars (uri, params, cb) { + assert(typeof uri === 'string', 'must pass registry URI to stars') + assert(params && typeof params === 'object', 'must pass params to stars') + assert(typeof cb === 'function', 'must pass callback to stars') + + var auth = params.auth + var name = params.username || (auth && auth.username) + if (!name) return cb(new Error('must pass either username or auth to stars')) + var encoded = encodeURIComponent(name) + var path = '-/_view/starredByUser?key="' + encoded + '"' + + this.request(url.resolve(uri, path), { auth: auth }, cb) } diff --git a/deps/npm/node_modules/npm-registry-client/lib/tag.js b/deps/npm/node_modules/npm-registry-client/lib/tag.js index 65430fe9307..3b6dad1df26 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/tag.js +++ b/deps/npm/node_modules/npm-registry-client/lib/tag.js @@ -1,5 +1,23 @@ module.exports = tag -function tag (uri, version, tagName, cb) { - this.request("PUT", uri+"/"+tagName, { body : JSON.stringify(version) }, cb) +var assert = require('assert') + +function tag (uri, params, cb) { + assert(typeof uri === 'string', 'must pass registry URI to tag') + assert(params && typeof params === 'object', 'must pass params to tag') + assert(typeof cb === 'function', 'must pass callback to tag') + + assert(typeof params.version === 'string', 'must pass version to tag') + assert(typeof params.tag === 'string', 'must pass tag name to tag') + assert( + params.auth && typeof params.auth === 'object', + 'must pass auth to tag' + ) + + var options = { + method: 'PUT', + body: JSON.stringify(params.version), + auth: params.auth + } + this.request(uri + '/' + params.tag, options, cb) } diff --git a/deps/npm/node_modules/npm-registry-client/lib/unpublish.js b/deps/npm/node_modules/npm-registry-client/lib/unpublish.js index 346d537fe6f..05c5a4b6110 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/unpublish.js +++ b/deps/npm/node_modules/npm-registry-client/lib/unpublish.js @@ -1,3 +1,4 @@ +module.exports = unpublish // fetch the data // modify to remove the version in question @@ -5,84 +6,94 @@ // else, PUT the modified data // delete the tarball -module.exports = unpublish +var semver = require('semver') +var url = require('url') +var chain = require('slide').chain +var assert = require('assert') -var semver = require("semver") - , url = require("url") - , chain = require("slide").chain +function unpublish (uri, params, cb) { + assert(typeof uri === 'string', 'must pass registry URI to unpublish') + assert(params && typeof params === 'object', 'must pass params to unpublish') + assert(typeof cb === 'function', 'must pass callback to unpublish') -function unpublish (uri, ver, cb) { - if (typeof cb !== "function") cb = ver, ver = null + var ver = params.version + var auth = params.auth + assert(auth && typeof auth === 'object', 'must pass auth to unpublish') - this.get(uri + "?write=true", { timeout : -1, follow : false }, function (er, data) { + var options = { + timeout: -1, + follow: false, + auth: auth + } + this.get(uri + '?write=true', options, function (er, data) { if (er) { - this.log.info("unpublish", uri+" not published") + this.log.info('unpublish', uri + ' not published') return cb() } // remove all if no version specified if (!ver) { - this.log.info("unpublish", "No version specified, removing all") - return this.request("DELETE", uri+"/-rev/"+data._rev, null, cb) + this.log.info('unpublish', 'No version specified, removing all') + return this.request(uri + '/-rev/' + data._rev, { method: 'DELETE', auth: auth }, cb) } var versions = data.versions || {} - , versionPublic = versions.hasOwnProperty(ver) + var versionPublic = versions.hasOwnProperty(ver) var dist if (!versionPublic) { - this.log.info("unpublish", uri+"@"+ver+" not published") + this.log.info('unpublish', uri + '@' + ver + ' not published') } else { dist = versions[ver].dist - this.log.verbose("unpublish", "removing attachments", dist) + this.log.verbose('unpublish', 'removing attachments', dist) } delete versions[ver] // if it was the only version, then delete the whole package. if (!Object.keys(versions).length) { - this.log.info("unpublish", "No versions remain, removing entire package") - return this.request("DELETE", uri + "/-rev/" + data._rev, null, cb) + this.log.info('unpublish', 'No versions remain, removing entire package') + return this.request(uri + '/-rev/' + data._rev, { method: 'DELETE', auth: auth }, cb) } if (!versionPublic) return cb() - var latestVer = data["dist-tags"].latest - for (var tag in data["dist-tags"]) { - if (data["dist-tags"][tag] === ver) delete data["dist-tags"][tag] + var latestVer = data['dist-tags'].latest + for (var tag in data['dist-tags']) { + if (data['dist-tags'][tag] === ver) delete data['dist-tags'][tag] } if (latestVer === ver) { - data["dist-tags"].latest = + data['dist-tags'].latest = Object.getOwnPropertyNames(versions).sort(semver.compareLoose).pop() } var rev = data._rev delete data._revisions delete data._attachments - var cb_ = detacher.call(this, uri, data, dist, cb) + var cb_ = detacher.call(this, uri, data, dist, auth, cb) - this.request("PUT", uri + "/-rev/" + rev, { body : data }, function (er) { + this.request(uri + '/-rev/' + rev, { method: 'PUT', body: data, auth: auth }, function (er) { if (er) { - this.log.error("unpublish", "Failed to update data") + this.log.error('unpublish', 'Failed to update data') } cb_(er) }.bind(this)) }.bind(this)) } -function detacher (uri, data, dist, cb) { +function detacher (uri, data, dist, credentials, cb) { return function (er) { if (er) return cb(er) - this.get(escape(uri, data.name), null, function (er, data) { + this.get(escape(uri, data.name), { auth: credentials }, function (er, data) { if (er) return cb(er) var tb = url.parse(dist.tarball) - detach.call(this, uri, data, tb.pathname, data._rev, function (er) { + detach.call(this, uri, data, tb.pathname, data._rev, credentials, function (er) { if (er || !dist.bin) return cb(er) chain(Object.keys(dist.bin).map(function (bt) { return function (cb) { var d = dist.bin[bt] - detach.call(this, uri, data, url.parse(d.tarball).pathname, null, cb) + detach.call(this, uri, data, url.parse(d.tarball).pathname, null, credentials, cb) }.bind(this) }, this), cb) }.bind(this)) @@ -90,21 +101,20 @@ function detacher (uri, data, dist, cb) { }.bind(this) } -function detach (uri, data, path, rev, cb) { +function detach (uri, data, path, rev, credentials, cb) { if (rev) { - path += "/-rev/" + rev - this.log.info("detach", path) - return this.request("DELETE", url.resolve(uri, path), null, cb) + path += '/-rev/' + rev + this.log.info('detach', path) + return this.request(url.resolve(uri, path), { method: 'DELETE', auth: credentials }, cb) } - this.get(escape(uri, data.name), null, function (er, data) { + this.get(escape(uri, data.name), { auth: credentials }, function (er, data) { rev = data._rev - if (!rev) return cb(new Error( - "No _rev found in "+data._id)) + if (!rev) return cb(new Error('No _rev found in ' + data._id)) detach.call(this, data, path, rev, cb) }.bind(this)) } function escape (base, name) { - var escaped = name.replace(/\//, "%2f") + var escaped = name.replace(/\//, '%2f') return url.resolve(base, escaped) } diff --git a/deps/npm/node_modules/npm-registry-client/lib/upload.js b/deps/npm/node_modules/npm-registry-client/lib/upload.js deleted file mode 100644 index f624a266c42..00000000000 --- a/deps/npm/node_modules/npm-registry-client/lib/upload.js +++ /dev/null @@ -1,22 +0,0 @@ -module.exports = upload - -var fs = require('fs') -, Stream = require("stream").Stream - -function upload (uri, file, etag, nofollow, cb) { - if (typeof nofollow === "function") cb = nofollow, nofollow = false - if (typeof etag === "function") cb = etag, etag = null - - if (file instanceof Stream) { - return this.request("PUT", uri, { body : file, etag : etag, follow : !nofollow }, cb) - } - - fs.stat(file, function (er, stat) { - if (er) return cb(er) - var s = fs.createReadStream(file) - s.size = stat.size - s.on("error", cb) - - this.request("PUT", uri, { body : s, etag : etag, follow : !nofollow }, cb) - }.bind(this)) -} diff --git a/deps/npm/node_modules/npm-registry-client/lib/util/nerf-dart.js b/deps/npm/node_modules/npm-registry-client/lib/util/nerf-dart.js deleted file mode 100644 index 3b26a56c65f..00000000000 --- a/deps/npm/node_modules/npm-registry-client/lib/util/nerf-dart.js +++ /dev/null @@ -1,21 +0,0 @@ -var url = require("url") - -module.exports = toNerfDart - -/** - * Maps a URL to an identifier. - * - * Name courtesy schiffertronix media LLC, a New Jersey corporation - * - * @param {String} uri The URL to be nerfed. - * - * @returns {String} A nerfed URL. - */ -function toNerfDart(uri) { - var parsed = url.parse(uri) - parsed.pathname = "/" - delete parsed.protocol - delete parsed.auth - - return url.format(parsed) -} diff --git a/deps/npm/node_modules/npm-registry-client/lib/whoami.js b/deps/npm/node_modules/npm-registry-client/lib/whoami.js index ffa7bd704e6..68db49e59a4 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/whoami.js +++ b/deps/npm/node_modules/npm-registry-client/lib/whoami.js @@ -1,13 +1,19 @@ module.exports = whoami -var url = require("url") +var url = require('url') +var assert = require('assert') -function whoami (uri, cb) { - if (!this.conf.getCredentialsByURI(uri)) { - return cb(new Error("Must be logged in to see who you are")) - } +function whoami (uri, params, cb) { + assert(typeof uri === 'string', 'must pass registry URI to whoami') + assert(params && typeof params === 'object', 'must pass params to whoami') + assert(typeof cb === 'function', 'must pass callback to whoami') - this.request("GET", url.resolve(uri, "whoami"), null, function (er, userdata) { + var auth = params.auth + assert(auth && typeof auth === 'object', 'must pass auth to whoami') + + if (auth.username) return process.nextTick(cb.bind(this, null, auth.username)) + + this.request(url.resolve(uri, '-/whoami'), { auth: auth }, function (er, userdata) { if (er) return cb(er) cb(null, userdata.username) diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/.npmignore b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/.npmignore new file mode 100644 index 00000000000..b512c09d476 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/.npmignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/LICENSE b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/LICENSE new file mode 100644 index 00000000000..99c130e1de3 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/LICENSE @@ -0,0 +1,24 @@ +The MIT License + +Copyright (c) 2013 Max Ogden + +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/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/index.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/index.js new file mode 100644 index 00000000000..b55ae7e03db --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/index.js @@ -0,0 +1,136 @@ +var Writable = require('readable-stream').Writable +var inherits = require('inherits') + +if (typeof Uint8Array === 'undefined') { + var U8 = require('typedarray').Uint8Array +} else { + var U8 = Uint8Array +} + +function ConcatStream(opts, cb) { + if (!(this instanceof ConcatStream)) return new ConcatStream(opts, cb) + + if (typeof opts === 'function') { + cb = opts + opts = {} + } + if (!opts) opts = {} + + var encoding = opts.encoding + var shouldInferEncoding = false + + if (!encoding) { + shouldInferEncoding = true + } else { + encoding = String(encoding).toLowerCase() + if (encoding === 'u8' || encoding === 'uint8') { + encoding = 'uint8array' + } + } + + Writable.call(this, { objectMode: true }) + + this.encoding = encoding + this.shouldInferEncoding = shouldInferEncoding + + if (cb) this.on('finish', function () { cb(this.getBody()) }) + this.body = [] +} + +module.exports = ConcatStream +inherits(ConcatStream, Writable) + +ConcatStream.prototype._write = function(chunk, enc, next) { + this.body.push(chunk) + next() +} + +ConcatStream.prototype.inferEncoding = function (buff) { + var firstBuffer = buff === undefined ? this.body[0] : buff; + if (Buffer.isBuffer(firstBuffer)) return 'buffer' + if (typeof Uint8Array !== 'undefined' && firstBuffer instanceof Uint8Array) return 'uint8array' + if (Array.isArray(firstBuffer)) return 'array' + if (typeof firstBuffer === 'string') return 'string' + if (Object.prototype.toString.call(firstBuffer) === "[object Object]") return 'object' + return 'buffer' +} + +ConcatStream.prototype.getBody = function () { + if (!this.encoding && this.body.length === 0) return [] + if (this.shouldInferEncoding) this.encoding = this.inferEncoding() + if (this.encoding === 'array') return arrayConcat(this.body) + if (this.encoding === 'string') return stringConcat(this.body) + if (this.encoding === 'buffer') return bufferConcat(this.body) + if (this.encoding === 'uint8array') return u8Concat(this.body) + return this.body +} + +var isArray = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]' +} + +function isArrayish (arr) { + return /Array\]$/.test(Object.prototype.toString.call(arr)) +} + +function stringConcat (parts) { + var strings = [] + var needsToString = false + for (var i = 0; i < parts.length; i++) { + var p = parts[i] + if (typeof p === 'string') { + strings.push(p) + } else if (Buffer.isBuffer(p)) { + strings.push(p) + } else { + strings.push(Buffer(p)) + } + } + if (Buffer.isBuffer(parts[0])) { + strings = Buffer.concat(strings) + strings = strings.toString('utf8') + } else { + strings = strings.join('') + } + return strings +} + +function bufferConcat (parts) { + var bufs = [] + for (var i = 0; i < parts.length; i++) { + var p = parts[i] + if (Buffer.isBuffer(p)) { + bufs.push(p) + } else if (typeof p === 'string' || isArrayish(p) + || (p && typeof p.subarray === 'function')) { + bufs.push(Buffer(p)) + } else bufs.push(Buffer(String(p))) + } + return Buffer.concat(bufs) +} + +function arrayConcat (parts) { + var res = [] + for (var i = 0; i < parts.length; i++) { + res.push.apply(res, parts[i]) + } + return res +} + +function u8Concat (parts) { + var len = 0 + for (var i = 0; i < parts.length; i++) { + if (typeof parts[i] === 'string') { + parts[i] = Buffer(parts[i]) + } + len += parts[i].length + } + var u8 = new U8(len) + for (var i = 0, offset = 0; i < parts.length; i++) { + var part = parts[i] + for (var j = 0; j < part.length; j++) { + u8[offset++] = part[j] + } + } + return u8 +} diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/.travis.yml b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/.travis.yml new file mode 100644 index 00000000000..cc4dba29d95 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.8" + - "0.10" diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/LICENSE b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/LICENSE new file mode 100644 index 00000000000..11adfaec9e7 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/LICENSE @@ -0,0 +1,35 @@ +/* + Copyright (c) 2010, Linden Research, Inc. + Copyright (c) 2012, Joshua Bell + + 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. + $/LicenseInfo$ + */ + +// Original can be found at: +// https://bitbucket.org/lindenlab/llsd +// Modifications by Joshua Bell inexorabletash@gmail.com +// https://github.com/inexorabletash/polyfill + +// ES3/ES5 implementation of the Krhonos Typed Array Specification +// Ref: http://www.khronos.org/registry/typedarray/specs/latest/ +// Date: 2011-02-01 +// +// Variations: +// * Allows typed_array.get/set() as alias for subscripts (typed_array[]) diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/example/tarray.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/example/tarray.js new file mode 100644 index 00000000000..8423d7c9b1c --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/example/tarray.js @@ -0,0 +1,4 @@ +var Uint8Array = require('../').Uint8Array; +var ua = new Uint8Array(5); +ua[1] = 256 + 55; +console.log(ua[1]); diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/index.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/index.js new file mode 100644 index 00000000000..5e540841f43 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/index.js @@ -0,0 +1,630 @@ +var undefined = (void 0); // Paranoia + +// Beyond this value, index getters/setters (i.e. array[0], array[1]) are so slow to +// create, and consume so much memory, that the browser appears frozen. +var MAX_ARRAY_LENGTH = 1e5; + +// Approximations of internal ECMAScript conversion functions +var ECMAScript = (function() { + // Stash a copy in case other scripts modify these + var opts = Object.prototype.toString, + ophop = Object.prototype.hasOwnProperty; + + return { + // Class returns internal [[Class]] property, used to avoid cross-frame instanceof issues: + Class: function(v) { return opts.call(v).replace(/^\[object *|\]$/g, ''); }, + HasProperty: function(o, p) { return p in o; }, + HasOwnProperty: function(o, p) { return ophop.call(o, p); }, + IsCallable: function(o) { return typeof o === 'function'; }, + ToInt32: function(v) { return v >> 0; }, + ToUint32: function(v) { return v >>> 0; } + }; +}()); + +// Snapshot intrinsics +var LN2 = Math.LN2, + abs = Math.abs, + floor = Math.floor, + log = Math.log, + min = Math.min, + pow = Math.pow, + round = Math.round; + +// ES5: lock down object properties +function configureProperties(obj) { + if (getOwnPropNames && defineProp) { + var props = getOwnPropNames(obj), i; + for (i = 0; i < props.length; i += 1) { + defineProp(obj, props[i], { + value: obj[props[i]], + writable: false, + enumerable: false, + configurable: false + }); + } + } +} + +// emulate ES5 getter/setter API using legacy APIs +// http://blogs.msdn.com/b/ie/archive/2010/09/07/transitioning-existing-code-to-the-es5-getter-setter-apis.aspx +// (second clause tests for Object.defineProperty() in IE<9 that only supports extending DOM prototypes, but +// note that IE<9 does not support __defineGetter__ or __defineSetter__ so it just renders the method harmless) +var defineProp +if (Object.defineProperty && (function() { + try { + Object.defineProperty({}, 'x', {}); + return true; + } catch (e) { + return false; + } + })()) { + defineProp = Object.defineProperty; +} else { + defineProp = function(o, p, desc) { + if (!o === Object(o)) throw new TypeError("Object.defineProperty called on non-object"); + if (ECMAScript.HasProperty(desc, 'get') && Object.prototype.__defineGetter__) { Object.prototype.__defineGetter__.call(o, p, desc.get); } + if (ECMAScript.HasProperty(desc, 'set') && Object.prototype.__defineSetter__) { Object.prototype.__defineSetter__.call(o, p, desc.set); } + if (ECMAScript.HasProperty(desc, 'value')) { o[p] = desc.value; } + return o; + }; +} + +var getOwnPropNames = Object.getOwnPropertyNames || function (o) { + if (o !== Object(o)) throw new TypeError("Object.getOwnPropertyNames called on non-object"); + var props = [], p; + for (p in o) { + if (ECMAScript.HasOwnProperty(o, p)) { + props.push(p); + } + } + return props; +}; + +// ES5: Make obj[index] an alias for obj._getter(index)/obj._setter(index, value) +// for index in 0 ... obj.length +function makeArrayAccessors(obj) { + if (!defineProp) { return; } + + if (obj.length > MAX_ARRAY_LENGTH) throw new RangeError("Array too large for polyfill"); + + function makeArrayAccessor(index) { + defineProp(obj, index, { + 'get': function() { return obj._getter(index); }, + 'set': function(v) { obj._setter(index, v); }, + enumerable: true, + configurable: false + }); + } + + var i; + for (i = 0; i < obj.length; i += 1) { + makeArrayAccessor(i); + } +} + +// Internal conversion functions: +// pack() - take a number (interpreted as Type), output a byte array +// unpack() - take a byte array, output a Type-like number + +function as_signed(value, bits) { var s = 32 - bits; return (value << s) >> s; } +function as_unsigned(value, bits) { var s = 32 - bits; return (value << s) >>> s; } + +function packI8(n) { return [n & 0xff]; } +function unpackI8(bytes) { return as_signed(bytes[0], 8); } + +function packU8(n) { return [n & 0xff]; } +function unpackU8(bytes) { return as_unsigned(bytes[0], 8); } + +function packU8Clamped(n) { n = round(Number(n)); return [n < 0 ? 0 : n > 0xff ? 0xff : n & 0xff]; } + +function packI16(n) { return [(n >> 8) & 0xff, n & 0xff]; } +function unpackI16(bytes) { return as_signed(bytes[0] << 8 | bytes[1], 16); } + +function packU16(n) { return [(n >> 8) & 0xff, n & 0xff]; } +function unpackU16(bytes) { return as_unsigned(bytes[0] << 8 | bytes[1], 16); } + +function packI32(n) { return [(n >> 24) & 0xff, (n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff]; } +function unpackI32(bytes) { return as_signed(bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], 32); } + +function packU32(n) { return [(n >> 24) & 0xff, (n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff]; } +function unpackU32(bytes) { return as_unsigned(bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], 32); } + +function packIEEE754(v, ebits, fbits) { + + var bias = (1 << (ebits - 1)) - 1, + s, e, f, ln, + i, bits, str, bytes; + + function roundToEven(n) { + var w = floor(n), f = n - w; + if (f < 0.5) + return w; + if (f > 0.5) + return w + 1; + return w % 2 ? w + 1 : w; + } + + // Compute sign, exponent, fraction + if (v !== v) { + // NaN + // http://dev.w3.org/2006/webapi/WebIDL/#es-type-mapping + e = (1 << ebits) - 1; f = pow(2, fbits - 1); s = 0; + } else if (v === Infinity || v === -Infinity) { + e = (1 << ebits) - 1; f = 0; s = (v < 0) ? 1 : 0; + } else if (v === 0) { + e = 0; f = 0; s = (1 / v === -Infinity) ? 1 : 0; + } else { + s = v < 0; + v = abs(v); + + if (v >= pow(2, 1 - bias)) { + e = min(floor(log(v) / LN2), 1023); + f = roundToEven(v / pow(2, e) * pow(2, fbits)); + if (f / pow(2, fbits) >= 2) { + e = e + 1; + f = 1; + } + if (e > bias) { + // Overflow + e = (1 << ebits) - 1; + f = 0; + } else { + // Normalized + e = e + bias; + f = f - pow(2, fbits); + } + } else { + // Denormalized + e = 0; + f = roundToEven(v / pow(2, 1 - bias - fbits)); + } + } + + // Pack sign, exponent, fraction + bits = []; + for (i = fbits; i; i -= 1) { bits.push(f % 2 ? 1 : 0); f = floor(f / 2); } + for (i = ebits; i; i -= 1) { bits.push(e % 2 ? 1 : 0); e = floor(e / 2); } + bits.push(s ? 1 : 0); + bits.reverse(); + str = bits.join(''); + + // Bits to bytes + bytes = []; + while (str.length) { + bytes.push(parseInt(str.substring(0, 8), 2)); + str = str.substring(8); + } + return bytes; +} + +function unpackIEEE754(bytes, ebits, fbits) { + + // Bytes to bits + var bits = [], i, j, b, str, + bias, s, e, f; + + for (i = bytes.length; i; i -= 1) { + b = bytes[i - 1]; + for (j = 8; j; j -= 1) { + bits.push(b % 2 ? 1 : 0); b = b >> 1; + } + } + bits.reverse(); + str = bits.join(''); + + // Unpack sign, exponent, fraction + bias = (1 << (ebits - 1)) - 1; + s = parseInt(str.substring(0, 1), 2) ? -1 : 1; + e = parseInt(str.substring(1, 1 + ebits), 2); + f = parseInt(str.substring(1 + ebits), 2); + + // Produce number + if (e === (1 << ebits) - 1) { + return f !== 0 ? NaN : s * Infinity; + } else if (e > 0) { + // Normalized + return s * pow(2, e - bias) * (1 + f / pow(2, fbits)); + } else if (f !== 0) { + // Denormalized + return s * pow(2, -(bias - 1)) * (f / pow(2, fbits)); + } else { + return s < 0 ? -0 : 0; + } +} + +function unpackF64(b) { return unpackIEEE754(b, 11, 52); } +function packF64(v) { return packIEEE754(v, 11, 52); } +function unpackF32(b) { return unpackIEEE754(b, 8, 23); } +function packF32(v) { return packIEEE754(v, 8, 23); } + + +// +// 3 The ArrayBuffer Type +// + +(function() { + + /** @constructor */ + var ArrayBuffer = function ArrayBuffer(length) { + length = ECMAScript.ToInt32(length); + if (length < 0) throw new RangeError('ArrayBuffer size is not a small enough positive integer'); + + this.byteLength = length; + this._bytes = []; + this._bytes.length = length; + + var i; + for (i = 0; i < this.byteLength; i += 1) { + this._bytes[i] = 0; + } + + configureProperties(this); + }; + + exports.ArrayBuffer = exports.ArrayBuffer || ArrayBuffer; + + // + // 4 The ArrayBufferView Type + // + + // NOTE: this constructor is not exported + /** @constructor */ + var ArrayBufferView = function ArrayBufferView() { + //this.buffer = null; + //this.byteOffset = 0; + //this.byteLength = 0; + }; + + // + // 5 The Typed Array View Types + // + + function makeConstructor(bytesPerElement, pack, unpack) { + // Each TypedArray type requires a distinct constructor instance with + // identical logic, which this produces. + + var ctor; + ctor = function(buffer, byteOffset, length) { + var array, sequence, i, s; + + if (!arguments.length || typeof arguments[0] === 'number') { + // Constructor(unsigned long length) + this.length = ECMAScript.ToInt32(arguments[0]); + if (length < 0) throw new RangeError('ArrayBufferView size is not a small enough positive integer'); + + this.byteLength = this.length * this.BYTES_PER_ELEMENT; + this.buffer = new ArrayBuffer(this.byteLength); + this.byteOffset = 0; + } else if (typeof arguments[0] === 'object' && arguments[0].constructor === ctor) { + // Constructor(TypedArray array) + array = arguments[0]; + + this.length = array.length; + this.byteLength = this.length * this.BYTES_PER_ELEMENT; + this.buffer = new ArrayBuffer(this.byteLength); + this.byteOffset = 0; + + for (i = 0; i < this.length; i += 1) { + this._setter(i, array._getter(i)); + } + } else if (typeof arguments[0] === 'object' && + !(arguments[0] instanceof ArrayBuffer || ECMAScript.Class(arguments[0]) === 'ArrayBuffer')) { + // Constructor(sequence array) + sequence = arguments[0]; + + this.length = ECMAScript.ToUint32(sequence.length); + this.byteLength = this.length * this.BYTES_PER_ELEMENT; + this.buffer = new ArrayBuffer(this.byteLength); + this.byteOffset = 0; + + for (i = 0; i < this.length; i += 1) { + s = sequence[i]; + this._setter(i, Number(s)); + } + } else if (typeof arguments[0] === 'object' && + (arguments[0] instanceof ArrayBuffer || ECMAScript.Class(arguments[0]) === 'ArrayBuffer')) { + // Constructor(ArrayBuffer buffer, + // optional unsigned long byteOffset, optional unsigned long length) + this.buffer = buffer; + + this.byteOffset = ECMAScript.ToUint32(byteOffset); + if (this.byteOffset > this.buffer.byteLength) { + throw new RangeError("byteOffset out of range"); + } + + if (this.byteOffset % this.BYTES_PER_ELEMENT) { + // The given byteOffset must be a multiple of the element + // size of the specific type, otherwise an exception is raised. + throw new RangeError("ArrayBuffer length minus the byteOffset is not a multiple of the element size."); + } + + if (arguments.length < 3) { + this.byteLength = this.buffer.byteLength - this.byteOffset; + + if (this.byteLength % this.BYTES_PER_ELEMENT) { + throw new RangeError("length of buffer minus byteOffset not a multiple of the element size"); + } + this.length = this.byteLength / this.BYTES_PER_ELEMENT; + } else { + this.length = ECMAScript.ToUint32(length); + this.byteLength = this.length * this.BYTES_PER_ELEMENT; + } + + if ((this.byteOffset + this.byteLength) > this.buffer.byteLength) { + throw new RangeError("byteOffset and length reference an area beyond the end of the buffer"); + } + } else { + throw new TypeError("Unexpected argument type(s)"); + } + + this.constructor = ctor; + + configureProperties(this); + makeArrayAccessors(this); + }; + + ctor.prototype = new ArrayBufferView(); + ctor.prototype.BYTES_PER_ELEMENT = bytesPerElement; + ctor.prototype._pack = pack; + ctor.prototype._unpack = unpack; + ctor.BYTES_PER_ELEMENT = bytesPerElement; + + // getter type (unsigned long index); + ctor.prototype._getter = function(index) { + if (arguments.length < 1) throw new SyntaxError("Not enough arguments"); + + index = ECMAScript.ToUint32(index); + if (index >= this.length) { + return undefined; + } + + var bytes = [], i, o; + for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT; + i < this.BYTES_PER_ELEMENT; + i += 1, o += 1) { + bytes.push(this.buffer._bytes[o]); + } + return this._unpack(bytes); + }; + + // NONSTANDARD: convenience alias for getter: type get(unsigned long index); + ctor.prototype.get = ctor.prototype._getter; + + // setter void (unsigned long index, type value); + ctor.prototype._setter = function(index, value) { + if (arguments.length < 2) throw new SyntaxError("Not enough arguments"); + + index = ECMAScript.ToUint32(index); + if (index >= this.length) { + return undefined; + } + + var bytes = this._pack(value), i, o; + for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT; + i < this.BYTES_PER_ELEMENT; + i += 1, o += 1) { + this.buffer._bytes[o] = bytes[i]; + } + }; + + // void set(TypedArray array, optional unsigned long offset); + // void set(sequence array, optional unsigned long offset); + ctor.prototype.set = function(index, value) { + if (arguments.length < 1) throw new SyntaxError("Not enough arguments"); + var array, sequence, offset, len, + i, s, d, + byteOffset, byteLength, tmp; + + if (typeof arguments[0] === 'object' && arguments[0].constructor === this.constructor) { + // void set(TypedArray array, optional unsigned long offset); + array = arguments[0]; + offset = ECMAScript.ToUint32(arguments[1]); + + if (offset + array.length > this.length) { + throw new RangeError("Offset plus length of array is out of range"); + } + + byteOffset = this.byteOffset + offset * this.BYTES_PER_ELEMENT; + byteLength = array.length * this.BYTES_PER_ELEMENT; + + if (array.buffer === this.buffer) { + tmp = []; + for (i = 0, s = array.byteOffset; i < byteLength; i += 1, s += 1) { + tmp[i] = array.buffer._bytes[s]; + } + for (i = 0, d = byteOffset; i < byteLength; i += 1, d += 1) { + this.buffer._bytes[d] = tmp[i]; + } + } else { + for (i = 0, s = array.byteOffset, d = byteOffset; + i < byteLength; i += 1, s += 1, d += 1) { + this.buffer._bytes[d] = array.buffer._bytes[s]; + } + } + } else if (typeof arguments[0] === 'object' && typeof arguments[0].length !== 'undefined') { + // void set(sequence array, optional unsigned long offset); + sequence = arguments[0]; + len = ECMAScript.ToUint32(sequence.length); + offset = ECMAScript.ToUint32(arguments[1]); + + if (offset + len > this.length) { + throw new RangeError("Offset plus length of array is out of range"); + } + + for (i = 0; i < len; i += 1) { + s = sequence[i]; + this._setter(offset + i, Number(s)); + } + } else { + throw new TypeError("Unexpected argument type(s)"); + } + }; + + // TypedArray subarray(long begin, optional long end); + ctor.prototype.subarray = function(start, end) { + function clamp(v, min, max) { return v < min ? min : v > max ? max : v; } + + start = ECMAScript.ToInt32(start); + end = ECMAScript.ToInt32(end); + + if (arguments.length < 1) { start = 0; } + if (arguments.length < 2) { end = this.length; } + + if (start < 0) { start = this.length + start; } + if (end < 0) { end = this.length + end; } + + start = clamp(start, 0, this.length); + end = clamp(end, 0, this.length); + + var len = end - start; + if (len < 0) { + len = 0; + } + + return new this.constructor( + this.buffer, this.byteOffset + start * this.BYTES_PER_ELEMENT, len); + }; + + return ctor; + } + + var Int8Array = makeConstructor(1, packI8, unpackI8); + var Uint8Array = makeConstructor(1, packU8, unpackU8); + var Uint8ClampedArray = makeConstructor(1, packU8Clamped, unpackU8); + var Int16Array = makeConstructor(2, packI16, unpackI16); + var Uint16Array = makeConstructor(2, packU16, unpackU16); + var Int32Array = makeConstructor(4, packI32, unpackI32); + var Uint32Array = makeConstructor(4, packU32, unpackU32); + var Float32Array = makeConstructor(4, packF32, unpackF32); + var Float64Array = makeConstructor(8, packF64, unpackF64); + + exports.Int8Array = exports.Int8Array || Int8Array; + exports.Uint8Array = exports.Uint8Array || Uint8Array; + exports.Uint8ClampedArray = exports.Uint8ClampedArray || Uint8ClampedArray; + exports.Int16Array = exports.Int16Array || Int16Array; + exports.Uint16Array = exports.Uint16Array || Uint16Array; + exports.Int32Array = exports.Int32Array || Int32Array; + exports.Uint32Array = exports.Uint32Array || Uint32Array; + exports.Float32Array = exports.Float32Array || Float32Array; + exports.Float64Array = exports.Float64Array || Float64Array; +}()); + +// +// 6 The DataView View Type +// + +(function() { + function r(array, index) { + return ECMAScript.IsCallable(array.get) ? array.get(index) : array[index]; + } + + var IS_BIG_ENDIAN = (function() { + var u16array = new(exports.Uint16Array)([0x1234]), + u8array = new(exports.Uint8Array)(u16array.buffer); + return r(u8array, 0) === 0x12; + }()); + + // Constructor(ArrayBuffer buffer, + // optional unsigned long byteOffset, + // optional unsigned long byteLength) + /** @constructor */ + var DataView = function DataView(buffer, byteOffset, byteLength) { + if (arguments.length === 0) { + buffer = new exports.ArrayBuffer(0); + } else if (!(buffer instanceof exports.ArrayBuffer || ECMAScript.Class(buffer) === 'ArrayBuffer')) { + throw new TypeError("TypeError"); + } + + this.buffer = buffer || new exports.ArrayBuffer(0); + + this.byteOffset = ECMAScript.ToUint32(byteOffset); + if (this.byteOffset > this.buffer.byteLength) { + throw new RangeError("byteOffset out of range"); + } + + if (arguments.length < 3) { + this.byteLength = this.buffer.byteLength - this.byteOffset; + } else { + this.byteLength = ECMAScript.ToUint32(byteLength); + } + + if ((this.byteOffset + this.byteLength) > this.buffer.byteLength) { + throw new RangeError("byteOffset and length reference an area beyond the end of the buffer"); + } + + configureProperties(this); + }; + + function makeGetter(arrayType) { + return function(byteOffset, littleEndian) { + + byteOffset = ECMAScript.ToUint32(byteOffset); + + if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) { + throw new RangeError("Array index out of range"); + } + byteOffset += this.byteOffset; + + var uint8Array = new exports.Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT), + bytes = [], i; + for (i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) { + bytes.push(r(uint8Array, i)); + } + + if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) { + bytes.reverse(); + } + + return r(new arrayType(new exports.Uint8Array(bytes).buffer), 0); + }; + } + + DataView.prototype.getUint8 = makeGetter(exports.Uint8Array); + DataView.prototype.getInt8 = makeGetter(exports.Int8Array); + DataView.prototype.getUint16 = makeGetter(exports.Uint16Array); + DataView.prototype.getInt16 = makeGetter(exports.Int16Array); + DataView.prototype.getUint32 = makeGetter(exports.Uint32Array); + DataView.prototype.getInt32 = makeGetter(exports.Int32Array); + DataView.prototype.getFloat32 = makeGetter(exports.Float32Array); + DataView.prototype.getFloat64 = makeGetter(exports.Float64Array); + + function makeSetter(arrayType) { + return function(byteOffset, value, littleEndian) { + + byteOffset = ECMAScript.ToUint32(byteOffset); + if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) { + throw new RangeError("Array index out of range"); + } + + // Get bytes + var typeArray = new arrayType([value]), + byteArray = new exports.Uint8Array(typeArray.buffer), + bytes = [], i, byteView; + + for (i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) { + bytes.push(r(byteArray, i)); + } + + // Flip if necessary + if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) { + bytes.reverse(); + } + + // Write them + byteView = new exports.Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT); + byteView.set(bytes); + }; + } + + DataView.prototype.setUint8 = makeSetter(exports.Uint8Array); + DataView.prototype.setInt8 = makeSetter(exports.Int8Array); + DataView.prototype.setUint16 = makeSetter(exports.Uint16Array); + DataView.prototype.setInt16 = makeSetter(exports.Int16Array); + DataView.prototype.setUint32 = makeSetter(exports.Uint32Array); + DataView.prototype.setInt32 = makeSetter(exports.Int32Array); + DataView.prototype.setFloat32 = makeSetter(exports.Float32Array); + DataView.prototype.setFloat64 = makeSetter(exports.Float64Array); + + exports.DataView = exports.DataView || DataView; + +}()); diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/package.json b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/package.json new file mode 100644 index 00000000000..b8b59f5c303 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/package.json @@ -0,0 +1,79 @@ +{ + "name": "typedarray", + "version": "0.0.6", + "description": "TypedArray polyfill for old browsers", + "main": "index.js", + "devDependencies": { + "tape": "~2.3.2" + }, + "scripts": { + "test": "tape test/*.js test/server/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/typedarray.git" + }, + "homepage": "https://github.com/substack/typedarray", + "keywords": [ + "ArrayBuffer", + "DataView", + "Float32Array", + "Float64Array", + "Int8Array", + "Int16Array", + "Int32Array", + "Uint8Array", + "Uint8ClampedArray", + "Uint16Array", + "Uint32Array", + "typed", + "array", + "polyfill" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "bugs": { + "url": "https://github.com/substack/typedarray/issues" + }, + "_id": "typedarray@0.0.6", + "dist": { + "shasum": "867ac74e3864187b1d3d47d996a78ec5c8830777", + "tarball": "http://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz" + }, + "_from": "typedarray@>=0.0.5 <0.1.0", + "_npmVersion": "1.4.3", + "_npmUser": { + "name": "substack", + "email": "mail@substack.net" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + } + ], + "directories": {}, + "_shasum": "867ac74e3864187b1d3d47d996a78ec5c8830777", + "_resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/readme.markdown b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/readme.markdown new file mode 100644 index 00000000000..d18f6f7197e --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/readme.markdown @@ -0,0 +1,61 @@ +# typedarray + +TypedArray polyfill ripped from [this +module](https://raw.github.com/inexorabletash/polyfill). + +[![build status](https://secure.travis-ci.org/substack/typedarray.png)](http://travis-ci.org/substack/typedarray) + +[![testling badge](https://ci.testling.com/substack/typedarray.png)](https://ci.testling.com/substack/typedarray) + +# example + +``` js +var Uint8Array = require('typedarray').Uint8Array; +var ua = new Uint8Array(5); +ua[1] = 256 + 55; +console.log(ua[1]); +``` + +output: + +``` +55 +``` + +# methods + +``` js +var TA = require('typedarray') +``` + +The `TA` object has the following constructors: + +* TA.ArrayBuffer +* TA.DataView +* TA.Float32Array +* TA.Float64Array +* TA.Int8Array +* TA.Int16Array +* TA.Int32Array +* TA.Uint8Array +* TA.Uint8ClampedArray +* TA.Uint16Array +* TA.Uint32Array + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install typedarray +``` + +To use this module in the browser, compile with +[browserify](http://browserify.org) +or download a UMD build from browserify CDN: + +http://wzrd.in/standalone/typedarray@latest + +# license + +MIT diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/test/server/undef_globals.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/test/server/undef_globals.js new file mode 100644 index 00000000000..425950f9fc9 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/test/server/undef_globals.js @@ -0,0 +1,19 @@ +var test = require('tape'); +var vm = require('vm'); +var fs = require('fs'); +var src = fs.readFileSync(__dirname + '/../../index.js', 'utf8'); + +test('u8a without globals', function (t) { + var c = { + module: { exports: {} }, + }; + c.exports = c.module.exports; + vm.runInNewContext(src, c); + var TA = c.module.exports; + var ua = new(TA.Uint8Array)(5); + + t.equal(ua.length, 5); + ua[1] = 256 + 55; + t.equal(ua[1], 55); + t.end(); +}); diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/test/tarray.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/test/tarray.js new file mode 100644 index 00000000000..df596a34f23 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/typedarray/test/tarray.js @@ -0,0 +1,10 @@ +var TA = require('../'); +var test = require('tape'); + +test('tiny u8a test', function (t) { + var ua = new(TA.Uint8Array)(5); + t.equal(ua.length, 5); + ua[1] = 256 + 55; + t.equal(ua[1], 55); + t.end(); +}); diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/package.json b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/package.json new file mode 100644 index 00000000000..0a5652171d2 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/package.json @@ -0,0 +1,78 @@ +{ + "name": "concat-stream", + "version": "1.4.8", + "description": "writable stream that concatenates strings or binary data and calls a callback with the result", + "tags": [ + "stream", + "simple", + "util", + "utility" + ], + "author": { + "name": "Max Ogden", + "email": "max@maxogden.com" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/maxogden/concat-stream.git" + }, + "bugs": { + "url": "http://github.com/maxogden/concat-stream/issues" + }, + "engines": [ + "node >= 0.8" + ], + "main": "index.js", + "scripts": { + "test": "tape test/*.js test/server/*.js" + }, + "license": "MIT", + "dependencies": { + "inherits": "~2.0.1", + "typedarray": "~0.0.5", + "readable-stream": "~1.1.9" + }, + "devDependencies": { + "tape": "~2.3.2" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/17..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "gitHead": "1f4ea1a7791b9366a133cab033eb0f3564cb0d92", + "homepage": "https://github.com/maxogden/concat-stream", + "_id": "concat-stream@1.4.8", + "_shasum": "e8325bb89e55000e52b626d97466fde1a28cfe5d", + "_from": "concat-stream@>=1.4.6 <2.0.0", + "_npmVersion": "2.7.0", + "_nodeVersion": "1.5.1", + "_npmUser": { + "name": "maxogden", + "email": "max@maxogden.com" + }, + "maintainers": [ + { + "name": "maxogden", + "email": "max@maxogden.com" + } + ], + "dist": { + "shasum": "e8325bb89e55000e52b626d97466fde1a28cfe5d", + "tarball": "http://registry.npmjs.org/concat-stream/-/concat-stream-1.4.8.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.4.8.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/readme.md b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/readme.md new file mode 100644 index 00000000000..d028aec3c0c --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/readme.md @@ -0,0 +1,84 @@ +# concat-stream + +Writable stream that concatenates strings or binary data and calls a callback with the result. Not a transform stream -- more of a stream sink. + +[![NPM](https://nodei.co/npm/concat-stream.png)](https://nodei.co/npm/concat-stream/) + +### examples + +#### Buffers + +```js +var fs = require('fs') +var concat = require('concat-stream') + +var readStream = fs.createReadStream('cat.png') +var concatStream = concat(gotPicture) + +readStream.on('error', handleError) +readStream.pipe(concatStream) + +function gotPicture(imageBuffer) { + // imageBuffer is all of `cat.png` as a node.js Buffer +} + +function handleError(err) { + // handle your error appropriately here, e.g.: + console.error(err) // print the error to STDERR + process.exit(1) // exit program with non-zero exit code +} + +``` + +#### Arrays + +```js +var write = concat(function(data) {}) +write.write([1,2,3]) +write.write([4,5,6]) +write.end() +// data will be [1,2,3,4,5,6] in the above callback +``` + +#### Uint8Arrays + +```js +var write = concat(function(data) {}) +var a = new Uint8Array(3) +a[0] = 97; a[1] = 98; a[2] = 99 +write.write(a) +write.write('!') +write.end(Buffer('!!1')) +``` + +See `test/` for more examples + +# methods + +```js +var concat = require('concat-stream') +``` + +## var writable = concat(opts={}, cb) + +Return a `writable` stream that will fire `cb(data)` with all of the data that +was written to the stream. Data can be written to `writable` as strings, +Buffers, arrays of byte integers, and Uint8Arrays. + +By default `concat-stream` will give you back the same data type as the type of the first buffer written to the stream. Use `opts.encoding` to set what format `data` should be returned as, e.g. if you if you don't want to rely on the built-in type checking or for some other reason. + +* `string` - get a string +* `buffer` - get back a Buffer +* `array` - get an array of byte integers +* `uint8array`, `u8`, `uint8` - get back a Uint8Array +* `object`, get back an array of Objects + +If you don't specify an encoding, and the types can't be inferred (e.g. you write things that aren't in the list above), it will try to convert concat them into a `Buffer`. + +# error handling + +`concat-stream` does not handle errors for you, so you must handle errors on whatever streams you pipe into `concat-stream`. This is a general rule when programming with node.js streams: always handle errors on each and every stream. Since `concat-stream` is not itself a stream it does not emit errors. + +# license + +MIT LICENSE diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/array.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/array.js new file mode 100644 index 00000000000..86e7dd43bf3 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/array.js @@ -0,0 +1,12 @@ +var concat = require('../') +var test = require('tape') + +test('array stream', function (t) { + t.plan(1) + var arrays = concat({ encoding: 'array' }, function(out) { + t.deepEqual(out, [1,2,3,4,5,6]) + }) + arrays.write([1,2,3]) + arrays.write([4,5,6]) + arrays.end() +}) diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/buffer.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/buffer.js new file mode 100644 index 00000000000..d28f5f9c1e2 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/buffer.js @@ -0,0 +1,31 @@ +var concat = require('../') +var test = require('tape') +var TA = require('typedarray') +var U8 = typeof Uint8Array !== 'undefined' ? Uint8Array : TA.Uint8Array + +test('buffer stream', function (t) { + t.plan(2) + var buffers = concat(function(out) { + t.ok(Buffer.isBuffer(out)) + t.equal(out.toString('utf8'), 'pizza Array is not a stringy cat') + }) + buffers.write(new Buffer('pizza Array is not a ', 'utf8')) + buffers.write(new Buffer('stringy cat')) + buffers.end() +}) + +test('buffer mixed writes', function (t) { + t.plan(2) + var buffers = concat(function(out) { + t.ok(Buffer.isBuffer(out)) + t.equal(out.toString('utf8'), 'pizza Array is not a stringy cat555') + }) + buffers.write(new Buffer('pizza')) + buffers.write(' Array is not a ') + buffers.write([ 115, 116, 114, 105, 110, 103, 121 ]) + var u8 = new U8(4) + u8[0] = 32; u8[1] = 99; u8[2] = 97; u8[3] = 116 + buffers.write(u8) + buffers.write(555) + buffers.end() +}) diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/infer.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/infer.js new file mode 100644 index 00000000000..91ab933f458 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/infer.js @@ -0,0 +1,15 @@ +var concat = require('../') +var test = require('tape') + +test('type inference works as expected', function(t) { + var stream = concat() + t.equal(stream.inferEncoding(['hello']), 'array', 'array') + t.equal(stream.inferEncoding(new Buffer('hello')), 'buffer', 'buffer') + t.equal(stream.inferEncoding(undefined), 'buffer', 'buffer') + t.equal(stream.inferEncoding(new Uint8Array(1)), 'uint8array', 'uint8array') + t.equal(stream.inferEncoding('hello'), 'string', 'string') + t.equal(stream.inferEncoding(''), 'string', 'string') + t.equal(stream.inferEncoding({hello: "world"}), 'object', 'object') + t.equal(stream.inferEncoding(1), 'buffer', 'buffer') + t.end() +}) diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/nothing.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/nothing.js new file mode 100644 index 00000000000..6ac60496582 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/nothing.js @@ -0,0 +1,25 @@ +var concat = require('../') +var test = require('tape') + +test('no callback stream', function (t) { + var stream = concat() + stream.write('space') + stream.end(' cats') + t.end() +}) + +test('no encoding set, no data', function (t) { + var stream = concat(function(data) { + t.deepEqual(data, []) + t.end() + }) + stream.end() +}) + +test('encoding set to string, no data', function (t) { + var stream = concat({ encoding: 'string' }, function(data) { + t.deepEqual(data, '') + t.end() + }) + stream.end() +}) diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/objects.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/objects.js new file mode 100644 index 00000000000..ad921ed25b9 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/objects.js @@ -0,0 +1,29 @@ +var concat = require('../') +var test = require('tape') + +test('writing objects', function (t) { + var stream = concat({encoding: "objects"}, concatted) + function concatted(objs) { + t.equal(objs.length, 2) + t.deepEqual(objs[0], {"foo": "bar"}) + t.deepEqual(objs[1], {"baz": "taco"}) + } + stream.write({"foo": "bar"}) + stream.write({"baz": "taco"}) + stream.end() + t.end() +}) + + +test('switch to objects encoding if no encoding specified and objects are written', function (t) { + var stream = concat(concatted) + function concatted(objs) { + t.equal(objs.length, 2) + t.deepEqual(objs[0], {"foo": "bar"}) + t.deepEqual(objs[1], {"baz": "taco"}) + } + stream.write({"foo": "bar"}) + stream.write({"baz": "taco"}) + stream.end() + t.end() +}) diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/server/ls.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/server/ls.js new file mode 100644 index 00000000000..3258d8ddcbe --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/server/ls.js @@ -0,0 +1,16 @@ +var concat = require('../../') +var spawn = require('child_process').spawn +var exec = require('child_process').exec +var test = require('tape') + +test('ls command', function (t) { + t.plan(1) + var cmd = spawn('ls', [ __dirname ]) + cmd.stdout.pipe( + concat(function(out) { + exec('ls ' + __dirname, function (err, body) { + t.equal(out.toString('utf8'), body.toString('utf8')) + }) + }) + ) +}) diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/string.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/string.js new file mode 100644 index 00000000000..218c522063b --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/string.js @@ -0,0 +1,76 @@ +var concat = require('../') +var test = require('tape') +var TA = require('typedarray') +var U8 = typeof Uint8Array !== 'undefined' ? Uint8Array : TA.Uint8Array + +test('string -> buffer stream', function (t) { + t.plan(2) + var strings = concat({ encoding: 'buffer'}, function(out) { + t.ok(Buffer.isBuffer(out)) + t.equal(out.toString('utf8'), 'nacho dogs') + }) + strings.write("nacho ") + strings.write("dogs") + strings.end() +}) + +test('string stream', function (t) { + t.plan(2) + var strings = concat({ encoding: 'string' }, function(out) { + t.equal(typeof out, 'string') + t.equal(out, 'nacho dogs') + }) + strings.write("nacho ") + strings.write("dogs") + strings.end() +}) + +test('end chunk', function (t) { + t.plan(1) + var endchunk = concat({ encoding: 'string' }, function(out) { + t.equal(out, 'this is the end') + }) + endchunk.write("this ") + endchunk.write("is the ") + endchunk.end("end") +}) + +test('string from mixed write encodings', function (t) { + t.plan(2) + var strings = concat({ encoding: 'string' }, function(out) { + t.equal(typeof out, 'string') + t.equal(out, 'nacho dogs') + }) + strings.write('na') + strings.write(Buffer('cho')) + strings.write([ 32, 100 ]) + var u8 = new U8(3) + u8[0] = 111; u8[1] = 103; u8[2] = 115; + strings.end(u8) +}) + +test('string from buffers with multibyte characters', function (t) { + t.plan(2) + var strings = concat({ encoding: 'string' }, function(out) { + t.equal(typeof out, 'string') + t.equal(out, '☃☃☃☃☃☃☃☃') + }) + var snowman = new Buffer('☃') + for (var i = 0; i < 8; i++) { + strings.write(snowman.slice(0, 1)) + strings.write(snowman.slice(1)) + } + strings.end() +}) + +test('string infer encoding with empty string chunk', function (t) { + t.plan(2) + var strings = concat(function(out) { + t.equal(typeof out, 'string') + t.equal(out, 'nacho dogs') + }) + strings.write("") + strings.write("nacho ") + strings.write("dogs") + strings.end() +}) diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/typedarray.js b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/typedarray.js new file mode 100644 index 00000000000..ee07110828a --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/node_modules/concat-stream/test/typedarray.js @@ -0,0 +1,33 @@ +var concat = require('../') +var test = require('tape') +var TA = require('typedarray') +var U8 = typeof Uint8Array !== 'undefined' ? Uint8Array : TA.Uint8Array + +test('typed array stream', function (t) { + t.plan(2) + var a = new U8(5) + a[0] = 97; a[1] = 98; a[2] = 99; a[3] = 100; a[4] = 101; + var b = new U8(3) + b[0] = 32; b[1] = 102; b[2] = 103; + var c = new U8(4) + c[0] = 32; c[1] = 120; c[2] = 121; c[3] = 122; + + var arrays = concat({ encoding: 'Uint8Array' }, function(out) { + t.equal(typeof out.subarray, 'function') + t.deepEqual(Buffer(out).toString('utf8'), 'abcde fg xyz') + }) + arrays.write(a) + arrays.write(b) + arrays.end(c) +}) + +test('typed array from strings, buffers, and arrays', function (t) { + t.plan(2) + var arrays = concat({ encoding: 'Uint8Array' }, function(out) { + t.equal(typeof out.subarray, 'function') + t.deepEqual(Buffer(out).toString('utf8'), 'abcde fg xyz') + }) + arrays.write('abcde') + arrays.write(Buffer(' fg ')) + arrays.end([ 120, 121, 122 ]) +}) diff --git a/deps/npm/node_modules/npm-registry-client/package.json b/deps/npm/node_modules/npm-registry-client/package.json index f9c447ee2be..23eacd5f97b 100644 --- a/deps/npm/node_modules/npm-registry-client/package.json +++ b/deps/npm/node_modules/npm-registry-client/package.json @@ -6,22 +6,23 @@ }, "name": "npm-registry-client", "description": "Client for the npm registry", - "version": "3.2.4", + "version": "6.4.0", "repository": { - "url": "git://github.com/isaacs/npm-registry-client" + "url": "git://github.com/isaacs/npm-registry-client.git" }, "main": "index.js", "scripts": { - "test": "tap test/*.js" + "test": "standard && tap test/*.js" }, "dependencies": { "chownr": "0", + "concat-stream": "^1.4.6", "graceful-fs": "^3.0.0", "mkdirp": "^0.5.0", - "normalize-package-data": "~1.0.1", - "npm-cache-filename": "^1.0.0", + "normalize-package-data": "~1.0.1 || ^2.0.0", + "npm-package-arg": "^3.0.0 || ^4.0.0", "once": "^1.3.0", - "request": "2 >=2.25.0", + "request": "^2.47.0", "retry": "^0.6.1", "rimraf": "2", "semver": "2 >=2.2.1 || 3.x || 4", @@ -29,22 +30,23 @@ "npmlog": "" }, "devDependencies": { - "concat-stream": "^1.4.6", - "npmconf": "^2.1.0", + "negotiator": "^0.4.9", + "nock": "^0.56.0", + "standard": "^3.2.0", "tap": "" }, "optionalDependencies": { "npmlog": "" }, "license": "ISC", - "readme": "# npm-registry-client\n\nThe code that npm uses to talk to the registry.\n\nIt handles all the caching and HTTP calls.\n\n## Usage\n\n```javascript\nvar RegClient = require('npm-registry-client')\nvar client = new RegClient(config)\nvar uri = \"npm://registry.npmjs.org/npm\"\nvar options = {timeout: 1000}\n\nclient.get(uri, options, function (error, data, raw, res) {\n // error is an error if there was a problem.\n // data is the parsed data object\n // raw is the json string\n // res is the response from couch\n})\n```\n\n# Registry URLs\n\nThe registry calls take either a full URL pointing to a resource in the\nregistry, or a base URL for the registry as a whole (for the base URL, any path\nwill be ignored). In addition to `http` and `https`, `npm` URLs are allowed.\n`npm` URLs are `https` URLs with the additional restrictions that they will\nalways include authorization credentials, and the response is always registry\nmetadata (and not tarballs or other attachments).\n\n# Configuration\n\nThis program is designed to work with\n[npmconf](https://npmjs.org/package/npmconf), but you can also pass in\na plain-jane object with the appropriate configs, and it'll shim it\nfor you. Any configuration thingie that has get/set/del methods will\nalso be accepted.\n\n* `cache` **Required** {String} Path to the cache folder\n* `always-auth` {Boolean} Auth even for GET requests.\n* `auth` {String} A base64-encoded `username:password`\n* `email` {String} User's email address\n* `tag` {String} The default tag to use when publishing new packages.\n Default = `\"latest\"`\n* `ca` {String} Cerficate signing authority certificates to trust.\n* `cert` {String} Client certificate (PEM encoded). Enable access\n to servers that require client certificates\n* `key` {String} Private key (PEM encoded) for client certificate 'cert'\n* `strict-ssl` {Boolean} Whether or not to be strict with SSL\n certificates. Default = `true`\n* `user-agent` {String} User agent header to send. Default =\n `\"node/{process.version} {process.platform} {process.arch}\"`\n* `log` {Object} The logger to use. Defaults to `require(\"npmlog\")` if\n that works, otherwise logs are disabled.\n* `fetch-retries` {Number} Number of times to retry on GET failures.\n Default=2\n* `fetch-retry-factor` {Number} `factor` setting for `node-retry`. Default=10\n* `fetch-retry-mintimeout` {Number} `minTimeout` setting for `node-retry`.\n Default=10000 (10 seconds)\n* `fetch-retry-maxtimeout` {Number} `maxTimeout` setting for `node-retry`.\n Default=60000 (60 seconds)\n* `proxy` {URL} The url to proxy requests through.\n* `https-proxy` {URL} The url to proxy https requests through.\n Defaults to be the same as `proxy` if unset.\n* `_auth` {String} The base64-encoded authorization header.\n* `username` `_password` {String} Username/password to use to generate\n `_auth` if not supplied.\n* `_token` {Object} A token for use with\n [couch-login](https://npmjs.org/package/couch-login)\n\n# client.request(method, uri, options, cb)\n\n* `method` {String} HTTP method\n* `uri` {String} URI pointing to the resource to request\n* `options` {Object} Object containing optional per-request properties.\n * `what` {Stream | Buffer | String | Object} The request body. Objects\n that are not Buffers or Streams are encoded as JSON.\n * `etag` {String} The cached ETag\n * `follow` {Boolean} Follow 302/301 responses (defaults to true)\n* `cb` {Function}\n * `error` {Error | null}\n * `data` {Object} the parsed data object\n * `raw` {String} the json\n * `res` {Response Object} response from couch\n\nMake a request to the registry. All the other methods are wrappers around\n`request`.\n\n# client.adduser(base, username, password, email, cb)\n\n* `base` {String} Base registry URL\n* `username` {String}\n* `password` {String}\n* `email` {String}\n* `cb` {Function}\n\nAdd a user account to the registry, or verify the credentials.\n\n# client.deprecate(uri, version, message, cb)\n\n* `uri` {String} Full registry URI for the deprecated package\n* `version` {String} Semver version range\n* `message` {String} The message to use as a deprecation warning\n* `cb` {Function}\n\nDeprecate a version of a package in the registry.\n\n# client.bugs(uri, cb)\n\n* `uri` {String} Full registry URI for the package\n* `cb` {Function}\n\nGet the url for bugs of a package\n\n# client.get(uri, options, cb)\n\n* `uri` {String} The complete registry URI to fetch\n* `options` {Object} Object containing optional per-request properties.\n * `timeout` {Number} Duration before the request times out.\n * `follow` {Boolean} Follow 302/301 responses (defaults to true)\n * `staleOk` {Boolean} If there's cached data available, then return that\n to the callback quickly, and update the cache the background.\n\nFetches data from the registry via a GET request, saving it in the cache folder\nwith the ETag.\n\n# client.publish(uri, data, tarball, cb)\n\n* `uri` {String} The registry URI to publish to\n* `data` {Object} Package data\n* `tarball` {String | Stream} Filename or stream of the package tarball\n* `cb` {Function}\n\nPublish a package to the registry.\n\nNote that this does not create the tarball from a folder. However, it can\naccept a gzipped tar stream or a filename to a tarball.\n\n# client.star(uri, starred, cb)\n\n* `uri` {String} The complete registry URI to star\n* `starred` {Boolean} True to star the package, false to unstar it.\n* `cb` {Function}\n\nStar or unstar a package.\n\nNote that the user does not have to be the package owner to star or unstar a\npackage, though other writes do require that the user be the package owner.\n\n# client.stars(base, username, cb)\n\n* `base` {String} The base URL for the registry\n* `username` {String} Name of user to fetch starred packages for.\n* `cb` {Function}\n\nView your own or another user's starred packages.\n\n# client.tag(uri, version, tag, cb)\n\n* `uri` {String} The complete registry URI to tag\n* `version` {String} Version to tag\n* `tag` {String} Tag name to apply\n* `cb` {Function}\n\nMark a version in the `dist-tags` hash, so that `pkg@tag` will fetch the\nspecified version.\n\n# client.unpublish(uri, [ver], cb)\n\n* `uri` {String} The complete registry URI to unpublish\n* `ver` {String} version to unpublish. Leave blank to unpublish all\n versions.\n* `cb` {Function}\n\nRemove a version of a package (or all versions) from the registry. When the\nlast version us unpublished, the entire document is removed from the database.\n\n# client.upload(uri, file, [etag], [nofollow], cb)\n\n* `uri` {String} The complete registry URI to upload to\n* `file` {String | Stream} Either the filename or a readable stream\n* `etag` {String} Cache ETag\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `cb` {Function}\n\nUpload an attachment. Mostly used by `client.publish()`.\n", + "readme": "# npm-registry-client\n\nThe code that npm uses to talk to the registry.\n\nIt handles all the caching and HTTP calls.\n\n## Usage\n\n```javascript\nvar RegClient = require('npm-registry-client')\nvar client = new RegClient(config)\nvar uri = \"https://registry.npmjs.org/npm\"\nvar params = {timeout: 1000}\n\nclient.get(uri, params, function (error, data, raw, res) {\n // error is an error if there was a problem.\n // data is the parsed data object\n // raw is the json string\n // res is the response from couch\n})\n```\n\n# Registry URLs\n\nThe registry calls take either a full URL pointing to a resource in the\nregistry, or a base URL for the registry as a whole (including the registry\npath – but be sure to terminate the path with `/`). `http` and `https` URLs are\nthe only ones supported.\n\n## Using the client\n\nEvery call to the client follows the same pattern:\n\n* `uri` {String} The *fully-qualified* URI of the registry API method being\n invoked.\n* `params` {Object} Per-request parameters.\n* `callback` {Function} Callback to be invoked when the call is complete.\n\n### Credentials\n\nMany requests to the registry can by authenticated, and require credentials\nfor authorization. These credentials always look the same:\n\n* `username` {String}\n* `password` {String}\n* `email` {String}\n* `alwaysAuth` {Boolean} Whether calls to the target registry are always\n authed.\n\n**or**\n\n* `token` {String}\n* `alwaysAuth` {Boolean} Whether calls to the target registry are always\n authed.\n\n## API\n\n### client.access(uri, params, cb)\n\n* `uri` {String} Registry URL for the package's access API endpoint.\n Looks like `/-/package//access`.\n* `params` {Object} Object containing per-request properties.\n * `access` {String} New access level for the package. Can be either\n `public` or `restricted`. Registry will raise an error if trying\n to change the access level of an unscoped package.\n * `auth` {Credentials}\n\nSet the access level for scoped packages. For now, there are only two\naccess levels: \"public\" and \"restricted\".\n\n### client.adduser(uri, params, cb)\n\n* `uri` {String} Base registry URL.\n* `params` {Object} Object containing per-request properties.\n * `auth` {Credentials}\n* `cb` {Function}\n * `error` {Error | null}\n * `data` {Object} the parsed data object\n * `raw` {String} the json\n * `res` {Response Object} response from couch\n\nAdd a user account to the registry, or verify the credentials.\n\n### client.deprecate(uri, params, cb)\n\n* `uri` {String} Full registry URI for the deprecated package.\n* `params` {Object} Object containing per-request properties.\n * `version` {String} Semver version range.\n * `message` {String} The message to use as a deprecation warning.\n * `auth` {Credentials}\n* `cb` {Function}\n\nDeprecate a version of a package in the registry.\n\n### client.distTags.fetch(uri, params, cb)\n\n* `uri` {String} Base URL for the registry.\n* `params` {Object} Object containing per-request properties.\n * `package` {String} Name of the package.\n * `auth` {Credentials}\n* `cb` {Function}\n\nFetch all of the `dist-tags` for the named package.\n\n### client.distTags.add(uri, params, cb)\n\n* `uri` {String} Base URL for the registry.\n* `params` {Object} Object containing per-request properties.\n * `package` {String} Name of the package.\n * `distTag` {String} Name of the new `dist-tag`.\n * `version` {String} Exact version to be mapped to the `dist-tag`.\n * `auth` {Credentials}\n* `cb` {Function}\n\nAdd (or replace) a single dist-tag onto the named package.\n\n### client.distTags.set(uri, params, cb)\n\n* `uri` {String} Base URL for the registry.\n* `params` {Object} Object containing per-request properties.\n * `package` {String} Name of the package.\n * `distTags` {Object} Object containing a map from tag names to package\n versions.\n * `auth` {Credentials}\n* `cb` {Function}\n\nSet all of the `dist-tags` for the named package at once, creating any\n`dist-tags` that do not already exit. Any `dist-tags` not included in the\n`distTags` map will be removed.\n\n### client.distTags.update(uri, params, cb)\n\n* `uri` {String} Base URL for the registry.\n* `params` {Object} Object containing per-request properties.\n * `package` {String} Name of the package.\n * `distTags` {Object} Object containing a map from tag names to package\n versions.\n * `auth` {Credentials}\n* `cb` {Function}\n\nUpdate the values of multiple `dist-tags`, creating any `dist-tags` that do\nnot already exist. Any pre-existing `dist-tags` not included in the `distTags`\nmap will be left alone.\n\n### client.distTags.rm(uri, params, cb)\n\n* `uri` {String} Base URL for the registry.\n* `params` {Object} Object containing per-request properties.\n * `package` {String} Name of the package.\n * `distTag` {String} Name of the new `dist-tag`.\n * `auth` {Credentials}\n* `cb` {Function}\n\nRemove a single `dist-tag` from the named package.\n\n### client.get(uri, params, cb)\n\n* `uri` {String} The complete registry URI to fetch\n* `params` {Object} Object containing per-request properties.\n * `timeout` {Number} Duration before the request times out. Optional\n (default: never).\n * `follow` {Boolean} Follow 302/301 responses. Optional (default: true).\n * `staleOk` {Boolean} If there's cached data available, then return that to\n the callback quickly, and update the cache the background. Optional\n (default: false).\n * `auth` {Credentials} Optional.\n* `cb` {Function}\n\nFetches data from the registry via a GET request, saving it in the cache folder\nwith the ETag or the \"Last Modified\" timestamp.\n\n### client.publish(uri, params, cb)\n\n* `uri` {String} The registry URI for the package to publish.\n* `params` {Object} Object containing per-request properties.\n * `metadata` {Object} Package metadata.\n * `access` {String} Access for the package. Can be `public` or `restricted` (no default).\n * `body` {Stream} Stream of the package body / tarball.\n * `auth` {Credentials}\n* `cb` {Function}\n\nPublish a package to the registry.\n\nNote that this does not create the tarball from a folder.\n\n### client.star(uri, params, cb)\n\n* `uri` {String} The complete registry URI for the package to star.\n* `params` {Object} Object containing per-request properties.\n * `starred` {Boolean} True to star the package, false to unstar it. Optional\n (default: false).\n * `auth` {Credentials}\n* `cb` {Function}\n\nStar or unstar a package.\n\nNote that the user does not have to be the package owner to star or unstar a\npackage, though other writes do require that the user be the package owner.\n\n### client.stars(uri, params, cb)\n\n* `uri` {String} The base URL for the registry.\n* `params` {Object} Object containing per-request properties.\n * `username` {String} Name of user to fetch starred packages for. Optional\n (default: user in `auth`).\n * `auth` {Credentials} Optional (required if `username` is omitted).\n* `cb` {Function}\n\nView your own or another user's starred packages.\n\n### client.tag(uri, params, cb)\n\n* `uri` {String} The complete registry URI to tag\n* `params` {Object} Object containing per-request properties.\n * `version` {String} Version to tag.\n * `tag` {String} Tag name to apply.\n * `auth` {Credentials}\n* `cb` {Function}\n\nMark a version in the `dist-tags` hash, so that `pkg@tag` will fetch the\nspecified version.\n\n### client.unpublish(uri, params, cb)\n\n* `uri` {String} The complete registry URI of the package to unpublish.\n* `params` {Object} Object containing per-request properties.\n * `version` {String} version to unpublish. Optional – omit to unpublish all\n versions.\n * `auth` {Credentials}\n* `cb` {Function}\n\nRemove a version of a package (or all versions) from the registry. When the\nlast version us unpublished, the entire document is removed from the database.\n\n### client.whoami(uri, params, cb)\n\n* `uri` {String} The base registry for the URI.\n* `params` {Object} Object containing per-request properties.\n * `auth` {Credentials}\n* `cb` {Function}\n\nSimple call to see who the registry thinks you are. Especially useful with\ntoken-based auth.\n\n\n## PLUMBING\n\nThe below are primarily intended for use by the rest of the API, or by the npm\ncaching logic directly.\n\n### client.request(uri, params, cb)\n\n* `uri` {String} URI pointing to the resource to request.\n* `params` {Object} Object containing per-request properties.\n * `method` {String} HTTP method. Optional (default: \"GET\").\n * `body` {Stream | Buffer | String | Object} The request body. Objects\n that are not Buffers or Streams are encoded as JSON. Optional – body\n only used for write operations.\n * `etag` {String} The cached ETag. Optional.\n * `lastModified` {String} The cached Last-Modified timestamp. Optional.\n * `follow` {Boolean} Follow 302/301 responses. Optional (default: true).\n * `auth` {Credentials} Optional.\n* `cb` {Function}\n * `error` {Error | null}\n * `data` {Object} the parsed data object\n * `raw` {String} the json\n * `res` {Response Object} response from couch\n\nMake a generic request to the registry. All the other methods are wrappers\naround `client.request`.\n\n### client.fetch(uri, params, cb)\n\n* `uri` {String} The complete registry URI to upload to\n* `params` {Object} Object containing per-request properties.\n * `headers` {Stream} HTTP headers to be included with the request. Optional.\n * `auth` {Credentials} Optional.\n* `cb` {Function}\n\nFetch a package from a URL, with auth set appropriately if included. Used to\ncache remote tarballs as well as request package tarballs from the registry.\n\n# Configuration\n\nThe client uses its own configuration, which is just passed in as a simple\nnested object. The following are the supported values (with their defaults, if\nany):\n\n* `proxy.http` {URL} The URL to proxy HTTP requests through.\n* `proxy.https` {URL} The URL to proxy HTTPS requests through. Defaults to be\n the same as `proxy.http` if unset.\n* `proxy.localAddress` {IP} The local address to use on multi-homed systems.\n* `ssl.ca` {String} Certificate signing authority certificates to trust.\n* `ssl.certificate` {String} Client certificate (PEM encoded). Enable access\n to servers that require client certificates.\n* `ssl.key` {String} Private key (PEM encoded) for client certificate.\n* `ssl.strict` {Boolean} Whether or not to be strict with SSL certificates.\n Default = `true`\n* `retry.count` {Number} Number of times to retry on GET failures. Default = 2.\n* `retry.factor` {Number} `factor` setting for `node-retry`. Default = 10.\n* `retry.minTimeout` {Number} `minTimeout` setting for `node-retry`.\n Default = 10000 (10 seconds)\n* `retry.maxTimeout` {Number} `maxTimeout` setting for `node-retry`.\n Default = 60000 (60 seconds)\n* `userAgent` {String} User agent header to send. Default =\n `\"node/{process.version}\"`\n* `log` {Object} The logger to use. Defaults to `require(\"npmlog\")` if\n that works, otherwise logs are disabled.\n* `defaultTag` {String} The default tag to use when publishing new packages.\n Default = `\"latest\"`\n* `couchToken` {Object} A token for use with\n [couch-login](https://npmjs.org/package/couch-login).\n* `sessionToken` {string} A random identifier for this set of client requests.\n Default = 8 random hexadecimal bytes.\n", "readmeFilename": "README.md", - "gitHead": "ddafd4913bdca30a1f9111660767f71653604b57", + "gitHead": "a8d3193832487fb2e6b5015e30d15fe1b15f48e2", "bugs": { "url": "https://github.com/isaacs/npm-registry-client/issues" }, "homepage": "https://github.com/isaacs/npm-registry-client", - "_id": "npm-registry-client@3.2.4", - "_shasum": "8659b3449e1c9a9f8181dad142cadb048bfe521f", - "_from": "npm-registry-client@>=3.2.4 <3.3.0" + "_id": "npm-registry-client@6.4.0", + "_shasum": "4da1adfd1b63c9a7b9a6626eb10e36665c29b5f4", + "_from": "npm-registry-client@6.4.0" } diff --git a/deps/npm/node_modules/npm-registry-client/test/00-setup.js b/deps/npm/node_modules/npm-registry-client/test/00-setup.js index ae6d03ed3f3..747768fb85f 100644 --- a/deps/npm/node_modules/npm-registry-client/test/00-setup.js +++ b/deps/npm/node_modules/npm-registry-client/test/00-setup.js @@ -1,10 +1,10 @@ -var tap = require("tap") -var rimraf = require("rimraf") +var tap = require('tap') +var rimraf = require('rimraf') -tap.test("setup", function (t) { - rimraf(__dirname + "/fixtures/cache", function (er) { +tap.test('setup', function (t) { + rimraf(__dirname + '/fixtures/cache', function (er) { if (er) throw er - t.pass("cache cleaned") + t.pass('cache cleaned') t.end() }) }) diff --git a/deps/npm/node_modules/npm-registry-client/test/access.js b/deps/npm/node_modules/npm-registry-client/test/access.js new file mode 100644 index 00000000000..4081c329f7f --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/access.js @@ -0,0 +1,96 @@ +var test = require('tap').test + +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() + +function nop () {} + +var URI = 'http://localhost:1337/-/package/underscore/access' +var TOKEN = 'foo' +var AUTH = { + token: TOKEN +} +var LEVEL = 'public' +var PARAMS = { + level: LEVEL, + auth: AUTH +} + +test('access call contract', function (t) { + t.throws(function () { + client.access(undefined, AUTH, nop) + }, 'requires a URI') + + t.throws(function () { + client.access([], PARAMS, nop) + }, 'requires URI to be a string') + + t.throws(function () { + client.access(URI, undefined, nop) + }, 'requires params object') + + t.throws(function () { + client.access(URI, '', nop) + }, 'params must be object') + + t.throws(function () { + client.access(URI, PARAMS, undefined) + }, 'requires callback') + + t.throws(function () { + client.access(URI, PARAMS, 'callback') + }, 'callback must be function') + + t.throws( + function () { + var params = { + auth: AUTH + } + client.access(URI, params, nop) + }, + { name: 'AssertionError', message: 'must pass level to access' }, + 'access must include level' + ) + + t.throws( + function () { + var params = { + level: LEVEL + } + client.access(URI, params, nop) + }, + { name: 'AssertionError', message: 'must pass auth to access' }, + 'access must include auth' + ) + + t.end() +}) + +test('set access level on a package', function (t) { + server.expect('POST', '/-/package/underscore/access', function (req, res) { + t.equal(req.method, 'POST') + + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { + b += d + }) + + req.on('end', function () { + var updated = JSON.parse(b) + + t.deepEqual(updated, { access: 'public' }) + + res.statusCode = 201 + res.json({ accessChanged: true }) + }) + }) + + client.access(URI, PARAMS, function (error, data) { + t.ifError(error, 'no errors') + t.ok(data.accessChanged, 'access level set') + + t.end() + }) +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/adduser-new.js b/deps/npm/node_modules/npm-registry-client/test/adduser-new.js index 57dca0b520d..d8c415bc5f6 100644 --- a/deps/npm/node_modules/npm-registry-client/test/adduser-new.js +++ b/deps/npm/node_modules/npm-registry-client/test/adduser-new.js @@ -1,44 +1,57 @@ -var tap = require("tap") +var tap = require('tap') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') var client = common.freshClient() -var password = "%1234@asdf%" -, username = "username" -, email = "i@izs.me" -, userdata = { +var password = '%1234@asdf%' +var username = 'username' +var email = 'i@izs.me' +var userdata = { name: username, email: email, - _id: "org.couchdb.user:username", - type: "user", + _id: 'org.couchdb.user:username', + type: 'user', roles: [], - date: "2012-06-07T04:11:21.591Z" } -, SD = require("string_decoder").StringDecoder -, decoder = new SD() - -tap.test("create new user account", function (t) { - server.expect("/-/user/org.couchdb.user:username", function (req, res) { - t.equal(req.method, "PUT") - var b = "" - req.on("data", function (d) { + date: '2012-06-07T04:11:21.591Z' +} + +var SD = require('string_decoder').StringDecoder +var decoder = new SD() + +tap.test('create new user account', function (t) { + var auth = { + username: username, + password: password, + email: email + } + var params = { auth: auth } + + server.expect('/registry/_design/app/_rewrite/-/user/org.couchdb.user:username', function (req, res) { + t.equal(req.method, 'PUT') + var b = '' + req.on('data', function (d) { b += decoder.write(d) }) - req.on("end", function () { + req.on('end', function () { var o = JSON.parse(b) userdata.password = password userdata.date = o.date t.deepEqual(o, userdata) res.statusCode = 201 - res.json({created:true}) + res.json(auth) }) }) - client.adduser("http://localhost:1337/", username, password, email, function (er, data) { - if (er) throw er - t.deepEqual(data, { created: true }) - t.end() - }) + client.adduser( + 'http://localhost:1337/registry/_design/app/_rewrite', + params, + function (er, data) { + if (er) throw er + t.deepEqual(data, auth, 'received expected auth data') + t.end() + } + ) }) diff --git a/deps/npm/node_modules/npm-registry-client/test/adduser-update.js b/deps/npm/node_modules/npm-registry-client/test/adduser-update.js index 2c5ccde6ead..18aad3ebe4b 100644 --- a/deps/npm/node_modules/npm-registry-client/test/adduser-update.js +++ b/deps/npm/node_modules/npm-registry-client/test/adduser-update.js @@ -1,57 +1,67 @@ -var tap = require("tap") +var tap = require('tap') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') var client = common.freshClient() -var password = "%1234@asdf%" -, username = "username" -, email = "i@izs.me" -, userdata = { +var password = '%1234@asdf%' +var username = 'username' +var email = 'i@izs.me' +var userdata = { name: username, email: email, - _id: "org.couchdb.user:username", - type: "user", + _id: 'org.couchdb.user:username', + type: 'user', roles: [], - date: "2012-06-07T04:11:21.591Z" } -, SD = require("string_decoder").StringDecoder -, decoder = new SD() + date: '2012-06-07T04:11:21.591Z' } +var SD = require('string_decoder').StringDecoder +var decoder = new SD() +tap.test('update a user acct', function (t) { + var auth = { + username: username, + password: password, + email: email + } + var params = { auth: auth } -tap.test("update a user acct", function (t) { - server.expect("PUT", "/-/user/org.couchdb.user:username", function (req, res) { - t.equal(req.method, "PUT") + server.expect('PUT', '/-/user/org.couchdb.user:username', function (req, res) { + t.equal(req.method, 'PUT') res.statusCode = 409 - res.json({error: "conflict"}) + res.json({error: 'conflict'}) }) - server.expect("GET", "/-/user/org.couchdb.user:username?write=true", function (req, res) { - t.equal(req.method, "GET") + server.expect('GET', '/-/user/org.couchdb.user:username?write=true', function (req, res) { + t.equal(req.method, 'GET') res.json(userdata) }) - server.expect("PUT", "/-/user/org.couchdb.user:username/-rev/" + userdata._rev, function (req, res) { - t.equal(req.method, "PUT") + server.expect('PUT', '/-/user/org.couchdb.user:username/-rev/' + userdata._rev, function (req, res) { + t.equal(req.method, 'PUT') - var b = "" - req.on("data", function (d) { + var b = '' + req.on('data', function (d) { b += decoder.write(d) }) - req.on("end", function () { + req.on('end', function () { var o = JSON.parse(b) userdata.password = password userdata.date = o.date t.deepEqual(o, userdata) res.statusCode = 201 - res.json({created:true}) + res.json(auth) }) }) - client.adduser("http://localhost:1337/", username, password, email, function (er, data) { - if (er) throw er - t.deepEqual(data, { created: true }) - t.end() - }) + client.adduser( + 'http://localhost:1337/', + params, + function (er, data) { + if (er) throw er + t.deepEqual(data, auth, 'got expected auth data') + t.end() + } + ) }) diff --git a/deps/npm/node_modules/npm-registry-client/test/adduser.js b/deps/npm/node_modules/npm-registry-client/test/adduser.js new file mode 100644 index 00000000000..10816ebf95f --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/adduser.js @@ -0,0 +1,162 @@ +var test = require('tap').test + +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() + +function nop () {} + +var URI = 'https://npm.registry:8043/rewrite' +var USERNAME = 'username' +var PASSWORD = 'password' +var EMAIL = 'n@p.m' +var AUTH = { + auth: { + username: USERNAME, + password: PASSWORD, + email: EMAIL + } +} + +test('adduser call contract', function (t) { + t.throws(function () { + client.adduser(undefined, AUTH, nop) + }, 'requires a URI') + + t.throws(function () { + client.adduser([], AUTH, nop) + }, 'requires URI to be a string') + + t.throws(function () { + client.adduser(URI, undefined, nop) + }, 'requires params object') + + t.throws(function () { + client.adduser(URI, '', nop) + }, 'params must be object') + + t.throws(function () { + client.adduser(URI, AUTH, undefined) + }, 'requires callback') + + t.throws(function () { + client.adduser(URI, AUTH, 'callback') + }, 'callback must be function') + + t.throws( + function () { + var params = { + auth: { + password: PASSWORD, + email: EMAIL + } + } + client.adduser(URI, params, nop) + }, + { name: 'AssertionError', message: 'must include username in auth' }, + 'auth must include username' + ) + + t.throws( + function () { + var params = { + auth: { + username: USERNAME, + email: EMAIL + } + } + client.adduser(URI, params, nop) + }, + { name: 'AssertionError', message: 'must include password in auth' }, + 'auth must include password' + ) + + t.throws( + function () { + var params = { + auth: { + username: USERNAME, + password: PASSWORD + } + } + client.adduser(URI, params, nop) + }, + { name: 'AssertionError', message: 'must include email in auth' }, + 'auth must include email' + ) + + t.test('username missing', function (t) { + var params = { + auth: { + username: '', + password: PASSWORD, + email: EMAIL + } + } + client.adduser(URI, params, function (err) { + t.equal(err && err.message, 'No username supplied.', 'username must not be empty') + t.end() + }) + }) + + t.test('password missing', function (t) { + var params = { + auth: { + username: USERNAME, + password: '', + email: EMAIL + } + } + client.adduser(URI, params, function (err) { + t.equal( + err && err.message, + 'No password supplied.', + 'password must not be empty' + ) + t.end() + }) + }) + + t.test('email missing', function (t) { + var params = { + auth: { + username: USERNAME, + password: PASSWORD, + email: '' + } + } + client.adduser(URI, params, function (err) { + t.equal( + err && err.message, + 'No email address supplied.', + 'email must not be empty' + ) + t.end() + }) + }) + + t.test('email malformed', function (t) { + var params = { + auth: { + username: USERNAME, + password: PASSWORD, + email: 'lolbutts' + } + } + client.adduser(URI, params, function (err) { + t.equal( + err && err.message, + 'Please use a real email address.', + 'email must look like email' + ) + t.end() + }) + }) + + t.end() +}) + +test('cleanup', function (t) { + server.close() + t.end() +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/bugs.js b/deps/npm/node_modules/npm-registry-client/test/bugs.js deleted file mode 100644 index 799445295d3..00000000000 --- a/deps/npm/node_modules/npm-registry-client/test/bugs.js +++ /dev/null @@ -1,28 +0,0 @@ -var tap = require("tap") - -var server = require("./lib/server.js") -var common = require("./lib/common.js") -var client = common.freshClient() - -tap.test("get the URL for the bugs page on a package", function (t) { - server.expect("GET", "/sample/latest", function (req, res) { - t.equal(req.method, "GET") - - res.json({ - bugs : { - url : "http://github.com/example/sample/issues", - email : "sample@example.com" - } - }) - }) - - client.bugs("http://localhost:1337/sample", function (error, info) { - t.ifError(error) - - t.ok(info.url, "got the URL") - t.ok(info.email, "got the email address") - - t.end() - }) -}) - diff --git a/deps/npm/node_modules/npm-registry-client/test/config-defaults.js b/deps/npm/node_modules/npm-registry-client/test/config-defaults.js new file mode 100644 index 00000000000..a432da85811 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/config-defaults.js @@ -0,0 +1,42 @@ +var test = require('tap').test + +require('./lib/server.js').close() +var common = require('./lib/common.js') + +test('config defaults', function (t) { + var client = common.freshClient() + + var proxy = client.config.proxy + t.notOk(proxy.http, 'no default value for HTTP proxy') + t.notOk(proxy.https, 'no default value for HTTPS proxy') + t.notOk(proxy.localAddress, 'no default value for local address') + + var ssl = client.config.ssl + t.notOk(ssl.ca, 'no default value for SSL certificate authority bundle') + t.notOk(ssl.certificate, 'no default value for SSL client certificate') + t.notOk(ssl.key, 'no default value for SSL client certificate key') + t.equal(ssl.strict, true, 'SSL is strict by default') + + var retry = client.config.retry + t.equal(retry.retries, 2, 'default retry count is 2') + t.equal(retry.factor, 10, 'default retry factor is 10') + t.equal(retry.minTimeout, 10000, 'retry minimum timeout is 10000 (10 seconds)') + t.equal(retry.maxTimeout, 60000, 'retry maximum timeout is 60000 (60 seconds)') + + t.equal(client.config.userAgent, 'node/' + process.version, 'default userAgent') + t.ok(client.log.info, "there's a default logger") + t.equal(client.config.defaultTag, 'latest', 'default tag is "latest"') + t.notOk(client.config.couchToken, 'no couchToken by default') + t.notOk(client.config.sessionToken, 'no sessionToken by default') + + t.end() +}) + +test('missing HTTPS proxy defaults to HTTP proxy', function (t) { + var client = common.freshClient({ proxy: { http: 'http://proxy.npm:8088/' }}) + + t.equal(client.config.proxy.http, 'http://proxy.npm:8088/', 'HTTP proxy set') + t.equal(client.config.proxy.http, client.config.proxy.https, 'HTTP === HTTPS') + + t.end() +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/config-override.js b/deps/npm/node_modules/npm-registry-client/test/config-override.js new file mode 100644 index 00000000000..026cb199cbe --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/config-override.js @@ -0,0 +1,57 @@ +var test = require('tap').test + +require('./lib/server.js').close() +var common = require('./lib/common.js') +var config = { + proxy: { + http: 'http://proxy.npm:8088/', + https: 'https://proxy.npm:8043/', + localAddress: 'localhost.localdomain' + }, + ssl: { + ca: 'not including a PEM', + certificate: 'still not including a PEM', + key: 'nope', + strict: false + }, + retry: { + count: 1, + factor: 9001, + minTimeout: -1, + maxTimeout: Infinity + }, + userAgent: 'npm-awesome/4 (Mozilla 5.0)', + log: { fake: function () {} }, + defaultTag: 'next', + couchToken: { object: true }, + sessionToken: 'hamchunx' +} + +test('config defaults', function (t) { + var client = common.freshClient(config) + + var proxy = client.config.proxy + t.equal(proxy.http, 'http://proxy.npm:8088/') + t.equal(proxy.https, 'https://proxy.npm:8043/') + t.equal(proxy.localAddress, 'localhost.localdomain') + + var ssl = client.config.ssl + t.equal(ssl.ca, 'not including a PEM') + t.equal(ssl.certificate, 'still not including a PEM') + t.equal(ssl.key, 'nope') + t.equal(ssl.strict, false) + + var retry = client.config.retry + t.equal(retry.count, 1) + t.equal(retry.factor, 9001) + t.equal(retry.minTimeout, -1) + t.equal(retry.maxTimeout, Infinity) + + t.equal(client.config.userAgent, 'npm-awesome/4 (Mozilla 5.0)') + t.ok(client.log.fake) + t.equal(client.config.defaultTag, 'next') + t.ok(client.config.couchToken.object) + t.equal(client.config.sessionToken, 'hamchunx') + + t.end() +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/deprecate.js b/deps/npm/node_modules/npm-registry-client/test/deprecate.js index 76a5ba128d8..d49f71215cf 100644 --- a/deps/npm/node_modules/npm-registry-client/test/deprecate.js +++ b/deps/npm/node_modules/npm-registry-client/test/deprecate.js @@ -1,66 +1,156 @@ -var tap = require("tap") +var test = require('tap').test -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var cache = require('./fixtures/underscore/cache.json') -var nerfed = "//localhost:" + server.port + "/:" +var client = common.freshClient() -var configuration = {} -configuration[nerfed + "_authToken"] = "not-bad-meaning-bad-but-bad-meaning-wombat" +function nop () {} -var client = common.freshClient(configuration) +var URI = 'https://npm.registry:8043/rewrite' +var VERSION = '1.3.2' +var MESSAGE = 'uhhh' +var TOKEN = 'lolbutts' +var AUTH = { + token: TOKEN +} +var PARAMS = { + version: VERSION, + message: MESSAGE, + auth: AUTH +} -var cache = require("./fixtures/underscore/cache.json") +test('deprecate call contract', function (t) { + t.throws(function () { + client.deprecate(undefined, PARAMS, nop) + }, 'requires a URI') -var VERSION = "1.3.2" -var MESSAGE = "uhhh" + t.throws(function () { + client.deprecate([], PARAMS, nop) + }, 'requires URI to be a string') -tap.test("deprecate a package", function (t) { - server.expect("GET", "/underscore?write=true", function (req, res) { - t.equal(req.method, "GET") + t.throws(function () { + client.deprecate(URI, undefined, nop) + }, 'requires params object') + + t.throws(function () { + client.deprecate(URI, '', nop) + }, 'params must be object') + + t.throws(function () { + client.deprecate(URI, PARAMS, undefined) + }, 'requires callback') + + t.throws(function () { + client.deprecate(URI, PARAMS, 'callback') + }, 'callback must be function') + + t.throws( + function () { + var params = { + message: MESSAGE, + auth: AUTH + } + client.deprecate(URI, params, nop) + }, + { name: 'AssertionError', message: 'must pass version to deprecate' }, + 'params must include version to deprecate' + ) + + t.throws( + function () { + var params = { + version: VERSION, + auth: AUTH + } + client.deprecate(URI, params, nop) + }, + { name: 'AssertionError', message: 'must pass message to deprecate' }, + 'params must include deprecation message' + ) + + t.throws( + function () { + var params = { + version: VERSION, + message: MESSAGE + } + client.deprecate(URI, params, nop) + }, + { name: 'AssertionError', message: 'must pass auth to deprecate' }, + 'params must include auth' + ) + + t.test('malformed semver in deprecation', function (t) { + var params = { + version: '-9001', + message: MESSAGE, + auth: AUTH + } + client.deprecate(URI, params, function (err) { + t.equal( + err && err.message, + 'invalid version range: -9001', + 'got expected semver validation failure' + ) + t.end() + }) + }) + + t.end() +}) + +test('deprecate a package', function (t) { + server.expect('GET', '/underscore?write=true', function (req, res) { + t.equal(req.method, 'GET') res.json(cache) }) - server.expect("PUT", "/underscore", function (req, res) { - t.equal(req.method, "PUT") + server.expect('PUT', '/underscore', function (req, res) { + t.equal(req.method, 'PUT') - var b = "" - req.setEncoding("utf8") - req.on("data", function (d) { + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { b += d }) - req.on("end", function () { + req.on('end', function () { var updated = JSON.parse(b) - var undeprecated = [ - "1.0.3", "1.0.4", "1.1.0", "1.1.1", "1.1.2", "1.1.3", "1.1.4", "1.1.5", "1.1.6", - "1.1.7", "1.2.0", "1.2.1", "1.2.2", "1.2.3", "1.2.4", "1.3.0", "1.3.1", "1.3.3" + var undeprecated = [ + '1.0.3', '1.0.4', '1.1.0', '1.1.1', '1.1.2', '1.1.3', '1.1.4', '1.1.5', '1.1.6', + '1.1.7', '1.2.0', '1.2.1', '1.2.2', '1.2.3', '1.2.4', '1.3.0', '1.3.1', '1.3.3' ] for (var i = 0; i < undeprecated.length; i++) { var current = undeprecated[i] t.notEqual( updated.versions[current].deprecated, MESSAGE, - current + " not deprecated" + current + ' not deprecated' ) } t.equal( updated.versions[VERSION].deprecated, MESSAGE, - VERSION + " deprecated" + VERSION + ' deprecated' ) res.statusCode = 201 - res.json({deprecated:true}) + res.json({ deprecated: true }) }) }) - client.deprecate(common.registry + "/underscore", VERSION, MESSAGE, function (er, data) { - t.ifError(er) - t.ok(data.deprecated, "was deprecated") + client.deprecate( + common.registry + '/underscore', + PARAMS, + function (er, data) { + t.ifError(er) + t.ok(data.deprecated, 'was deprecated') - t.end() - }) + t.end() + } + ) }) diff --git a/deps/npm/node_modules/npm-registry-client/test/dist-tags-add.js b/deps/npm/node_modules/npm-registry-client/test/dist-tags-add.js new file mode 100644 index 00000000000..e66d80a3e32 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/dist-tags-add.js @@ -0,0 +1,141 @@ +var test = require('tap').test + +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() + +function nop () {} + +var BASE_URL = 'http://localhost:1337/' +var URI = '/-/package/underscore/dist-tags/test' +var TOKEN = 'foo' +var AUTH = { + token: TOKEN +} +var PACKAGE = 'underscore' +var DIST_TAG = 'test' +var VERSION = '3.1.3' +var PARAMS = { + 'package': PACKAGE, + distTag: DIST_TAG, + version: VERSION, + auth: AUTH +} + +test('distTags.add call contract', function (t) { + t.throws(function () { + client.distTags.add(undefined, AUTH, nop) + }, 'requires a URI') + + t.throws(function () { + client.distTags.add([], PARAMS, nop) + }, 'requires URI to be a string') + + t.throws(function () { + client.distTags.add(BASE_URL, undefined, nop) + }, 'requires params object') + + t.throws(function () { + client.distTags.add(BASE_URL, '', nop) + }, 'params must be object') + + t.throws(function () { + client.distTags.add(BASE_URL, PARAMS, undefined) + }, 'requires callback') + + t.throws(function () { + client.distTags.add(BASE_URL, PARAMS, 'callback') + }, 'callback must be function') + + t.throws( + function () { + var params = { + distTag: DIST_TAG, + version: VERSION, + auth: AUTH + } + client.distTags.add(BASE_URL, params, nop) + }, + { + name: 'AssertionError', + message: 'must pass package name to distTags.add' + }, + 'distTags.add must include package name' + ) + + t.throws( + function () { + var params = { + 'package': PACKAGE, + version: VERSION, + auth: AUTH + } + client.distTags.add(BASE_URL, params, nop) + }, + { + name: 'AssertionError', + message: 'must pass package distTag name to distTags.add' + }, + 'distTags.add must include dist-tag' + ) + + t.throws( + function () { + var params = { + 'package': PACKAGE, + distTag: DIST_TAG, + auth: AUTH + } + client.distTags.add(BASE_URL, params, nop) + }, + { + name: 'AssertionError', + message: 'must pass version to be mapped to distTag to distTags.add' + }, + 'distTags.add must include version' + ) + + t.throws( + function () { + var params = { + 'package': PACKAGE, + distTag: DIST_TAG, + version: VERSION + } + client.distTags.add(BASE_URL, params, nop) + }, + { name: 'AssertionError', message: 'must pass auth to distTags.add' }, + 'distTags.add must include auth' + ) + + t.end() +}) + +test('add a new dist-tag to a package', function (t) { + server.expect('PUT', URI, function (req, res) { + t.equal(req.method, 'PUT') + + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { + b += d + }) + + req.on('end', function () { + t.doesNotThrow(function () { + var parsed = JSON.parse(b) + t.deepEqual(parsed, VERSION) + + res.statusCode = 200 + res.json({ test: VERSION }) + }, 'got valid JSON from client') + }) + }) + + client.distTags.add(BASE_URL, PARAMS, function (error, data) { + t.ifError(error, 'no errors') + t.ok(data.test, 'dist-tag added') + + t.end() + }) +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/dist-tags-fetch.js b/deps/npm/node_modules/npm-registry-client/test/dist-tags-fetch.js new file mode 100644 index 00000000000..ef0901ea7fc --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/dist-tags-fetch.js @@ -0,0 +1,98 @@ +var test = require('tap').test + +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() + +function nop () {} + +var BASE_URL = 'http://localhost:1337/' +var URI = '/-/package/underscore/dist-tags' +var TOKEN = 'foo' +var AUTH = { + token: TOKEN +} +var PACKAGE = 'underscore' +var PARAMS = { + 'package': PACKAGE, + auth: AUTH +} + +test('distTags.fetch call contract', function (t) { + t.throws(function () { + client.distTags.fetch(undefined, AUTH, nop) + }, 'requires a URI') + + t.throws(function () { + client.distTags.fetch([], PARAMS, nop) + }, 'requires URI to be a string') + + t.throws(function () { + client.distTags.fetch(BASE_URL, undefined, nop) + }, 'requires params object') + + t.throws(function () { + client.distTags.fetch(BASE_URL, '', nop) + }, 'params must be object') + + t.throws(function () { + client.distTags.fetch(BASE_URL, PARAMS, undefined) + }, 'requires callback') + + t.throws(function () { + client.distTags.fetch(BASE_URL, PARAMS, 'callback') + }, 'callback must be function') + + t.throws( + function () { + var params = { + auth: AUTH + } + client.distTags.fetch(BASE_URL, params, nop) + }, + { + name: 'AssertionError', + message: 'must pass package name to distTags.fetch' + }, + 'distTags.fetch must include package name' + ) + + t.throws( + function () { + var params = { + 'package': PACKAGE + } + client.distTags.fetch(BASE_URL, params, nop) + }, + { name: 'AssertionError', message: 'must pass auth to distTags.fetch' }, + 'distTags.fetch must include auth' + ) + + t.end() +}) + +test('fetch dist-tags for a package', function (t) { + server.expect('GET', URI, function (req, res) { + t.equal(req.method, 'GET') + + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { + b += d + }) + + req.on('end', function () { + t.notOk(b, 'no request body') + + res.statusCode = 200 + res.json({ a: '1.0.0', b: '2.0.0', _etag: 'xxx' }) + }) + }) + + client.distTags.fetch(BASE_URL, PARAMS, function (error, data) { + t.ifError(error, 'no errors') + t.same(data, { a: '1.0.0', b: '2.0.0' }, 'etag filtered from response') + + t.end() + }) +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/dist-tags-rm.js b/deps/npm/node_modules/npm-registry-client/test/dist-tags-rm.js new file mode 100644 index 00000000000..a035014dc67 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/dist-tags-rm.js @@ -0,0 +1,117 @@ +var test = require('tap').test + +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() + +function nop () {} + +var BASE_URL = 'http://localhost:1337/' +var URI = '/-/package/underscore/dist-tags/test' +var TOKEN = 'foo' +var AUTH = { + token: TOKEN +} +var PACKAGE = 'underscore' +var DIST_TAG = 'test' +var PARAMS = { + 'package': PACKAGE, + distTag: DIST_TAG, + auth: AUTH +} + +test('distTags.rm call contract', function (t) { + t.throws(function () { + client.distTags.rm(undefined, AUTH, nop) + }, 'requires a URI') + + t.throws(function () { + client.distTags.rm([], PARAMS, nop) + }, 'requires URI to be a string') + + t.throws(function () { + client.distTags.rm(BASE_URL, undefined, nop) + }, 'requires params object') + + t.throws(function () { + client.distTags.rm(BASE_URL, '', nop) + }, 'params must be object') + + t.throws(function () { + client.distTags.rm(BASE_URL, PARAMS, undefined) + }, 'requires callback') + + t.throws(function () { + client.distTags.rm(BASE_URL, PARAMS, 'callback') + }, 'callback must be function') + + t.throws( + function () { + var params = { + distTag: DIST_TAG, + auth: AUTH + } + client.distTags.rm(BASE_URL, params, nop) + }, + { + name: 'AssertionError', + message: 'must pass package name to distTags.rm' + }, + 'distTags.rm must include package name' + ) + + t.throws( + function () { + var params = { + 'package': PACKAGE, + auth: AUTH + } + client.distTags.rm(BASE_URL, params, nop) + }, + { + name: 'AssertionError', + message: 'must pass package distTag name to distTags.rm' + }, + 'distTags.rm must include dist-tag' + ) + + t.throws( + function () { + var params = { + 'package': PACKAGE, + distTag: DIST_TAG + } + client.distTags.rm(BASE_URL, params, nop) + }, + { name: 'AssertionError', message: 'must pass auth to distTags.rm' }, + 'distTags.rm must include auth' + ) + + t.end() +}) + +test('remove a dist-tag from a package', function (t) { + server.expect('DELETE', URI, function (req, res) { + t.equal(req.method, 'DELETE') + + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { + b += d + }) + + req.on('end', function () { + t.notOk(b, 'got no message body') + + res.statusCode = 200 + res.json({}) + }) + }) + + client.distTags.rm(BASE_URL, PARAMS, function (error, data) { + t.ifError(error, 'no errors') + t.notOk(data.test, 'dist-tag removed') + + t.end() + }) +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/dist-tags-set.js b/deps/npm/node_modules/npm-registry-client/test/dist-tags-set.js new file mode 100644 index 00000000000..691aef13ea1 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/dist-tags-set.js @@ -0,0 +1,121 @@ +var test = require('tap').test + +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() + +function nop () {} + +var BASE_URL = 'http://localhost:1337/' +var URI = '/-/package/underscore/dist-tags' +var TOKEN = 'foo' +var AUTH = { + token: TOKEN +} +var PACKAGE = 'underscore' +var DIST_TAGS = { + 'a': '8.0.8', + 'b': '3.0.3' +} +var PARAMS = { + 'package': PACKAGE, + distTags: DIST_TAGS, + auth: AUTH +} + +test('distTags.set call contract', function (t) { + t.throws(function () { + client.distTags.set(undefined, AUTH, nop) + }, 'requires a URI') + + t.throws(function () { + client.distTags.set([], PARAMS, nop) + }, 'requires URI to be a string') + + t.throws(function () { + client.distTags.set(BASE_URL, undefined, nop) + }, 'requires params object') + + t.throws(function () { + client.distTags.set(BASE_URL, '', nop) + }, 'params must be object') + + t.throws(function () { + client.distTags.set(BASE_URL, PARAMS, undefined) + }, 'requires callback') + + t.throws(function () { + client.distTags.set(BASE_URL, PARAMS, 'callback') + }, 'callback must be function') + + t.throws( + function () { + var params = { + distTags: DIST_TAGS, + auth: AUTH + } + client.distTags.set(BASE_URL, params, nop) + }, + { + name: 'AssertionError', + message: 'must pass package name to distTags.set' + }, + 'distTags.set must include package name' + ) + + t.throws( + function () { + var params = { + 'package': PACKAGE, + auth: AUTH + } + client.distTags.set(BASE_URL, params, nop) + }, + { + name: 'AssertionError', + message: 'must pass distTags map to distTags.set' + }, + 'distTags.set must include dist-tags' + ) + + t.throws( + function () { + var params = { + 'package': PACKAGE, + distTags: DIST_TAGS + } + client.distTags.set(BASE_URL, params, nop) + }, + { name: 'AssertionError', message: 'must pass auth to distTags.set' }, + 'distTags.set must include auth' + ) + + t.end() +}) + +test('set dist-tags for a package', function (t) { + server.expect('PUT', URI, function (req, res) { + t.equal(req.method, 'PUT') + + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { + b += d + }) + + req.on('end', function () { + var d = JSON.parse(b) + t.deepEqual(d, DIST_TAGS, 'got back tags') + + res.statusCode = 200 + res.json(DIST_TAGS) + }) + }) + + client.distTags.set(BASE_URL, PARAMS, function (error, data) { + t.ifError(error, 'no errors') + t.ok(data.a && data.b, 'dist-tags set') + + t.end() + }) +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/dist-tags-update.js b/deps/npm/node_modules/npm-registry-client/test/dist-tags-update.js new file mode 100644 index 00000000000..4a829c85d18 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/dist-tags-update.js @@ -0,0 +1,112 @@ +var test = require('tap').test + +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() + +function nop () {} + +var BASE_URL = 'http://localhost:1337/' +var URI = '/-/package/underscore/dist-tags' +var TOKEN = 'foo' +var AUTH = { + token: TOKEN +} +var PACKAGE = 'underscore' +var DIST_TAGS = { + 'a': '8.0.8', + 'b': '3.0.3' +} +var PARAMS = { + 'package': PACKAGE, + distTags: DIST_TAGS, + auth: AUTH +} + +test('distTags.update call contract', function (t) { + t.throws(function () { + client.distTags.update(undefined, AUTH, nop) + }, 'requires a URI') + + t.throws(function () { + client.distTags.update([], PARAMS, nop) + }, 'requires URI to be a string') + + t.throws(function () { + client.distTags.update(BASE_URL, undefined, nop) + }, 'requires params object') + + t.throws(function () { + client.distTags.update(BASE_URL, '', nop) + }, 'params must be object') + + t.throws(function () { + client.distTags.update(BASE_URL, PARAMS, undefined) + }, 'requires callback') + + t.throws(function () { + client.distTags.update(BASE_URL, PARAMS, 'callback') + }, 'callback must be function') + + t.throws( + function () { + var params = { distTags: DIST_TAGS, auth: AUTH } + client.distTags.update(BASE_URL, params, nop) + }, + { + name: 'AssertionError', + message: 'must pass package name to distTags.update' + }, + 'distTags.update must include package name' + ) + + t.throws( + function () { + var params = { 'package': PACKAGE, auth: AUTH } + client.distTags.update(BASE_URL, params, nop) + }, + { + name: 'AssertionError', + message: 'must pass distTags map to distTags.update' + }, + 'distTags.update must include dist-tags' + ) + + t.throws( + function () { + var params = { 'package': PACKAGE, distTags: DIST_TAGS } + client.distTags.update(BASE_URL, params, nop) + }, + { name: 'AssertionError', message: 'must pass auth to distTags.update' }, + 'distTags.update must include auth' + ) + + t.end() +}) + +test('update dist-tags for a package', function (t) { + server.expect('POST', URI, function (req, res) { + t.equal(req.method, 'POST') + + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { + b += d + }) + + req.on('end', function () { + var d = JSON.parse(b) + t.deepEqual(d, DIST_TAGS, 'got back tags') + + res.statusCode = 200 + res.json(DIST_TAGS) + }) + }) + + client.distTags.update(BASE_URL, PARAMS, function (error, data) { + t.ifError(error, 'no errors') + t.ok(data.a && data.b, 'dist-tags set') + + t.end() + }) +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/fetch-404.js b/deps/npm/node_modules/npm-registry-client/test/fetch-404.js index 2ce3b212b04..e05e36f26cd 100644 --- a/deps/npm/node_modules/npm-registry-client/test/fetch-404.js +++ b/deps/npm/node_modules/npm-registry-client/test/fetch-404.js @@ -1,41 +1,42 @@ -var resolve = require("path").resolve -var createReadStream = require("graceful-fs").createReadStream -var readFileSync = require("graceful-fs").readFileSync +var resolve = require('path').resolve +var createReadStream = require('graceful-fs').createReadStream +var readFileSync = require('graceful-fs').readFileSync -var tap = require("tap") -var cat = require("concat-stream") +var tap = require('tap') +var cat = require('concat-stream') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') -var tgz = resolve(__dirname, "./fixtures/underscore/1.3.3/package.tgz") +var tgz = resolve(__dirname, './fixtures/underscore/1.3.3/package.tgz') -tap.test("basic fetch", function (t) { - server.expect("/underscore/-/underscore-1.3.3.tgz", function (req, res) { - t.equal(req.method, "GET", "got expected method") +tap.test('fetch with a 404 response', function (t) { + server.expect('/underscore/-/underscore-1.3.3.tgz', function (req, res) { + t.equal(req.method, 'GET', 'got expected method') res.writeHead(200, { - "content-type" : "application/x-tar", - "content-encoding" : "gzip" + 'content-type': 'application/x-tar', + 'content-encoding': 'gzip' }) createReadStream(tgz).pipe(res) }) var client = common.freshClient() + var defaulted = {} client.fetch( - "http://localhost:1337/underscore/-/underscore-1.3.3.tgz", - null, + 'http://localhost:1337/underscore/-/underscore-1.3.3.tgz', + defaulted, function (er, res) { - t.ifError(er, "loaded successfully") + t.ifError(er, 'loaded successfully') var sink = cat(function (data) { t.deepEqual(data, readFileSync(tgz)) t.end() }) - res.on("error", function (error) { - t.ifError(error, "no errors on stream") + res.on('error', function (error) { + t.ifError(error, 'no errors on stream') }) res.pipe(sink) diff --git a/deps/npm/node_modules/npm-registry-client/test/fetch-408.js b/deps/npm/node_modules/npm-registry-client/test/fetch-408.js index bdd8bf07034..d49b149f636 100644 --- a/deps/npm/node_modules/npm-registry-client/test/fetch-408.js +++ b/deps/npm/node_modules/npm-registry-client/test/fetch-408.js @@ -1,49 +1,50 @@ -var resolve = require("path").resolve -var createReadStream = require("graceful-fs").createReadStream -var readFileSync = require("graceful-fs").readFileSync +var resolve = require('path').resolve +var createReadStream = require('graceful-fs').createReadStream +var readFileSync = require('graceful-fs').readFileSync -var tap = require("tap") -var cat = require("concat-stream") +var tap = require('tap') +var cat = require('concat-stream') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') -var tgz = resolve(__dirname, "./fixtures/underscore/1.3.3/package.tgz") +var tgz = resolve(__dirname, './fixtures/underscore/1.3.3/package.tgz') -tap.test("fetch with retry on timeout", function (t) { - server.expect("/underscore/-/underscore-1.3.3.tgz", function (req, res) { - t.equal(req.method, "GET", "got expected method") +tap.test('fetch with retry on timeout', function (t) { + server.expect('/underscore/-/underscore-1.3.3.tgz', function (req, res) { + t.equal(req.method, 'GET', 'got expected method') res.writeHead(408) res.end() }) - server.expect("/underscore/-/underscore-1.3.3.tgz", function (req, res) { - t.equal(req.method, "GET", "got expected method") + server.expect('/underscore/-/underscore-1.3.3.tgz', function (req, res) { + t.equal(req.method, 'GET', 'got expected method') res.writeHead(200, { - "content-type" : "application/x-tar", - "content-encoding" : "gzip" + 'content-type': 'application/x-tar', + 'content-encoding': 'gzip' }) createReadStream(tgz).pipe(res) }) var client = common.freshClient() - client.conf.set("fetch-retry-mintimeout", 100) + var defaulted = {} + client.config.retry.minTimeout = 100 client.fetch( - "http://localhost:1337/underscore/-/underscore-1.3.3.tgz", - {}, + 'http://localhost:1337/underscore/-/underscore-1.3.3.tgz', + defaulted, function (er, res) { - t.ifError(er, "loaded successfully") + t.ifError(er, 'loaded successfully') var sink = cat(function (data) { t.deepEqual(data, readFileSync(tgz)) t.end() }) - res.on("error", function (error) { - t.ifError(error, "no errors on stream") + res.on('error', function (error) { + t.ifError(error, 'no errors on stream') }) res.pipe(sink) diff --git a/deps/npm/node_modules/npm-registry-client/test/fetch-503.js b/deps/npm/node_modules/npm-registry-client/test/fetch-503.js index 91cd6754daf..04f5901e8c8 100644 --- a/deps/npm/node_modules/npm-registry-client/test/fetch-503.js +++ b/deps/npm/node_modules/npm-registry-client/test/fetch-503.js @@ -1,49 +1,50 @@ -var resolve = require("path").resolve -var createReadStream = require("graceful-fs").createReadStream -var readFileSync = require("graceful-fs").readFileSync +var resolve = require('path').resolve +var createReadStream = require('graceful-fs').createReadStream +var readFileSync = require('graceful-fs').readFileSync -var tap = require("tap") -var cat = require("concat-stream") +var tap = require('tap') +var cat = require('concat-stream') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') -var tgz = resolve(__dirname, "./fixtures/underscore/1.3.3/package.tgz") +var tgz = resolve(__dirname, './fixtures/underscore/1.3.3/package.tgz') -tap.test("fetch with retry on server error", function (t) { - server.expect("/underscore/-/underscore-1.3.3.tgz", function (req, res) { - t.equal(req.method, "GET", "got expected method") +tap.test('fetch with retry on server error', function (t) { + server.expect('/underscore/-/underscore-1.3.3.tgz', function (req, res) { + t.equal(req.method, 'GET', 'got expected method') res.writeHead(503) res.end() }) - server.expect("/underscore/-/underscore-1.3.3.tgz", function (req, res) { - t.equal(req.method, "GET", "got expected method") + server.expect('/underscore/-/underscore-1.3.3.tgz', function (req, res) { + t.equal(req.method, 'GET', 'got expected method') res.writeHead(200, { - "content-type" : "application/x-tar", - "content-encoding" : "gzip" + 'content-type': 'application/x-tar', + 'content-encoding': 'gzip' }) createReadStream(tgz).pipe(res) }) var client = common.freshClient() - client.conf.set("fetch-retry-mintimeout", 100) + var defaulted = {} + client.config.retry.minTimeout = 100 client.fetch( - "http://localhost:1337/underscore/-/underscore-1.3.3.tgz", - {}, + 'http://localhost:1337/underscore/-/underscore-1.3.3.tgz', + defaulted, function (er, res) { - t.ifError(er, "loaded successfully") + t.ifError(er, 'loaded successfully') var sink = cat(function (data) { t.deepEqual(data, readFileSync(tgz)) t.end() }) - res.on("error", function (error) { - t.ifError(error, "no errors on stream") + res.on('error', function (error) { + t.ifError(error, 'no errors on stream') }) res.pipe(sink) diff --git a/deps/npm/node_modules/npm-registry-client/test/fetch-authed.js b/deps/npm/node_modules/npm-registry-client/test/fetch-authed.js index da359296c41..ccfd4b77f20 100644 --- a/deps/npm/node_modules/npm-registry-client/test/fetch-authed.js +++ b/deps/npm/node_modules/npm-registry-client/test/fetch-authed.js @@ -1,53 +1,54 @@ -var resolve = require("path").resolve -var createReadStream = require("graceful-fs").createReadStream -var readFileSync = require("graceful-fs").readFileSync +var resolve = require('path').resolve +var createReadStream = require('graceful-fs').createReadStream +var readFileSync = require('graceful-fs').readFileSync -var tap = require("tap") -var cat = require("concat-stream") +var tap = require('tap') +var cat = require('concat-stream') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') -var tgz = resolve(__dirname, "./fixtures/underscore/1.3.3/package.tgz") +var tgz = resolve(__dirname, './fixtures/underscore/1.3.3/package.tgz') -tap.test("basic fetch with scoped always-auth enabled", function (t) { - server.expect("/underscore/-/underscore-1.3.3.tgz", function (req, res) { - t.equal(req.method, "GET", "got expected method") +tap.test('basic fetch with scoped always-auth enabled', function (t) { + server.expect('/underscore/-/underscore-1.3.3.tgz', function (req, res) { + t.equal(req.method, 'GET', 'got expected method') t.equal( req.headers.authorization, - "Basic dXNlcm5hbWU6JTEyMzRAYXNkZiU=", - "got expected auth header" + 'Basic dXNlcm5hbWU6JTEyMzRAYXNkZiU=', + 'got expected auth header' ) res.writeHead(200, { - "content-type" : "application/x-tar", - "content-encoding" : "gzip" + 'content-type': 'application/x-tar', + 'content-encoding': 'gzip' }) createReadStream(tgz).pipe(res) }) - var nerfed = "//localhost:" + server.port + "/:" - var configuration = {} - configuration[nerfed + "username"] = "username" - configuration[nerfed + "_password"] = new Buffer("%1234@asdf%").toString("base64") - configuration[nerfed + "email"] = "i@izs.me" - configuration[nerfed + "always-auth"] = true + var auth = { + username: 'username', + password: '%1234@asdf%', + email: 'i@izs.me', + alwaysAuth: true + } - var client = common.freshClient(configuration) + var client = common.freshClient() + var authed = { auth: auth } client.fetch( - "http://localhost:1337/underscore/-/underscore-1.3.3.tgz", - null, + 'http://localhost:1337/underscore/-/underscore-1.3.3.tgz', + authed, function (er, res) { - t.ifError(er, "loaded successfully") + t.ifError(er, 'loaded successfully') var sink = cat(function (data) { t.deepEqual(data, readFileSync(tgz)) t.end() }) - res.on("error", function (error) { - t.ifError(error, "no errors on stream") + res.on('error', function (error) { + t.ifError(error, 'no errors on stream') }) res.pipe(sink) diff --git a/deps/npm/node_modules/npm-registry-client/test/fetch-basic.js b/deps/npm/node_modules/npm-registry-client/test/fetch-basic.js index 2ce3b212b04..7bf4d1bd1a3 100644 --- a/deps/npm/node_modules/npm-registry-client/test/fetch-basic.js +++ b/deps/npm/node_modules/npm-registry-client/test/fetch-basic.js @@ -1,41 +1,89 @@ -var resolve = require("path").resolve -var createReadStream = require("graceful-fs").createReadStream -var readFileSync = require("graceful-fs").readFileSync +var resolve = require('path').resolve +var createReadStream = require('graceful-fs').createReadStream +var readFileSync = require('graceful-fs').readFileSync -var tap = require("tap") -var cat = require("concat-stream") +var test = require('tap').test +var concat = require('concat-stream') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() -var tgz = resolve(__dirname, "./fixtures/underscore/1.3.3/package.tgz") +var tgz = resolve(__dirname, './fixtures/underscore/1.3.3/package.tgz') -tap.test("basic fetch", function (t) { - server.expect("/underscore/-/underscore-1.3.3.tgz", function (req, res) { - t.equal(req.method, "GET", "got expected method") +function nop () {} + +var URI = 'https://npm.registry:8043/rewrite' +var USERNAME = 'username' +var PASSWORD = 'hi' +var EMAIL = 'n@p.m' +var HEADERS = { + 'npm-custom': 'lolbutts' +} +var AUTH = { + username: USERNAME, + password: PASSWORD, + email: EMAIL +} +var PARAMS = { + headers: HEADERS, + auth: AUTH +} + +test('fetch call contract', function (t) { + t.throws(function () { + client.get(undefined, PARAMS, nop) + }, 'requires a URI') + + t.throws(function () { + client.get([], PARAMS, nop) + }, 'requires URI to be a string') + + t.throws(function () { + client.get(URI, undefined, nop) + }, 'requires params object') + + t.throws(function () { + client.get(URI, '', nop) + }, 'params must be object') + + t.throws(function () { + client.get(URI, PARAMS, undefined) + }, 'requires callback') + + t.throws(function () { + client.get(URI, PARAMS, 'callback') + }, 'callback must be function') + + t.end() +}) + +test('basic fetch', function (t) { + server.expect('/underscore/-/underscore-1.3.3.tgz', function (req, res) { + t.equal(req.method, 'GET', 'got expected method') res.writeHead(200, { - "content-type" : "application/x-tar", - "content-encoding" : "gzip" + 'content-type': 'application/x-tar', + 'content-encoding': 'gzip' }) createReadStream(tgz).pipe(res) }) - var client = common.freshClient() + var defaulted = {} client.fetch( - "http://localhost:1337/underscore/-/underscore-1.3.3.tgz", - null, + 'http://localhost:1337/underscore/-/underscore-1.3.3.tgz', + defaulted, function (er, res) { - t.ifError(er, "loaded successfully") + t.ifError(er, 'loaded successfully') - var sink = cat(function (data) { + var sink = concat(function (data) { t.deepEqual(data, readFileSync(tgz)) t.end() }) - res.on("error", function (error) { - t.ifError(error, "no errors on stream") + res.on('error', function (error) { + t.ifError(error, 'no errors on stream') }) res.pipe(sink) diff --git a/deps/npm/node_modules/npm-registry-client/test/fetch-github-api-json.js b/deps/npm/node_modules/npm-registry-client/test/fetch-github-api-json.js new file mode 100644 index 00000000000..43f25f1ad7b --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/fetch-github-api-json.js @@ -0,0 +1,67 @@ +var resolve = require('path').resolve +var createReadStream = require('graceful-fs').createReadStream +var readFileSync = require('graceful-fs').readFileSync + +var tap = require('tap') +var cat = require('concat-stream') +var Negotiator = require('negotiator') + +var server = require('./lib/server.js') +var common = require('./lib/common.js') + +var tgz = resolve(__dirname, './fixtures/underscore/1.3.3/package.tgz') + +tap.test("fetch accepts github api's json", function (t) { + server.expect('/underscore/-/underscore-1.3.3', function (req, res) { + t.equal(req.method, 'GET', 'got expected method') + + var negotiator = new Negotiator(req) + + // fetching a tarball from `api.github.com` returns a 415 error if json is + // not accepted + if (negotiator.mediaTypes().indexOf('application/vnd.github+json') === -1) { + res.writeHead(415, { + 'Content-Type': 'application/json' + }) + } else { + res.writeHead(302, { + 'Content-Type': 'text/html', + 'Location': '/underscore/-/underscore-1.3.3.tgz' + }) + } + + res.end() + }) + + server.expect('/underscore/-/underscore-1.3.3.tgz', function (req, res) { + t.equal(req.method, 'GET', 'got expected method') + + res.writeHead(200, { + 'Content-Type': 'application/x-tar', + 'Content-Encoding': 'gzip' + }) + + createReadStream(tgz).pipe(res) + }) + + var client = common.freshClient() + var defaulted = {} + client.fetch( + 'http://localhost:1337/underscore/-/underscore-1.3.3', + defaulted, + function (er, res) { + t.ifError(er, 'loaded successfully') + + var sink = cat(function (data) { + t.deepEqual(data, readFileSync(tgz)) + t.end() + }) + + res.on('error', function (error) { + t.ifError(error, 'no errors on stream') + }) + + res.pipe(sink) + } + ) +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/fetch-not-authed.js b/deps/npm/node_modules/npm-registry-client/test/fetch-not-authed.js index 0275dc2b96b..2fb92c2c207 100644 --- a/deps/npm/node_modules/npm-registry-client/test/fetch-not-authed.js +++ b/deps/npm/node_modules/npm-registry-client/test/fetch-not-authed.js @@ -1,49 +1,50 @@ -var resolve = require("path").resolve -var createReadStream = require("graceful-fs").createReadStream -var readFileSync = require("graceful-fs").readFileSync +var resolve = require('path').resolve +var createReadStream = require('graceful-fs').createReadStream +var readFileSync = require('graceful-fs').readFileSync -var tap = require("tap") -var cat = require("concat-stream") +var tap = require('tap') +var cat = require('concat-stream') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') -var tgz = resolve(__dirname, "./fixtures/underscore/1.3.3/package.tgz") +var tgz = resolve(__dirname, './fixtures/underscore/1.3.3/package.tgz') -tap.test("basic fetch with scoped always-auth disabled", function (t) { - server.expect("/underscore/-/underscore-1.3.3.tgz", function (req, res) { - t.equal(req.method, "GET", "got expected method") - t.notOk(req.headers.authorization, "received no auth header") +tap.test('basic fetch with scoped always-auth disabled', function (t) { + server.expect('/underscore/-/underscore-1.3.3.tgz', function (req, res) { + t.equal(req.method, 'GET', 'got expected method') + t.notOk(req.headers.authorization, 'received no auth header') res.writeHead(200, { - "content-type" : "application/x-tar", - "content-encoding" : "gzip" + 'content-type': 'application/x-tar', + 'content-encoding': 'gzip' }) createReadStream(tgz).pipe(res) }) - var nerfed = "//localhost:" + server.port + "/:" - var configuration = {} - configuration[nerfed + "username"] = "username" - configuration[nerfed + "_password"] = new Buffer("%1234@asdf%").toString("base64") - configuration[nerfed + "email"] = "i@izs.me" - configuration[nerfed + "always-auth"] = false + var auth = { + username: 'username', + password: '%1234@asdf%', + email: 'i@izs.me', + alwaysAuth: false + } - var client = common.freshClient(configuration) + var client = common.freshClient() + var authed = { auth: auth } client.fetch( - "http://localhost:1337/underscore/-/underscore-1.3.3.tgz", - null, + 'http://localhost:1337/underscore/-/underscore-1.3.3.tgz', + authed, function (er, res) { - t.ifError(er, "loaded successfully") + t.ifError(er, 'loaded successfully') var sink = cat(function (data) { t.deepEqual(data, readFileSync(tgz)) t.end() }) - res.on("error", function (error) { - t.ifError(error, "no errors on stream") + res.on('error', function (error) { + t.ifError(error, 'no errors on stream') }) res.pipe(sink) diff --git a/deps/npm/node_modules/npm-registry-client/test/get-all.js b/deps/npm/node_modules/npm-registry-client/test/get-all.js deleted file mode 100644 index 75570fcbb6c..00000000000 --- a/deps/npm/node_modules/npm-registry-client/test/get-all.js +++ /dev/null @@ -1,16 +0,0 @@ -var tap = require("tap") - -var server = require("./lib/server.js") -var common = require("./lib/common.js") -var client = common.freshClient() - -tap.test("basic request", function (t) { - server.expect("/-/all", function (req, res) { - res.json([]) - }) - - client.get("http://localhost:1337/-/all", null, function (er) { - t.ifError(er, "no error") - t.end() - }) -}) diff --git a/deps/npm/node_modules/npm-registry-client/test/get-basic.js b/deps/npm/node_modules/npm-registry-client/test/get-basic.js index 240dc876221..a2ab27fe0f1 100644 --- a/deps/npm/node_modules/npm-registry-client/test/get-basic.js +++ b/deps/npm/node_modules/npm-registry-client/test/get-basic.js @@ -1,35 +1,80 @@ -var tap = require("tap") +var test = require('tap').test -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') var client = common.freshClient() -var us = require("./fixtures/underscore/1.3.3/cache.json") -var usroot = require("./fixtures/underscore/cache.json") +var us = require('./fixtures/underscore/1.3.3/cache.json') +var usroot = require('./fixtures/underscore/cache.json') -tap.test("basic request", function (t) { - server.expect("/underscore/1.3.3", function (req, res) { +function nop () {} + +var URI = 'https://npm.registry:8043/rewrite' +var TIMEOUT = 3600 +var FOLLOW = false +var STALE_OK = true +var TOKEN = 'lolbutts' +var AUTH = { + token: TOKEN +} +var PARAMS = { + timeout: TIMEOUT, + follow: FOLLOW, + staleOk: STALE_OK, + auth: AUTH +} + +test('get call contract', function (t) { + t.throws(function () { + client.get(undefined, PARAMS, nop) + }, 'requires a URI') + + t.throws(function () { + client.get([], PARAMS, nop) + }, 'requires URI to be a string') + + t.throws(function () { + client.get(URI, undefined, nop) + }, 'requires params object') + + t.throws(function () { + client.get(URI, '', nop) + }, 'params must be object') + + t.throws(function () { + client.get(URI, PARAMS, undefined) + }, 'requires callback') + + t.throws(function () { + client.get(URI, PARAMS, 'callback') + }, 'callback must be function') + + t.end() +}) + +test('basic request', function (t) { + server.expect('/underscore/1.3.3', function (req, res) { res.json(us) }) - server.expect("/underscore", function (req, res) { + server.expect('/underscore', function (req, res) { res.json(usroot) }) - server.expect("/@bigco%2funderscore", function (req, res) { + server.expect('/@bigco%2funderscore', function (req, res) { res.json(usroot) }) t.plan(3) - client.get("http://localhost:1337/underscore/1.3.3", null, function (er, data) { + client.get('http://localhost:1337/underscore/1.3.3', PARAMS, function (er, data) { t.deepEqual(data, us) }) - client.get("http://localhost:1337/underscore", null, function (er, data) { + client.get('http://localhost:1337/underscore', PARAMS, function (er, data) { t.deepEqual(data, usroot) }) - client.get("http://localhost:1337/@bigco%2funderscore", null, function (er, data) { + client.get('http://localhost:1337/@bigco%2funderscore', PARAMS, function (er, data) { t.deepEqual(data, usroot) }) }) diff --git a/deps/npm/node_modules/npm-registry-client/test/get-error-403.js b/deps/npm/node_modules/npm-registry-client/test/get-error-403.js index 27406b1680c..c9c96d354e0 100644 --- a/deps/npm/node_modules/npm-registry-client/test/get-error-403.js +++ b/deps/npm/node_modules/npm-registry-client/test/get-error-403.js @@ -1,30 +1,30 @@ -var tap = require("tap") +var tap = require('tap') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') -tap.test("get fails with 403", function (t) { - server.expect("/habanero", function (req, res) { - t.equal(req.method, "GET", "got expected method") +tap.test('get fails with 403', function (t) { + server.expect('/habanero', function (req, res) { + t.equal(req.method, 'GET', 'got expected method') res.writeHead(403) - res.end("{\"error\":\"get that cat out of the toilet that's gross omg\"}") + res.end('{"error":"get that cat out of the toilet that\'s gross omg"}') }) var client = common.freshClient() - client.conf.set("fetch-retry-mintimeout", 100) + client.config.retry.minTimeout = 100 client.get( - "http://localhost:1337/habanero", + 'http://localhost:1337/habanero', {}, function (er) { - t.ok(er, "failed as expected") + t.ok(er, 'failed as expected') - t.equal(er.statusCode, 403, "status code was attached as expected") - t.equal(er.code, "E403", "error code was formatted as expected") + t.equal(er.statusCode, 403, 'status code was attached as expected') + t.equal(er.code, 'E403', 'error code was formatted as expected') t.equal( er.message, - "get that cat out of the toilet that's gross omg : habanero", - "got error message" + 'get that cat out of the toilet that\'s gross omg : habanero', + 'got error message' ) t.end() diff --git a/deps/npm/node_modules/npm-registry-client/test/initialize.js b/deps/npm/node_modules/npm-registry-client/test/initialize.js new file mode 100644 index 00000000000..aefbe626fce --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/initialize.js @@ -0,0 +1,91 @@ +var test = require('tap').test + +// var server = require('./lib/server.js') +var Client = require('../') + +test('defaulted initialization', function (t) { + var client = new Client() + var options = client.initialize( + 'http://localhost:1337/', + 'GET', + 'application/json', + {} + ) + + t.equal(options.url, 'http://localhost:1337/', 'URLs match') + t.equal(options.method, 'GET', 'methods match') + t.equal(options.proxy, undefined, "proxy won't overwrite environment") + t.equal(options.localAddress, undefined, 'localAddress has no default value') + t.equal(options.strictSSL, true, 'SSL is strict by default') + + t.equal(options.headers.accept, 'application/json', 'accept header set') + t.equal( + options.headers.version, + require('../package.json').version, + 'npm-registry-client version is present in headers' + ) + t.ok(options.headers['npm-session'], 'request ID generated') + t.ok(options.headers['user-agent'], 'user-agent preset') + + var HttpAgent = require('http').Agent + t.ok(options.agent instanceof HttpAgent, 'got an HTTP agent for an HTTP URL') + + t.end() +}) + +test('referer set on client', function (t) { + var client = new Client() + client.refer = 'xtestx' + var options = client.initialize( + 'http://localhost:1337/', + 'GET', + 'application/json', + {} + ) + + t.equal(options.headers.referer, 'xtestx', 'referer header set') + + t.end() +}) + +test('initializing with proxy explicitly disabled', function (t) { + var client = new Client({ proxy: { http: false }}) + var options = client.initialize( + 'http://localhost:1337/', + 'GET', + 'application/json', + {} + ) + t.ok('proxy' in options, 'proxy overridden by explicitly setting to false') + t.equal(options.proxy, null, 'request will override proxy when empty proxy passed in') + t.end() +}) + +test('initializing with proxy undefined', function (t) { + var client = new Client({ proxy: { http: undefined }}) + var options = client.initialize( + 'http://localhost:1337/', + 'GET', + 'application/json', + {} + ) + t.notOk('proxy' in options, 'proxy can be read from env.PROXY by request') + t.end() +}) + +test('initializing with a certificate should map down to the https agent', function (t) { + var certificate = '-----BEGIN CERTIFICATE----- TEST\nTEST -----END CERTIFICATE-----\n' + var client = new Client({ + ssl: { + certificate: certificate + } + }) + var options = client.initialize( + { protocol: 'https:' }, + 'GET', + 'application/json', + {} + ) + t.equal(options.agent.options.cert, certificate, 'certificate will be saved properly on agent') + t.end() +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/lib/common.js b/deps/npm/node_modules/npm-registry-client/test/lib/common.js index 712f6632f29..8b7875d4c08 100644 --- a/deps/npm/node_modules/npm-registry-client/test/lib/common.js +++ b/deps/npm/node_modules/npm-registry-client/test/lib/common.js @@ -1,80 +1,14 @@ -var resolve = require("path").resolve - -var server = require("./server.js") -var RC = require("../../") -var toNerfDart = require("../../lib/util/nerf-dart.js") - -var REGISTRY = "http://localhost:" + server.port +var server = require('./server.js') +var RC = require('../../') +var REGISTRY = 'http://localhost:' + server.port module.exports = { - port : server.port, - registry : REGISTRY, - freshClient : function freshClient(config) { - config = config || {} - config.cache = resolve(__dirname, "../fixtures/cache") - config.registry = REGISTRY - var container = { - get: function (k) { return config[k] }, - set: function (k, v) { config[k] = v }, - del: function (k) { delete config[k] }, - getCredentialsByURI: function(uri) { - var nerfed = toNerfDart(uri) - var c = {scope : nerfed} - - if (this.get(nerfed + ":_authToken")) { - c.token = this.get(nerfed + ":_authToken") - // the bearer token is enough, don't confuse things - return c - } - - if (this.get(nerfed + ":_password")) { - c.password = new Buffer(this.get(nerfed + ":_password"), "base64").toString("utf8") - } - - if (this.get(nerfed + ":username")) { - c.username = this.get(nerfed + ":username") - } - - if (this.get(nerfed + ":email")) { - c.email = this.get(nerfed + ":email") - } - - if (this.get(nerfed + ":always-auth") !== undefined) { - c.alwaysAuth = this.get(nerfed + ":always-auth") - } - - if (c.username && c.password) { - c.auth = new Buffer(c.username + ":" + c.password).toString("base64") - } - - return c - }, - setCredentialsByURI: function (uri, c) { - var nerfed = toNerfDart(uri) - - if (c.token) { - this.set(nerfed + ":_authToken", c.token, "user") - this.del(nerfed + ":_password", "user") - this.del(nerfed + ":username", "user") - this.del(nerfed + ":email", "user") - } - else if (c.username || c.password || c.email) { - this.del(nerfed + ":_authToken", "user") - - var encoded = new Buffer(c.password, "utf8").toString("base64") - this.set(nerfed + ":_password", encoded, "user") - this.set(nerfed + ":username", c.username, "user") - this.set(nerfed + ":email", c.email, "user") - } - else { - throw new Error("No credentials to set.") - } - } - } - - var client = new RC(container) + port: server.port, + registry: REGISTRY, + freshClient: function freshClient (config) { + var client = new RC(config) server.log = client.log - client.log.level = "silent" + client.log.level = 'silent' return client } diff --git a/deps/npm/node_modules/npm-registry-client/test/lib/server.js b/deps/npm/node_modules/npm-registry-client/test/lib/server.js index 37cfae04177..60b116d80f9 100644 --- a/deps/npm/node_modules/npm-registry-client/test/lib/server.js +++ b/deps/npm/node_modules/npm-registry-client/test/lib/server.js @@ -3,7 +3,7 @@ var http = require('http') var server = http.createServer(handler) var port = server.port = process.env.PORT || 1337 -var assert = require("assert") +var assert = require('assert') server.listen(port) module.exports = server @@ -15,27 +15,26 @@ function handler (req, res) { // If we got authorization, make sure it's the right password. if (req.headers.authorization && req.headers.authorization.match(/^Basic/)) { - var auth = req.headers.authorization.replace(/^Basic /, "") - auth = new Buffer(auth, "base64").toString("utf8") - assert.equal(auth, "username:%1234@asdf%") + var auth = req.headers.authorization.replace(/^Basic /, '') + auth = new Buffer(auth, 'base64').toString('utf8') + assert.equal(auth, 'username:%1234@asdf%') } var u = '* ' + req.url - , mu = req.method + ' ' + req.url + var mu = req.method + ' ' + req.url var k = server._expect[mu] ? mu : server._expect[u] ? u : null if (!k) throw Error('unexpected request: ' + req.method + ' ' + req.url) var fn = server._expect[k].shift() - if (!fn) throw Error('unexpected request' + req.method + ' ' + req.url) - + if (!fn) throw Error('unexpected request: ' + req.method + ' ' + req.url) var remain = (Object.keys(server._expect).reduce(function (s, k) { return s + server._expect[k].length }, 0)) if (remain === 0) server.close() - else this.log.info("fake-registry", "TEST SERVER: %d reqs remain", remain) - this.log.info("fake-registry", Object.keys(server._expect).map(function(k) { + else this.log.info('fake-registry', 'TEST SERVER: %d reqs remain', remain) + this.log.info('fake-registry', Object.keys(server._expect).map(function (k) { return [k, server._expect[k].length] }).reduce(function (acc, kv) { acc[kv[0]] = kv[1] @@ -52,7 +51,7 @@ function json (o) { } // this log is meanto to be overridden -server.log = require("npmlog") +server.log = require('npmlog') server.expect = function (method, u, fn) { if (typeof u === 'function') { diff --git a/deps/npm/node_modules/npm-registry-client/test/logout.js b/deps/npm/node_modules/npm-registry-client/test/logout.js new file mode 100644 index 00000000000..7836d805aee --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/logout.js @@ -0,0 +1,74 @@ +var test = require('tap').test + +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() + +function nop () {} + +var URI = 'http://localhost:1337/rewrite' +var TOKEN = 'b00b00feed' +var PARAMS = { + auth: { + token: TOKEN + } +} + +test('logout call contract', function (t) { + t.throws(function () { + client.logout(undefined, PARAMS, nop) + }, 'requires a URI') + + t.throws(function () { + client.logout([], PARAMS, nop) + }, 'requires URI to be a string') + + t.throws(function () { + client.logout(URI, undefined, nop) + }, 'requires params object') + + t.throws(function () { + client.logout(URI, '', nop) + }, 'params must be object') + + t.throws(function () { + client.logout(URI, PARAMS, undefined) + }, 'requires callback') + + t.throws(function () { + client.logout(URI, PARAMS, 'callback') + }, 'callback must be function') + + t.throws( + function () { + var params = { + auth: {} + } + client.logout(URI, params, nop) + }, + { name: 'AssertionError', message: 'can only log out for token auth' }, + 'auth must include token' + ) + + t.end() +}) + +test('log out from a token-based registry', function (t) { + server.expect('DELETE', '/-/user/token/' + TOKEN, function (req, res) { + t.equal(req.method, 'DELETE') + t.equal(req.headers.authorization, 'Bearer ' + TOKEN, 'request is authed') + + res.json({message: 'ok'}) + }) + + client.logout(URI, PARAMS, function (er) { + t.ifError(er, 'no errors') + + t.end() + }) +}) + +test('cleanup', function (t) { + server.close() + t.end() +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/publish-again-scoped.js b/deps/npm/node_modules/npm-registry-client/test/publish-again-scoped.js index 97838ca44dc..42f67272138 100644 --- a/deps/npm/node_modules/npm-registry-client/test/publish-again-scoped.js +++ b/deps/npm/node_modules/npm-registry-client/test/publish-again-scoped.js @@ -1,80 +1,88 @@ -var tap = require("tap") -var fs = require("fs") +var tap = require('tap') +var fs = require('fs') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') -var nerfed = "//localhost:" + server.port + "/:" +var auth = { + username: 'username', + password: '%1234@asdf%', + email: 'i@izs.me', + alwaysAuth: true +} -var configuration = {} -configuration[nerfed + "username"] = "username" -configuration[nerfed + "_password"] = new Buffer("%1234@asdf%").toString("base64") -configuration[nerfed + "email"] = "i@izs.me" +var client = common.freshClient() -var client = common.freshClient(configuration) - -tap.test("publish again", function (t) { +tap.test('publish again', function (t) { // not really a tarball, but doesn't matter - var tarball = require.resolve("../package.json") - var pd = fs.readFileSync(tarball, "base64") - var pkg = require("../package.json") + var bodyPath = require.resolve('../package.json') + var tarball = fs.createReadStream(bodyPath) + var pd = fs.readFileSync(bodyPath, 'base64') + var pkg = require('../package.json') var lastTime = null - server.expect("/@npm%2fnpm-registry-client", function (req, res) { - t.equal(req.method, "PUT") - var b = "" - req.setEncoding("utf8") - req.on("data", function (d) { + server.expect('/@npm%2fnpm-registry-client', function (req, res) { + t.equal(req.method, 'PUT') + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { b += d }) - req.on("end", function () { + req.on('end', function () { var o = lastTime = JSON.parse(b) - t.equal(o._id, "@npm/npm-registry-client") - t.equal(o["dist-tags"].latest, pkg.version) + t.equal(o._id, '@npm/npm-registry-client') + t.equal(o['dist-tags'].latest, pkg.version) t.has(o.versions[pkg.version], pkg) - t.same(o.maintainers, [ { name: "username", email: "i@izs.me" } ]) - var att = o._attachments[ pkg.name + "-" + pkg.version + ".tgz" ] + t.same(o.maintainers, [ { name: 'username', email: 'i@izs.me' } ]) + var att = o._attachments[ pkg.name + '-' + pkg.version + '.tgz' ] t.same(att.data, pd) res.statusCode = 409 - res.json({reason: "must supply latest _rev to update existing package"}) + res.json({reason: 'must supply latest _rev to update existing package'}) }) }) - server.expect("/@npm%2fnpm-registry-client?write=true", function (req, res) { - t.equal(req.method, "GET") + server.expect('/@npm%2fnpm-registry-client?write=true', function (req, res) { + t.equal(req.method, 'GET') t.ok(lastTime) for (var i in lastTime.versions) { var v = lastTime.versions[i] delete lastTime.versions[i] - lastTime.versions["0.0.2"] = v - lastTime["dist-tags"] = { latest: "0.0.2" } + lastTime.versions['0.0.2'] = v + lastTime['dist-tags'] = { latest: '0.0.2' } } - lastTime._rev = "asdf" + lastTime._rev = 'asdf' res.json(lastTime) }) - server.expect("/@npm%2fnpm-registry-client", function (req, res) { - t.equal(req.method, "PUT") + server.expect('/@npm%2fnpm-registry-client', function (req, res) { + t.equal(req.method, 'PUT') t.ok(lastTime) - var b = "" - req.setEncoding("utf8") - req.on("data", function (d) { + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { b += d }) - req.on("end", function() { + req.on('end', function () { var o = JSON.parse(b) - t.equal(o._rev, "asdf") - t.deepEqual(o.versions["0.0.2"], o.versions[pkg.version]) + t.equal(o._rev, 'asdf') + t.deepEqual(o.versions['0.0.2'], o.versions[pkg.version]) res.statusCode = 201 res.json({created: true}) }) }) - pkg.name = "@npm/npm-registry-client" - client.publish("http://localhost:1337/", pkg, tarball, function (er, data) { + pkg.name = '@npm/npm-registry-client' + + var params = { + metadata: pkg, + access: 'restricted', + body: tarball, + auth: auth + } + client.publish('http://localhost:1337/', params, function (er, data) { if (er) throw er t.deepEqual(data, { created: true }) t.end() diff --git a/deps/npm/node_modules/npm-registry-client/test/publish-again.js b/deps/npm/node_modules/npm-registry-client/test/publish-again.js index 39c368fd35b..5beec90e4a0 100644 --- a/deps/npm/node_modules/npm-registry-client/test/publish-again.js +++ b/deps/npm/node_modules/npm-registry-client/test/publish-again.js @@ -1,79 +1,86 @@ -var tap = require("tap") -var fs = require("fs") +var tap = require('tap') +var fs = require('fs') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') -var nerfed = "//localhost:" + server.port + "/:" +var auth = { + username: 'username', + password: '%1234@asdf%', + email: 'i@izs.me', + alwaysAuth: true +} -var configuration = {} -configuration[nerfed + "username"] = "username" -configuration[nerfed + "_password"] = new Buffer("%1234@asdf%").toString("base64") -configuration[nerfed + "email"] = "i@izs.me" +var client = common.freshClient() -var client = common.freshClient(configuration) - -tap.test("publish again", function (t) { +tap.test('publish again', function (t) { // not really a tarball, but doesn't matter - var tarball = require.resolve("../package.json") - var pd = fs.readFileSync(tarball, "base64") - var pkg = require("../package.json") + var bodyPath = require.resolve('../package.json') + var tarball = fs.createReadStream(bodyPath) + var pd = fs.readFileSync(bodyPath, 'base64') + var pkg = require('../package.json') var lastTime = null - server.expect("/npm-registry-client", function (req, res) { - t.equal(req.method, "PUT") - var b = "" - req.setEncoding("utf8") - req.on("data", function (d) { + server.expect('/npm-registry-client', function (req, res) { + t.equal(req.method, 'PUT') + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { b += d }) - req.on("end", function () { + req.on('end', function () { var o = lastTime = JSON.parse(b) - t.equal(o._id, "npm-registry-client") - t.equal(o["dist-tags"].latest, pkg.version) + t.equal(o._id, 'npm-registry-client') + t.equal(o['dist-tags'].latest, pkg.version) t.has(o.versions[pkg.version], pkg) - t.same(o.maintainers, [ { name: "username", email: "i@izs.me" } ]) - var att = o._attachments[ pkg.name + "-" + pkg.version + ".tgz" ] + t.same(o.maintainers, [ { name: 'username', email: 'i@izs.me' } ]) + var att = o._attachments[ pkg.name + '-' + pkg.version + '.tgz' ] t.same(att.data, pd) res.statusCode = 409 - res.json({reason: "must supply latest _rev to update existing package"}) + res.json({reason: 'must supply latest _rev to update existing package'}) }) }) - server.expect("/npm-registry-client?write=true", function (req, res) { - t.equal(req.method, "GET") + server.expect('/npm-registry-client?write=true', function (req, res) { + t.equal(req.method, 'GET') t.ok(lastTime) for (var i in lastTime.versions) { var v = lastTime.versions[i] delete lastTime.versions[i] - lastTime.versions["0.0.2"] = v - lastTime["dist-tags"] = { latest: "0.0.2" } + lastTime.versions['0.0.2'] = v + lastTime['dist-tags'] = { latest: '0.0.2' } } - lastTime._rev = "asdf" + lastTime._rev = 'asdf' res.json(lastTime) }) - server.expect("/npm-registry-client", function (req, res) { - t.equal(req.method, "PUT") + server.expect('/npm-registry-client', function (req, res) { + t.equal(req.method, 'PUT') t.ok(lastTime) - var b = "" - req.setEncoding("utf8") - req.on("data", function (d) { + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { b += d }) - req.on("end", function() { + req.on('end', function () { var o = JSON.parse(b) - t.equal(o._rev, "asdf") - t.deepEqual(o.versions["0.0.2"], o.versions[pkg.version]) + t.equal(o._rev, 'asdf') + t.deepEqual(o.versions['0.0.2'], o.versions[pkg.version]) res.statusCode = 201 res.json({created: true}) }) }) - client.publish("http://localhost:1337/", pkg, tarball, function (er, data) { + var params = { + metadata: pkg, + access: 'public', + body: tarball, + auth: auth + } + client.publish('http://localhost:1337/', params, function (er, data) { if (er) throw er t.deepEqual(data, { created: true }) t.end() diff --git a/deps/npm/node_modules/npm-registry-client/test/publish-failed-no-message.js b/deps/npm/node_modules/npm-registry-client/test/publish-failed-no-message.js new file mode 100644 index 00000000000..5cb66d1e077 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/publish-failed-no-message.js @@ -0,0 +1,43 @@ +var createReadStream = require('fs').createReadStream + +var test = require('tap').test + +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var config = { retry: { retries: 0 } } +var client = common.freshClient(config) + +var URI = 'http://localhost:1337/' +var USERNAME = 'username' +var PASSWORD = '%1234@asdf%' +var EMAIL = 'i@izs.me' +var METADATA = require('../package.json') +var ACCESS = 'public' +// not really a tarball, but doesn't matter +var BODY_PATH = require.resolve('../package.json') +var BODY = createReadStream(BODY_PATH) +var AUTH = { + username: USERNAME, + password: PASSWORD, + email: EMAIL +} +var PARAMS = { + metadata: METADATA, + access: ACCESS, + body: BODY, + auth: AUTH +} + +test('publish with a 500 response but no message', function (t) { + server.expect('/npm-registry-client', function (req, res) { + res.statusCode = 500 + res.json({ success: false }) + }) + + client.publish(URI, PARAMS, function (er, data) { + t.ok(er, 'got expected error') + t.notOk(data, 'no payload on failure') + + t.end() + }) +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/publish-mixcase-name.js b/deps/npm/node_modules/npm-registry-client/test/publish-mixcase-name.js new file mode 100644 index 00000000000..f2cc1d66813 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/publish-mixcase-name.js @@ -0,0 +1,91 @@ +var tap = require('tap') +var fs = require('fs') + +var server = require('./lib/server.js') +var common = require('./lib/common.js') + +var auth = { + username: 'username', + password: '%1234@asdf%', + email: 'i@izs.me', + alwaysAuth: true +} + +var client = common.freshClient() + +tap.test('publish mixcase name', function (t) { + // not really a tarball, but doesn't matter + var bodyPath = require.resolve('../package.json') + var tarball = fs.createReadStream(bodyPath) + var pd = fs.readFileSync(bodyPath, 'base64') + var pkg = require('../package.json') + var lastTime = null + + // change to mixed case name + pkg.name = 'npm-Registry-Client' + + server.expect('/npm-Registry-Client', function (req, res) { + t.equal(req.method, 'PUT') + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { + b += d + }) + + req.on('end', function () { + var o = lastTime = JSON.parse(b) + t.equal(o._id, 'npm-Registry-Client') + t.equal(o['dist-tags'].latest, pkg.version) + t.has(o.versions[pkg.version], pkg) + t.same(o.maintainers, [ { name: 'username', email: 'i@izs.me' } ]) + var att = o._attachments[ pkg.name + '-' + pkg.version + '.tgz' ] + t.same(att.data, pd) + res.statusCode = 409 + res.json({reason: 'must supply latest _rev to update existing package'}) + }) + }) + + server.expect('/npm-Registry-Client?write=true', function (req, res) { + t.equal(req.method, 'GET') + t.ok(lastTime) + for (var i in lastTime.versions) { + var v = lastTime.versions[i] + delete lastTime.versions[i] + lastTime.versions['0.0.2'] = v + lastTime['dist-tags'] = { latest: '0.0.2' } + } + lastTime._rev = 'asdf' + res.json(lastTime) + }) + + server.expect('/npm-Registry-Client', function (req, res) { + t.equal(req.method, 'PUT') + t.ok(lastTime) + + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { + b += d + }) + + req.on('end', function () { + var o = JSON.parse(b) + t.equal(o._rev, 'asdf') + t.deepEqual(o.versions['0.0.2'], o.versions[pkg.version]) + res.statusCode = 201 + res.json({created: true}) + }) + }) + + var params = { + metadata: pkg, + access: 'public', + body: tarball, + auth: auth + } + client.publish('http://localhost:1337/', params, function (er, data) { + if (er) throw er + t.deepEqual(data, { created: true }) + t.end() + }) +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/publish-new-mixcase-name.js b/deps/npm/node_modules/npm-registry-client/test/publish-new-mixcase-name.js new file mode 100644 index 00000000000..5b0e47655c2 --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/publish-new-mixcase-name.js @@ -0,0 +1,72 @@ +var test = require('tap').test +var crypto = require('crypto') +var fs = require('fs') + +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() + +var URI = 'http://localhost:1337/' +var USERNAME = 'username' +var PASSWORD = '%1234@asdf%' +var EMAIL = 'i@izs.me' +var METADATA = require('../package.json') +var ACCESS = 'public' +// not really a tarball, but doesn't matter +var BODY_PATH = require.resolve('../package.json') +var BODY = fs.createReadStream(BODY_PATH) +var AUTH = { + username: USERNAME, + password: PASSWORD, + email: EMAIL +} +var PARAMS = { + metadata: METADATA, + access: ACCESS, + body: BODY, + auth: AUTH +} + +test('publish-new-mixcase-name', function (t) { + var pd = fs.readFileSync(BODY_PATH, 'base64') + + // change to mixed-case name + METADATA.name = 'npm-Registry-Client' + + server.expect('/npm-Registry-Client', function (req, res) { + t.equal(req.method, 'PUT') + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { + b += d + }) + + req.on('end', function () { + var o = JSON.parse(b) + t.equal(o._id, 'npm-Registry-Client') + t.equal(o['dist-tags'].latest, METADATA.version) + t.equal(o.access, ACCESS) + t.has(o.versions[METADATA.version], METADATA) + t.same(o.maintainers, [{ name: 'username', email: 'i@izs.me' }]) + t.same(o.maintainers, o.versions[METADATA.version].maintainers) + + var att = o._attachments[METADATA.name + '-' + METADATA.version + '.tgz'] + t.same(att.data, pd) + + var hash = crypto.createHash('sha1').update(pd, 'base64').digest('hex') + t.equal(o.versions[METADATA.version].dist.shasum, hash) + + res.statusCode = 403 + res.json({error: 'Name must be lower-case'}) + }) + }) + + client.publish(URI, PARAMS, function (er, data, json, res) { + t.assert(er instanceof Error) // expect error + + // TODO: need a test that ensures useful error message + // t.similar(data.error, /must be lower-case/) + + t.end() + }) +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/publish-scoped-auth-token.js b/deps/npm/node_modules/npm-registry-client/test/publish-scoped-auth-token.js index e1bb7dd1ee2..d4704ca491d 100644 --- a/deps/npm/node_modules/npm-registry-client/test/publish-scoped-auth-token.js +++ b/deps/npm/node_modules/npm-registry-client/test/publish-scoped-auth-token.js @@ -1,50 +1,54 @@ -var tap = require("tap") -var crypto = require("crypto") -var fs = require("fs") +var tap = require('tap') +var crypto = require('crypto') +var fs = require('fs') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') -var nerfed = "//localhost:" + server.port + "/:" +var auth = { token: 'of-glad-tidings' } -var configuration = {} -configuration[nerfed + "_authToken"] = "of-glad-tidings" +var client = common.freshClient() -var client = common.freshClient(configuration) - -tap.test("publish", function (t) { +tap.test('publish', function (t) { // not really a tarball, but doesn't matter - var tarball = require.resolve("../package.json") - var pd = fs.readFileSync(tarball, "base64") - var pkg = require("../package.json") - pkg.name = "@npm/npm-registry-client" - - server.expect("/@npm%2fnpm-registry-client", function (req, res) { - t.equal(req.method, "PUT") - t.equal(req.headers.authorization, "Bearer of-glad-tidings") - - var b = "" - req.setEncoding("utf8") - req.on("data", function (d) { + var bodyPath = require.resolve('../package.json') + var tarball = fs.createReadStream(bodyPath) + var pd = fs.readFileSync(bodyPath, 'base64') + var pkg = require('../package.json') + pkg.name = '@npm/npm-registry-client' + + server.expect('/@npm%2fnpm-registry-client', function (req, res) { + t.equal(req.method, 'PUT') + t.equal(req.headers.authorization, 'Bearer of-glad-tidings') + + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { b += d }) - req.on("end", function () { + req.on('end', function () { var o = JSON.parse(b) - t.equal(o._id, "@npm/npm-registry-client") - t.equal(o["dist-tags"].latest, pkg.version) + t.equal(o._id, '@npm/npm-registry-client') + t.equal(o['dist-tags'].latest, pkg.version) t.has(o.versions[pkg.version], pkg) t.same(o.maintainers, o.versions[pkg.version].maintainers) - var att = o._attachments[ pkg.name + "-" + pkg.version + ".tgz" ] + var att = o._attachments[ pkg.name + '-' + pkg.version + '.tgz' ] t.same(att.data, pd) - var hash = crypto.createHash("sha1").update(pd, "base64").digest("hex") + var hash = crypto.createHash('sha1').update(pd, 'base64').digest('hex') t.equal(o.versions[pkg.version].dist.shasum, hash) res.statusCode = 201 - res.json({created:true}) + res.json({ created: true }) }) }) - client.publish(common.registry, pkg, tarball, function (er, data) { + var params = { + metadata: pkg, + access: 'restricted', + body: tarball, + auth: auth + } + client.publish(common.registry, params, function (er, data) { if (er) throw er t.deepEqual(data, { created: true }) t.end() diff --git a/deps/npm/node_modules/npm-registry-client/test/publish-scoped.js b/deps/npm/node_modules/npm-registry-client/test/publish-scoped.js index b5dea3649c3..7758c3c12b9 100644 --- a/deps/npm/node_modules/npm-registry-client/test/publish-scoped.js +++ b/deps/npm/node_modules/npm-registry-client/test/publish-scoped.js @@ -1,55 +1,61 @@ -var tap = require("tap") -var crypto = require("crypto") -var fs = require("fs") +var tap = require('tap') +var crypto = require('crypto') +var fs = require('fs') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') -var nerfed = "//localhost:" + server.port + "/:" +var auth = { + username: 'username', + password: '%1234@asdf%', + email: 'ogd@aoaioxxysz.net' +} -var configuration = {} -configuration[nerfed + "username"] = "username" -configuration[nerfed + "_password"] = new Buffer("%1234@asdf%").toString("base64") -configuration[nerfed + "email"] = "ogd@aoaioxxysz.net" +var client = common.freshClient() -var client = common.freshClient(configuration) +var _auth = new Buffer('username:%1234@asdf%').toString('base64') -var _auth = new Buffer("username:%1234@asdf%").toString("base64") - -tap.test("publish", function (t) { +tap.test('publish', function (t) { // not really a tarball, but doesn't matter - var tarball = require.resolve("../package.json") - var pd = fs.readFileSync(tarball, "base64") - var pkg = require("../package.json") - pkg.name = "@npm/npm-registry-client" - - server.expect("/@npm%2fnpm-registry-client", function (req, res) { - t.equal(req.method, "PUT") - t.equal(req.headers.authorization, "Basic " + _auth) - - var b = "" - req.setEncoding("utf8") - req.on("data", function (d) { + var bodyPath = require.resolve('../package.json') + var tarball = fs.createReadStream(bodyPath) + var pd = fs.readFileSync(bodyPath, 'base64') + var pkg = require('../package.json') + pkg.name = '@npm/npm-registry-client' + + server.expect('/@npm%2fnpm-registry-client', function (req, res) { + t.equal(req.method, 'PUT') + t.equal(req.headers.authorization, 'Basic ' + _auth) + + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { b += d }) - req.on("end", function () { + req.on('end', function () { var o = JSON.parse(b) - t.equal(o._id, "@npm/npm-registry-client") - t.equal(o["dist-tags"].latest, pkg.version) + t.equal(o._id, '@npm/npm-registry-client') + t.equal(o['dist-tags'].latest, pkg.version) t.has(o.versions[pkg.version], pkg) - t.same(o.maintainers, [ { name: "username", email: "ogd@aoaioxxysz.net" } ]) + t.same(o.maintainers, [ { name: 'username', email: 'ogd@aoaioxxysz.net' } ]) t.same(o.maintainers, o.versions[pkg.version].maintainers) - var att = o._attachments[ pkg.name + "-" + pkg.version + ".tgz" ] + var att = o._attachments[ pkg.name + '-' + pkg.version + '.tgz' ] t.same(att.data, pd) - var hash = crypto.createHash("sha1").update(pd, "base64").digest("hex") + var hash = crypto.createHash('sha1').update(pd, 'base64').digest('hex') t.equal(o.versions[pkg.version].dist.shasum, hash) res.statusCode = 201 - res.json({created:true}) + res.json({ created: true }) }) }) - client.publish(common.registry, pkg, tarball, function (er, data) { + var params = { + metadata: pkg, + access: 'restricted', + body: tarball, + auth: auth + } + client.publish(common.registry, params, function (er, data) { if (er) throw er t.deepEqual(data, { created: true }) t.end() diff --git a/deps/npm/node_modules/npm-registry-client/test/publish.js b/deps/npm/node_modules/npm-registry-client/test/publish.js index 2d76dfae202..f2c257e95c3 100644 --- a/deps/npm/node_modules/npm-registry-client/test/publish.js +++ b/deps/npm/node_modules/npm-registry-client/test/publish.js @@ -1,51 +1,202 @@ -var tap = require("tap") -var crypto = require("crypto") -var fs = require("fs") +var test = require('tap').test +var crypto = require('crypto') +var fs = require('fs') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() -var nerfed = "//localhost:" + server.port + "/:" +function nop () {} -var configuration = {} -configuration[nerfed + "username"] = "username" -configuration[nerfed + "_password"] = new Buffer("%1234@asdf%").toString("base64") -configuration[nerfed + "email"] = "i@izs.me" +var URI = 'http://localhost:1337/' +var USERNAME = 'username' +var PASSWORD = '%1234@asdf%' +var EMAIL = 'i@izs.me' +var METADATA = require('../package.json') +var ACCESS = 'public' +// not really a tarball, but doesn't matter +var BODY_PATH = require.resolve('../package.json') +var BODY = fs.createReadStream(BODY_PATH) +var AUTH = { + username: USERNAME, + password: PASSWORD, + email: EMAIL +} +var PARAMS = { + metadata: METADATA, + access: ACCESS, + body: BODY, + auth: AUTH +} -var client = common.freshClient(configuration) +test('publish call contract', function (t) { + t.throws(function () { + client.publish(undefined, PARAMS, nop) + }, 'requires a URI') -tap.test("publish", function (t) { - // not really a tarball, but doesn't matter - var tarball = require.resolve("../package.json") - var pd = fs.readFileSync(tarball, "base64") - var pkg = require("../package.json") + t.throws(function () { + client.publish([], PARAMS, nop) + }, 'requires URI to be a string') - server.expect("/npm-registry-client", function (req, res) { - t.equal(req.method, "PUT") - var b = "" - req.setEncoding("utf8") - req.on("data", function (d) { + t.throws(function () { + client.publish(URI, undefined, nop) + }, 'requires params object') + + t.throws(function () { + client.publish(URI, '', nop) + }, 'params must be object') + + t.throws(function () { + client.publish(URI, PARAMS, undefined) + }, 'requires callback') + + t.throws(function () { + client.publish(URI, PARAMS, 'callback') + }, 'callback must be function') + + t.throws( + function () { + var params = { + access: ACCESS, + body: BODY, + auth: AUTH + } + client.publish(URI, params, nop) + }, + { name: 'AssertionError', message: 'must pass package metadata to publish' }, + 'params must include metadata for package' + ) + + t.throws( + function () { + var params = { + metadata: METADATA, + access: ACCESS, + auth: AUTH + } + client.publish(URI, params, nop) + }, + { name: 'AssertionError', message: 'must pass package body to publish' }, + 'params must include body of package to publish' + ) + + t.throws( + function () { + var params = { + metadata: METADATA, + access: ACCESS, + body: BODY + } + client.publish(URI, params, nop) + }, + { name: 'AssertionError', message: 'must pass auth to publish' }, + 'params must include auth' + ) + + t.throws( + function () { + var params = { + metadata: -1, + access: ACCESS, + body: BODY, + auth: AUTH + } + client.publish(URI, params, nop) + }, + { name: 'AssertionError', message: 'must pass package metadata to publish' }, + 'metadata must be object' + ) + + t.throws( + function () { + var params = { + metadata: METADATA, + access: 'hamchunx', + body: BODY, + auth: AUTH + } + client.publish(URI, params, nop) + }, + { + name: 'AssertionError', + message: "if present, access level must be either 'public' or 'restricted'" + }, + "access level must be 'public' or 'restricted'" + ) + + t.throws( + function () { + var params = { + metadata: METADATA, + access: ACCESS, + body: -1, + auth: AUTH + } + client.publish(URI, params, nop) + }, + { + name: 'AssertionError', + message: 'package body passed to publish must be a stream' + }, + 'body must be a Stream' + ) + + t.test('malformed semver in publish', function (t) { + var metadata = JSON.parse(JSON.stringify(METADATA)) + metadata.version = '%!@#$' + var params = { + metadata: metadata, + access: ACCESS, + message: BODY, + auth: AUTH + } + client.publish(URI, params, function (err) { + t.equal( + err && err.message, + 'invalid semver: %!@#$', + 'got expected semver validation failure' + ) + t.end() + }) + }) + + t.end() +}) + +test('publish', function (t) { + var pd = fs.readFileSync(BODY_PATH, 'base64') + + server.expect('/npm-registry-client', function (req, res) { + t.equal(req.method, 'PUT') + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { b += d }) - req.on("end", function () { + req.on('end', function () { var o = JSON.parse(b) - t.equal(o._id, "npm-registry-client") - t.equal(o["dist-tags"].latest, pkg.version) - t.has(o.versions[pkg.version], pkg) - t.same(o.maintainers, [ { name: "username", email: "i@izs.me" } ]) - t.same(o.maintainers, o.versions[pkg.version].maintainers) - var att = o._attachments[ pkg.name + "-" + pkg.version + ".tgz" ] + t.equal(o._id, 'npm-registry-client') + t.equal(o['dist-tags'].latest, METADATA.version) + t.equal(o.access, ACCESS) + t.has(o.versions[METADATA.version], METADATA) + t.same(o.maintainers, [{ name: 'username', email: 'i@izs.me' }]) + t.same(o.maintainers, o.versions[METADATA.version].maintainers) + + var att = o._attachments[METADATA.name + '-' + METADATA.version + '.tgz'] t.same(att.data, pd) - var hash = crypto.createHash("sha1").update(pd, "base64").digest("hex") - t.equal(o.versions[pkg.version].dist.shasum, hash) + + var hash = crypto.createHash('sha1').update(pd, 'base64').digest('hex') + t.equal(o.versions[METADATA.version].dist.shasum, hash) + res.statusCode = 201 - res.json({created:true}) + res.json({ created: true }) }) }) - client.publish("http://localhost:1337/", pkg, tarball, function (er, data) { + client.publish(URI, PARAMS, function (er, data) { if (er) throw er + t.deepEqual(data, { created: true }) t.end() }) diff --git a/deps/npm/node_modules/npm-registry-client/test/redirects.js b/deps/npm/node_modules/npm-registry-client/test/redirects.js index b7ead8795fa..d589f161a63 100644 --- a/deps/npm/node_modules/npm-registry-client/test/redirects.js +++ b/deps/npm/node_modules/npm-registry-client/test/redirects.js @@ -1,48 +1,51 @@ -var tap = require("tap") +var tap = require('tap') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') var client = common.freshClient() var pkg = { - _id: "some-package@1.2.3", - name: "some-package", - version: "1.2.3" + _id: 'some-package@1.2.3', + name: 'some-package', + version: '1.2.3' } -tap.test("basic request", function (t) { +tap.test('basic request', function (t) { // Expect one request for { follow : false } - server.expect("/-/some-package/1.2.3", function (req, res) { + server.expect('/-/some-package/1.2.3', function (req, res) { res.writeHead(301, { - "Location": "/some-package/1.2.3" + 'Location': '/some-package/1.2.3' }) - res.end("Redirecting") + res.end('Redirecting') }) // Expect 2 requests for { follow : true } - server.expect("/-/some-package/1.2.3", function (req, res) { + server.expect('/-/some-package/1.2.3', function (req, res) { res.writeHead(301, { - "Location": "/some-package/1.2.3" + 'Location': '/some-package/1.2.3' }) - res.end("Redirecting") + res.end('Redirecting') }) - server.expect("/some-package/1.2.3", function (req, res) { + server.expect('/some-package/1.2.3', function (req, res) { res.json(pkg) }) - t.plan(2); - - client.get("http://localhost:1337/-/some-package/1.2.3", { - follow: false - }, function(er, data) { - t.assert(er, "Error must be set"); - }) - - client.get("http://localhost:1337/-/some-package/1.2.3", { - follow: true - }, function(er, data) { - t.deepEqual(data, pkg) - }) + t.plan(2) + + client.get( + 'http://localhost:1337/-/some-package/1.2.3', + { follow: false }, + function (er) { + t.ok(er, 'Error must be set') + } + ) + + client.get( + 'http://localhost:1337/-/some-package/1.2.3', + { follow: true }, + function (er, data) { + t.deepEqual(data, pkg) + } + ) }) - diff --git a/deps/npm/node_modules/npm-registry-client/test/request-gzip-content.js b/deps/npm/node_modules/npm-registry-client/test/request-gzip-content.js index 1085bfaca20..27a76b8a81a 100644 --- a/deps/npm/node_modules/npm-registry-client/test/request-gzip-content.js +++ b/deps/npm/node_modules/npm-registry-client/test/request-gzip-content.js @@ -1,50 +1,55 @@ -var zlib = require("zlib") -var tap = require("tap") +var zlib = require('zlib') +var tap = require('tap') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') var client = common.freshClient({ - "fetch-retries" : 1, - "fetch-retry-mintimeout" : 10, - "fetch-retry-maxtimeout" : 100 + retry: { + count: 1, + minTimeout: 10, + maxTimeout: 100 + } }) -var TEST_URL = "http://localhost:1337/some-package-gzip/1.2.3" +var TEST_URL = common.registry + '/some-package-gzip/1.2.3' var pkg = { - _id: "some-package-gzip@1.2.3", - name: "some-package-gzip", - version: "1.2.3" + _id: 'some-package-gzip@1.2.3', + name: 'some-package-gzip', + version: '1.2.3' } zlib.gzip(JSON.stringify(pkg), function (err, pkgGzip) { - tap.test("request gzip package content", function (t) { - t.ifError(err, "example package compressed") + tap.test('request gzip package content', function (t) { + t.ifError(err, 'example package compressed') - server.expect("GET", "/some-package-gzip/1.2.3", function (req, res) { + server.expect('GET', '/some-package-gzip/1.2.3', function (req, res) { res.statusCode = 200 - res.setHeader("Content-Encoding", "gzip") - res.setHeader("Content-Type", "application/json") + res.setHeader('Content-Encoding', 'gzip') + res.setHeader('Content-Type', 'application/json') res.end(pkgGzip) }) - client.get(TEST_URL, null, function (er, data) { + client.get(TEST_URL, {}, function (er, data) { if (er) throw er - t.deepEqual(data, pkg) + t.deepEqual(data, pkg, 'some-package-gzip version 1.2.3') t.end() }) }) - tap.test("request wrong gzip package content", function (t) { - server.expect("GET", "/some-package-gzip-error/1.2.3", function (req, res) { - res.statusCode = 200 - res.setHeader("Content-Encoding", "gzip") - res.setHeader("Content-Type", "application/json") - res.end(new Buffer("wrong gzip content")) - }) - - client.get(TEST_URL, null, function (er) { - t.ok(er) + tap.test('request wrong gzip package content', function (t) { + // will retry 3 times + for (var i = 0; i < 3; i++) { + server.expect('GET', '/some-package-gzip/1.2.3', function (req, res) { + res.statusCode = 200 + res.setHeader('Content-Encoding', 'gzip') + res.setHeader('Content-Type', 'application/json') + res.end(new Buffer('wrong gzip content')) + }) + } + + client.get(TEST_URL, {}, function (er) { + t.ok(er, 'ungzip error') t.end() }) }) diff --git a/deps/npm/node_modules/npm-registry-client/test/request.js b/deps/npm/node_modules/npm-registry-client/test/request.js new file mode 100644 index 00000000000..68af9bcca2b --- /dev/null +++ b/deps/npm/node_modules/npm-registry-client/test/request.js @@ -0,0 +1,263 @@ +var Readable = require('stream').Readable +var inherits = require('util').inherits + +var test = require('tap').test +var concat = require('concat-stream') + +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() + +function OneA () { + Readable.call(this) + this.push('A') + this.push(null) +} +inherits(OneA, Readable) + +function nop () {} + +var URI = 'http://localhost:1337/' +var USERNAME = 'username' +var PASSWORD = '%1234@asdf%' +var EMAIL = 'i@izs.me' +var AUTH = { + username: USERNAME, + password: PASSWORD, + email: EMAIL +} +var PARAMS = { auth: AUTH } + +test('request call contract', function (t) { + t.throws( + function () { + client.request(undefined, PARAMS, nop) + }, + { name: 'AssertionError', message: 'must pass uri to request' }, + 'requires a URI' + ) + + t.throws( + function () { + client.request([], PARAMS, nop) + }, + { name: 'AssertionError', message: 'must pass uri to request' }, + 'requires URI to be a string' + ) + + t.throws( + function () { + client.request(URI, undefined, nop) + }, + { name: 'AssertionError', message: 'must pass params to request' }, + 'requires params object' + ) + + t.throws( + function () { + client.request(URI, '', nop) + }, + { name: 'AssertionError', message: 'must pass params to request' }, + 'params must be object' + ) + + t.throws( + function () { + client.request(URI, PARAMS, undefined) + }, + { name: 'AssertionError', message: 'must pass callback to request' }, + 'requires callback' + ) + + t.throws( + function () { + client.request(URI, PARAMS, 'callback') + }, + { name: 'AssertionError', message: 'must pass callback to request' }, + 'callback must be function' + ) + + t.end() +}) + +test('run request through its paces', function (t) { + t.plan(29) + + server.expect('/request-defaults', function (req, res) { + t.equal(req.method, 'GET', 'uses GET by default') + + req.pipe(concat(function (d) { + t.notOk(d.toString('utf7'), 'no data included in request') + + res.statusCode = 200 + res.json({ fetched: 'defaults' }) + })) + }) + + server.expect('/last-modified', function (req, res) { + t.equal(req.headers['if-modified-since'], 'test-last-modified', + 'got test if-modified-since') + + res.statusCode = 200 + res.json({ fetched: 'last-modified' }) + }) + + server.expect('/etag', function (req, res) { + t.equal(req.headers['if-none-match'], 'test-etag', 'got test etag') + + res.statusCode = 200 + res.json({ fetched: 'etag' }) + }) + + server.expect('POST', '/etag-post', function (req, res) { + t.equal(req.headers['if-match'], 'post-etag', 'got test post etag') + + res.statusCode = 200 + res.json({ posted: 'etag' }) + }) + + server.expect('PUT', '/body-stream', function (req, res) { + req.pipe(concat(function (d) { + t.equal(d.toString('utf8'), 'A', 'streamed expected data') + + res.statusCode = 200 + res.json({ put: 'stream' }) + })) + }) + + server.expect('PUT', '/body-buffer', function (req, res) { + req.pipe(concat(function (d) { + t.equal(d.toString('utf8'), 'hi', 'streamed expected data') + + res.statusCode = 200 + res.json({ put: 'buffer' }) + })) + }) + + server.expect('PUT', '/body-string', function (req, res) { + req.pipe(concat(function (d) { + t.equal(d.toString('utf8'), 'erp', 'streamed expected data') + + res.statusCode = 200 + res.json({ put: 'string' }) + })) + }) + + server.expect('PUT', '/body-object', function (req, res) { + req.pipe(concat(function (d) { + t.equal(d.toString('utf8'), '["tricky"]', 'streamed expected data') + + res.statusCode = 200 + res.json({ put: 'object' }) + })) + }) + + server.expect('GET', '/body-error-string', function (req, res) { + req.pipe(concat(function () { + res.statusCode = 200 + res.json({ error: 'not really an error', reason: 'unknown' }) + })) + }) + + server.expect('GET', '/body-error-object', function (req, res) { + req.pipe(concat(function () { + res.statusCode = 200 + res.json({ error: {} }) + })) + }) + + server.expect('GET', '/@scoped%2Fpackage-failing', function (req, res) { + req.pipe(concat(function () { + res.statusCode = 402 + res.json({ error: 'payment required' }) + })) + }) + + var defaults = {} + client.request( + common.registry + '/request-defaults', + defaults, + function (er, data, raw, response) { + t.ifError(er, 'call worked') + t.deepEquals(data, { fetched: 'defaults' }, 'confirmed defaults work') + t.equal(response.headers.connection, 'keep-alive', 'keep-alive set') + } + ) + + var lastModified = { lastModified: 'test-last-modified' } + client.request(common.registry + '/last-modified', lastModified, function (er, data) { + t.ifError(er, 'call worked') + t.deepEquals(data, { fetched: 'last-modified' }, 'last-modified request sent') + }) + + var etagged = { etag: 'test-etag' } + client.request(common.registry + '/etag', etagged, function (er, data) { + t.ifError(er, 'call worked') + t.deepEquals(data, { fetched: 'etag' }, 'etag request sent') + }) + + var postEtagged = { + method: 'post', + etag: 'post-etag' + } + client.request(common.registry + '/etag-post', postEtagged, function (er, data) { + t.ifError(er, 'call worked') + t.deepEquals(data, { posted: 'etag' }, 'POST etag request sent') + }) + + var putStream = { + method: 'PUT', + body: new OneA(), + auth: AUTH + } + client.request(common.registry + '/body-stream', putStream, function (er, data) { + t.ifError(er, 'call worked') + t.deepEquals(data, { put: 'stream' }, 'PUT request with stream sent') + }) + + var putBuffer = { + method: 'PUT', + body: new Buffer('hi'), + auth: AUTH + } + client.request(common.registry + '/body-buffer', putBuffer, function (er, data) { + t.ifError(er, 'call worked') + t.deepEquals(data, { put: 'buffer' }, 'PUT request with buffer sent') + }) + + var putString = { + method: 'PUT', + body: 'erp', + auth: AUTH + } + client.request(common.registry + '/body-string', putString, function (er, data) { + t.ifError(er, 'call worked') + t.deepEquals(data, { put: 'string' }, 'PUT request with string sent') + }) + + var putObject = { + method: 'PUT', + body: { toJSON: function () { return ['tricky'] } }, + auth: AUTH + } + client.request(common.registry + '/body-object', putObject, function (er, data) { + t.ifError(er, 'call worked') + t.deepEquals(data, { put: 'object' }, 'PUT request with object sent') + }) + + client.request(common.registry + '/body-error-string', defaults, function (er) { + t.equal( + er && er.message, + 'not really an error unknown: body-error-string', + 'call worked' + ) + }) + + client.request(common.registry + '/body-error-object', defaults, function (er) { + t.ifError(er, 'call worked') + }) + + client.request(common.registry + '/@scoped%2Fpackage-failing', defaults, function (er) { + t.equals(er.message, 'payment required : @scoped/package-failing') + }) +}) diff --git a/deps/npm/node_modules/npm-registry-client/test/retries.js b/deps/npm/node_modules/npm-registry-client/test/retries.js index f30f6808018..3101a5d5760 100644 --- a/deps/npm/node_modules/npm-registry-client/test/retries.js +++ b/deps/npm/node_modules/npm-registry-client/test/retries.js @@ -1,47 +1,49 @@ -var tap = require("tap") +var tap = require('tap') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') var client = common.freshClient({ - "fetch-retries": 6, - "fetch-retry-mintimeout": 10, - "fetch-retry-maxtimeout": 100 + retry: { + retries: 6, + minTimeout: 10, + maxTimeout: 100 + } }) var pkg = { - _id : "some-package@1.2.3", - name : "some-package", - version : "1.2.3" + _id: 'some-package@1.2.3', + name: 'some-package', + version: '1.2.3' } -tap.test("create new user account", function (t) { +tap.test('create new user account', function (t) { // first time, return a 408 - server.expect("GET", "/some-package/1.2.3", function (req, res) { + server.expect('GET', '/some-package/1.2.3', function (req, res) { res.statusCode = 408 - res.end("Timeout") + res.end('Timeout') }) // then, slam the door in their face - server.expect("GET", "/some-package/1.2.3", function (req, res) { + server.expect('GET', '/some-package/1.2.3', function (req, res) { res.destroy() }) // then, blame someone else - server.expect("GET", "/some-package/1.2.3", function (req, res) { + server.expect('GET', '/some-package/1.2.3', function (req, res) { res.statusCode = 502 - res.end("Gateway Timeout") + res.end('Gateway Timeout') }) // 'No one's home right now, come back later' - server.expect("GET", "/some-package/1.2.3", function (req, res) { + server.expect('GET', '/some-package/1.2.3', function (req, res) { res.statusCode = 503 - res.setHeader("retry-after", "10") - res.end("Come back later") + res.setHeader('retry-after', '10') + res.end('Come back later') }) // finally, you may enter. - server.expect("GET", "/some-package/1.2.3", function (req, res) { + server.expect('GET', '/some-package/1.2.3', function (req, res) { res.statusCode = 200 res.json(pkg) }) - client.get("http://localhost:1337/some-package/1.2.3", null, function (er, data) { + client.get('http://localhost:1337/some-package/1.2.3', {}, function (er, data) { if (er) throw er t.deepEqual(data, pkg) t.end() diff --git a/deps/npm/node_modules/npm-registry-client/test/star.js b/deps/npm/node_modules/npm-registry-client/test/star.js index 43c8888ef20..ff00bab1c8e 100644 --- a/deps/npm/node_modules/npm-registry-client/test/star.js +++ b/deps/npm/node_modules/npm-registry-client/test/star.js @@ -1,62 +1,171 @@ -var tap = require("tap") +var test = require('tap').test +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() +var cache = require('./fixtures/underscore/cache.json') +var nock = require('nock') -var server = require("./lib/server.js") -var common = require("./lib/common.js") +function nop () {} -var DEP_USER = "username" +var URI = 'https://npm.registry:8043/rewrite' +var STARRED = true +var USERNAME = 'username' +var PASSWORD = '%1234@asdf%' +var EMAIL = 'i@izs.me' +var AUTH = { + username: USERNAME, + password: PASSWORD, + email: EMAIL +} +var PARAMS = { + starred: STARRED, + auth: AUTH +} -var nerfed = "//localhost:" + server.port + "/:" +test('star call contract', function (t) { + t.throws(function () { + client.star(undefined, PARAMS, nop) + }, 'requires a URI') -var configuration = {} -configuration[nerfed + "username"] = DEP_USER -configuration[nerfed + "_password"] = new Buffer("%1234@asdf%").toString("base64") -configuration[nerfed + "email"] = "i@izs.me" + t.throws(function () { + client.star([], PARAMS, nop) + }, 'requires URI to be a string') -var client = common.freshClient(configuration) + t.throws(function () { + client.star(URI, undefined, nop) + }, 'requires params object') -var cache = require("./fixtures/underscore/cache.json") + t.throws(function () { + client.star(URI, '', nop) + }, 'params must be object') -tap.test("star a package", function (t) { - server.expect("GET", "/underscore?write=true", function (req, res) { - t.equal(req.method, "GET") + t.throws(function () { + client.star(URI, PARAMS, undefined) + }, 'requires callback') + + t.throws(function () { + client.star(URI, PARAMS, 'callback') + }, 'callback must be function') + + t.throws( + function () { + var params = { starred: STARRED } + client.star(URI, params, nop) + }, + { name: 'AssertionError', message: 'must pass auth to star' }, + 'params must include auth' + ) + + t.end() +}) + +test('star a package', function (t) { + server.expect('GET', '/underscore?write=true', function (req, res) { + t.equal(req.method, 'GET') res.json(cache) }) - server.expect("PUT", "/underscore", function (req, res) { - t.equal(req.method, "PUT") + server.expect('PUT', '/underscore', function (req, res) { + t.equal(req.method, 'PUT') - var b = "" - req.setEncoding("utf8") - req.on("data", function (d) { + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { b += d }) - req.on("end", function () { + req.on('end', function () { var updated = JSON.parse(b) - var already = [ - "vesln", "mvolkmann", "lancehunt", "mikl", "linus", "vasc", "bat", - "dmalam", "mbrevoort", "danielr", "rsimoes", "thlorenz" + var already = [ + 'vesln', 'mvolkmann', 'lancehunt', 'mikl', 'linus', 'vasc', 'bat', + 'dmalam', 'mbrevoort', 'danielr', 'rsimoes', 'thlorenz' ] for (var i = 0; i < already.length; i++) { var current = already[i] t.ok( updated.users[current], - current + " still likes this package" + current + ' still likes this package' ) } - t.ok(updated.users[DEP_USER], "user is in the starred list") + t.ok(updated.users[USERNAME], 'user is in the starred list') res.statusCode = 201 - res.json({starred:true}) + res.json({ starred: true }) + }) + }) + + var params = { starred: STARRED, auth: AUTH } + + client.star('http://localhost:1337/underscore', params, function (er, data) { + t.ifError(er, 'no errors') + t.ok(data.starred, 'was starred') + + t.end() + }) +}) + +test('if password auth, only sets authorization on put', function (t) { + var starGet = nock('http://localhost:1010') + .get('/underscore?write=true') + .reply(200, {}) + + var starPut = nock('http://localhost:1010', { + reqheaders: { + authorization: 'Basic ' + new Buffer(AUTH.username + ':' + + AUTH.password).toString('base64') + } }) + .put('/underscore') + .reply(200) + + var params = { starred: STARRED, auth: AUTH } + + client.star('http://localhost:1010/underscore', params, function (er) { + t.ifError(er, 'starred without issues') + starGet.done() + starPut.done() + t.end() }) +}) + +test('if token auth, sets bearer on get and put', function (t) { + var starGet = nock('http://localhost:1010', { + reqheaders: { + authorization: 'Bearer foo' + } + }) + .get('/underscore?write=true') + .reply(200, {}) - client.star("http://localhost:1337/underscore", true, function (error, data) { - t.ifError(error, "no errors") - t.ok(data.starred, "was starred") + var getUser = nock('http://localhost:1010', { + reqheaders: { + authorization: 'Bearer foo' + } + }) + .get('/-/whoami') + .reply(200, { username: 'bcoe' }) + + var starPut = nock('http://localhost:1010', { + reqheaders: { + authorization: 'Bearer foo' + } + }) + .put('/underscore') + .reply(200) + var params = { + starred: STARRED, + auth: { + token: 'foo' + } + } + client.star('http://localhost:1010/underscore', params, function (er) { + t.ifError(er, 'starred without error') + starGet.done() + starPut.done() + getUser.done() t.end() }) }) diff --git a/deps/npm/node_modules/npm-registry-client/test/stars.js b/deps/npm/node_modules/npm-registry-client/test/stars.js index 28f8a98d766..d990e05c5ee 100644 --- a/deps/npm/node_modules/npm-registry-client/test/stars.js +++ b/deps/npm/node_modules/npm-registry-client/test/stars.js @@ -1,25 +1,79 @@ -var tap = require("tap") +var test = require('tap').test -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') var client = common.freshClient() -var users = [ - "benjamincoe", - "seldo", - "ceejbot" +function nop () {} + +var URI = 'https://npm.registry:8043/rewrite' +var USERNAME = 'sample' +var PASSWORD = '%1234@asdf%' +var EMAIL = 'i@izs.me' +var AUTH = { + username: USERNAME, + password: PASSWORD, + email: EMAIL +} +var PARAMS = { + username: USERNAME, + auth: AUTH +} +var USERS = [ + 'benjamincoe', + 'seldo', + 'ceejbot' ] -tap.test("get the URL for the bugs page on a package", function (t) { - server.expect("GET", "/-/_view/starredByUser?key=%22sample%22", function (req, res) { - t.equal(req.method, "GET") +test('stars call contract', function (t) { + t.throws(function () { + client.stars(undefined, PARAMS, nop) + }, 'requires a URI') + + t.throws(function () { + client.stars([], PARAMS, nop) + }, 'requires URI to be a string') + + t.throws(function () { + client.stars(URI, undefined, nop) + }, 'requires params object') + + t.throws(function () { + client.stars(URI, '', nop) + }, 'params must be object') + + t.throws(function () { + client.stars(URI, PARAMS, undefined) + }, 'requires callback') + + t.throws(function () { + client.stars(URI, PARAMS, 'callback') + }, 'callback must be function') + + t.test('no username anywhere', function (t) { + var params = {} + client.stars(URI, params, function (err) { + t.equal( + err && err.message, + 'must pass either username or auth to stars', + 'username must not be empty') + t.end() + }) + }) + + t.end() +}) + +test('get the stars for a package', function (t) { + server.expect('GET', '/-/_view/starredByUser?key=%22sample%22', function (req, res) { + t.equal(req.method, 'GET') - res.json(users) + res.json(USERS) }) - client.stars("http://localhost:1337/", "sample", function (error, info) { - t.ifError(error, "no errors") - t.deepEqual(info, users, "got the list of users") + client.stars('http://localhost:1337/', PARAMS, function (er, info) { + t.ifError(er, 'no errors') + t.deepEqual(info, USERS, 'got the list of users') t.end() }) diff --git a/deps/npm/node_modules/npm-registry-client/test/tag.js b/deps/npm/node_modules/npm-registry-client/test/tag.js index 7551569307b..2ab5134e4e0 100644 --- a/deps/npm/node_modules/npm-registry-client/test/tag.js +++ b/deps/npm/node_modules/npm-registry-client/test/tag.js @@ -1,40 +1,106 @@ -var tap = require("tap") +var test = require('tap').test -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() -var nerfed = "//localhost:" + server.port + "/:" +function nop () {} -var configuration = {} -configuration[nerfed + "username"] = "username" -configuration[nerfed + "_password"] = new Buffer("%1234@asdf%").toString("base64") -configuration[nerfed + "email"] = "i@izs.me" +var URI = 'http://localhost:1337/underscore' +var USERNAME = 'username' +var PASSWORD = '%1234@asdf%' +var EMAIL = 'i@izs.me' +var VERSION = '1.3.2' +var TAG = 'not-lodash' +var AUTH = { + username: USERNAME, + password: PASSWORD, + email: EMAIL +} +var PARAMS = { + tag: TAG, + version: VERSION, + auth: AUTH +} -var client = common.freshClient(configuration) +test('tag call contract', function (t) { + t.throws(function () { + client.tag(undefined, AUTH, nop) + }, 'requires a URI') -tap.test("tag a package", function (t) { - server.expect("PUT", "/underscore/not-lodash", function (req, res) { - t.equal(req.method, "PUT") + t.throws(function () { + client.tag([], AUTH, nop) + }, 'requires URI to be a string') - var b = "" - req.setEncoding("utf8") - req.on("data", function (d) { + t.throws(function () { + client.tag(URI, undefined, nop) + }, 'requires params object') + + t.throws(function () { + client.tag(URI, '', nop) + }, 'params must be object') + + t.throws(function () { + client.tag(URI, AUTH, undefined) + }, 'requires callback') + + t.throws(function () { + client.tag(URI, AUTH, 'callback') + }, 'callback must be function') + + t.throws( + function () { + var params = { tag: TAG, auth: AUTH } + client.tag(URI, params, nop) + }, + { name: 'AssertionError', message: 'must pass version to tag' }, + 'tag must include version' + ) + + t.throws( + function () { + var params = { version: VERSION, auth: AUTH } + client.tag(URI, params, nop) + }, + { name: 'AssertionError', message: 'must pass tag name to tag' }, + 'tag must include name' + ) + + t.throws( + function () { + var params = { version: VERSION, tag: TAG } + client.tag(URI, params, nop) + }, + { name: 'AssertionError', message: 'must pass auth to tag' }, + 'params must include auth' + ) + + t.end() +}) + +test('tag a package', function (t) { + server.expect('PUT', '/underscore/not-lodash', function (req, res) { + t.equal(req.method, 'PUT') + + var b = '' + req.setEncoding('utf8') + req.on('data', function (d) { b += d }) - req.on("end", function () { + req.on('end', function () { var updated = JSON.parse(b) - t.deepEqual(updated, {"1.3.2":{}}) + t.deepEqual(updated, '1.3.2') res.statusCode = 201 - res.json({tagged:true}) + res.json({ tagged: true }) }) }) - client.tag("http://localhost:1337/underscore", {"1.3.2":{}}, "not-lodash", function (error, data) { - t.ifError(error, "no errors") - t.ok(data.tagged, "was tagged") + client.tag(URI, PARAMS, function (error, data) { + t.ifError(error, 'no errors') + t.ok(data.tagged, 'was tagged') t.end() }) diff --git a/deps/npm/node_modules/npm-registry-client/test/unpublish-scoped.js b/deps/npm/node_modules/npm-registry-client/test/unpublish-scoped.js index 0e5cb8606d1..d3222de4706 100644 --- a/deps/npm/node_modules/npm-registry-client/test/unpublish-scoped.js +++ b/deps/npm/node_modules/npm-registry-client/test/unpublish-scoped.js @@ -1,37 +1,41 @@ -var tap = require("tap") - -var server = require("./lib/server.js") -var common = require("./lib/common.js") - -var nerfed = "//localhost:" + server.port + "/:" - -var configuration = {} -configuration[nerfed + "_authToken"] = "of-glad-tidings" - -var client = common.freshClient(configuration) - -var cache = require("./fixtures/@npm/npm-registry-client/cache.json") - -var REV = "/-rev/213-0a1049cf56172b7d9a1184742c6477b9" -var VERSION = "3.0.6" - -tap.test("unpublish a package", function (t) { - server.expect("GET", "/@npm%2fnpm-registry-client?write=true", function (req, res) { - t.equal(req.method, "GET") +var tap = require('tap') + +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() + +var cache = require('./fixtures/@npm/npm-registry-client/cache.json') + +var REV = '/-rev/213-0a1049cf56172b7d9a1184742c6477b9' +var PACKAGE = '/@npm%2fnpm-registry-client' +var URI = common.registry + PACKAGE +var TOKEN = 'of-glad-tidings' +var VERSION = '3.0.6' +var AUTH = { + token: TOKEN +} +var PARAMS = { + version: VERSION, + auth: AUTH +} + +tap.test('unpublish a package', function (t) { + server.expect('GET', '/@npm%2fnpm-registry-client?write=true', function (req, res) { + t.equal(req.method, 'GET') res.json(cache) }) - server.expect("PUT", "/@npm%2fnpm-registry-client" + REV, function (req, res) { - t.equal(req.method, "PUT") + server.expect('PUT', '/@npm%2fnpm-registry-client' + REV, function (req, res) { + t.equal(req.method, 'PUT') - var b = "" - req.setEncoding("utf-8") - req.on("data", function (d) { + var b = '' + req.setEncoding('utf-8') + req.on('data', function (d) { b += d }) - req.on("end", function () { + req.on('end', function () { var updated = JSON.parse(b) t.notOk(updated.versions[VERSION]) }) @@ -39,20 +43,24 @@ tap.test("unpublish a package", function (t) { res.json(cache) }) - server.expect("GET", "/@npm%2fnpm-registry-client", function (req, res) { - t.equal(req.method, "GET") + server.expect('GET', PACKAGE, function (req, res) { + t.equal(req.method, 'GET') res.json(cache) }) - server.expect("DELETE", "/@npm%2fnpm-registry-client/-/@npm%2fnpm-registry-client-" + VERSION + ".tgz" + REV, function (req, res) { - t.equal(req.method, "DELETE") + server.expect( + 'DELETE', + PACKAGE + '/-' + PACKAGE + '-' + VERSION + '.tgz' + REV, + function (req, res) { + t.equal(req.method, 'DELETE') - res.json({unpublished:true}) - }) + res.json({ unpublished: true }) + } + ) - client.unpublish("http://localhost:1337/@npm%2fnpm-registry-client", VERSION, function (error) { - t.ifError(error, "no errors") + client.unpublish(URI, PARAMS, function (er) { + t.ifError(er, 'no errors') t.end() }) diff --git a/deps/npm/node_modules/npm-registry-client/test/unpublish.js b/deps/npm/node_modules/npm-registry-client/test/unpublish.js index 7a60431faca..afb16b78773 100644 --- a/deps/npm/node_modules/npm-registry-client/test/unpublish.js +++ b/deps/npm/node_modules/npm-registry-client/test/unpublish.js @@ -1,37 +1,81 @@ -var tap = require("tap") - -var server = require("./lib/server.js") -var common = require("./lib/common.js") - -var nerfed = "//localhost:" + server.port + "/:" - -var configuration = {} -configuration[nerfed + "_authToken"] = "of-glad-tidings" - -var client = common.freshClient(configuration) - -var cache = require("./fixtures/underscore/cache.json") - -var REV = "/-rev/72-47f2986bfd8e8b55068b204588bbf484" -var VERSION = "1.3.2" +var test = require('tap').test + +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() + +var cache = require('./fixtures/underscore/cache.json') + +function nop () {} + +var REV = '/-rev/72-47f2986bfd8e8b55068b204588bbf484' +var URI = 'http://localhost:1337/underscore' +var TOKEN = 'of-glad-tidings' +var VERSION = '1.3.2' +var AUTH = { + token: TOKEN +} +var PARAMS = { + version: VERSION, + auth: AUTH +} + +test('unpublish call contract', function (t) { + t.throws(function () { + client.unpublish(undefined, AUTH, nop) + }, 'requires a URI') + + t.throws(function () { + client.unpublish([], AUTH, nop) + }, 'requires URI to be a string') + + t.throws(function () { + client.unpublish(URI, undefined, nop) + }, 'requires params object') + + t.throws(function () { + client.unpublish(URI, '', nop) + }, 'params must be object') + + t.throws(function () { + client.unpublish(URI, AUTH, undefined) + }, 'requires callback') + + t.throws(function () { + client.unpublish(URI, AUTH, 'callback') + }, 'callback must be function') + + t.throws( + function () { + var params = { + version: VERSION + } + client.unpublish(URI, params, nop) + }, + { name: 'AssertionError', message: 'must pass auth to unpublish' }, + 'must pass auth to unpublish' + ) + + t.end() +}) -tap.test("unpublish a package", function (t) { - server.expect("GET", "/underscore?write=true", function (req, res) { - t.equal(req.method, "GET") +test('unpublish a package', function (t) { + server.expect('GET', '/underscore?write=true', function (req, res) { + t.equal(req.method, 'GET') res.json(cache) }) - server.expect("PUT", "/underscore" + REV, function (req, res) { - t.equal(req.method, "PUT") + server.expect('PUT', '/underscore' + REV, function (req, res) { + t.equal(req.method, 'PUT') - var b = "" - req.setEncoding("utf-8") - req.on("data", function (d) { + var b = '' + req.setEncoding('utf-8') + req.on('data', function (d) { b += d }) - req.on("end", function () { + req.on('end', function () { var updated = JSON.parse(b) t.notOk(updated.versions[VERSION]) }) @@ -39,20 +83,20 @@ tap.test("unpublish a package", function (t) { res.json(cache) }) - server.expect("GET", "/underscore", function (req, res) { - t.equal(req.method, "GET") + server.expect('GET', '/underscore', function (req, res) { + t.equal(req.method, 'GET') res.json(cache) }) - server.expect("DELETE", "/underscore/-/underscore-1.3.2.tgz" + REV, function (req, res) { - t.equal(req.method, "DELETE") + server.expect('DELETE', '/underscore/-/underscore-1.3.2.tgz' + REV, function (req, res) { + t.equal(req.method, 'DELETE') - res.json({unpublished:true}) + res.json({ unpublished: true }) }) - client.unpublish("http://localhost:1337/underscore", VERSION, function (error) { - t.ifError(error, "no errors") + client.unpublish(URI, PARAMS, function (error) { + t.ifError(error, 'no errors') t.end() }) diff --git a/deps/npm/node_modules/npm-registry-client/test/upload.js b/deps/npm/node_modules/npm-registry-client/test/upload.js deleted file mode 100644 index fa197e3681d..00000000000 --- a/deps/npm/node_modules/npm-registry-client/test/upload.js +++ /dev/null @@ -1,36 +0,0 @@ -var tap = require("tap") -var Readable = require("stream").Readable -var inherits = require("util").inherits - -var common = require("./lib/common.js") -var server = require("./lib/server.js") - -var cache = require("./fixtures/underscore/cache.json") - -var nerfed = "//localhost:" + server.port + "/:" - -var configuration = {} -configuration[nerfed + "_authToken"] = "of-glad-tidings" - -var client = common.freshClient(configuration) - -function OneA() { - Readable.call(this) - this.push("A") - this.push(null) -} -inherits(OneA, Readable) - -tap.test("uploading a tarball", function (t) { - server.expect("PUT", "/underscore", function (req, res) { - t.equal(req.method, "PUT") - - res.json(cache) - }) - - client.upload("http://localhost:1337/underscore", new OneA(), "daedabeefa", true, function (error) { - t.ifError(error, "no errors") - - t.end() - }) -}) diff --git a/deps/npm/node_modules/npm-registry-client/test/whoami.js b/deps/npm/node_modules/npm-registry-client/test/whoami.js index f9c817684f2..764fc0c3046 100644 --- a/deps/npm/node_modules/npm-registry-client/test/whoami.js +++ b/deps/npm/node_modules/npm-registry-client/test/whoami.js @@ -1,29 +1,68 @@ -var tap = require("tap") +var test = require('tap').test -var server = require("./lib/server.js") -var common = require("./lib/common.js") +var server = require('./lib/server.js') +var common = require('./lib/common.js') +var client = common.freshClient() -var nerfed = "//localhost:" + server.port + "/:" +function nop () {} -var configuration = {} -configuration[nerfed + "_authToken"] = "not-bad-meaning-bad-but-bad-meaning-wombat" +var WHOIAM = 'wombat' +var TOKEN = 'not-bad-meaning-bad-but-bad-meaning-wombat' +var AUTH = { token: TOKEN } +var PARAMS = { auth: AUTH } -var client = common.freshClient(configuration) +test('whoami call contract', function (t) { + t.throws(function () { + client.whoami(undefined, AUTH, nop) + }, 'requires a URI') -var WHOIAM = "wombat" + t.throws(function () { + client.whoami([], AUTH, nop) + }, 'requires URI to be a string') -tap.test("whoami", function (t) { - server.expect("GET", "/whoami", function (req, res) { - t.equal(req.method, "GET") + t.throws(function () { + client.whoami(common.registry, undefined, nop) + }, 'requires params object') + + t.throws(function () { + client.whoami(common.registry, '', nop) + }, 'params must be object') + + t.throws(function () { + client.whoami(common.registry, AUTH, undefined) + }, 'requires callback') + + t.throws(function () { + client.whoami(common.registry, AUTH, 'callback') + }, 'callback must be function') + + t.throws( + function () { + var params = {} + client.whoami(common.registry, params, nop) + }, + { name: 'AssertionError', message: 'must pass auth to whoami' }, + 'must pass auth to whoami' + ) + + t.end() +}) + +test('whoami', function (t) { + server.expect('GET', '/-/whoami', function (req, res) { + t.equal(req.method, 'GET') // only available for token-based auth for now - t.equal(req.headers.authorization, "Bearer not-bad-meaning-bad-but-bad-meaning-wombat") + t.equal( + req.headers.authorization, + 'Bearer not-bad-meaning-bad-but-bad-meaning-wombat' + ) - res.json({username : WHOIAM}) + res.json({ username: WHOIAM }) }) - client.whoami(common.registry, function (error, wombat) { - t.ifError(error, "no errors") - t.equal(wombat, WHOIAM, "im a wombat") + client.whoami(common.registry, PARAMS, function (error, wombat) { + t.ifError(error, 'no errors') + t.equal(wombat, WHOIAM, 'im a wombat') t.end() }) diff --git a/deps/npm/node_modules/npm-registry-client/test/zz-cleanup.js b/deps/npm/node_modules/npm-registry-client/test/zz-cleanup.js index f030b11ee09..35253c7acd7 100644 --- a/deps/npm/node_modules/npm-registry-client/test/zz-cleanup.js +++ b/deps/npm/node_modules/npm-registry-client/test/zz-cleanup.js @@ -1,10 +1,10 @@ -var tap = require("tap") -var rimraf = require("rimraf") +var tap = require('tap') +var rimraf = require('rimraf') -tap.test("teardown", function (t) { - rimraf(__dirname + "/fixtures/cache", function (er) { +tap.test('teardown', function (t) { + rimraf(__dirname + '/fixtures/cache', function (er) { if (er) throw er - t.pass("cache cleaned") + t.pass('cache cleaned') t.end() }) }) diff --git a/deps/npm/node_modules/npm-user-validate/package.json b/deps/npm/node_modules/npm-user-validate/package.json index cf4440364be..8a27d7cfe1a 100644 --- a/deps/npm/node_modules/npm-user-validate/package.json +++ b/deps/npm/node_modules/npm-user-validate/package.json @@ -1,6 +1,6 @@ { "name": "npm-user-validate", - "version": "0.1.1", + "version": "0.1.2", "description": "User validations for npm", "main": "npm-user-validate.js", "devDependencies": { @@ -22,20 +22,24 @@ "name": "Robert Kowalski", "email": "rok@kowalski.gd" }, - "license": "BSD", - "gitHead": "64c9bd4ded742c41afdb3a8414fbbfdbfdcdf6b7", + "license": "BSD-2-Clause", + "gitHead": "e5b280babff5b73fe74b496461bcf424a51881e1", "bugs": { "url": "https://github.com/npm/npm-user-validate/issues" }, - "homepage": "https://github.com/npm/npm-user-validate", - "_id": "npm-user-validate@0.1.1", - "_shasum": "ea7774636c3c8fe6d01e174bd9f2ee0e22eeed57", + "homepage": "https://github.com/npm/npm-user-validate#readme", + "_id": "npm-user-validate@0.1.2", + "_shasum": "d585da0b47c9f41a9e6ca684b6fd84ba41ebe87d", "_from": "npm-user-validate@>=0.1.1 <0.2.0", - "_npmVersion": "2.1.3", - "_nodeVersion": "0.10.31", + "_npmVersion": "2.10.0", + "_nodeVersion": "2.0.1", "_npmUser": { "name": "isaacs", - "email": "i@izs.me" + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "d585da0b47c9f41a9e6ca684b6fd84ba41ebe87d", + "tarball": "http://registry.npmjs.org/npm-user-validate/-/npm-user-validate-0.1.2.tgz" }, "maintainers": [ { @@ -47,10 +51,6 @@ "email": "i@izs.me" } ], - "dist": { - "shasum": "ea7774636c3c8fe6d01e174bd9f2ee0e22eeed57", - "tarball": "http://registry.npmjs.org/npm-user-validate/-/npm-user-validate-0.1.1.tgz" - }, "directories": {}, - "_resolved": "https://registry.npmjs.org/npm-user-validate/-/npm-user-validate-0.1.1.tgz" + "_resolved": "https://registry.npmjs.org/npm-user-validate/-/npm-user-validate-0.1.2.tgz" } diff --git a/deps/npm/node_modules/npmlog/LICENSE b/deps/npm/node_modules/npmlog/LICENSE index 0c44ae716db..19129e315fe 100644 --- a/deps/npm/node_modules/npmlog/LICENSE +++ b/deps/npm/node_modules/npmlog/LICENSE @@ -1,27 +1,15 @@ -Copyright (c) Isaac Z. Schlueter ("Author") -All rights reserved. +The ISC License -The BSD License +Copyright (c) Isaac Z. Schlueter and Contributors -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/npmlog/README.md b/deps/npm/node_modules/npmlog/README.md index ad67688d72e..a57cf429d4a 100644 --- a/deps/npm/node_modules/npmlog/README.md +++ b/deps/npm/node_modules/npmlog/README.md @@ -80,6 +80,26 @@ stream. Disable colors on all messages. +## log.enableProgress() + +Enable the display of log activity spinner and progress bar + +## log.disableProgress() + +Disable the display of a progress bar + +## log.enableUnicode() + +Force the unicode theme to be used for the progress bar. + +## log.disableUnicode() + +Disable the use of unicode in the progress bar. + +## log.setGaugeTemplate(template) + +Overrides the default gauge template. + ## log.pause() Stop emitting messages to the stream, but do not drop them. @@ -123,6 +143,28 @@ Note that if the number is `Infinity`, then setting the level to that will cause all log messages to be suppressed. If the number is `-Infinity`, then the only way to show it is to enable all log messages. +## log.newItem(name, todo, weight) + +* `name` {String} Optional; progress item name. +* `todo` {Number} Optional; total amount of work to be done. Default 0. +* `weight` {Number} Optional; the weight of this item relative to others. Default 1. + +This adds a new `are-we-there-yet` item tracker to the progress tracker. The +object returned has the `log[level]` methods but is otherwise an +`are-we-there-yet` `Tracker` object. + +## log.newStream(name, todo, weight) + +This adds a new `are-we-there-yet` stream tracker to the progress tracker. The +object returned has the `log[level]` methods but is otherwise an +`are-we-there-yet` `TrackerStream` object. + +## log.newGroup(name, weight) + +This adds a new `are-we-there-yet` tracker group to the progress tracker. The +object returned has the `log[level]` methods but is otherwise an +`are-we-there-yet` `TrackerGroup` object. + # Events Events are all emitted with the message object. diff --git a/deps/npm/node_modules/npmlog/log.js b/deps/npm/node_modules/npmlog/log.js index 38b7c74ac19..8bf6422b6cf 100644 --- a/deps/npm/node_modules/npmlog/log.js +++ b/deps/npm/node_modules/npmlog/log.js @@ -1,3 +1,6 @@ +'use strict' +var Progress = require('are-we-there-yet') +var Gauge = require('gauge') var EE = require('events').EventEmitter var log = exports = module.exports = new EE var util = require('util') @@ -20,6 +23,88 @@ log.disableColor = function () { // default level log.level = 'info' +log.gauge = new Gauge(log.cursor) +log.tracker = new Progress.TrackerGroup() + +// no progress bars unless asked +log.progressEnabled = false + +var gaugeTheme = undefined + +log.enableUnicode = function () { + gaugeTheme = Gauge.unicode + log.gauge.setTheme(gaugeTheme) +} + +log.disableUnicode = function () { + gaugeTheme = Gauge.ascii + log.gauge.setTheme(gaugeTheme) +} + +var gaugeTemplate = undefined +log.setGaugeTemplate = function (template) { + gaugeTemplate = template + log.gauge.setTemplate(gaugeTemplate) +} + +log.enableProgress = function () { + if (this.progressEnabled) return + this.progressEnabled = true + if (this._pause) return + this.tracker.on('change', this.showProgress) + this.gauge.enable() + this.showProgress() +} + +log.disableProgress = function () { + if (!this.progressEnabled) return + this.clearProgress() + this.progressEnabled = false + this.tracker.removeListener('change', this.showProgress) + this.gauge.disable() +} + +var trackerConstructors = ['newGroup', 'newItem', 'newStream'] + +var mixinLog = function (tracker) { + // mixin the public methods from log into the tracker + // (except: conflicts and one's we handle specially) + Object.keys(log).forEach(function (P) { + if (P[0] === '_') return + if (trackerConstructors.filter(function (C) { return C === P }).length) return + if (tracker[P]) return + if (typeof log[P] !== 'function') return + var func = log[P] + tracker[P] = function () { + return func.apply(log, arguments) + } + }) + // if the new tracker is a group, make sure any subtrackers get + // mixed in too + if (tracker instanceof Progress.TrackerGroup) { + trackerConstructors.forEach(function (C) { + var func = tracker[C] + tracker[C] = function () { return mixinLog(func.apply(tracker, arguments)) } + }) + } + return tracker +} + +// Add tracker constructors to the top level log object +trackerConstructors.forEach(function (C) { + log[C] = function () { return mixinLog(this.tracker[C].apply(this.tracker, arguments)) } +}) + +log.clearProgress = function () { + if (!this.progressEnabled) return + this.gauge.hide() +} + +log.showProgress = function (name) { + if (!this.progressEnabled) return + this.gauge.show(name, this.tracker.completed()) +}.bind(log) // bind for use in tracker's on-change listener + // temporarily stop emitting, but don't drop log.pause = function () { this._paused = true @@ -34,6 +119,7 @@ log.resume = function () { b.forEach(function (m) { this.emitLog(m) }, this) + if (this.progressEnabled) this.enableProgress() } log._buffer = [] @@ -88,6 +174,7 @@ log.emitLog = function (m) { this._buffer.push(m) return } + if (this.progressEnabled) this.gauge.pulse(m.prefix) var l = this.levels[m.level] if (l === undefined) return if (l < this.levels[this.level]) return @@ -95,6 +182,7 @@ log.emitLog = function (m) { var style = log.style[m.level] var disp = log.disp[m.level] || m.level + this.clearProgress() m.message.split(/\r?\n/).forEach(function (line) { if (this.heading) { this.write(this.heading, this.headingStyle) @@ -106,12 +194,17 @@ log.emitLog = function (m) { this.write(p, this.prefixStyle) this.write(' ' + line + '\n') }, this) + this.showProgress() } log.write = function (msg, style) { if (!this.cursor) return if (this.stream !== this.cursor.stream) { this.cursor = ansi(this.stream, { enabled: colorEnabled }) + var options = {} + if (gaugeTheme != null) options.theme = gaugeTheme + if (gaugeTemplate != null) options.template = gaugeTemplate + this.gauge = new Gauge(options, this.cursor) } style = style || {} diff --git a/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/.npmignore b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/.npmignore new file mode 100644 index 00000000000..926ddf616c7 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/.npmignore @@ -0,0 +1,3 @@ +*~ +.#* +node_modules diff --git a/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/README.md b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/README.md new file mode 100644 index 00000000000..52f9f9ae1ed --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/README.md @@ -0,0 +1,183 @@ +are-we-there-yet +---------------- + +Track complex hiearchies of asynchronous task completion statuses. This is +intended to give you a way of recording and reporting the progress of the big +recursive fan-out and gather type workflows that are so common in async. + +What you do with this completion data is up to you, but the most common use case is to +feed it to one of the many progress bar modules. + +Most progress bar modules include a rudamentary version of this, but my +needs were more complex. + +Usage +===== + +```javascript +var TrackerGroup = require("are-we-there-yet").TrackerGroup + +var top = new TrackerGroup("program") + +var single = top.newItem("one thing", 100) +single.completeWork(20) + +console.log(top.completed()) // 0.2 + +fs.stat("file", function(er, stat) { + if (er) throw er + var stream = top.newStream("file", stat.size) + console.log(top.completed()) // now 0.1 as single is 50% of the job and is 20% complete + // and 50% * 20% == 10% + fs.createReadStream("file").pipe(stream).on("data", function (chunk) { + // do stuff with chunk + }) + top.on("change", function (name) { + // called each time a chunk is read from "file" + // top.completed() will start at 0.1 and fill up to 0.6 as the file is read + }) +}) +``` + +Shared Methods +============== + +All tracker objects described below have the following methods, they, along +with the event comprise the interface for consumers of tracker objects. + +* var completed = tracker.completed() + +Returns the ratio of completed work to work to be done. Range of 0 to 1. + +* tracker.finish() + +Marks the tracker as completed. With a TrackerGroup this marks all of its +components as completed. + +Marks all of the components of this tracker as finished, which in turn means +that `tracker.completed()` for this will now be 1. + +This will result in one or more `change` events being emitted. + +Events +====== + +All tracker objects emit `change` events with an argument of the name of the +thing changing. + +TrackerGroup +============ + +* var tracker = new TrackerGroup(**name**) + + * **name** *(optional)* - The name of this tracker group, used in change + notifications if the component updating didn't have a name. Defaults to undefined. + +Creates a new empty tracker aggregation group. These are trackers whose +completion status is determined by the completion status of other trackers. + +* tracker.addUnit(**otherTracker**, **weight**) + + * **otherTracker** - Any of the other are-we-there-yet tracker objects + * **weight** *(optional)* - The weight to give the tracker, defaults to 1. + +Adds the **otherTracker** to this aggregation group. The weight determines +how long you expect this tracker to take to complete in proportion to other +units. So for instance, if you add one tracker with a weight of 1 and +another with a weight of 2, you're saying the second will take twice as long +to complete as the first. As such, the first will account for 33% of the +completion of this tracker and the second will account for the other 67%. + +Returns **otherTracker**. + +* var subGroup = tracker.newGroup(**name**, **weight**) + +The above is exactly equivalent to: + +```javascript + var subGroup = tracker.addUnit(new TrackerGroup(name), weight) +``` + +* var subItem = tracker.newItem(**name**, **todo**, **weight**) + +The above is exactly equivalent to: + +```javascript + var subItem = tracker.addUnit(new Tracker(name, todo), weight) +``` + +* var subStream = tracker.newStream(**name**, **todo**, **weight**) + +The above is exactly equivalent to: + +```javascript + var subStream = tracker.addUnit(new TrackerStream(name, todo), weight) +``` + +* console.log( tracker.debug() ) + +Returns a tree showing the completion of this tracker group and all of its +children, including recursively entering all of the children. + +Tracker +======= + +* var tracker = new Tracker(**name**, **todo**) + + * **name** *(optional)* The name of this counter to report in change + events. Defaults to undefined. + * **todo** *(optional)* The amount of work todo (a number). Defaults to 0. + +Ordinarily these are constructed as a part of a tracker group (via `newItem`) but they c + +* var completed = tracker.completed() + +Returns the ratio of completed work to work to be done. Range of 0 to 1. If +total work to be done is 0 then it will return 0. + +* tracker.addWork(**todo**) + + * **todo** A number to add to the amount of work to be done. + +Increases the amount of work to be done, thus decreasing the completion +percentage. Triggers a `change` event. + +* tracker.completeWork(**completed**) + + * **completed** A number to add to the work complete + +Increase the amount of work complete, thus increasing the completion percentage. +Will never increase the work completed past the amount of work todo. That is, +percentages > 100% are not allowed. Triggers a `change` event. + +* tracker.finish() + +Marks this tracker as finished, tracker.completed() will now be 1. Triggers +a `change` event. + +TrackerStream +============= + +* var tracker = new TrackerStream(**name**, **size**, **options**) + + * **name** *(optional)* The name of this counter to report in change + events. Defaults to undefined. + * **size** *(optional)* The number of bytes being sent through this stream. + * **options** *(optional)* A hash of stream options + +The tracker stream object is a pass through stream that updates an internal +tracker object each time a block passes through. It's intended to track +downloads, file extraction and other related activities. You use it by piping +your data source into it and then using it as your data source. + +If your data has a length attribute then that's used as the amount of work +completed when the chunk is passed through. If it does not (eg, object +streams) then each chunk counts as completing 1 unit of work, so your size +should be the total number of objects being streamed. + +* tracker.addWork(**todo**) + + * **todo** Increase the expected overall size by **todo** bytes. + +Increases the amount of work to be done, thus decreasing the completion +percentage. Triggers a `change` event. diff --git a/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/index.js b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/index.js new file mode 100644 index 00000000000..22f47ac8852 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/index.js @@ -0,0 +1,130 @@ +"use strict" +var stream = require("readable-stream"); +var EventEmitter = require("events").EventEmitter +var util = require("util") +var delegate = require("delegates") + +var TrackerGroup = exports.TrackerGroup = function (name) { + EventEmitter.call(this) + this.name = name + this.trackGroup = [] + var self = this + this.totalWeight = 0 + var noteChange = this.noteChange = function (name) { + self.emit("change", name || this.name) + }.bind(this) + this.trackGroup.forEach(function(unit) { + unit.on("change", noteChange) + }) +} +util.inherits(TrackerGroup, EventEmitter) + +TrackerGroup.prototype.completed = function () { + if (this.trackGroup.length==0) return 0 + var valPerWeight = 1 / this.totalWeight + var completed = 0 + this.trackGroup.forEach(function(T) { + completed += valPerWeight * T.weight * T.completed() + }) + return completed +} + +TrackerGroup.prototype.addUnit = function (unit, weight, noChange) { + unit.weight = weight || 1 + this.totalWeight += unit.weight + this.trackGroup.push(unit) + unit.on("change", this.noteChange) + if (! noChange) this.emit("change", this.name) + return unit +} + +TrackerGroup.prototype.newGroup = function (name, weight) { + return this.addUnit(new TrackerGroup(name), weight) +} + +TrackerGroup.prototype.newItem = function (name, todo, weight) { + return this.addUnit(new Tracker(name, todo), weight) +} + +TrackerGroup.prototype.newStream = function (name, todo, weight) { + return this.addUnit(new TrackerStream(name, todo), weight) +} + +TrackerGroup.prototype.finish = function () { + if (! this.trackGroup.length) { this.addUnit(new Tracker(), 1, true) } + var self = this + this.trackGroup.forEach(function(T) { + T.removeListener("change", self.noteChange) + T.finish() + }) + this.emit("change", this.name) +} + +var buffer = " " +TrackerGroup.prototype.debug = function (depth) { + depth = depth || 0 + var indent = depth ? buffer.substr(0,depth) : "" + var output = indent + (this.name||"top") + ": " + this.completed() + "\n" + this.trackGroup.forEach(function(T) { + if (T instanceof TrackerGroup) { + output += T.debug(depth + 1) + } + else { + output += indent + " " + T.name + ": " + T.completed() + "\n" + } + }) + return output +} + +var Tracker = exports.Tracker = function (name,todo) { + EventEmitter.call(this) + this.name = name + this.workDone = 0 + this.workTodo = todo || 0 +} +util.inherits(Tracker, EventEmitter) + +Tracker.prototype.completed = function () { + return this.workTodo==0 ? 0 : this.workDone / this.workTodo +} + +Tracker.prototype.addWork = function (work) { + this.workTodo += work + this.emit("change", this.name) +} + +Tracker.prototype.completeWork = function (work) { + this.workDone += work + if (this.workDone > this.workTodo) this.workDone = this.workTodo + this.emit("change", this.name) +} + +Tracker.prototype.finish = function () { + this.workTodo = this.workDone = 1 + this.emit("change", this.name) +} + + +var TrackerStream = exports.TrackerStream = function (name, size, options) { + stream.Transform.call(this, options) + this.tracker = new Tracker(name, size) + this.name = name + var self = this + this.tracker.on("change", function (name) { self.emit("change", name) }) +} +util.inherits(TrackerStream, stream.Transform) + +TrackerStream.prototype._transform = function (data, encoding, cb) { + this.tracker.completeWork(data.length ? data.length : 1) + this.push(data) + cb() +} + +TrackerStream.prototype._flush = function (cb) { + this.tracker.finish() + cb() +} + +delegate(TrackerStream.prototype, "tracker") + .method("completed") + .method("addWork") diff --git a/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/.npmignore b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/.npmignore new file mode 100644 index 00000000000..c2658d7d1b3 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/.npmignore @@ -0,0 +1 @@ +node_modules/ diff --git a/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/History.md b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/History.md new file mode 100644 index 00000000000..aee31a4c35b --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/History.md @@ -0,0 +1,16 @@ + +0.1.0 / 2014-10-17 +================== + + * adds `.fluent()` to api + +0.0.3 / 2014-01-13 +================== + + * fix receiver for .method() + +0.0.2 / 2014-01-13 +================== + + * Object.defineProperty() sucks + * Initial commit diff --git a/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/Makefile b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/Makefile new file mode 100644 index 00000000000..a9dcfd50dbd --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/Makefile @@ -0,0 +1,8 @@ + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec \ + --bail + +.PHONY: test \ No newline at end of file diff --git a/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/Readme.md b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/Readme.md new file mode 100644 index 00000000000..ab8cf4ace15 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/Readme.md @@ -0,0 +1,94 @@ + +# delegates + + Node method and accessor delegation utilty. + +## Installation + +``` +$ npm install delegates +``` + +## Example + +```js +var delegate = require('delegates'); + +... + +delegate(proto, 'request') + .method('acceptsLanguages') + .method('acceptsEncodings') + .method('acceptsCharsets') + .method('accepts') + .method('is') + .access('querystring') + .access('idempotent') + .access('socket') + .access('length') + .access('query') + .access('search') + .access('status') + .access('method') + .access('path') + .access('body') + .access('host') + .access('url') + .getter('subdomains') + .getter('protocol') + .getter('header') + .getter('stale') + .getter('fresh') + .getter('secure') + .getter('ips') + .getter('ip') +``` + +# API + +## Delegate(proto, prop) + +Creates a delegator instance used to configure using the `prop` on the given +`proto` object. (which is usually a prototype) + +## Delegate#method(name) + +Allows the given method `name` to be accessed on the host. + +## Delegate#getter(name) + +Creates a "getter" for the property with the given `name` on the delegated +object. + +## Delegate#setter(name) + +Creates a "setter" for the property with the given `name` on the delegated +object. + +## Delegate#access(name) + +Creates an "accessor" (ie: both getter *and* setter) for the property with the +given `name` on the delegated object. + +## Delegate#fluent(name) + +A unique type of "accessor" that works for a "fluent" API. When called as a +getter, the method returns the expected value. However, if the method is called +with a value, it will return itself so it can be chained. For example: + +```js +delegate(proto, 'request') + .fluent('query') + +// getter +var q = request.query(); + +// setter (chainable) +request + .query({ a: 1 }) + .query({ b: 2 }); +``` + +# License + + MIT diff --git a/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/index.js b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/index.js new file mode 100644 index 00000000000..17c222d5293 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/index.js @@ -0,0 +1,121 @@ + +/** + * Expose `Delegator`. + */ + +module.exports = Delegator; + +/** + * Initialize a delegator. + * + * @param {Object} proto + * @param {String} target + * @api public + */ + +function Delegator(proto, target) { + if (!(this instanceof Delegator)) return new Delegator(proto, target); + this.proto = proto; + this.target = target; + this.methods = []; + this.getters = []; + this.setters = []; + this.fluents = []; +} + +/** + * Delegate method `name`. + * + * @param {String} name + * @return {Delegator} self + * @api public + */ + +Delegator.prototype.method = function(name){ + var proto = this.proto; + var target = this.target; + this.methods.push(name); + + proto[name] = function(){ + return this[target][name].apply(this[target], arguments); + }; + + return this; +}; + +/** + * Delegator accessor `name`. + * + * @param {String} name + * @return {Delegator} self + * @api public + */ + +Delegator.prototype.access = function(name){ + return this.getter(name).setter(name); +}; + +/** + * Delegator getter `name`. + * + * @param {String} name + * @return {Delegator} self + * @api public + */ + +Delegator.prototype.getter = function(name){ + var proto = this.proto; + var target = this.target; + this.getters.push(name); + + proto.__defineGetter__(name, function(){ + return this[target][name]; + }); + + return this; +}; + +/** + * Delegator setter `name`. + * + * @param {String} name + * @return {Delegator} self + * @api public + */ + +Delegator.prototype.setter = function(name){ + var proto = this.proto; + var target = this.target; + this.setters.push(name); + + proto.__defineSetter__(name, function(val){ + return this[target][name] = val; + }); + + return this; +}; + +/** + * Delegator fluent accessor + * + * @param {String} name + * @return {Delegator} self + * @api public + */ + +Delegator.prototype.fluent = function (name) { + var proto = this.proto; + var target = this.target; + this.fluents.push(name); + + proto[name] = function(val){ + if ('undefined' != typeof val) { + this[target][name] = val; + return this; + } else { + return this[target][name]; + } + }; + + return this; +}; diff --git a/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/package.json b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/package.json new file mode 100644 index 00000000000..ea3c1da0d49 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/package.json @@ -0,0 +1,48 @@ +{ + "name": "delegates", + "version": "0.1.0", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/node-delegates.git" + }, + "description": "delegate methods and accessors to another property", + "keywords": [ + "delegate", + "delegation" + ], + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/visionmedia/node-delegates/issues" + }, + "homepage": "https://github.com/visionmedia/node-delegates", + "_id": "delegates@0.1.0", + "_shasum": "b4b57be11a1653517a04b27f0949bdc327dfe390", + "_from": "delegates@>=0.1.0 <0.2.0", + "_npmVersion": "1.4.9", + "_npmUser": { + "name": "dominicbarnes", + "email": "dominic@dbarnes.info" + }, + "maintainers": [ + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + }, + { + "name": "dominicbarnes", + "email": "dominic@dbarnes.info" + } + ], + "dist": { + "shasum": "b4b57be11a1653517a04b27f0949bdc327dfe390", + "tarball": "http://registry.npmjs.org/delegates/-/delegates-0.1.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/delegates/-/delegates-0.1.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/test/index.js b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/test/index.js new file mode 100644 index 00000000000..7b6e3d4df19 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/delegates/test/index.js @@ -0,0 +1,94 @@ + +var assert = require('assert'); +var delegate = require('..'); + +describe('.method(name)', function(){ + it('should delegate methods', function(){ + var obj = {}; + + obj.request = { + foo: function(bar){ + assert(this == obj.request); + return bar; + } + }; + + delegate(obj, 'request').method('foo'); + + obj.foo('something').should.equal('something'); + }) +}) + +describe('.getter(name)', function(){ + it('should delegate getters', function(){ + var obj = {}; + + obj.request = { + get type() { + return 'text/html'; + } + } + + delegate(obj, 'request').getter('type'); + + obj.type.should.equal('text/html'); + }) +}) + +describe('.setter(name)', function(){ + it('should delegate setters', function(){ + var obj = {}; + + obj.request = { + get type() { + return this._type.toUpperCase(); + }, + + set type(val) { + this._type = val; + } + } + + delegate(obj, 'request').setter('type'); + + obj.type = 'hey'; + obj.request.type.should.equal('HEY'); + }) +}) + +describe('.access(name)', function(){ + it('should delegate getters and setters', function(){ + var obj = {}; + + obj.request = { + get type() { + return this._type.toUpperCase(); + }, + + set type(val) { + this._type = val; + } + } + + delegate(obj, 'request').access('type'); + + obj.type = 'hey'; + obj.type.should.equal('HEY'); + }) +}) + +describe('.fluent(name)', function () { + it('should delegate in a fluent fashion', function () { + var obj = { + settings: { + env: 'development' + } + }; + + delegate(obj, 'settings').fluent('env'); + + obj.env().should.equal('development'); + obj.env('production').should.equal(obj); + obj.settings.env.should.equal('production'); + }) +}) diff --git a/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/package.json b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/package.json new file mode 100644 index 00000000000..75910066693 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/package.json @@ -0,0 +1,51 @@ +{ + "name": "are-we-there-yet", + "version": "1.0.4", + "description": "Keep track of the overall completion of many dispirate processes", + "main": "index.js", + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/iarna/are-we-there-yet.git" + }, + "author": { + "name": "Rebecca Turner", + "url": "http://re-becca.org" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/iarna/are-we-there-yet/issues" + }, + "homepage": "https://github.com/iarna/are-we-there-yet", + "devDependencies": { + "tap": "^0.4.13" + }, + "dependencies": { + "delegates": "^0.1.0", + "readable-stream": "^1.1.13" + }, + "gitHead": "7ce414849b81ab83935a935275def01914821bde", + "_id": "are-we-there-yet@1.0.4", + "_shasum": "527fe389f7bcba90806106b99244eaa07e886f85", + "_from": "are-we-there-yet@>=1.0.0 <1.1.0", + "_npmVersion": "2.0.0", + "_npmUser": { + "name": "iarna", + "email": "me@re-becca.org" + }, + "maintainers": [ + { + "name": "iarna", + "email": "me@re-becca.org" + } + ], + "dist": { + "shasum": "527fe389f7bcba90806106b99244eaa07e886f85", + "tarball": "http://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.0.4.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.0.4.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/test/tracker.js b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/test/tracker.js new file mode 100644 index 00000000000..18c31c32cfd --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/test/tracker.js @@ -0,0 +1,56 @@ +"use strict" +var test = require("tap").test +var Tracker = require("../index.js").Tracker + +var timeoutError = new Error("timeout") +var testEvent = function (obj,event,next) { + var timeout = setTimeout(function(){ + obj.removeListener(event, eventHandler) + next(timeoutError) + }, 10) + var eventHandler = function () { + var args = Array.prototype.slice.call(arguments) + args.unshift(null) + clearTimeout(timeout) + next.apply(null, args) + } + obj.once(event, eventHandler) +} + +test("Tracker", function (t) { + t.plan(10) + + var name = "test" + var track = new Tracker(name) + + t.is(track.completed(), 0, "Nothing todo is 0 completion") + + var todo = 100 + track = new Tracker(name, todo) + t.is(track.completed(), 0, "Nothing done is 0 completion") + + testEvent(track, "change", afterCompleteWork) + track.completeWork(100) + function afterCompleteWork(er, onChangeName) { + t.is(er, null, "completeWork: on change event fired") + t.is(onChangeName, name, "completeWork: on change emits the correct name") + } + t.is(track.completed(), 1, "completeWork: 100% completed") + + testEvent(track, "change", afterAddWork) + track.addWork(100) + function afterAddWork(er, onChangeName) { + t.is(er, null, "addWork: on change event fired") + t.is(onChangeName, name, "addWork: on change emits the correct name") + } + t.is(track.completed(), 0.5, "addWork: 50% completed") + + + track.completeWork(200) + t.is(track.completed(), 1, "completeWork: Over completion is still only 100% complete") + + track = new Tracker(name, todo) + track.completeWork(50) + track.finish() + t.is(track.completed(), 1, "finish: Explicitly finishing moves to 100%") +}) diff --git a/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/test/trackergroup.js b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/test/trackergroup.js new file mode 100644 index 00000000000..a64e121c03a --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/test/trackergroup.js @@ -0,0 +1,87 @@ +"use strict" +var test = require("tap").test +var Tracker = require("../index.js").Tracker +var TrackerGroup = require("../index.js").TrackerGroup + +var timeoutError = new Error("timeout") +var testEvent = function (obj,event,next) { + var timeout = setTimeout(function(){ + obj.removeListener(event, eventHandler) + next(timeoutError) + }, 10) + var eventHandler = function () { + var args = Array.prototype.slice.call(arguments) + args.unshift(null) + clearTimeout(timeout) + next.apply(null, args) + } + obj.once(event, eventHandler) +} + +test("TrackerGroup", function (t) { + var name = "test" + + var track = new TrackerGroup(name) + t.is(track.completed(), 0, "Nothing todo is 0 completion") + testEvent(track, "change", afterFinishEmpty) + track.finish() + var a, b + function afterFinishEmpty(er, onChangeName) { + t.is(er, null, "finishEmpty: on change event fired") + t.is(onChangeName, name, "finishEmpty: on change emits the correct name") + t.is(track.completed(), 1, "finishEmpty: Finishing an empty group actually finishes it") + + track = new TrackerGroup(name) + a = track.newItem("a", 10, 1) + b = track.newItem("b", 10, 1) + t.is(track.completed(), 0, "Initially empty") + testEvent(track, "change", afterCompleteWork) + a.completeWork(5) + } + function afterCompleteWork(er, onChangeName) { + t.is(er, null, "on change event fired") + t.is(onChangeName, "a", "on change emits the correct name") + t.is(track.completed(), 0.25, "Complete half of one is a quarter overall") + testEvent(track, "change", afterFinishAll) + track.finish() + } + function afterFinishAll(er, onChangeName) { + t.is(er, null, "finishAll: on change event fired") + t.is(onChangeName, name, "finishAll: on change emits the correct name") + t.is(track.completed(), 1, "Finishing everything ") + + track = new TrackerGroup(name) + a = track.newItem("a", 10, 2) + b = track.newItem("b", 10, 1) + t.is(track.completed(), 0, "weighted: Initially empty") + testEvent(track, "change", afterWeightedCompleteWork) + a.completeWork(5) + } + function afterWeightedCompleteWork(er, onChangeName) { + t.is(er, null, "weighted: on change event fired") + t.is(onChangeName, "a", "weighted: on change emits the correct name") + t.is(Math.round(track.completed()*100), 33, "weighted: Complete half of double weighted") + testEvent(track, "change", afterWeightedFinishAll) + track.finish() + } + function afterWeightedFinishAll(er, onChangeName) { + t.is(er, null, "weightedFinishAll: on change event fired") + t.is(onChangeName, name, "weightedFinishAll: on change emits the correct name") + t.is(track.completed(), 1, "weightedFinishaAll: Finishing everything ") + + track = new TrackerGroup(name) + a = track.newGroup("a", 10) + b = track.newGroup("b", 10) + var a1 = a.newItem("a.1",10) + a1.completeWork(5) + t.is(track.completed(), 0.25, "nested: Initially quarter done") + testEvent(track, "change", afterNestedComplete) + b.finish() + } + function afterNestedComplete(er, onChangeName) { + t.is(er, null, "nestedComplete: on change event fired") + t.is(onChangeName, "b", "nestedComplete: on change emits the correct name") + t.is(track.completed(), 0.75, "nestedComplete: Finishing everything ") + t.end() + } +}) diff --git a/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/test/trackerstream.js b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/test/trackerstream.js new file mode 100644 index 00000000000..72b6043097f --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/are-we-there-yet/test/trackerstream.js @@ -0,0 +1,65 @@ +"use strict" +var test = require("tap").test +var util = require("util") +var stream = require("readable-stream") +var TrackerStream = require("../index.js").TrackerStream + +var timeoutError = new Error("timeout") +var testEvent = function (obj,event,next) { + var timeout = setTimeout(function(){ + obj.removeListener(event, eventHandler) + next(timeoutError) + }, 10) + var eventHandler = function () { + var args = Array.prototype.slice.call(arguments) + args.unshift(null) + clearTimeout(timeout) + next.apply(null, args) + } + obj.once(event, eventHandler) +} + +var Sink = function () { + stream.Writable.apply(this,arguments) +} +util.inherits(Sink, stream.Writable) +Sink.prototype._write = function (data, encoding, cb) { + cb() +} + +test("TrackerStream", function (t) { + t.plan(9) + + var name = "test" + var track = new TrackerStream(name) + + t.is(track.completed(), 0, "Nothing todo is 0 completion") + + var todo = 10 + track = new TrackerStream(name, todo) + t.is(track.completed(), 0, "Nothing done is 0 completion") + + track.pipe(new Sink()) + + testEvent(track, "change", afterCompleteWork) + track.write("0123456789") + function afterCompleteWork(er, onChangeName) { + t.is(er, null, "write: on change event fired") + t.is(onChangeName, name, "write: on change emits the correct name") + t.is(track.completed(), 1, "write: 100% completed") + + testEvent(track, "change", afterAddWork) + track.addWork(10) + } + function afterAddWork(er, onChangeName) { + t.is(er, null, "addWork: on change event fired") + t.is(track.completed(), 0.5, "addWork: 50% completed") + + testEvent(track, "change", afterAllWork) + track.write("ABCDEFGHIJKLMNOPQRST") + } + function afterAllWork(er) { + t.is(er, null, "allWork: on change event fired") + t.is(track.completed(), 1, "allWork: 100% completed") + } +}) diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/.npmignore b/deps/npm/node_modules/npmlog/node_modules/gauge/.npmignore new file mode 100644 index 00000000000..df22a16c635 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/.npmignore @@ -0,0 +1,32 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Commenting this out is preferred by some people, see +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- +node_modules + +# Users Environment Variables +.lock-wscript + +# Editor cruft +*~ +.#* diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/LICENSE b/deps/npm/node_modules/npmlog/node_modules/gauge/LICENSE new file mode 100644 index 00000000000..e756052969b --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2014, Rebecca Turner + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/README.md b/deps/npm/node_modules/npmlog/node_modules/gauge/README.md new file mode 100644 index 00000000000..fb9eb0a7d1e --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/README.md @@ -0,0 +1,161 @@ +gauge +===== + +A nearly stateless terminal based horizontal guage / progress bar. + +```javascript +var Gauge = require("gauge") + +var gauge = new Gauge() + +gauge.show("test", 0.20) + +gauge.pulse("this") + +gauge.hide() +``` + +![](example.png) + + +### `var gauge = new Gauge([options], [ansiStream])` + +* **options** – *(optional)* An option object. (See [below] for details.) +* **ansiStream** – *(optional)* A stream that's been blessed by the [ansi] + module to include various commands for controlling the cursor in a terminal. + +[ansi]: https://www.npmjs.com/package/ansi +[below]: #theme-objects + +Constructs a new gauge. Gauges are drawn on a single line, and are not drawn +if the current terminal isn't a tty. + +The **options** object can have the following properties, all of which are +optional: + +* maxUpdateFrequency: defaults to 50 msec, the gauge will not be drawn more + than once in this period of time. This applies to `show` and `pulse` + calls, but if you `hide` and then `show` the gauge it will draw it + regardless of time since last draw. +* theme: defaults to Gauge.unicode` if the terminal supports + unicode according to [has-unicode], otherwise it defaults to `Gauge.ascii`. + Details on the [theme object](#theme-objects) are documented elsewhere. +* template: see [documentation elsewhere](#template-objects) for + defaults and details. + +[has-unicode]: https://www.npmjs.com/package/has-unicode + +If **ansiStream** isn't passed in, then one will be constructed from stderr +with `ansi(process.stderr)`. + +### `gauge.show([name, [completed]])` + +* **name** – *(optional)* The name of the current thing contributing to progress. Defaults to the last value used, or "". +* **completed** – *(optional)* The portion completed as a value between 0 and 1. Defaults to the last value used, or 0. + +If `process.stdout.isTTY` is false then this does nothing. If completed is 0 +and `gauge.pulse` has never been called, then similarly nothing will be printed. + +If `maxUpdateFrequency` msec haven't passed since the last call to `show` or +`pulse` then similarly, nothing will be printed. (Actually, the update is +deferred until `maxUpdateFrequency` msec have passed and if nothing else has +happened, the gauge update will happen.) + +### `gauge.hide()` + +Removes the gauge from the terminal. + +### `gauge.pulse([name])` + +* **name** – *(optional)* The specific thing that triggered this pulse + +Spins the spinner in the gauge to show output. If **name** is included then +it will be combined with the last name passed to `gauge.show` using the +subsection property of the theme (typically a right facing arrow). + +### `gauge.disable()` + +Hides the gauge and ignores further calls to `show` or `pulse`. + +### `gauge.enable()` + +Shows the gauge and resumes updating when `show` or `pulse` is called. + +### `gauge.setTheme(theme)` + +Change the active theme, will be displayed with the next show or pulse + +### `gauge.setTemplate(template)` + +Change the active template, will be displayed with the next show or pulse + +### Theme Objects + +There are two theme objects available as a part of the module, `Gauge.unicode` and `Gauge.ascii`. +Theme objects have the follow properties: + +| Property | Unicode | ASCII | +| ---------- | ------- | ----- | +| startgroup | ╢ | \| | +| endgroup | ╟ | \| | +| complete | █ | # | +| incomplete | ░ | - | +| spinner | ▀▐▄▌ | -\\\|/ | +| subsection | → | -> | + +*startgroup*, *endgroup* and *subsection* can be as many characters as you want. + +*complete* and *incomplete* should be a single character width each. + +*spinner* is a list of characters to use in turn when displaying an activity +spinner. The Gauge will spin as many characters as you give here. + +### Template Objects + +A template is an array of objects and strings that, after being evaluated, +will be turned into the gauge line. The default template is: + +```javascript +[ + {type: "name", separated: true, maxLength: 25, minWidth: 25, align: "left"}, + {type: "spinner", separated: true}, + {type: "startgroup"}, + {type: "completionbar"}, + {type: "endgroup"} +] +``` + +The various template elements can either be **plain strings**, in which case they will +be be included verbatum in the output. + +If the template element is an object, it can have the following keys: + +* *type* can be: + * `name` – The most recent name passed to `show`; if this is in response to a + `pulse` then the name passed to `pulse` will be appended along with the + subsection property from the theme. + * `spinner` – If you've ever called `pulse` this will be one of the characters + from the spinner property of the theme. + * `startgroup` – The `startgroup` property from the theme. + * `completionbar` – This progress bar itself + * `endgroup` – The `endgroup` property from the theme. +* *separated* – If true, the element will be separated with spaces from things on + either side (and margins count as space, so it won't be indented), but only + if its included. +* *maxLength* – The maximum length for this element. If its value is longer it + will be truncated. +* *minLength* – The minimum length for this element. If its value is shorter it + will be padded according to the *align* value. +* *align* – (Default: left) Possible values "left", "right" and "center". Works + as you'd expect from word processors. +* *length* – Provides a single value for both *minLength* and *maxLength*. If both + *length* and *minLength or *maxLength* are specifed then the latter take precedence. + +### Tracking Completion + +If you have more than one thing going on that you want to track completion +of, you may find the related [are-we-there-yet] helpful. It's `change` +event can be wired up to the `show` method to get a more traditional +progress bar interface. + +[are-we-there-yet]: https://www.npmjs.com/package/are-we-there-yet diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/example.png b/deps/npm/node_modules/npmlog/node_modules/gauge/example.png new file mode 100644 index 00000000000..2667cac459e Binary files /dev/null and b/deps/npm/node_modules/npmlog/node_modules/gauge/example.png differ diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/.npmignore b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/.npmignore new file mode 100644 index 00000000000..7e17cf19b7a --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/.npmignore @@ -0,0 +1,32 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Commenting this out is preferred by some people, see +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- +node_modules + +# Users Environment Variables +.lock-wscript + +# Editor temp files +*~ +.#* diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/LICENSE b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/LICENSE new file mode 100644 index 00000000000..d42e25e9565 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/LICENSE @@ -0,0 +1,14 @@ +Copyright (c) 2014, Rebecca Turner + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/README.md b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/README.md new file mode 100644 index 00000000000..e9d3cc326c1 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/README.md @@ -0,0 +1,40 @@ +has-unicode +=========== + +Try to guess if your terminal supports unicode + +```javascript +var hasUnicode = require("has-unicode") + +if (hasUnicode()) { + // the terminal probably has unicode support +} +``` +```javascript +var hasUnicode = require("has-unicode").tryHarder +hasUnicode(function(unicodeSupported) { + if (unicodeSupported) { + // the terminal probably has unicode support + } +}) +``` + +## Detecting Unicode + +What we actually detect is UTF-8 support, as that's what Node itself supports. +If you have a UTF-16 locale then you won't be detected as unicode capable. + +### Windows + +Since at least Windows 7, `cmd` and `powershell` have been unicode capable. +As such, we report any Windows installation as unicode capable. + + +### Unix Like Operating Systems + +We look at the environment variables `LC_ALL`, `LC_CTYPE`, and `LANG` in +that order. For `LC_ALL` and `LANG`, it looks for `.UTF-8` in the value. +For `LC_CTYPE` it looks to see if the value is `UTF-8`. This is sufficient +for most POSIX systems. While locale data can be put in `/etc/locale.conf` +as well, AFAIK it's always copied into the environment. + diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/index.js b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/index.js new file mode 100644 index 00000000000..edceb703094 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/index.js @@ -0,0 +1,18 @@ +"use strict" +var os = require("os") +var child_process = require("child_process") + +var hasUnicode = module.exports = function () { + // Supported Win32 platforms (>XP) support unicode in the console, though + // font support isn't fantastic. + if (os.type() == "Windows_NT") { return true } + + var isUTF8 = /[.]UTF-8/ + if (isUTF8.test(process.env.LC_ALL) + || process.env.LC_CTYPE == 'UTF-8' + || isUTF8.test(process.env.LANG)) { + return true + } + + return false +} diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/package.json b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/package.json new file mode 100644 index 00000000000..fd552a9e409 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/package.json @@ -0,0 +1,53 @@ +{ + "name": "has-unicode", + "version": "1.0.0", + "description": "Try to guess if your terminal supports unicode", + "main": "index.js", + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/iarna/has-unicode.git" + }, + "keywords": [ + "unicode", + "terminal" + ], + "author": { + "name": "Rebecca Turner", + "email": "me@re-becca.org" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/iarna/has-unicode/issues" + }, + "homepage": "https://github.com/iarna/has-unicode", + "devDependencies": { + "require-inject": "^1.1.1", + "tap": "^0.4.13" + }, + "gitHead": "a8c3dcf3be5f0c8f8e26a3e7ffea7da24344a006", + "_id": "has-unicode@1.0.0", + "_shasum": "bac5c44e064c2ffc3b8fcbd8c71afe08f9afc8cc", + "_from": "has-unicode@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.11", + "_nodeVersion": "0.10.33", + "_npmUser": { + "name": "iarna", + "email": "me@re-becca.org" + }, + "maintainers": [ + { + "name": "iarna", + "email": "me@re-becca.org" + } + ], + "dist": { + "shasum": "bac5c44e064c2ffc3b8fcbd8c71afe08f9afc8cc", + "tarball": "http://registry.npmjs.org/has-unicode/-/has-unicode-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/test/index.js b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/test/index.js new file mode 100644 index 00000000000..2394c14ef7f --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/has-unicode/test/index.js @@ -0,0 +1,26 @@ +"use strict" +var test = require("tap").test +var requireInject = require("require-inject") + +test("Windows", function (t) { + t.plan(1) + var hasUnicode = requireInject("../index.js", { + os: { type: function () { return "Windows_NT" } } + }) + t.is(hasUnicode(), true, "Windows is assumed to be unicode aware") +}) +test("Unix Env", function (t) { + t.plan(3) + var hasUnicode = requireInject("../index.js", { + os: { type: function () { return "Linux" } }, + child_process: { exec: function (cmd,cb) { cb(new Error("not available")) } } + }) + process.env.LANG = "en_US.UTF-8" + process.env.LC_ALL = null + t.is(hasUnicode(), true, "Linux with a UTF8 language") + process.env.LANG = null + process.env.LC_ALL = "en_US.UTF-8" + t.is(hasUnicode(), true, "Linux with UTF8 locale") + process.env.LC_ALL = null + t.is(hasUnicode(), false, "Linux without UTF8 language or locale") +}) diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._basetostring/LICENSE.txt b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._basetostring/LICENSE.txt new file mode 100644 index 00000000000..17764328c82 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._basetostring/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright 2012-2015 The Dojo Foundation +Based on Underscore.js 1.7.0, copyright 2009-2015 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. diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._basetostring/README.md b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._basetostring/README.md new file mode 100644 index 00000000000..ad04ea956e4 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._basetostring/README.md @@ -0,0 +1,20 @@ +# lodash._basetostring v3.0.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `baseToString` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash._basetostring +``` + +In Node.js/io.js: + +```js +var baseToString = require('lodash._basetostring'); +``` + +See the [package source](https://github.com/lodash/lodash/blob/3.0.0-npm-packages/lodash._basetostring) for more details. diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._basetostring/index.js b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._basetostring/index.js new file mode 100644 index 00000000000..71ac885889b --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._basetostring/index.js @@ -0,0 +1,25 @@ +/** + * lodash 3.0.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.7.0 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** + * Converts `value` to a string if it is not one. An empty string is returned + * for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + if (typeof value == 'string') { + return value; + } + return value == null ? '' : (value + ''); +} + +module.exports = baseToString; diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._basetostring/package.json b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._basetostring/package.json new file mode 100644 index 00000000000..dfb815b7577 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._basetostring/package.json @@ -0,0 +1,72 @@ +{ + "name": "lodash._basetostring", + "version": "3.0.0", + "description": "The modern build of lodash’s internal `baseToString` as a module.", + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "license": "MIT", + "author": { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + "contributors": [ + { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + { + "name": "Benjamin Tan", + "email": "demoneaux@gmail.com", + "url": "https://d10.github.io/" + }, + { + "name": "Blaine Bublitz", + "email": "blaine@iceddev.com", + "url": "http://www.iceddev.com/" + }, + { + "name": "Kit Cambridge", + "email": "github@kitcambridge.be", + "url": "http://kitcambridge.be/" + }, + { + "name": "Mathias Bynens", + "email": "mathias@qiwi.be", + "url": "https://mathiasbynens.be/" + } + ], + "repository": { + "type": "git", + "url": "git+https://github.com/lodash/lodash.git" + }, + "scripts": { + "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" + }, + "bugs": { + "url": "https://github.com/lodash/lodash/issues" + }, + "_id": "lodash._basetostring@3.0.0", + "_shasum": "75a9a4aaaa2b2a8761111ff5431e7d83c1daf0e2", + "_from": "lodash._basetostring@3.0.0", + "_npmVersion": "2.3.0", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jdalton", + "email": "john.david.dalton@gmail.com" + }, + "maintainers": [ + { + "name": "jdalton", + "email": "john.david.dalton@gmail.com" + } + ], + "dist": { + "shasum": "75a9a4aaaa2b2a8761111ff5431e7d83c1daf0e2", + "tarball": "http://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/LICENSE.txt b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/LICENSE.txt new file mode 100644 index 00000000000..9cd87e5dcef --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright 2012-2015 The Dojo Foundation +Based on Underscore.js, copyright 2009-2015 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. diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/README.md b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/README.md new file mode 100644 index 00000000000..0e1c73128ce --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/README.md @@ -0,0 +1,20 @@ +# lodash._createpadding v3.6.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `createPadding` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash._createpadding +``` + +In Node.js/io.js: + +```js +var createPadding = require('lodash._createpadding'); +``` + +See the [package source](https://github.com/lodash/lodash/blob/3.6.0-npm-packages/lodash._createpadding) for more details. diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/index.js b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/index.js new file mode 100644 index 00000000000..72890bd2d8f --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/index.js @@ -0,0 +1,39 @@ +/** + * lodash 3.6.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.2 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var repeat = require('lodash.repeat'); + +/** Native method references. */ +var ceil = Math.ceil; + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeIsFinite = global.isFinite; + +/** + * Creates the padding required for `string` based on the given `length`. + * The `chars` string is truncated if the number of characters exceeds `length`. + * + * @private + * @param {string} string The string to create padding for. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the pad for `string`. + */ +function createPadding(string, length, chars) { + var strLength = string.length; + length = +length; + + if (strLength >= length || !nativeIsFinite(length)) { + return ''; + } + var padLength = length - strLength; + chars = chars == null ? ' ' : (chars + ''); + return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength); +} + +module.exports = createPadding; diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/node_modules/lodash.repeat/LICENSE.txt b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/node_modules/lodash.repeat/LICENSE.txt new file mode 100644 index 00000000000..17764328c82 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/node_modules/lodash.repeat/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright 2012-2015 The Dojo Foundation +Based on Underscore.js 1.7.0, copyright 2009-2015 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. diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/node_modules/lodash.repeat/README.md b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/node_modules/lodash.repeat/README.md new file mode 100644 index 00000000000..d2796e3f739 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/node_modules/lodash.repeat/README.md @@ -0,0 +1,20 @@ +# lodash.repeat v3.0.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.repeat` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash.repeat +``` + +In Node.js/io.js: + +```js +var repeat = require('lodash.repeat'); +``` + +See the [documentation](https://lodash.com/docs#repeat) or [package source](https://github.com/lodash/lodash/blob/3.0.0-npm-packages/lodash.repeat) for more details. diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/node_modules/lodash.repeat/index.js b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/node_modules/lodash.repeat/index.js new file mode 100644 index 00000000000..68e10081346 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/node_modules/lodash.repeat/index.js @@ -0,0 +1,57 @@ +/** + * lodash 3.0.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.7.0 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var baseToString = require('lodash._basetostring'); + +/** Native method references. */ +var floor = Math.floor; + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeIsFinite = global.isFinite; + +/** + * Repeats the given string `n` times. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to repeat. + * @param {number} [n=0] The number of times to repeat the string. + * @returns {string} Returns the repeated string. + * @example + * + * _.repeat('*', 3); + * // => '***' + * + * _.repeat('abc', 2); + * // => 'abcabc' + * + * _.repeat('abc', 0); + * // => '' + */ +function repeat(string, n) { + var result = ''; + string = baseToString(string); + n = +n; + if (n < 1 || !string || !nativeIsFinite(n)) { + return result; + } + // Leverage the exponentiation by squaring algorithm for a faster repeat. + // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. + do { + if (n % 2) { + result += string; + } + n = floor(n / 2); + string += string; + } while (n); + + return result; +} + +module.exports = repeat; diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/node_modules/lodash.repeat/package.json b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/node_modules/lodash.repeat/package.json new file mode 100644 index 00000000000..de5156da130 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/node_modules/lodash.repeat/package.json @@ -0,0 +1,81 @@ +{ + "name": "lodash.repeat", + "version": "3.0.0", + "description": "The modern build of lodash’s `_.repeat` as a module.", + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "license": "MIT", + "keywords": [ + "lodash", + "lodash-modularized", + "stdlib", + "util" + ], + "author": { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + "contributors": [ + { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + { + "name": "Benjamin Tan", + "email": "demoneaux@gmail.com", + "url": "https://d10.github.io/" + }, + { + "name": "Blaine Bublitz", + "email": "blaine@iceddev.com", + "url": "http://www.iceddev.com/" + }, + { + "name": "Kit Cambridge", + "email": "github@kitcambridge.be", + "url": "http://kitcambridge.be/" + }, + { + "name": "Mathias Bynens", + "email": "mathias@qiwi.be", + "url": "https://mathiasbynens.be/" + } + ], + "repository": { + "type": "git", + "url": "git+https://github.com/lodash/lodash.git" + }, + "scripts": { + "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" + }, + "dependencies": { + "lodash._basetostring": "^3.0.0" + }, + "bugs": { + "url": "https://github.com/lodash/lodash/issues" + }, + "_id": "lodash.repeat@3.0.0", + "_shasum": "c340f4136c99dc5b2e397b3fd50cffbd172a94b0", + "_from": "lodash.repeat@>=3.0.0 <4.0.0", + "_npmVersion": "2.3.0", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jdalton", + "email": "john.david.dalton@gmail.com" + }, + "maintainers": [ + { + "name": "jdalton", + "email": "john.david.dalton@gmail.com" + } + ], + "dist": { + "shasum": "c340f4136c99dc5b2e397b3fd50cffbd172a94b0", + "tarball": "http://registry.npmjs.org/lodash.repeat/-/lodash.repeat-3.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/lodash.repeat/-/lodash.repeat-3.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/package.json b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/package.json new file mode 100644 index 00000000000..ffe797253ae --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash._createpadding/package.json @@ -0,0 +1,75 @@ +{ + "name": "lodash._createpadding", + "version": "3.6.0", + "description": "The modern build of lodash’s internal `createPadding` as a module.", + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "license": "MIT", + "author": { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + "contributors": [ + { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + { + "name": "Benjamin Tan", + "email": "demoneaux@gmail.com", + "url": "https://d10.github.io/" + }, + { + "name": "Blaine Bublitz", + "email": "blaine@iceddev.com", + "url": "http://www.iceddev.com/" + }, + { + "name": "Kit Cambridge", + "email": "github@kitcambridge.be", + "url": "http://kitcambridge.be/" + }, + { + "name": "Mathias Bynens", + "email": "mathias@qiwi.be", + "url": "https://mathiasbynens.be/" + } + ], + "repository": { + "type": "git", + "url": "git+https://github.com/lodash/lodash.git" + }, + "scripts": { + "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" + }, + "dependencies": { + "lodash.repeat": "^3.0.0" + }, + "bugs": { + "url": "https://github.com/lodash/lodash/issues" + }, + "_id": "lodash._createpadding@3.6.0", + "_shasum": "c466850dd1a05e6bfec54fd0cf0db28b68332d5e", + "_from": "lodash._createpadding@3.6.0", + "_npmVersion": "2.7.3", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "jdalton", + "email": "john.david.dalton@gmail.com" + }, + "maintainers": [ + { + "name": "jdalton", + "email": "john.david.dalton@gmail.com" + } + ], + "dist": { + "shasum": "c466850dd1a05e6bfec54fd0cf0db28b68332d5e", + "tarball": "http://registry.npmjs.org/lodash._createpadding/-/lodash._createpadding-3.6.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/lodash._createpadding/-/lodash._createpadding-3.6.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.pad/LICENSE.txt b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.pad/LICENSE.txt new file mode 100644 index 00000000000..9cd87e5dcef --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.pad/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright 2012-2015 The Dojo Foundation +Based on Underscore.js, copyright 2009-2015 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. diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.pad/README.md b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.pad/README.md new file mode 100644 index 00000000000..9b4891cd8c6 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.pad/README.md @@ -0,0 +1,20 @@ +# lodash.pad v3.1.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.pad` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash.pad +``` + +In Node.js/io.js: + +```js +var pad = require('lodash.pad'); +``` + +See the [documentation](https://lodash.com/docs#pad) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.pad) for more details. diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.pad/index.js b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.pad/index.js new file mode 100644 index 00000000000..d08251ba593 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.pad/index.js @@ -0,0 +1,57 @@ +/** + * lodash 3.1.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.2 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var baseToString = require('lodash._basetostring'), + createPadding = require('lodash._createpadding'); + +/** Native method references. */ +var ceil = Math.ceil, + floor = Math.floor; + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeIsFinite = global.isFinite; + +/** + * Pads `string` on the left and right sides if it is shorter than `length`. + * Padding characters are truncated if they can't be evenly divided by `length`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.pad('abc', 8); + * // => ' abc ' + * + * _.pad('abc', 8, '_-'); + * // => '_-abc_-_' + * + * _.pad('abc', 3); + * // => 'abc' + */ +function pad(string, length, chars) { + string = baseToString(string); + length = +length; + + var strLength = string.length; + if (strLength >= length || !nativeIsFinite(length)) { + return string; + } + var mid = (length - strLength) / 2, + leftLength = floor(mid), + rightLength = ceil(mid); + + chars = createPadding('', rightLength, chars); + return chars.slice(0, leftLength) + string + chars; +} + +module.exports = pad; diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.pad/package.json b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.pad/package.json new file mode 100644 index 00000000000..6f028c0cc62 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.pad/package.json @@ -0,0 +1,98 @@ +{ + "name": "lodash.pad", + "version": "3.1.0", + "description": "The modern build of lodash’s `_.pad` as a module.", + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "license": "MIT", + "keywords": [ + "lodash", + "lodash-modularized", + "stdlib", + "util" + ], + "author": { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + "contributors": [ + { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + { + "name": "Benjamin Tan", + "email": "demoneaux@gmail.com", + "url": "https://d10.github.io/" + }, + { + "name": "Blaine Bublitz", + "email": "blaine@iceddev.com", + "url": "http://www.iceddev.com/" + }, + { + "name": "Kit Cambridge", + "email": "github@kitcambridge.be", + "url": "http://kitcambridge.be/" + }, + { + "name": "Mathias Bynens", + "email": "mathias@qiwi.be", + "url": "https://mathiasbynens.be/" + } + ], + "repository": { + "type": "git", + "url": "git+https://github.com/lodash/lodash.git" + }, + "scripts": { + "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" + }, + "dependencies": { + "lodash._basetostring": "^3.0.0", + "lodash._createpadding": "^3.0.0" + }, + "bugs": { + "url": "https://github.com/lodash/lodash/issues" + }, + "_id": "lodash.pad@3.1.0", + "_shasum": "9f18b1f3749a95e197b5ff2ae752ea9851ada965", + "_from": "lodash.pad@>=3.0.0 <4.0.0", + "_npmVersion": "2.7.3", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "jdalton", + "email": "john.david.dalton@gmail.com" + }, + "maintainers": [ + { + "name": "jdalton", + "email": "john.david.dalton@gmail.com" + }, + { + "name": "d10", + "email": "demoneaux@gmail.com" + }, + { + "name": "kitcambridge", + "email": "github@kitcambridge.be" + }, + { + "name": "mathias", + "email": "mathias@qiwi.be" + }, + { + "name": "phated", + "email": "blaine@iceddev.com" + } + ], + "dist": { + "shasum": "9f18b1f3749a95e197b5ff2ae752ea9851ada965", + "tarball": "http://registry.npmjs.org/lodash.pad/-/lodash.pad-3.1.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/lodash.pad/-/lodash.pad-3.1.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padleft/LICENSE.txt b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padleft/LICENSE.txt new file mode 100644 index 00000000000..9cd87e5dcef --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padleft/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright 2012-2015 The Dojo Foundation +Based on Underscore.js, copyright 2009-2015 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. diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padleft/README.md b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padleft/README.md new file mode 100644 index 00000000000..641b4d6f007 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padleft/README.md @@ -0,0 +1,20 @@ +# lodash.padleft v3.1.1 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.padLeft` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash.padleft +``` + +In Node.js/io.js: + +```js +var padLeft = require('lodash.padleft'); +``` + +See the [documentation](https://lodash.com/docs#padLeft) or [package source](https://github.com/lodash/lodash/blob/3.1.1-npm-packages/lodash.padleft) for more details. diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padleft/index.js b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padleft/index.js new file mode 100644 index 00000000000..2abb69a6c06 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padleft/index.js @@ -0,0 +1,50 @@ +/** + * lodash 3.1.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var baseToString = require('lodash._basetostring'), + createPadding = require('lodash._createpadding'); + +/** + * Creates a function for `_.padLeft` or `_.padRight`. + * + * @private + * @param {boolean} [fromRight] Specify padding from the right. + * @returns {Function} Returns the new pad function. + */ +function createPadDir(fromRight) { + return function(string, length, chars) { + string = baseToString(string); + return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string); + }; +} + +/** + * Pads `string` on the left side if it is shorter than `length`. Padding + * characters are truncated if they exceed `length`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.padLeft('abc', 6); + * // => ' abc' + * + * _.padLeft('abc', 6, '_-'); + * // => '_-_abc' + * + * _.padLeft('abc', 3); + * // => 'abc' + */ +var padLeft = createPadDir(); + +module.exports = padLeft; diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padleft/package.json b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padleft/package.json new file mode 100644 index 00000000000..55b0c256f9d --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padleft/package.json @@ -0,0 +1,98 @@ +{ + "name": "lodash.padleft", + "version": "3.1.1", + "description": "The modern build of lodash’s `_.padLeft` as a module.", + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "license": "MIT", + "keywords": [ + "lodash", + "lodash-modularized", + "stdlib", + "util" + ], + "author": { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + "contributors": [ + { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + { + "name": "Benjamin Tan", + "email": "demoneaux@gmail.com", + "url": "https://d10.github.io/" + }, + { + "name": "Blaine Bublitz", + "email": "blaine@iceddev.com", + "url": "http://www.iceddev.com/" + }, + { + "name": "Kit Cambridge", + "email": "github@kitcambridge.be", + "url": "http://kitcambridge.be/" + }, + { + "name": "Mathias Bynens", + "email": "mathias@qiwi.be", + "url": "https://mathiasbynens.be/" + } + ], + "repository": { + "type": "git", + "url": "git+https://github.com/lodash/lodash.git" + }, + "scripts": { + "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" + }, + "dependencies": { + "lodash._basetostring": "^3.0.0", + "lodash._createpadding": "^3.0.0" + }, + "bugs": { + "url": "https://github.com/lodash/lodash/issues" + }, + "_id": "lodash.padleft@3.1.1", + "_shasum": "150151f1e0245edba15d50af2d71f1d5cff46530", + "_from": "lodash.padleft@>=3.0.0 <4.0.0", + "_npmVersion": "2.9.0", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "jdalton", + "email": "john.david.dalton@gmail.com" + }, + "maintainers": [ + { + "name": "jdalton", + "email": "john.david.dalton@gmail.com" + }, + { + "name": "d10", + "email": "demoneaux@gmail.com" + }, + { + "name": "kitcambridge", + "email": "github@kitcambridge.be" + }, + { + "name": "mathias", + "email": "mathias@qiwi.be" + }, + { + "name": "phated", + "email": "blaine@iceddev.com" + } + ], + "dist": { + "shasum": "150151f1e0245edba15d50af2d71f1d5cff46530", + "tarball": "http://registry.npmjs.org/lodash.padleft/-/lodash.padleft-3.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/lodash.padleft/-/lodash.padleft-3.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padright/LICENSE.txt b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padright/LICENSE.txt new file mode 100644 index 00000000000..9cd87e5dcef --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padright/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright 2012-2015 The Dojo Foundation +Based on Underscore.js, copyright 2009-2015 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. diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padright/README.md b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padright/README.md new file mode 100644 index 00000000000..bcd6e5742fe --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padright/README.md @@ -0,0 +1,20 @@ +# lodash.padright v3.1.1 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.padRight` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash.padright +``` + +In Node.js/io.js: + +```js +var padRight = require('lodash.padright'); +``` + +See the [documentation](https://lodash.com/docs#padRight) or [package source](https://github.com/lodash/lodash/blob/3.1.1-npm-packages/lodash.padright) for more details. diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padright/index.js b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padright/index.js new file mode 100644 index 00000000000..6de81c4bbed --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padright/index.js @@ -0,0 +1,50 @@ +/** + * lodash 3.1.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var baseToString = require('lodash._basetostring'), + createPadding = require('lodash._createpadding'); + +/** + * Creates a function for `_.padLeft` or `_.padRight`. + * + * @private + * @param {boolean} [fromRight] Specify padding from the right. + * @returns {Function} Returns the new pad function. + */ +function createPadDir(fromRight) { + return function(string, length, chars) { + string = baseToString(string); + return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string); + }; +} + +/** + * Pads `string` on the right side if it is shorter than `length`. Padding + * characters are truncated if they exceed `length`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to pad. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padded string. + * @example + * + * _.padRight('abc', 6); + * // => 'abc ' + * + * _.padRight('abc', 6, '_-'); + * // => 'abc_-_' + * + * _.padRight('abc', 3); + * // => 'abc' + */ +var padRight = createPadDir(true); + +module.exports = padRight; diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padright/package.json b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padright/package.json new file mode 100644 index 00000000000..2a40f94bfc3 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/node_modules/lodash.padright/package.json @@ -0,0 +1,98 @@ +{ + "name": "lodash.padright", + "version": "3.1.1", + "description": "The modern build of lodash’s `_.padRight` as a module.", + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "license": "MIT", + "keywords": [ + "lodash", + "lodash-modularized", + "stdlib", + "util" + ], + "author": { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + "contributors": [ + { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + { + "name": "Benjamin Tan", + "email": "demoneaux@gmail.com", + "url": "https://d10.github.io/" + }, + { + "name": "Blaine Bublitz", + "email": "blaine@iceddev.com", + "url": "http://www.iceddev.com/" + }, + { + "name": "Kit Cambridge", + "email": "github@kitcambridge.be", + "url": "http://kitcambridge.be/" + }, + { + "name": "Mathias Bynens", + "email": "mathias@qiwi.be", + "url": "https://mathiasbynens.be/" + } + ], + "repository": { + "type": "git", + "url": "git+https://github.com/lodash/lodash.git" + }, + "scripts": { + "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" + }, + "dependencies": { + "lodash._basetostring": "^3.0.0", + "lodash._createpadding": "^3.0.0" + }, + "bugs": { + "url": "https://github.com/lodash/lodash/issues" + }, + "_id": "lodash.padright@3.1.1", + "_shasum": "79f7770baaa39738c040aeb5465e8d88f2aacec0", + "_from": "lodash.padright@>=3.0.0 <4.0.0", + "_npmVersion": "2.9.0", + "_nodeVersion": "0.12.2", + "_npmUser": { + "name": "jdalton", + "email": "john.david.dalton@gmail.com" + }, + "maintainers": [ + { + "name": "jdalton", + "email": "john.david.dalton@gmail.com" + }, + { + "name": "d10", + "email": "demoneaux@gmail.com" + }, + { + "name": "kitcambridge", + "email": "github@kitcambridge.be" + }, + { + "name": "mathias", + "email": "mathias@qiwi.be" + }, + { + "name": "phated", + "email": "blaine@iceddev.com" + } + ], + "dist": { + "shasum": "79f7770baaa39738c040aeb5465e8d88f2aacec0", + "tarball": "http://registry.npmjs.org/lodash.padright/-/lodash.padright-3.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/lodash.padright/-/lodash.padright-3.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/package.json b/deps/npm/node_modules/npmlog/node_modules/gauge/package.json new file mode 100644 index 00000000000..227173e6401 --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/package.json @@ -0,0 +1,60 @@ +{ + "name": "gauge", + "version": "1.2.0", + "description": "A terminal based horizontal guage", + "main": "progress-bar.js", + "scripts": { + "test": "tap test/*.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/iarna/gauge.git" + }, + "keywords": [ + "progressbar", + "progress", + "gauge" + ], + "author": { + "name": "Rebecca Turner", + "email": "me@re-becca.org" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/iarna/gauge/issues" + }, + "homepage": "https://github.com/iarna/gauge", + "dependencies": { + "ansi": "^0.3.0", + "has-unicode": "^1.0.0", + "lodash.pad": "^3.0.0", + "lodash.padleft": "^3.0.0", + "lodash.padright": "^3.0.0" + }, + "devDependencies": { + "tap": "^0.4.13" + }, + "gitHead": "db15c35374816b3fc3b9e1e54866f31ed7f4a733", + "_id": "gauge@1.2.0", + "_shasum": "3094ab1285633f799814388fc8f2de67b4c012c5", + "_from": "gauge@>=1.2.0 <1.3.0", + "_npmVersion": "2.6.0", + "_nodeVersion": "1.1.0", + "_npmUser": { + "name": "iarna", + "email": "me@re-becca.org" + }, + "maintainers": [ + { + "name": "iarna", + "email": "me@re-becca.org" + } + ], + "dist": { + "shasum": "3094ab1285633f799814388fc8f2de67b4c012c5", + "tarball": "http://registry.npmjs.org/gauge/-/gauge-1.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/gauge/-/gauge-1.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/npmlog/node_modules/gauge/progress-bar.js b/deps/npm/node_modules/npmlog/node_modules/gauge/progress-bar.js new file mode 100644 index 00000000000..39dbf2ac43d --- /dev/null +++ b/deps/npm/node_modules/npmlog/node_modules/gauge/progress-bar.js @@ -0,0 +1,209 @@ +"use strict" +var hasUnicode = require("has-unicode") +var ansi = require("ansi") +var align = { + center: require("lodash.pad"), + left: require("lodash.padright"), + right: require("lodash.padleft") +} +var defaultStream = process.stderr +function isTTY() { + return process.stderr.isTTY +} +function getWritableTTYColumns() { + // One less than the actual as writing to the final column wraps the line + return process.stderr.columns - 1 +} + +var ProgressBar = module.exports = function (options, cursor) { + if (! options) options = {} + if (! cursor && options.write) { + cursor = options + options = {} + } + if (! cursor) { + cursor = ansi(defaultStream) + } + this.cursor = cursor + this.showing = false + this.theme = options.theme || (hasUnicode() ? ProgressBar.unicode : ProgressBar.ascii) + this.template = options.template || [ + {type: "name", separated: true, length: 25}, + {type: "spinner", separated: true}, + {type: "startgroup"}, + {type: "completionbar"}, + {type: "endgroup"} + ] + this.updatefreq = options.maxUpdateFrequency || 50 + this.lastName = "" + this.lastCompleted = 0 + this.spun = 0 + this.last = new Date(0) +} +ProgressBar.prototype = {} + +ProgressBar.unicode = { + startgroup: "╢", + endgroup: "╟", + complete: "█", + incomplete: "░", + spinner: "▀▐▄▌", + subsection: "→" +} + +ProgressBar.ascii = { + startgroup: "|", + endgroup: "|", + complete: "#", + incomplete: "-", + spinner: "-\\|/", + subsection: "->" +} + +ProgressBar.prototype.setTheme = function(theme) { + this.theme = theme +} + +ProgressBar.prototype.setTemplate = function(template) { + this.template = template +} + +ProgressBar.prototype.disable = function() { + this.hide() + this.disabled = true +} + +ProgressBar.prototype.enable = function() { + this.disabled = false + this.show() +} + +ProgressBar.prototype.hide = function() { + if (!isTTY()) return + if (this.disabled) return + this.cursor.show() + if (this.showing) this.cursor.up(1) + this.cursor.horizontalAbsolute(0).eraseLine() + this.showing = false +} + +var repeat = function (str, count) { + var out = "" + for (var ii=0; ii P | |----|\n' ], + [ 'show' ] ]) +}) diff --git a/deps/npm/node_modules/npmlog/package.json b/deps/npm/node_modules/npmlog/package.json index 3d36b8a15a6..1613546d9f1 100644 --- a/deps/npm/node_modules/npmlog/package.json +++ b/deps/npm/node_modules/npmlog/package.json @@ -6,7 +6,7 @@ }, "name": "npmlog", "description": "logger for npm", - "version": "0.1.1", + "version": "1.2.1", "repository": { "type": "git", "url": "git://github.com/isaacs/npmlog.git" @@ -16,20 +16,43 @@ "test": "tap test/*.js" }, "dependencies": { - "ansi": "~0.3.0" + "ansi": "~0.3.0", + "are-we-there-yet": "~1.0.0", + "gauge": "~1.2.0" }, "devDependencies": { "tap": "" }, - "license": "BSD", - "readme": "# npmlog\n\nThe logger util that npm uses.\n\nThis logger is very basic. It does the logging for npm. It supports\ncustom levels and colored output.\n\nBy default, logs are written to stderr. If you want to send log messages\nto outputs other than streams, then you can change the `log.stream`\nmember, or you can just listen to the events that it emits, and do\nwhatever you want with them.\n\n# Basic Usage\n\n```\nvar log = require('npmlog')\n\n// additional stuff ---------------------------+\n// message ----------+ |\n// prefix ----+ | |\n// level -+ | | |\n// v v v v\n log.info('fyi', 'I have a kitty cat: %j', myKittyCat)\n```\n\n## log.level\n\n* {String}\n\nThe level to display logs at. Any logs at or above this level will be\ndisplayed. The special level `silent` will prevent anything from being\ndisplayed ever.\n\n## log.record\n\n* {Array}\n\nAn array of all the log messages that have been entered.\n\n## log.maxRecordSize\n\n* {Number}\n\nThe maximum number of records to keep. If log.record gets bigger than\n10% over this value, then it is sliced down to 90% of this value.\n\nThe reason for the 10% window is so that it doesn't have to resize a\nlarge array on every log entry.\n\n## log.prefixStyle\n\n* {Object}\n\nA style object that specifies how prefixes are styled. (See below)\n\n## log.headingStyle\n\n* {Object}\n\nA style object that specifies how the heading is styled. (See below)\n\n## log.heading\n\n* {String} Default: \"\"\n\nIf set, a heading that is printed at the start of every line.\n\n## log.stream\n\n* {Stream} Default: `process.stderr`\n\nThe stream where output is written.\n\n## log.enableColor()\n\nForce colors to be used on all messages, regardless of the output\nstream.\n\n## log.disableColor()\n\nDisable colors on all messages.\n\n## log.pause()\n\nStop emitting messages to the stream, but do not drop them.\n\n## log.resume()\n\nEmit all buffered messages that were written while paused.\n\n## log.log(level, prefix, message, ...)\n\n* `level` {String} The level to emit the message at\n* `prefix` {String} A string prefix. Set to \"\" to skip.\n* `message...` Arguments to `util.format`\n\nEmit a log message at the specified level.\n\n## log\\[level](prefix, message, ...)\n\nFor example,\n\n* log.silly(prefix, message, ...)\n* log.verbose(prefix, message, ...)\n* log.info(prefix, message, ...)\n* log.http(prefix, message, ...)\n* log.warn(prefix, message, ...)\n* log.error(prefix, message, ...)\n\nLike `log.log(level, prefix, message, ...)`. In this way, each level is\ngiven a shorthand, so you can do `log.info(prefix, message)`.\n\n## log.addLevel(level, n, style, disp)\n\n* `level` {String} Level indicator\n* `n` {Number} The numeric level\n* `style` {Object} Object with fg, bg, inverse, etc.\n* `disp` {String} Optional replacement for `level` in the output.\n\nSets up a new level with a shorthand function and so forth.\n\nNote that if the number is `Infinity`, then setting the level to that\nwill cause all log messages to be suppressed. If the number is\n`-Infinity`, then the only way to show it is to enable all log messages.\n\n# Events\n\nEvents are all emitted with the message object.\n\n* `log` Emitted for all messages\n* `log.` Emitted for all messages with the `` level.\n* `` Messages with prefixes also emit their prefix as an event.\n\n# Style Objects\n\nStyle objects can have the following fields:\n\n* `fg` {String} Color for the foreground text\n* `bg` {String} Color for the background\n* `bold`, `inverse`, `underline` {Boolean} Set the associated property\n* `bell` {Boolean} Make a noise (This is pretty annoying, probably.)\n\n# Message Objects\n\nEvery log event is emitted with a message object, and the `log.record`\nlist contains all of them that have been created. They have the\nfollowing fields:\n\n* `id` {Number}\n* `level` {String}\n* `prefix` {String}\n* `message` {String} Result of `util.format()`\n* `messageRaw` {Array} Arguments to `util.format()`\n", - "readmeFilename": "README.md", - "gitHead": "b58e360cd99db707d1191ce6125ae53d79f075a1", + "license": "ISC", + "gitHead": "4e1a73a567036064ded425a7d48c863d53550b4f", "bugs": { "url": "https://github.com/isaacs/npmlog/issues" }, - "homepage": "https://github.com/isaacs/npmlog", - "_id": "npmlog@0.1.1", - "_shasum": "8b9b9e4405d7ec48c31c2346965aadc7abaecaa5", - "_from": "npmlog@latest" + "homepage": "https://github.com/isaacs/npmlog#readme", + "_id": "npmlog@1.2.1", + "_shasum": "28e7be619609b53f7ad1dd300a10d64d716268b6", + "_from": "npmlog@>=1.2.1 <1.3.0", + "_npmVersion": "2.10.0", + "_nodeVersion": "2.0.1", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "28e7be619609b53f7ad1dd300a10d64d716268b6", + "tarball": "http://registry.npmjs.org/npmlog/-/npmlog-1.2.1.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + }, + { + "name": "iarna", + "email": "me@re-becca.org" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/npmlog/-/npmlog-1.2.1.tgz", + "readme": "ERROR: No README data found!" } diff --git a/deps/npm/node_modules/npmlog/test/progress.js b/deps/npm/node_modules/npmlog/test/progress.js new file mode 100644 index 00000000000..97b13ded2c6 --- /dev/null +++ b/deps/npm/node_modules/npmlog/test/progress.js @@ -0,0 +1,114 @@ +'use strict' + +var test = require('tap').test +var log = require('../log.js') + +var actions = [] +log.gauge = { + enable: function () { + actions.push(['enable']) + }, + disable: function () { + actions.push(['disable']) + }, + hide: function () { + actions.push(['hide']) + }, + show: function (name, completed) { + actions.push(['show', name, completed]) + }, + pulse: function (name) { + actions.push(['pulse', name]) + } +} + +function didActions(t, msg, output) { + var tests = [] + for (var ii = 0; ii < output.length; ++ ii) { + for (var jj = 0; jj < output[ii].length; ++ jj) { + tests.push({cmd: ii, arg: jj}) + } + } + t.is(actions.length, output.length, msg) + tests.forEach(function (test) { + t.is(actions[test.cmd] ? actions[test.cmd][test.arg] : null, + output[test.cmd][test.arg], + msg + ': ' + output[test.cmd] + (test.arg ? ' arg #'+test.arg : '')) + }) + actions = [] +} + + +test('enableProgress', function (t) { + t.plan(6) + log.enableProgress() + didActions(t, 'enableProgress', [ [ 'enable' ], [ 'show', undefined, 0 ] ]) + log.enableProgress() + didActions(t, 'enableProgress again', []) +}) + +test('disableProgress', function (t) { + t.plan(4) + log.disableProgress() + didActions(t, 'disableProgress', [ [ 'hide' ], [ 'disable' ] ]) + log.disableProgress() + didActions(t, 'disableProgress again', []) +}) + +test('showProgress', function (t) { + t.plan(5) + log.showProgress('foo') + didActions(t, 'showProgress disabled', []) + log.enableProgress() + actions = [] + log.showProgress('foo') + didActions(t, 'showProgress', [ [ 'show', 'foo', 0 ] ]) +}) + +test('clearProgress', function (t) { + t.plan(3) + log.clearProgress() + didActions(t, 'clearProgress', [ [ 'hide' ] ]) + log.disableProgress() + actions = [] + log.clearProgress() + didActions(t, 'clearProgress disabled', [ ]) +}) + +test("newItem", function (t) { + t.plan(12) + log.enableProgress() + actions = [] + var a = log.newItem("test", 10) + didActions(t, "newItem", [ [ 'show', undefined, 0 ] ]) + a.completeWork(5) + didActions(t, "newItem:completeWork", [ [ 'show', 'test', 0.5 ] ]) + a.finish() + didActions(t, "newItem:finish", [ [ 'show', 'test', 1 ] ]) +}) + +// test that log objects proxy through. And test that completion status filters up +test("newGroup", function (t) { + t.plan(23) + var a = log.newGroup("newGroup") + didActions(t, "newGroup", [ [ 'show', undefined, 0.5 ] ]) + a.warn("test", "this is a test") + didActions(t, "newGroup:warn", [ [ 'pulse', 'test' ], [ 'hide' ], [ 'show', undefined, 0.5 ] ]) + var b = a.newItem("newGroup2", 10) + didActions(t, "newGroup:newItem", [ [ 'show', 'newGroup', 0.5 ] ]) + b.completeWork(5) + didActions(t, "newGroup:completeWork", [ [ 'show', 'newGroup2', 0.75 ] ]) + a.finish() + didActions(t, "newGroup:finish", [ [ 'show', 'newGroup', 1 ] ]) +}) + +test("newStream", function (t) { + t.plan(13) + var a = log.newStream("newStream", 10) + didActions(t, "newStream", [ [ 'show', undefined, 0.6666666666666666 ] ]) + a.write("abcde") + didActions(t, "newStream", [ [ 'show', 'newStream', 0.8333333333333333 ] ]) + a.write("fghij") + didActions(t, "newStream", [ [ 'show', 'newStream', 1 ] ]) + t.is(log.tracker.completed(), 1, "Overall completion") +}) diff --git a/deps/npm/node_modules/once/LICENSE b/deps/npm/node_modules/once/LICENSE index 0c44ae716db..19129e315fe 100644 --- a/deps/npm/node_modules/once/LICENSE +++ b/deps/npm/node_modules/once/LICENSE @@ -1,27 +1,15 @@ -Copyright (c) Isaac Z. Schlueter ("Author") -All rights reserved. +The ISC License -The BSD License +Copyright (c) Isaac Z. Schlueter and Contributors -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/once/package.json b/deps/npm/node_modules/once/package.json index eb8a4217a27..c85f12ebe1d 100644 --- a/deps/npm/node_modules/once/package.json +++ b/deps/npm/node_modules/once/package.json @@ -1,6 +1,6 @@ { "name": "once", - "version": "1.3.1", + "version": "1.3.2", "description": "Run a function exactly one time", "main": "once.js", "directories": { @@ -17,7 +17,7 @@ }, "repository": { "type": "git", - "url": "git://github.com/isaacs/once" + "url": "git://github.com/isaacs/once.git" }, "keywords": [ "once", @@ -30,20 +30,24 @@ "email": "i@izs.me", "url": "http://blog.izs.me/" }, - "license": "BSD", - "gitHead": "c90ac02a74f433ce47f6938869e68dd6196ffc2c", + "license": "ISC", + "gitHead": "e35eed5a7867574e2bf2260a1ba23970958b22f2", "bugs": { "url": "https://github.com/isaacs/once/issues" }, - "homepage": "https://github.com/isaacs/once", - "_id": "once@1.3.1", - "_shasum": "f3f3e4da5b7d27b5c732969ee3e67e729457b31f", - "_from": "once@>=1.3.1 <2.0.0", - "_npmVersion": "2.0.0", - "_nodeVersion": "0.10.31", + "homepage": "https://github.com/isaacs/once#readme", + "_id": "once@1.3.2", + "_shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b", + "_from": "once@>=1.3.2 <1.4.0", + "_npmVersion": "2.9.1", + "_nodeVersion": "2.0.0", "_npmUser": { "name": "isaacs", - "email": "i@izs.me" + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b", + "tarball": "http://registry.npmjs.org/once/-/once-1.3.2.tgz" }, "maintainers": [ { @@ -51,10 +55,6 @@ "email": "i@izs.me" } ], - "dist": { - "shasum": "f3f3e4da5b7d27b5c732969ee3e67e729457b31f", - "tarball": "http://registry.npmjs.org/once/-/once-1.3.1.tgz" - }, - "_resolved": "https://registry.npmjs.org/once/-/once-1.3.1.tgz", + "_resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz", "readme": "ERROR: No README data found!" } diff --git a/deps/npm/node_modules/opener/LICENSE.txt b/deps/npm/node_modules/opener/LICENSE.txt index 0407ecda831..f580e3d3af7 100644 --- a/deps/npm/node_modules/opener/LICENSE.txt +++ b/deps/npm/node_modules/opener/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright © 2012–2014 Domenic Denicola +Copyright © 2012–2015 Domenic Denicola This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, diff --git a/deps/npm/node_modules/opener/opener.js b/deps/npm/node_modules/opener/opener.js index 3f95d0635a5..8951fa2def5 100755 --- a/deps/npm/node_modules/opener/opener.js +++ b/deps/npm/node_modules/opener/opener.js @@ -35,6 +35,11 @@ function opener(args, options, callback) { // // Furthermore, if "cmd /c" double-quoted the first parameter, then "start" will interpret it as a window title, // so we need to add a dummy empty-string window title: http://stackoverflow.com/a/154090/3191 + // + // Additionally, on Windows ampersand needs to be escaped when passed to "start" + args = args.map(function(value) { + return value.replace(/&/g, '^&'); + }); args = ["/c", "start", '""'].concat(args); } diff --git a/deps/npm/node_modules/opener/package.json b/deps/npm/node_modules/opener/package.json index b62915e6ef9..aab02afc15b 100644 --- a/deps/npm/node_modules/opener/package.json +++ b/deps/npm/node_modules/opener/package.json @@ -1,39 +1,43 @@ { "name": "opener", "description": "Opens stuff, like webpages and files and executables, cross-platform", - "version": "1.4.0", + "version": "1.4.1", "author": { "name": "Domenic Denicola", - "email": "domenic@domenicdenicola.com", - "url": "http://domenic.me/" + "email": "d@domenic.me", + "url": "https://domenic.me/" }, "license": "WTFPL", "repository": { "type": "git", - "url": "git://github.com/domenic/opener.git" - }, - "bugs": { - "url": "http://github.com/domenic/opener/issues" + "url": "https://github.com/domenic/opener" }, "main": "opener.js", "bin": { "opener": "opener.js" }, + "files": [ + "opener.js" + ], "scripts": { "lint": "jshint opener.js" }, "devDependencies": { - "jshint": "^2.5.4" + "jshint": "^2.6.3" + }, + "gitHead": "d0ee95b19951703462fa593baa16e81fdff7827c", + "bugs": { + "url": "https://github.com/domenic/opener/issues" }, - "gitHead": "b9d36d4f82c26560acdadbabbb10ddba46a30dc5", "homepage": "https://github.com/domenic/opener", - "_id": "opener@1.4.0", - "_shasum": "d11f86eeeb076883735c9d509f538fe82d10b941", - "_from": "opener@>=1.4.0 <1.5.0", - "_npmVersion": "1.4.23", + "_id": "opener@1.4.1", + "_shasum": "897590acd1aed3311b703b58bccb4d43f56f2895", + "_from": "opener@>=1.4.1 <1.5.0", + "_npmVersion": "2.7.0", + "_nodeVersion": "1.5.1", "_npmUser": { "name": "domenic", - "email": "domenic@domenicdenicola.com" + "email": "d@domenic.me" }, "maintainers": [ { @@ -42,9 +46,9 @@ } ], "dist": { - "shasum": "d11f86eeeb076883735c9d509f538fe82d10b941", - "tarball": "http://registry.npmjs.org/opener/-/opener-1.4.0.tgz" + "shasum": "897590acd1aed3311b703b58bccb4d43f56f2895", + "tarball": "http://registry.npmjs.org/opener/-/opener-1.4.1.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/opener/-/opener-1.4.0.tgz" + "_resolved": "https://registry.npmjs.org/opener/-/opener-1.4.1.tgz" } diff --git a/deps/npm/node_modules/osenv/.npmignore b/deps/npm/node_modules/osenv/.npmignore new file mode 100644 index 00000000000..8c23deeb34b --- /dev/null +++ b/deps/npm/node_modules/osenv/.npmignore @@ -0,0 +1,13 @@ +*.swp +.*.swp + +.DS_Store +*~ +.project +.settings +npm-debug.log +coverage.html +.idea +lib-cov + +node_modules diff --git a/deps/npm/node_modules/osenv/.travis.yml b/deps/npm/node_modules/osenv/.travis.yml new file mode 100644 index 00000000000..99f2bbf5068 --- /dev/null +++ b/deps/npm/node_modules/osenv/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +language: node_js +node_js: + - '0.8' + - '0.10' + - '0.12' + - 'iojs' +before_install: + - npm install -g npm@latest diff --git a/deps/npm/node_modules/osenv/LICENSE b/deps/npm/node_modules/osenv/LICENSE index 0c44ae716db..19129e315fe 100644 --- a/deps/npm/node_modules/osenv/LICENSE +++ b/deps/npm/node_modules/osenv/LICENSE @@ -1,27 +1,15 @@ -Copyright (c) Isaac Z. Schlueter ("Author") -All rights reserved. +The ISC License -The BSD License +Copyright (c) Isaac Z. Schlueter and Contributors -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/osenv/node_modules/os-tmpdir/index.js b/deps/npm/node_modules/osenv/node_modules/os-tmpdir/index.js new file mode 100644 index 00000000000..52d90bf2698 --- /dev/null +++ b/deps/npm/node_modules/osenv/node_modules/os-tmpdir/index.js @@ -0,0 +1,25 @@ +'use strict'; +var isWindows = process.platform === 'win32'; +var trailingSlashRe = isWindows ? /[^:]\\$/ : /.\/$/; + +// https://github.com/nodejs/io.js/blob/3e7a14381497a3b73dda68d05b5130563cdab420/lib/os.js#L25-L43 +module.exports = function () { + var path; + + if (isWindows) { + path = process.env.TEMP || + process.env.TMP || + (process.env.SystemRoot || process.env.windir) + '\\temp'; + } else { + path = process.env.TMPDIR || + process.env.TMP || + process.env.TEMP || + '/tmp'; + } + + if (trailingSlashRe.test(path)) { + path = path.slice(0, -1); + } + + return path; +}; diff --git a/deps/npm/node_modules/osenv/node_modules/os-tmpdir/license b/deps/npm/node_modules/osenv/node_modules/os-tmpdir/license new file mode 100644 index 00000000000..654d0bfe943 --- /dev/null +++ b/deps/npm/node_modules/osenv/node_modules/os-tmpdir/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.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/deps/npm/node_modules/osenv/node_modules/os-tmpdir/package.json b/deps/npm/node_modules/osenv/node_modules/os-tmpdir/package.json new file mode 100644 index 00000000000..1857f8f5fa2 --- /dev/null +++ b/deps/npm/node_modules/osenv/node_modules/os-tmpdir/package.json @@ -0,0 +1,70 @@ +{ + "name": "os-tmpdir", + "version": "1.0.1", + "description": "Node.js os.tmpdir() ponyfill", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/os-tmpdir.git" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "node test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "built-in", + "core", + "ponyfill", + "polyfill", + "shim", + "os", + "tmpdir", + "tempdir", + "tmp", + "temp", + "dir", + "directory", + "env", + "environment" + ], + "devDependencies": { + "ava": "0.0.4" + }, + "gitHead": "5c5d355f81378980db629d60128ad03e02b1c1e5", + "bugs": { + "url": "https://github.com/sindresorhus/os-tmpdir/issues" + }, + "homepage": "https://github.com/sindresorhus/os-tmpdir", + "_id": "os-tmpdir@1.0.1", + "_shasum": "e9b423a1edaf479882562e92ed71d7743a071b6e", + "_from": "os-tmpdir@>=1.0.0 <2.0.0", + "_npmVersion": "2.9.1", + "_nodeVersion": "0.12.3", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "dist": { + "shasum": "e9b423a1edaf479882562e92ed71d7743a071b6e", + "tarball": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.1.tgz" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/osenv/node_modules/os-tmpdir/readme.md b/deps/npm/node_modules/osenv/node_modules/os-tmpdir/readme.md new file mode 100644 index 00000000000..54d4c6ec8e5 --- /dev/null +++ b/deps/npm/node_modules/osenv/node_modules/os-tmpdir/readme.md @@ -0,0 +1,36 @@ +# os-tmpdir [![Build Status](https://travis-ci.org/sindresorhus/os-tmpdir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-tmpdir) + +> Node.js [`os.tmpdir()`](https://nodejs.org/api/os.html#os_os_tmpdir) ponyfill + +> Ponyfill: A polyfill that doesn't overwrite the native method + +Use this instead of `require('os').tmpdir()` to get a consistent behaviour on different Node.js versions (even 0.8). + +*This is actually taken from io.js 2.0.2 as it contains some fixes that haven't bubbled up to Node.js yet.* + + +## Install + +``` +$ npm install --save os-tmpdir +``` + + +## Usage + +```js +var osTmpdir = require('os-tmpdir'); + +osTmpdir(); +//=> /var/folders/m3/5574nnhn0yj488ccryqr7tc80000gn/T +``` + + +## API + +See the [`os.tmpdir()` docs](https://nodejs.org/api/os.html#os_os_tmpdir). + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/osenv/osenv.js b/deps/npm/node_modules/osenv/osenv.js index 7836fafcc1a..0cabcba66ec 100644 --- a/deps/npm/node_modules/osenv/osenv.js +++ b/deps/npm/node_modules/osenv/osenv.js @@ -1,7 +1,7 @@ var isWindows = process.platform === 'win32' var path = require('path') var exec = require('child_process').exec -var os = require('os') +var osTmpdir = require('os-tmpdir') // looking up envs is a bit costly. // Also, sometimes we want to have a fallback @@ -46,7 +46,7 @@ memo('hostname', function () { }, 'hostname') memo('tmpdir', function () { - return os.tmpDir() + return osTmpdir() }) memo('home', function () { diff --git a/deps/npm/node_modules/osenv/package.json b/deps/npm/node_modules/osenv/package.json index b66ce8df24c..851f19b51ef 100644 --- a/deps/npm/node_modules/osenv/package.json +++ b/deps/npm/node_modules/osenv/package.json @@ -1,20 +1,22 @@ { "name": "osenv", - "version": "0.1.0", + "version": "0.1.2", "main": "osenv.js", "directories": { "test": "test" }, - "dependencies": {}, + "dependencies": { + "os-tmpdir": "^1.0.0" + }, "devDependencies": { - "tap": "~0.4.9" + "tap": "^1.2.0" }, "scripts": { "test": "tap test/*.js" }, "repository": { "type": "git", - "url": "git://github.com/isaacs/osenv" + "url": "git+https://github.com/npm/osenv.git" }, "keywords": [ "environment", @@ -30,15 +32,16 @@ "email": "i@izs.me", "url": "http://blog.izs.me/" }, - "license": "BSD", + "license": "ISC", "description": "Look up environment settings specific to different operating systems", "readme": "# osenv\n\nLook up environment settings specific to different operating systems.\n\n## Usage\n\n```javascript\nvar osenv = require('osenv')\nvar path = osenv.path()\nvar user = osenv.user()\n// etc.\n\n// Some things are not reliably in the env, and have a fallback command:\nvar h = osenv.hostname(function (er, hostname) {\n h = hostname\n})\n// This will still cause it to be memoized, so calling osenv.hostname()\n// is now an immediate operation.\n\n// You can always send a cb, which will get called in the nextTick\n// if it's been memoized, or wait for the fallback data if it wasn't\n// found in the environment.\nosenv.hostname(function (er, hostname) {\n if (er) console.error('error looking up hostname')\n else console.log('this machine calls itself %s', hostname)\n})\n```\n\n## osenv.hostname()\n\nThe machine name. Calls `hostname` if not found.\n\n## osenv.user()\n\nThe currently logged-in user. Calls `whoami` if not found.\n\n## osenv.prompt()\n\nEither PS1 on unix, or PROMPT on Windows.\n\n## osenv.tmpdir()\n\nThe place where temporary files should be created.\n\n## osenv.home()\n\nNo place like it.\n\n## osenv.path()\n\nAn array of the places that the operating system will search for\nexecutables.\n\n## osenv.editor() \n\nReturn the executable name of the editor program. This uses the EDITOR\nand VISUAL environment variables, and falls back to `vi` on Unix, or\n`notepad.exe` on Windows.\n\n## osenv.shell()\n\nThe SHELL on Unix, which Windows calls the ComSpec. Defaults to 'bash'\nor 'cmd'.\n", "readmeFilename": "README.md", + "gitHead": "88a154d6d8ad39fefb9af2fe1b306cd12fb6d6d0", "bugs": { - "url": "https://github.com/isaacs/osenv/issues" + "url": "https://github.com/npm/osenv/issues" }, - "homepage": "https://github.com/isaacs/osenv", - "_id": "osenv@0.1.0", - "_shasum": "61668121eec584955030b9f470b1d2309504bfcb", - "_from": "osenv@~0.1.0" + "homepage": "https://github.com/npm/osenv#readme", + "_id": "osenv@0.1.2", + "_shasum": "f4d23ebeceaef078600fb78c0ea58fac5996a02d", + "_from": "osenv@latest" } diff --git a/deps/npm/node_modules/osenv/test/windows.js b/deps/npm/node_modules/osenv/test/windows.js index 63ca453212a..c9d837a32d4 100644 --- a/deps/npm/node_modules/osenv/test/windows.js +++ b/deps/npm/node_modules/osenv/test/windows.js @@ -3,9 +3,8 @@ // how the underlying system looks up module paths and runs // child processes, and all that stuff is cached. if (process.platform !== 'win32') { - console.log('TAP Version 13\n' + - '1..0\n' + - '# Skip windows tests, this is not windows\n') + console.log('TAP version 13\n' + + '1..0 # Skip windows tests, this is not windows\n') return } diff --git a/deps/npm/node_modules/read-installed/node_modules/debuglog/package.json b/deps/npm/node_modules/read-installed/node_modules/debuglog/package.json index 3966625621e..4a8257c9810 100644 --- a/deps/npm/node_modules/read-installed/node_modules/debuglog/package.json +++ b/deps/npm/node_modules/read-installed/node_modules/debuglog/package.json @@ -27,7 +27,7 @@ "shasum": "aa24ffb9ac3df9a2351837cfb2d279360cd78492", "tarball": "http://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz" }, - "_from": "debuglog@>=1.0.1-0 <2.0.0-0", + "_from": "debuglog@>=1.0.1 <2.0.0", "_npmVersion": "1.4.3", "_npmUser": { "name": "octet", @@ -41,5 +41,6 @@ ], "directories": {}, "_shasum": "aa24ffb9ac3df9a2351837cfb2d279360cd78492", - "_resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz" + "_resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz", + "readme": "ERROR: No README data found!" } diff --git a/deps/npm/node_modules/read-installed/node_modules/readdir-scoped-modules/package.json b/deps/npm/node_modules/read-installed/node_modules/readdir-scoped-modules/package.json index 84b91e75a55..de45b2f4da7 100644 --- a/deps/npm/node_modules/read-installed/node_modules/readdir-scoped-modules/package.json +++ b/deps/npm/node_modules/read-installed/node_modules/readdir-scoped-modules/package.json @@ -1,6 +1,6 @@ { "name": "readdir-scoped-modules", - "version": "1.0.0", + "version": "1.0.1", "description": "Like `fs.readdir` but handling `@org/module` dirs as if they were a single entry.", "main": "readdir.js", "directories": { @@ -9,6 +9,7 @@ "dependencies": { "debuglog": "^1.0.1", "dezalgo": "^1.0.0", + "graceful-fs": "^3.0.4", "once": "^1.3.0" }, "devDependencies": { @@ -31,24 +32,30 @@ "url": "https://github.com/npm/readdir-scoped-modules/issues" }, "homepage": "https://github.com/npm/readdir-scoped-modules", - "gitHead": "35a4a7a2325d12ed25ed322cd61f976b740f7fb7", - "_id": "readdir-scoped-modules@1.0.0", - "_shasum": "e939de969b38b3e7dfaa14fbcfe7a2fd15a4ea37", - "_from": "readdir-scoped-modules@>=1.0.0-0 <2.0.0-0", - "_npmVersion": "2.0.0-alpha.6.0", + "gitHead": "451d38946c5b6b6c0db33a890f33536a11ed79f7", + "_id": "readdir-scoped-modules@1.0.1", + "_shasum": "5c2a77f3e08250a8fddf53fa58cdc17900b808b9", + "_from": "readdir-scoped-modules@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.9", + "_nodeVersion": "0.10.33", "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" }, "maintainers": [ { "name": "isaacs", "email": "i@izs.me" + }, + { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" } ], "dist": { - "shasum": "e939de969b38b3e7dfaa14fbcfe7a2fd15a4ea37", - "tarball": "http://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.0.0.tgz" + "shasum": "5c2a77f3e08250a8fddf53fa58cdc17900b808b9", + "tarball": "http://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.0.1.tgz" }, - "_resolved": "https://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.0.0.tgz" + "_resolved": "https://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.0.1.tgz", + "readme": "ERROR: No README data found!" } diff --git a/deps/npm/node_modules/read-installed/node_modules/readdir-scoped-modules/readdir.js b/deps/npm/node_modules/read-installed/node_modules/readdir-scoped-modules/readdir.js index 91978a739db..efbe5526d8c 100644 --- a/deps/npm/node_modules/read-installed/node_modules/readdir-scoped-modules/readdir.js +++ b/deps/npm/node_modules/read-installed/node_modules/readdir-scoped-modules/readdir.js @@ -1,4 +1,4 @@ -var fs = require ('fs') +var fs = require ('graceful-fs') var dz = require ('dezalgo') var once = require ('once') var path = require ('path') diff --git a/deps/npm/node_modules/read-installed/node_modules/util-extend/package.json b/deps/npm/node_modules/read-installed/node_modules/util-extend/package.json index 0bab48d3297..942b786046c 100644 --- a/deps/npm/node_modules/read-installed/node_modules/util-extend/package.json +++ b/deps/npm/node_modules/read-installed/node_modules/util-extend/package.json @@ -22,7 +22,7 @@ "shasum": "bb703b79480293ddcdcfb3c6a9fea20f483415bc", "tarball": "http://registry.npmjs.org/util-extend/-/util-extend-1.0.1.tgz" }, - "_from": "util-extend@>=1.0.1-0 <2.0.0-0", + "_from": "util-extend@>=1.0.1 <2.0.0", "_npmVersion": "1.3.4", "_npmUser": { "name": "isaacs", @@ -36,5 +36,6 @@ ], "directories": {}, "_shasum": "bb703b79480293ddcdcfb3c6a9fea20f483415bc", - "_resolved": "https://registry.npmjs.org/util-extend/-/util-extend-1.0.1.tgz" + "_resolved": "https://registry.npmjs.org/util-extend/-/util-extend-1.0.1.tgz", + "homepage": "https://github.com/isaacs/util-extend" } diff --git a/deps/npm/node_modules/read-installed/package.json b/deps/npm/node_modules/read-installed/package.json index 2c50225534f..7ecdc716e24 100644 --- a/deps/npm/node_modules/read-installed/package.json +++ b/deps/npm/node_modules/read-installed/package.json @@ -1,7 +1,7 @@ { "name": "read-installed", "description": "Read all the installed packages in a folder, and return a tree structure with all the data.", - "version": "3.1.3", + "version": "4.0.0", "repository": { "type": "git", "url": "git://github.com/isaacs/read-installed" @@ -12,7 +12,7 @@ }, "dependencies": { "debuglog": "^1.0.1", - "read-package-json": "1", + "read-package-json": "^2.0.0", "readdir-scoped-modules": "^1.0.0", "semver": "2 || 3 || 4", "slide": "~1.1.3", @@ -33,33 +33,14 @@ "rimraf": "^2.2.8", "tap": "~0.4.8" }, - "gitHead": "50e45af7581b1a879c62146fafbfa1b92842f7df", + "readme": "# read-installed\n\nRead all the installed packages in a folder, and return a tree\nstructure with all the data.\n\nnpm uses this.\n\n## 2.0.0\n\nBreaking changes in `2.0.0`:\n\nThe second argument is now an `Object` that contains the following keys:\n\n * `depth` optional, defaults to Infinity\n * `log` optional log Function\n * `dev` optional, default false, set to true to include devDependencies\n\n## Usage\n\n```javascript\nvar readInstalled = require(\"read-installed\")\n// optional options\nvar options = { dev: false, log: fn, depth: 2 }\nreadInstalled(folder, options, function (er, data) {\n ...\n})\n```\n", + "readmeFilename": "README.md", + "gitHead": "c1dea4823e2219a79d6184621917ee27d4283bc0", "bugs": { "url": "https://github.com/isaacs/read-installed/issues" }, "homepage": "https://github.com/isaacs/read-installed", - "_id": "read-installed@3.1.3", - "_shasum": "c09092a13c2117f22842cad16804f3b059129d11", - "_from": "read-installed@>=3.1.2-0 <3.2.0-0", - "_npmVersion": "2.0.0-beta.3", - "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - }, - { - "name": "othiym23", - "email": "ogd@aoaioxxysz.net" - } - ], - "dist": { - "shasum": "c09092a13c2117f22842cad16804f3b059129d11", - "tarball": "http://registry.npmjs.org/read-installed/-/read-installed-3.1.3.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/read-installed/-/read-installed-3.1.3.tgz" + "_id": "read-installed@4.0.0", + "_shasum": "dbca08d6bd83e2a3b93c962053ba4d839e0769ba", + "_from": "read-installed@>=4.0.0 <4.1.0" } diff --git a/deps/npm/node_modules/read-installed/read-installed.js b/deps/npm/node_modules/read-installed/read-installed.js index a92ed3fbee3..2e299445bcd 100644 --- a/deps/npm/node_modules/read-installed/read-installed.js +++ b/deps/npm/node_modules/read-installed/read-installed.js @@ -345,7 +345,7 @@ function unmarkExtraneous (obj, opts) { obj.extraneous = false - var deps = obj._dependencies + var deps = obj._dependencies || [] if (opts.dev && obj.devDependencies && (obj.root || obj.link)) { Object.keys(obj.devDependencies).forEach(function (k) { deps[k] = obj.devDependencies[k] diff --git a/deps/npm/node_modules/read-installed/test/empty.js b/deps/npm/node_modules/read-installed/test/empty.js new file mode 100644 index 00000000000..09ace074f5c --- /dev/null +++ b/deps/npm/node_modules/read-installed/test/empty.js @@ -0,0 +1,16 @@ +var readInstalled = require("../read-installed.js"); +var test = require("tap").test; +var path = require("path"); + +test("Handle bad path", function (t) { + readInstalled(path.join(__dirname, "../unknown"), { + dev: true, + log: console.error + }, function (er, map) { + t.notOk(er, "er should be null"); + t.ok(map, "map should be data"); + t.equal(Object.keys(map.dependencies).length, 0, "Dependencies should have no keys"); + if (er) return console.error(er.stack || er.message); + t.end(); + }); +}); diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/.editorconfig b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/.editorconfig new file mode 100644 index 00000000000..fb7f73a832a --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/.editorconfig @@ -0,0 +1,14 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.js, **/*.js] +indent_size = 4 +indent_style = space + +[{package.json,.travis.yml}] +indent_size = 2 +indent_style = space diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/.npmignore b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/.npmignore new file mode 100644 index 00000000000..59d842baa84 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/.npmignore @@ -0,0 +1,28 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Commenting this out is preferred by some people, see +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- +node_modules + +# Users Environment Variables +.lock-wscript diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/LICENSE b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/LICENSE new file mode 100644 index 00000000000..e637724b3bc --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Sam Mikes + +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/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/README.md b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/README.md new file mode 100644 index 00000000000..ffad93584b1 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/README.md @@ -0,0 +1,29 @@ +# json-parse-helpfulerror + +A drop-in replacement for `JSON.parse` that uses + to provide more useful error messages in the +event of a parse error. + +# Example + +## Installation + +``` +npm i -S json-parse-helpfulerror +``` + +## Use + +```js +var jph = require('json-parse-helpfulerror'); + +var notJSON = "{'foo': 3}"; // keys must be double-quoted in JSON + +JSON.parse(notJSON); // throws unhelpful error + +jph.parse("{'foo': 3}") // throws more helpful error: "Unexpected token '\''..." +``` + +# License + +MIT \ No newline at end of file diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/index.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/index.js new file mode 100644 index 00000000000..15648b017b3 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/index.js @@ -0,0 +1,21 @@ +'use strict'; + +var jju = require('jju'); + +function parse(text, reviver) { + try { + return JSON.parse(text, reviver); + } catch (err) { + // we expect this to throw with a more informative message + jju.parse(text, { + mode: 'json', + reviver: reviver + }); + + // backup if jju is not as strict as JSON.parse; re-throw error + // data-dependent code path, I do not know how to cover it + throw err; + } +} + +exports.parse = parse; diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/.editorconfig b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/.editorconfig new file mode 100644 index 00000000000..8de2a35e3a2 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/.editorconfig @@ -0,0 +1,19 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true + +[{.,}*.{js,json,json5,yml,yaml}] +indent_style = space +indent_size = 2 + +[*.md] +indent_style = space +indent_size = 4 +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/.npmignore b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/.npmignore new file mode 100644 index 00000000000..b561496c91d --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/.npmignore @@ -0,0 +1,6 @@ +package.json +node_modules +test/external +examples +/.eslint* +/.travis.yml diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/README.md b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/README.md new file mode 100644 index 00000000000..85d52a2dcea --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/README.md @@ -0,0 +1,243 @@ +`jju` - a set of utilities to work with JSON / JSON5 documents + +[![npm version badge](https://img.shields.io/npm/v/jju.svg)](https://www.npmjs.org/package/jju) +[![travis badge](http://img.shields.io/travis/rlidwka/jju.svg)](https://travis-ci.org/rlidwka/jju) +[![downloads badge](http://img.shields.io/npm/dm/jju.svg)](https://www.npmjs.org/package/jju) + +## Installation + +``` +npm install jju +``` + +## Usage + +This module provides following functions: + +1. [jju.parse()](#jjuparse-function) parses json/json5 text and returns a javascript value it corresponds to +2. [jju.stringify()](#jjustringify-function) converts javascript value to an appropriate json/json5 text +3. [jju.tokenize()](#jjutokenize-function) parses json/json5 text and returns an array of tokens it consists of ([see demo](http://rlidwka.github.io/jju/tokenizer.html)) +4. [jju.analyze()](#jjuanalyze-function) parses json/json5 text and tries to guess indentation, quoting style, etc. +5. [jju.update()](#jjuupdate-function) changes json/json5 text, preserving original formatting as much as possible ([see demo](http://rlidwka.github.io/jju/editor.html)) + +All functions are able to work with a standard JSON documents. `jju.parse()` and `jju.stringify()` are better in some cases, but slower than native `JSON.parse()` and `JSON.stringify()` versions. Detailed description see below. + +### jju.parse() function + +```javascript +/* + * Main syntax: + * + * `text` - text to parse, type: String + * `options` - parser options, type: Object + */ +jju.parse(text[, options]) + +// compatibility syntax +jju.parse(text[, reviver]) +``` + +Options: + + - reserved\_keys - what to do with reserved keys (String, default="ignore") + - "ignore" - ignore reserved keys + - "throw" - throw SyntaxError in case of reserved keys + - "replace" - replace reserved keys, this is the default JSON.parse behaviour, unsafe + + Reserved keys are keys that exist in an empty object (`hasOwnProperty`, `__proto__`, etc.). + +```javascript +// 'ignore' will cause reserved keys to be ignored: +parse('{hasOwnProperty: 1}', {reserved_keys: 'ignore'}) == {} +parse('{hasOwnProperty: 1, x: 2}', {reserved_keys: 'ignore'}).hasOwnProperty('x') == true + +// 'throw' will cause SyntaxError in these cases: +parse('{hasOwnProperty: 1}', {reserved_keys: 'throw'}) == SyntaxError + +// 'replace' will replace reserved keys with new ones: +parse('{hasOwnProperty: 1}', {reserved_keys: 'throw'}) == {hasOwnProperty: 1} +parse('{hasOwnProperty: 1, x: 2}', {reserved_keys: 'ignore'}).hasOwnProperty('x') == TypeError +``` + + + - null\_prototype - create object as Object.create(null) instead of '{}' (Boolean) + + if `reserved_keys != 'replace'`, default is **false** + + if `reserved_keys == 'replace'`, default is **true** + + It is usually unsafe and not recommended to change this option to false in the last case. + + - reviver - reviver function - Function + + This function should follow JSON specification + + - mode - operation mode, set it to 'json' if you want to throw on non-strict json files (String) + +### jju.stringify() function + +```javascript +/* + * Main syntax: + * + * `value` - value to serialize, type: * + * `options` - serializer options, type: Object + */ +jju.stringify(value[, options]) + +// compatibility syntax +jju.stringify(value[, replacer [, indent]) +``` + +Options: + + - ascii - output ascii only (Boolean, default=false) + If this option is enabled, output will not have any characters except of 0x20-0x7f. + + - indent - indentation (String, Number or Boolean, default='\t') + This option follows JSON specification. + + - quote - enquoting char (String, "'" or '"', default="'") + - quote\_keys - whether keys quoting in objects is required or not (String, default=false) + If you want `{"q": 1}` instead of `{q: 1}`, set it to true. + + - sort\_keys - sort all keys while stringifying (Boolean or Function, default=false) + By default sort order will depend on implementation, with v8 it's insertion order. If set to `true`, all keys (but not arrays) will be sorted alphabetically. You can provide your own sorting function as well. + + - replacer - replacer function or array (Function or Array) + This option follows JSON specification. + + - no\_trailing\_comma = don't output trailing comma (Boolean, default=false) + If this option is set, arrays like this `[1,2,3,]` will never be generated. Otherwise they may be generated for pretty printing. + + - mode - operation mode, set it to 'json' if you want correct json in the output (String) + + Currently it's either 'json' or something else. If it is 'json', following options are implied: + + - options.quote = '"' + - options.no\_trailing\_comma = true + - options.quote\_keys = true + - '\x' literals are not used + +### jju.tokenize() function + +```javascript +/* + * Main syntax: + * + * `text` - text to tokenize, type: String + * `options` - parser options, type: Object + */ +jju.tokenize(text[, options]) +``` + +Options are the same as for the `jju.parse` function. + +Return value is an array of tokens, where each token is an object: + + - raw (String) - raw text of this token, if you join all raw's, you will get the original document + - type (String) - type of the token, can be `whitespace`, `comment`, `key`, `literal`, `separator` or `newline` + - stack (Array) - path to the current token in the syntax tree + - value - value of the token if token is a `key` or `literal` + +You can check tokenizer for yourself using [this demo](http://rlidwka.github.io/jju/tokenizer.html). + +### jju.analyze() function + +```javascript +/* + * Main syntax: + * + * `text` - text to analyze, type: String + * `options` - parser options, type: Object + */ +jju.analyze(text[, options]) +``` + +Options are the same as for the `jju.parse` function. + +Return value is an object defining a programming style in which the document was written. + + - indent (String) - preferred indentation + - newline (String) - preferred newline + - quote (String) - `"` or `'` depending on which quote is preferred + - quote\_keys (Boolean) - `true` if unquoted keys were used at least once + - has\_whitespace (Boolean) - `true` if input has a whitespace token + - has\_comments (Boolean) - `true` if input has a comment token + - has\_newlines (Boolean) - `true` if input has a newline token + - has\_trailing\_comma (Boolean) - `true` if input has at least one trailing comma + +### jju.update() function + +```javascript +/* + * Main syntax: + * + * `text` - original text, type: String + * `new_value` - new value you want to set + * `options` - parser or stringifier options, type: Object + */ +jju.update(text, new_value[, options]) +``` + +If you want to update a JSON document, here is the general approach: + +```javascript +// here is your original JSON document: +var input = '{"foo": "bar", "baz": 123}' + +// you need to parse it first: +var json = jju.parse(input, {mode: 'json'}) +// json is { foo: 'bar', baz: 123 } + +// then you can change it as you like: +json.foo = 'quux' +json.hello = 'world' + +// then you run an update function to change the original json: +var output = jju.update(input, json, {mode: 'json'}) +// output is '{"foo": "quux", "baz": 123, "hello": "world"}' +``` + +Look at [this demo](http://rlidwka.github.io/jju/editor.html) to test various types of json. + +## Advantages over existing JSON libraries + +In a few cases it makes sense to use this module instead of built-in JSON methods. + +Parser: + - better error reporting with source code and line numbers + +In case of syntax error, JSON.parse does not return any good information to the user. This module does: + +``` +$ node -e 'require("jju").parse("[1,1,1,1,invalid]")' + +SyntaxError: Unexpected token 'i' at 0:9 +[1,1,1,1,invalid] + ^ +``` + +This module is about 5 times slower, so if user experience matters to you more than performance, use this module. If you're working with a lot of machine-generated data, use JSON.parse instead. + +Stringifier: + - util.inspect-like pretty printing + +This module behaves more smart when dealing with object and arrays, and does not always print newlines in them: + +``` +$ node -e 'console.log(require("./").stringify([[,,,],,,[,,,,]], {mode:"json"}))' +[ + [null, null, null], + null, + null, + [null, null, null, null] +] +``` + +JSON.stringify will split this into 15 lines, and it's hard to read. + +Yet again, this feature comes with a performance hit, so if user experience matters to you more than performance, use this module. If your JSON will be consumed by machines, use JSON.stringify instead. + +As a rule of thumb, if you use "space" argument to indent your JSON, you'd better use this module instead. + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/benchmark/benchmark.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/benchmark/benchmark.js new file mode 100755 index 00000000000..28a6aad75ad --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/benchmark/benchmark.js @@ -0,0 +1,40 @@ +#!/usr/bin/env node + +var Benchmark = require('benchmark') +var YAML = require('js-yaml') +var JJU = require('../') +var JSON5 = require('json5') +var suite = new Benchmark.Suite + +var sample +sample = require('fs').readFileSync(__dirname + '/../package.yaml') +sample = YAML.safeLoad(sample) +sample = JSON.stringify(sample) + +var functions = { + 'JSON': function(x) { JSON.parse(x) }, + 'JSON5': function(x) { JSON5.parse(x) }, + 'JJU': function(x) { JJU.parse(x) }, + 'JS-YAML': function(x) { YAML.safeLoad(x) }, +} + +for (var name in functions) { + with ({ fn: functions[name] }) { + suite.add(name, { + onCycle: function onCycle(event) { + process.stdout.write('\r\033[2K - ' + event.target) + }, + fn: function () { + fn(sample) + }, + }) + } +} + +console.log() +suite.on('cycle', function(event) { + console.log('\r\033[2K + ' + String(event.target)) +}) +.run() + +process.on('exit', function() { console.log() }) diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/benchmark/package.json b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/benchmark/package.json new file mode 100644 index 00000000000..7f0dcf08b72 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/benchmark/package.json @@ -0,0 +1,9 @@ +{ + "name": "benchmarks", + "private": true, + "dependencies": { + "json5": "*", + "js-yaml": "*", + "benchmark": "*" + } +} diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/docs/Grammar.md b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/docs/Grammar.md new file mode 100644 index 00000000000..eb7c8bc667f --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/docs/Grammar.md @@ -0,0 +1,219 @@ + +JSON5 grammar expressed in EBNF form. + +PS: I don't know what is appropriate syntax highlighter for this, so I'm using "modula2" because why not. I also inserted after backslash to preserve syntax highlighting, this character has nothing to do with actual JSON5 syntax and should be ignored. + +```modula2 +json5_text = expression_with_whitespace + +expression_with_whitespace = [white_space] , expression , [white_space] + +expression = literal + | array_literal + | object_literal + +literal = null_literal + | boolean_literal + | signed_numeric_literal + | string_literal + +null_literal = 'null' + +boolean_literal = 'true' + | 'false' + +(* Source Characters *) + +source_character = . + (* any Unicode code unit *) + +line_terminator = + | + | + | + +line_terminator_sequence = + | + | + | + | , + +white_space = white_space_element + | white_space , white_space_element + +white_space_element = white_space_character + | comment + +white_space_character = + | + | + | + | + | + | + +comment = multi_line_comment + | single_line_comment + +multi_line_comment = '/*' , [multi_line_comment_chars] , '*/' + +multi_line_comment_chars = (source_character - '*') , [multi_line_comment_chars] + | '*' , [post_asterisk_comment_chars] + +post_asterisk_comment_chars = (source_character - ('*' | '/')) , [multi_line_comment_chars] + | '*' , [post_asterisk_comment_chars] + +single_line_comment = '//' , [single_line_comment_chars] + +single_line_comment_chars = single_line_comment_char , single_line_comment_chars + +single_line_comment_char = source_character - line_terminator + +(* Character classes *) + +decimal_digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' + +non_zero_digit = decimal_digit - '0' + +hex_digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'a' + | 'b' | 'c' | 'd' | 'e' | 'f' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' + +ascii_letter = ascii_letter_lowercase + | ascii_letter_uppercase + +ascii_letter_lowercase = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' + | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' + | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' + +ascii_letter_uppercase = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' + | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' + | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' + +(* Numeric Literals *) + +signed_numeric_literal = '-' , numeric_literal + | '+' , numeric_literal + | numeric_literal + +numeric_literal = decimal_literal + | hex_integer_literal + | non_finite_literal + +non_finite_literal = 'Infinity' + | 'NaN' + +decimal_literal = decimal_integer_literal , '.' , [decimal_digits] , [exponent_part] + | '.' , decimal_digits , [exponent_part] + | decimal_integer_literal , [exponent_part] + +decimal_integer_literal = '0' + | non_zero_digit , [decimal_digits] + +decimal_digits = decimal_digit + | decimal_digits , decimal_digit + +exponent_part = exponent_indicator , signed_integer + +exponent_indicator = 'e' | 'E' + +signed_integer = decimal_digits + | '+' , decimal_digits + | '-' , decimal_digits + +hex_integer_literal = '0x' , hex_digit + | '0X' , hex_digit + | hex_integer_literal , hex_digit + +(* String Literals *) + +string_literal = '"' , [double_string_characters] , '"' + | "'" , [single_string_characters] , "'" + +double_string_characters = double_string_character , [double_string_characters] + +single_string_characters = single_string_character , [single_string_characters] + +double_string_character = source_character - ('"' | '\​' | line_terminator) + | '\​' , escape_sequence + | line_continuation + +single_string_character = source_character - ("'" | '\​' | line_terminator) + | '\​' , escape_sequence + | line_continuation + +line_continuation = '\​' , line_terminator_sequence + +escape_sequence = character_escape_sequence + | '0' + | hex_escape_sequence + | unicode_escape_sequence + +character_escape_sequence = single_escape_character + | non_escape_character + +single_escape_character = '"' | "'" | '\​' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' + +non_escape_character = source_character - (escape_character | line_terminator) + +escape_character = single_escape_character + | decimal_digit + | 'x' + | 'u' + +hex_escape_sequence = 'x' , hex_digit , hex_digit + +unicode_escape_sequence = 'u' , hex_digit , hex_digit , hex_digit , hex_digit + +(* Array Literals *) + +array_literal = '[' , [white_space] , ']' + | '[' , [white_space] , element_list , ']' + | '[' , [white_space] , element_list , ',' , [white_space] , ']' + +element_list = expression , [white_space] + | element_list , ',' , [white_space] , expression , [white_space] + +(* Object Literals *) + +object_literal = '{' , [white_space] , '}' + | '{' , [white_space] , property_name_and_value_list , '}' + | '{' , [white_space] , property_name_and_value_list , ',' , '}' + +property_name_and_value_list = property_assignment , [white_space] + | property_name_and_value_list , [white_space] , ',' , [white_space] , property_assignment , [white_space] + +property_assignment = property_name , [white_space] , ':' , [white_space] , expression + +property_name = identifier_name + | string_literal + | numeric_literal + +identifier_name = identifier_start + | identifier_name , identifier_part + +identifier_start = unicode_letter + | '$' + | '_' + | '\​' , unicode_escape_sequence + +identifier_part = identifier_start + | unicode_combining_mark + | unicode_digit + | unicode_connector_punctuation + | + | + +unicode_letter = ascii_letter + (* + any character in the Unicode categories "Uppercase letter (Lu)", "Lowercase letter (Ll)", "Titlecase letter (Lt)", "Modifier letter (Lm)", "Other letter (Lo)", or "Letter number (Nl)" *) + +unicode_combining_mark = + (* + any character in the Unicode categories "Non-spacing mark (Mn)" or "Combining spacing mark (Mc)" *) + +unicode_digit = decimal_digit + (* + any character in the Unicode category "Decimal number (Nd)" *) + +unicode_connector_punctuation = + (* + any character in the Unicode category "Connector punctuation (Pc)" *) + + +``` diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/docs/JSON5.md b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/docs/JSON5.md new file mode 100644 index 00000000000..bbe18a3d8ce --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/docs/JSON5.md @@ -0,0 +1,50 @@ +## JSON5 syntax + +We support slighly modified version of JSON5, see https://groups.google.com/forum/#!topic/json5/3DjClVYI6Wg + +I started from ES5 specification and added a set of additional restrictions on top of ES5 spec. So I'd expect my implementation to be much closer to javascript. It's no longer an extension of json, but a reduction of ecmascript, which was my original intent. + +This JSON5 version is a subset of ES5 language, specification is here: + +http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf + +This is a language that defines data structures only, so following notes/restrictions are applied: + +- Literals (NullLiteral, BooleanLiteral, NumericLiteral, StringLiteral) are allowed. +- Compatibility syntax is not supported, which means octal literals are forbidden. +- ArrayLiterals and allowed, but instead of AssignmentExpressions you can only use other allowed Literals, ArrayLiterals and ObjectLiterals. Elisions are currently not supported. +- ObjectLiterals and allowed, but instead of AssignmentExpressions you can only use other allowed Literals, ArrayLiterals and ObjectLiterals. Setters and getters are forbidden. +- All other primary expressions ("this", Identifier, Expression) are forbidden. +- Two unary expressions ('-' and '+') allowed before NumericLiterals. +- Any data that has a number type can be represented, including +0, -0, +Infinity, -Infinity and NaN. +- "undefined" is forbidden, use null instead if applicable. +- Comments and whitespace are defined according to spec. + +Main authority here is ES5 spec, so strict backward JSON compatibility is not guaranteed. + + +If you're unsure whether a behaviour of this library is a bug or not, you can run this test: + +```javascript +JSON5.parse(String(something)) +``` + +Should always be equal to: + +```javascript +eval('(function(){return ('+String(something)+'\n)\n})()') +``` + +If `something` meets all rules above. Parens and newlines in the example above are carefully placed so comments and another newlines will work properly, so don't look so impressed about that. + + +## Weirdness of JSON5 + +These are the parts that I don't particulary like, but see no good way to fix: + + - no elisions, `[,,,] -> [null,null,null]` + - `[Object], [Circular]` aren't parsed + - no way of nicely representing multiline strings + - unicode property names are way to hard to implement + - Date and other custom objects + - incompatible with YAML (at least comments) diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/index.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/index.js new file mode 100644 index 00000000000..50f16249634 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/index.js @@ -0,0 +1,32 @@ + +module.exports.__defineGetter__('parse', function() { + return require('./lib/parse').parse +}) + +module.exports.__defineGetter__('stringify', function() { + return require('./lib/stringify').stringify +}) + +module.exports.__defineGetter__('tokenize', function() { + return require('./lib/parse').tokenize +}) + +module.exports.__defineGetter__('update', function() { + return require('./lib/document').update +}) + +module.exports.__defineGetter__('analyze', function() { + return require('./lib/analyze').analyze +}) + +module.exports.__defineGetter__('utils', function() { + return require('./lib/utils') +}) + +/**package +{ "name": "jju", + "version": "0.0.0", + "dependencies": {"js-yaml": "*"}, + "scripts": {"postinstall": "js-yaml package.yaml > package.json ; npm install"} +} +**/ diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/analyze.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/analyze.js new file mode 100644 index 00000000000..9b0f9af01cd --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/analyze.js @@ -0,0 +1,92 @@ +/* + * Author: Alex Kocharin + * GIT: https://github.com/rlidwka/jju + * License: WTFPL, grab your copy here: http://www.wtfpl.net/txt/copying/ + */ + +var tokenize = require('./parse').tokenize + +module.exports.analyze = function analyzeJSON(input, options) { + if (options == null) options = {} + + if (!Array.isArray(input)) { + input = tokenize(input, options) + } + + var result = { + has_whitespace: false, + has_comments: false, + has_newlines: false, + has_trailing_comma: false, + indent: '', + newline: '\n', + quote: '"', + quote_keys: true, + } + + var stats = { + indent: {}, + newline: {}, + quote: {}, + } + + for (var i=0; i stats[k][b] ? a : b + }) + } + } + + return result +} + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/document.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/document.js new file mode 100644 index 00000000000..cfab8691fc9 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/document.js @@ -0,0 +1,485 @@ +/* + * Author: Alex Kocharin + * GIT: https://github.com/rlidwka/jju + * License: WTFPL, grab your copy here: http://www.wtfpl.net/txt/copying/ + */ + +var assert = require('assert') +var tokenize = require('./parse').tokenize +var stringify = require('./stringify').stringify +var analyze = require('./analyze').analyze + +function isObject(x) { + return typeof(x) === 'object' && x !== null +} + +function value_to_tokenlist(value, stack, options, is_key, indent) { + options = Object.create(options) + options._stringify_key = !!is_key + + if (indent) { + options._prefix = indent.prefix.map(function(x) { + return x.raw + }).join('') + } + + if (options._splitMin == null) options._splitMin = 0 + if (options._splitMax == null) options._splitMax = 0 + + var stringified = stringify(value, options) + + if (is_key) { + return [ { raw: stringified, type: 'key', stack: stack, value: value } ] + } + + options._addstack = stack + var result = tokenize(stringified, { + _addstack: stack, + }) + result.data = null + return result +} + +// '1.2.3' -> ['1','2','3'] +function arg_to_path(path) { + // array indexes + if (typeof(path) === 'number') path = String(path) + + if (path === '') path = [] + if (typeof(path) === 'string') path = path.split('.') + + if (!Array.isArray(path)) throw Error('Invalid path type, string or array expected') + return path +} + +// returns new [begin, end] or false if not found +// +// {x:3, xxx: 111, y: [111, {q: 1, e: 2} ,333] } +// f('y',0) returns this B^^^^^^^^^^^^^^^^^^^^^^^^E +// then f('1',1) would reduce it to B^^^^^^^^^^E +function find_element_in_tokenlist(element, lvl, tokens, begin, end) { + while(tokens[begin].stack[lvl] != element) { + if (begin++ >= end) return false + } + while(tokens[end].stack[lvl] != element) { + if (end-- < begin) return false + } + return [begin, end] +} + +function is_whitespace(token_type) { + return token_type === 'whitespace' + || token_type === 'newline' + || token_type === 'comment' +} + +function find_first_non_ws_token(tokens, begin, end) { + while(is_whitespace(tokens[begin].type)) { + if (begin++ >= end) return false + } + return begin +} + +function find_last_non_ws_token(tokens, begin, end) { + while(is_whitespace(tokens[end].type)) { + if (end-- < begin) return false + } + return end +} + +/* + * when appending a new element of an object/array, we are trying to + * figure out the style used on the previous element + * + * return {prefix, sep1, sep2, suffix} + * + * ' "key" : "element" \r\n' + * prefix^^^^ sep1^ ^^sep2 ^^^^^^^^suffix + * + * begin - the beginning of the object/array + * end - last token of the last element (value or comma usually) + */ +function detect_indent_style(tokens, is_array, begin, end, level) { + var result = { + sep1: [], + sep2: [], + suffix: [], + prefix: [], + newline: [], + } + + if (tokens[end].type === 'separator' && tokens[end].stack.length !== level+1 && tokens[end].raw !== ',') { + // either a beginning of the array (no last element) or other weird situation + // + // just return defaults + return result + } + + // ' "key" : "value" ,' + // skipping last separator, we're now here ^^ + if (tokens[end].type === 'separator') + end = find_last_non_ws_token(tokens, begin, end - 1) + if (end === false) return result + + // ' "key" : "value" ,' + // skipping value ^^^^^^^ + while(tokens[end].stack.length > level) end-- + + if (!is_array) { + while(is_whitespace(tokens[end].type)) { + if (end < begin) return result + if (tokens[end].type === 'whitespace') { + result.sep2.unshift(tokens[end]) + } else { + // newline, comment or other unrecognized codestyle + return result + } + end-- + } + + // ' "key" : "value" ,' + // skipping separator ^ + assert.equal(tokens[end].type, 'separator') + assert.equal(tokens[end].raw, ':') + while(is_whitespace(tokens[--end].type)) { + if (end < begin) return result + if (tokens[end].type === 'whitespace') { + result.sep1.unshift(tokens[end]) + } else { + // newline, comment or other unrecognized codestyle + return result + } + } + + assert.equal(tokens[end].type, 'key') + end-- + } + + // ' "key" : "value" ,' + // skipping key ^^^^^ + while(is_whitespace(tokens[end].type)) { + if (end < begin) return result + if (tokens[end].type === 'whitespace') { + result.prefix.unshift(tokens[end]) + } else if (tokens[end].type === 'newline') { + result.newline.unshift(tokens[end]) + return result + } else { + // comment or other unrecognized codestyle + return result + } + end-- + } + + return result +} + +function Document(text, options) { + var self = Object.create(Document.prototype) + + if (options == null) options = {} + //options._structure = true + var tokens = self._tokens = tokenize(text, options) + self._data = tokens.data + tokens.data = null + self._options = options + + var stats = analyze(text, options) + if (options.indent == null) { + options.indent = stats.indent + } + if (options.quote == null) { + options.quote = stats.quote + } + if (options.quote_keys == null) { + options.quote_keys = stats.quote_keys + } + if (options.no_trailing_comma == null) { + options.no_trailing_comma = !stats.has_trailing_comma + } + return self +} + +// return true if it's a proper object +// throw otherwise +function check_if_can_be_placed(key, object, is_unset) { + //if (object == null) return false + function error(add) { + return Error("You can't " + (is_unset ? 'unset' : 'set') + " key '" + key + "'" + add) + } + + if (!isObject(object)) { + throw error(' of an non-object') + } + if (Array.isArray(object)) { + // array, check boundary + if (String(key).match(/^\d+$/)) { + key = Number(String(key)) + if (object.length < key || (is_unset && object.length === key)) { + throw error(', out of bounds') + } else if (is_unset && object.length !== key+1) { + throw error(' in the middle of an array') + } else { + return true + } + } else { + throw error(' of an array') + } + } else { + // object + return true + } +} + +// usage: document.set('path.to.something', 'value') +// or: document.set(['path','to','something'], 'value') +Document.prototype.set = function(path, value) { + path = arg_to_path(path) + + // updating this._data and check for errors + if (path.length === 0) { + if (value === undefined) throw Error("can't remove root document") + this._data = value + var new_key = false + + } else { + var data = this._data + + for (var i=0; i {x:1}` + // removing sep, literal and optional sep + // ':' + var pos2 = find_last_non_ws_token(this._tokens, pos_old[0], position[0] - 1) + assert.equal(this._tokens[pos2].type, 'separator') + assert.equal(this._tokens[pos2].raw, ':') + position[0] = pos2 + + // key + var pos2 = find_last_non_ws_token(this._tokens, pos_old[0], position[0] - 1) + assert.equal(this._tokens[pos2].type, 'key') + assert.equal(this._tokens[pos2].value, path[path.length-1]) + position[0] = pos2 + } + + // removing comma in arrays and objects + var pos2 = find_last_non_ws_token(this._tokens, pos_old[0], position[0] - 1) + assert.equal(this._tokens[pos2].type, 'separator') + if (this._tokens[pos2].raw === ',') { + position[0] = pos2 + } else { + // beginning of the array/object, so we should remove trailing comma instead + pos2 = find_first_non_ws_token(this._tokens, position[1] + 1, pos_old[1]) + assert.equal(this._tokens[pos2].type, 'separator') + if (this._tokens[pos2].raw === ',') { + position[1] = pos2 + } + } + + } else { + var indent = pos2 !== false + ? detect_indent_style(this._tokens, Array.isArray(data), pos_old[0], position[1] - 1, i) + : {} + var newtokens = value_to_tokenlist(value, path, this._options, false, indent) + } + + } else { + // insert new key, that's tricky + var path_1 = path.slice(0, i) + + // find a last separator after which we're inserting it + var pos2 = find_last_non_ws_token(this._tokens, position[0] + 1, position[1] - 1) + assert(pos2 !== false) + + var indent = pos2 !== false + ? detect_indent_style(this._tokens, Array.isArray(data), position[0] + 1, pos2, i) + : {} + + var newtokens = value_to_tokenlist(value, path, this._options, false, indent) + + // adding leading whitespaces according to detected codestyle + var prefix = [] + if (indent.newline && indent.newline.length) + prefix = prefix.concat(indent.newline) + if (indent.prefix && indent.prefix.length) + prefix = prefix.concat(indent.prefix) + + // adding '"key":' (as in "key":"value") to object values + if (!Array.isArray(data)) { + prefix = prefix.concat(value_to_tokenlist(path[path.length-1], path_1, this._options, true)) + if (indent.sep1 && indent.sep1.length) + prefix = prefix.concat(indent.sep1) + prefix.push({raw: ':', type: 'separator', stack: path_1}) + if (indent.sep2 && indent.sep2.length) + prefix = prefix.concat(indent.sep2) + } + + newtokens.unshift.apply(newtokens, prefix) + + // check if prev token is a separator AND they're at the same level + if (this._tokens[pos2].type === 'separator' && this._tokens[pos2].stack.length === path.length-1) { + // previous token is either , or [ or { + if (this._tokens[pos2].raw === ',') { + // restore ending comma + newtokens.push({raw: ',', type: 'separator', stack: path_1}) + } + } else { + // previous token isn't a separator, so need to insert one + newtokens.unshift({raw: ',', type: 'separator', stack: path_1}) + } + + if (indent.suffix && indent.suffix.length) + newtokens.push.apply(newtokens, indent.suffix) + + assert.equal(this._tokens[position[1]].type, 'separator') + position[0] = pos2+1 + position[1] = pos2 + } + + newtokens.unshift(position[1] - position[0] + 1) + newtokens.unshift(position[0]) + this._tokens.splice.apply(this._tokens, newtokens) + + return this +} + +// convenience method +Document.prototype.unset = function(path) { + return this.set(path, undefined) +} + +Document.prototype.get = function(path) { + path = arg_to_path(path) + + var data = this._data + for (var i=0; i old_data.length) { + // adding new elements, so going forward + for (var i=0; i=0; i--) { + path.push(String(i)) + change(path, old_data[i], new_data[i]) + path.pop() + } + } + + } else { + // both values are objects here + for (var i in new_data) { + path.push(String(i)) + change(path, old_data[i], new_data[i]) + path.pop() + } + + for (var i in old_data) { + if (i in new_data) continue + path.push(String(i)) + change(path, old_data[i], new_data[i]) + path.pop() + } + } + } +} + +Document.prototype.toString = function() { + return this._tokens.map(function(x) { + return x.raw + }).join('') +} + +module.exports.Document = Document + +module.exports.update = function updateJSON(source, new_value, options) { + return Document(source, options).update(new_value).toString() +} + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/parse.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/parse.js new file mode 100644 index 00000000000..5f9fe998610 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/parse.js @@ -0,0 +1,752 @@ +/* + * Author: Alex Kocharin + * GIT: https://github.com/rlidwka/jju + * License: WTFPL, grab your copy here: http://www.wtfpl.net/txt/copying/ + */ + +// RTFM: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf + +var Uni = require('./unicode') + +function isHexDigit(x) { + return (x >= '0' && x <= '9') + || (x >= 'A' && x <= 'F') + || (x >= 'a' && x <= 'f') +} + +function isOctDigit(x) { + return x >= '0' && x <= '7' +} + +function isDecDigit(x) { + return x >= '0' && x <= '9' +} + +var unescapeMap = { + '\'': '\'', + '"' : '"', + '\\': '\\', + 'b' : '\b', + 'f' : '\f', + 'n' : '\n', + 'r' : '\r', + 't' : '\t', + 'v' : '\v', + '/' : '/', +} + +function formatError(input, msg, position, lineno, column, json5) { + var result = msg + ' at ' + (lineno + 1) + ':' + (column + 1) + , tmppos = position - column - 1 + , srcline = '' + , underline = '' + + var isLineTerminator = json5 ? Uni.isLineTerminator : Uni.isLineTerminatorJSON + + // output no more than 70 characters before the wrong ones + if (tmppos < position - 70) { + tmppos = position - 70 + } + + while (1) { + var chr = input[++tmppos] + + if (isLineTerminator(chr) || tmppos === input.length) { + if (position >= tmppos) { + // ending line error, so show it after the last char + underline += '^' + } + break + } + srcline += chr + + if (position === tmppos) { + underline += '^' + } else if (position > tmppos) { + underline += input[tmppos] === '\t' ? '\t' : ' ' + } + + // output no more than 78 characters on the string + if (srcline.length > 78) break + } + + return result + '\n' + srcline + '\n' + underline +} + +function parse(input, options) { + // parse as a standard JSON mode + var json5 = !(options.mode === 'json' || options.legacy) + var isLineTerminator = json5 ? Uni.isLineTerminator : Uni.isLineTerminatorJSON + var isWhiteSpace = json5 ? Uni.isWhiteSpace : Uni.isWhiteSpaceJSON + + var length = input.length + , lineno = 0 + , linestart = 0 + , position = 0 + , stack = [] + + var tokenStart = function() {} + var tokenEnd = function(v) {return v} + + /* tokenize({ + raw: '...', + type: 'whitespace'|'comment'|'key'|'literal'|'separator'|'newline', + value: 'number'|'string'|'whatever', + path: [...], + }) + */ + if (options._tokenize) { + ;(function() { + var start = null + tokenStart = function() { + if (start !== null) throw Error('internal error, token overlap') + start = position + } + + tokenEnd = function(v, type) { + if (start != position) { + var hash = { + raw: input.substr(start, position-start), + type: type, + stack: stack.slice(0), + } + if (v !== undefined) hash.value = v + options._tokenize.call(null, hash) + } + start = null + return v + } + })() + } + + function fail(msg) { + var column = position - linestart + + if (!msg) { + if (position < length) { + var token = '\'' + + JSON + .stringify(input[position]) + .replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + + '\'' + + if (!msg) msg = 'Unexpected token ' + token + } else { + if (!msg) msg = 'Unexpected end of input' + } + } + + var error = SyntaxError(formatError(input, msg, position, lineno, column, json5)) + error.row = lineno + 1 + error.column = column + 1 + throw error + } + + function newline(chr) { + // account for + if (chr === '\r' && input[position] === '\n') position++ + linestart = position + lineno++ + } + + function parseGeneric() { + var result + + while (position < length) { + tokenStart() + var chr = input[position++] + + if (chr === '"' || (chr === '\'' && json5)) { + return tokenEnd(parseString(chr), 'literal') + + } else if (chr === '{') { + tokenEnd(undefined, 'separator') + return parseObject() + + } else if (chr === '[') { + tokenEnd(undefined, 'separator') + return parseArray() + + } else if (chr === '-' + || chr === '.' + || isDecDigit(chr) + // + number Infinity NaN + || (json5 && (chr === '+' || chr === 'I' || chr === 'N')) + ) { + return tokenEnd(parseNumber(), 'literal') + + } else if (chr === 'n') { + parseKeyword('null') + return tokenEnd(null, 'literal') + + } else if (chr === 't') { + parseKeyword('true') + return tokenEnd(true, 'literal') + + } else if (chr === 'f') { + parseKeyword('false') + return tokenEnd(false, 'literal') + + } else { + position-- + return tokenEnd(undefined) + } + } + } + + function parseKey() { + var result + + while (position < length) { + tokenStart() + var chr = input[position++] + + if (chr === '"' || (chr === '\'' && json5)) { + return tokenEnd(parseString(chr), 'key') + + } else if (chr === '{') { + tokenEnd(undefined, 'separator') + return parseObject() + + } else if (chr === '[') { + tokenEnd(undefined, 'separator') + return parseArray() + + } else if (chr === '.' + || isDecDigit(chr) + ) { + return tokenEnd(parseNumber(true), 'key') + + } else if (json5 + && Uni.isIdentifierStart(chr) || (chr === '\\' && input[position] === 'u')) { + // unicode char or a unicode sequence + var rollback = position - 1 + var result = parseIdentifier() + + if (result === undefined) { + position = rollback + return tokenEnd(undefined) + } else { + return tokenEnd(result, 'key') + } + + } else { + position-- + return tokenEnd(undefined) + } + } + } + + function skipWhiteSpace() { + tokenStart() + while (position < length) { + var chr = input[position++] + + if (isLineTerminator(chr)) { + position-- + tokenEnd(undefined, 'whitespace') + tokenStart() + position++ + newline(chr) + tokenEnd(undefined, 'newline') + tokenStart() + + } else if (isWhiteSpace(chr)) { + // nothing + + } else if (chr === '/' + && json5 + && (input[position] === '/' || input[position] === '*') + ) { + position-- + tokenEnd(undefined, 'whitespace') + tokenStart() + position++ + skipComment(input[position++] === '*') + tokenEnd(undefined, 'comment') + tokenStart() + + } else { + position-- + break + } + } + return tokenEnd(undefined, 'whitespace') + } + + function skipComment(multi) { + while (position < length) { + var chr = input[position++] + + if (isLineTerminator(chr)) { + // LineTerminator is an end of singleline comment + if (!multi) { + // let parent function deal with newline + position-- + return + } + + newline(chr) + + } else if (chr === '*' && multi) { + // end of multiline comment + if (input[position] === '/') { + position++ + return + } + + } else { + // nothing + } + } + + if (multi) { + fail('Unclosed multiline comment') + } + } + + function parseKeyword(keyword) { + // keyword[0] is not checked because it should've checked earlier + var _pos = position + var len = keyword.length + for (var i=1; i= length || keyword[i] != input[position]) { + position = _pos-1 + fail() + } + position++ + } + } + + function parseObject() { + var result = options.null_prototype ? Object.create(null) : {} + , empty_object = {} + , is_non_empty = false + + while (position < length) { + skipWhiteSpace() + var item1 = parseKey() + skipWhiteSpace() + tokenStart() + var chr = input[position++] + tokenEnd(undefined, 'separator') + + if (chr === '}' && item1 === undefined) { + if (!json5 && is_non_empty) { + position-- + fail('Trailing comma in object') + } + return result + + } else if (chr === ':' && item1 !== undefined) { + skipWhiteSpace() + stack.push(item1) + var item2 = parseGeneric() + stack.pop() + + if (item2 === undefined) fail('No value found for key ' + item1) + if (typeof(item1) !== 'string') { + if (!json5 || typeof(item1) !== 'number') { + fail('Wrong key type: ' + item1) + } + } + + if ((item1 in empty_object || empty_object[item1] != null) && options.reserved_keys !== 'replace') { + if (options.reserved_keys === 'throw') { + fail('Reserved key: ' + item1) + } else { + // silently ignore it + } + } else { + if (typeof(options.reviver) === 'function') { + item2 = options.reviver.call(null, item1, item2) + } + + if (item2 !== undefined) { + is_non_empty = true + Object.defineProperty(result, item1, { + value: item2, + enumerable: true, + configurable: true, + writable: true, + }) + } + } + + skipWhiteSpace() + + tokenStart() + var chr = input[position++] + tokenEnd(undefined, 'separator') + + if (chr === ',') { + continue + + } else if (chr === '}') { + return result + + } else { + fail() + } + + } else { + position-- + fail() + } + } + + fail() + } + + function parseArray() { + var result = [] + + while (position < length) { + skipWhiteSpace() + stack.push(result.length) + var item = parseGeneric() + stack.pop() + skipWhiteSpace() + tokenStart() + var chr = input[position++] + tokenEnd(undefined, 'separator') + + if (item !== undefined) { + if (typeof(options.reviver) === 'function') { + item = options.reviver.call(null, String(result.length), item) + } + if (item === undefined) { + result.length++ + item = true // hack for check below, not included into result + } else { + result.push(item) + } + } + + if (chr === ',') { + if (item === undefined) { + fail('Elisions are not supported') + } + + } else if (chr === ']') { + if (!json5 && item === undefined && result.length) { + position-- + fail('Trailing comma in array') + } + return result + + } else { + position-- + fail() + } + } + } + + function parseNumber() { + // rewind because we don't know first char + position-- + + var start = position + , chr = input[position++] + , t + + var to_num = function(is_octal) { + var str = input.substr(start, position - start) + + if (is_octal) { + var result = parseInt(str.replace(/^0o?/, ''), 8) + } else { + var result = Number(str) + } + + if (Number.isNaN(result)) { + position-- + fail('Bad numeric literal - "' + input.substr(start, position - start + 1) + '"') + } else if (!json5 && !str.match(/^-?(0|[1-9][0-9]*)(\.[0-9]+)?(e[+-]?[0-9]+)?$/i)) { + // additional restrictions imposed by json + position-- + fail('Non-json numeric literal - "' + input.substr(start, position - start + 1) + '"') + } else { + return result + } + } + + // ex: -5982475.249875e+29384 + // ^ skipping this + if (chr === '-' || (chr === '+' && json5)) chr = input[position++] + + if (chr === 'N' && json5) { + parseKeyword('NaN') + return NaN + } + + if (chr === 'I' && json5) { + parseKeyword('Infinity') + + // returning +inf or -inf + return to_num() + } + + if (chr >= '1' && chr <= '9') { + // ex: -5982475.249875e+29384 + // ^^^ skipping these + while (position < length && isDecDigit(input[position])) position++ + chr = input[position++] + } + + // special case for leading zero: 0.123456 + if (chr === '0') { + chr = input[position++] + + // new syntax, "0o777" old syntax, "0777" + var is_octal = chr === 'o' || chr === 'O' || isOctDigit(chr) + var is_hex = chr === 'x' || chr === 'X' + + if (json5 && (is_octal || is_hex)) { + while (position < length + && (is_hex ? isHexDigit : isOctDigit)( input[position] ) + ) position++ + + var sign = 1 + if (input[start] === '-') { + sign = -1 + start++ + } else if (input[start] === '+') { + start++ + } + + return sign * to_num(is_octal) + } + } + + if (chr === '.') { + // ex: -5982475.249875e+29384 + // ^^^ skipping these + while (position < length && isDecDigit(input[position])) position++ + chr = input[position++] + } + + if (chr === 'e' || chr === 'E') { + chr = input[position++] + if (chr === '-' || chr === '+') position++ + // ex: -5982475.249875e+29384 + // ^^^ skipping these + while (position < length && isDecDigit(input[position])) position++ + chr = input[position++] + } + + // we have char in the buffer, so count for it + position-- + return to_num() + } + + function parseIdentifier() { + // rewind because we don't know first char + position-- + + var result = '' + + while (position < length) { + var chr = input[position++] + + if (chr === '\\' + && input[position] === 'u' + && isHexDigit(input[position+1]) + && isHexDigit(input[position+2]) + && isHexDigit(input[position+3]) + && isHexDigit(input[position+4]) + ) { + // UnicodeEscapeSequence + chr = String.fromCharCode(parseInt(input.substr(position+1, 4), 16)) + position += 5 + } + + if (result.length) { + // identifier started + if (Uni.isIdentifierPart(chr)) { + result += chr + } else { + position-- + return result + } + + } else { + if (Uni.isIdentifierStart(chr)) { + result += chr + } else { + return undefined + } + } + } + + fail() + } + + function parseString(endChar) { + // 7.8.4 of ES262 spec + var result = '' + + while (position < length) { + var chr = input[position++] + + if (chr === endChar) { + return result + + } else if (chr === '\\') { + if (position >= length) fail() + chr = input[position++] + + if (unescapeMap[chr] && (json5 || (chr != 'v' && chr != "'"))) { + result += unescapeMap[chr] + + } else if (json5 && isLineTerminator(chr)) { + // line continuation + newline(chr) + + } else if (chr === 'u' || (chr === 'x' && json5)) { + // unicode/character escape sequence + var off = chr === 'u' ? 4 : 2 + + // validation for \uXXXX + for (var i=0; i= length) fail() + if (!isHexDigit(input[position])) fail('Bad escape sequence') + position++ + } + + result += String.fromCharCode(parseInt(input.substr(position-off, off), 16)) + } else if (json5 && isOctDigit(chr)) { + if (chr < '4' && isOctDigit(input[position]) && isOctDigit(input[position+1])) { + // three-digit octal + var digits = 3 + } else if (isOctDigit(input[position])) { + // two-digit octal + var digits = 2 + } else { + var digits = 1 + } + position += digits - 1 + result += String.fromCharCode(parseInt(input.substr(position-digits, digits), 8)) + /*if (!isOctDigit(input[position])) { + // \0 is allowed still + result += '\0' + } else { + fail('Octal literals are not supported') + }*/ + + } else if (json5) { + // \X -> x + result += chr + + } else { + position-- + fail() + } + + } else if (isLineTerminator(chr)) { + fail() + + } else { + if (!json5 && chr.charCodeAt(0) < 32) { + position-- + fail('Unexpected control character') + } + + // SourceCharacter but not one of " or \ or LineTerminator + result += chr + } + } + + fail() + } + + skipWhiteSpace() + var return_value = parseGeneric() + if (return_value !== undefined || position < length) { + skipWhiteSpace() + + if (position >= length) { + if (typeof(options.reviver) === 'function') { + return_value = options.reviver.call(null, '', return_value) + } + return return_value + } else { + fail() + } + + } else { + if (position) { + fail('No data, only a whitespace') + } else { + fail('No data, empty input') + } + } +} + +/* + * parse(text, options) + * or + * parse(text, reviver) + * + * where: + * text - string + * options - object + * reviver - function + */ +module.exports.parse = function parseJSON(input, options) { + // support legacy functions + if (typeof(options) === 'function') { + options = { + reviver: options + } + } + + if (input === undefined) { + // parse(stringify(x)) should be equal x + // with JSON functions it is not 'cause of undefined + // so we're fixing it + return undefined + } + + // JSON.parse compat + if (typeof(input) !== 'string') input = String(input) + if (options == null) options = {} + if (options.reserved_keys == null) options.reserved_keys = 'ignore' + + if (options.reserved_keys === 'throw' || options.reserved_keys === 'ignore') { + if (options.null_prototype == null) { + options.null_prototype = true + } + } + + try { + return parse(input, options) + } catch(err) { + // jju is a recursive parser, so JSON.parse("{{{{{{{") could blow up the stack + // + // this catch is used to skip all those internal calls + if (err instanceof SyntaxError && err.row != null && err.column != null) { + var old_err = err + err = SyntaxError(old_err.message) + err.column = old_err.column + err.row = old_err.row + } + throw err + } +} + +module.exports.tokenize = function tokenizeJSON(input, options) { + if (options == null) options = {} + + options._tokenize = function(smth) { + if (options._addstack) smth.stack.unshift.apply(smth.stack, options._addstack) + tokens.push(smth) + } + + var tokens = [] + tokens.data = module.exports.parse(input, options) + return tokens +} + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/stringify.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/stringify.js new file mode 100644 index 00000000000..ce89d77ee1f --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/stringify.js @@ -0,0 +1,383 @@ +/* + * Author: Alex Kocharin + * GIT: https://github.com/rlidwka/jju + * License: WTFPL, grab your copy here: http://www.wtfpl.net/txt/copying/ + */ + +var Uni = require('./unicode') + +// Fix Function#name on browsers that do not support it (IE) +// http://stackoverflow.com/questions/6903762/function-name-not-supported-in-ie +if (!(function f(){}).name) { + Object.defineProperty((function(){}).constructor.prototype, 'name', { + get: function() { + var name = this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1] + // For better performance only parse once, and then cache the + // result through a new accessor for repeated access. + Object.defineProperty(this, 'name', { value: name }) + return name + } + }) +} + +var special_chars = { + 0: '\\0', // this is not an octal literal + 8: '\\b', + 9: '\\t', + 10: '\\n', + 11: '\\v', + 12: '\\f', + 13: '\\r', + 92: '\\\\', +} + +// for oddballs +var hasOwnProperty = Object.prototype.hasOwnProperty + +// some people escape those, so I'd copy this to be safe +var escapable = /[\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/ + +function _stringify(object, options, recursiveLvl, currentKey) { + var opt_json = options.mode === 'json' + /* + * Opinionated decision warning: + * + * Objects are serialized in the following form: + * { type: 'Class', data: DATA } + * + * Class is supposed to be a function, and new Class(DATA) is + * supposed to be equivalent to the original value + */ + /*function custom_type() { + return stringify({ + type: object.constructor.name, + data: object.toString() + }) + }*/ + + // if add, it's an internal indentation, so we add 1 level and a eol + // if !add, it's an ending indentation, so we just indent + function indent(str, add) { + var prefix = options._prefix ? options._prefix : '' + if (!options.indent) return prefix + str + var result = '' + var count = recursiveLvl + (add || 0) + for (var i=0; i 0) { + if (!Uni.isIdentifierPart(key[i])) + return _stringify_str(key) + + } else { + if (!Uni.isIdentifierStart(key[i])) + return _stringify_str(key) + } + + var chr = key.charCodeAt(i) + + if (options.ascii) { + if (chr < 0x80) { + result += key[i] + + } else { + result += '\\u' + ('0000' + chr.toString(16)).slice(-4) + } + + } else { + if (escapable.exec(key[i])) { + result += '\\u' + ('0000' + chr.toString(16)).slice(-4) + + } else { + result += key[i] + } + } + } + + return result + } + + function _stringify_str(key) { + var quote = options.quote + var quoteChr = quote.charCodeAt(0) + + var result = '' + for (var i=0; i= 8 && chr <= 13 && (!opt_json || chr !== 11)) { + result += special_chars[chr] + } else if (!opt_json) { + result += '\\x0' + chr.toString(16) + } else { + result += '\\u000' + chr.toString(16) + } + + } else if (chr < 0x20) { + if (!opt_json) { + result += '\\x' + chr.toString(16) + } else { + result += '\\u00' + chr.toString(16) + } + + } else if (chr >= 0x20 && chr < 0x80) { + // ascii range + if (chr === 47 && i && key[i-1] === '<') { + // escaping slashes in + result += '\\' + key[i] + + } else if (chr === 92) { + result += '\\\\' + + } else if (chr === quoteChr) { + result += '\\' + quote + + } else { + result += key[i] + } + + } else if (options.ascii || Uni.isLineTerminator(key[i]) || escapable.exec(key[i])) { + if (chr < 0x100) { + if (!opt_json) { + result += '\\x' + chr.toString(16) + } else { + result += '\\u00' + chr.toString(16) + } + + } else if (chr < 0x1000) { + result += '\\u0' + chr.toString(16) + + } else if (chr < 0x10000) { + result += '\\u' + chr.toString(16) + + } else { + throw Error('weird codepoint') + } + } else { + result += key[i] + } + } + return quote + result + quote + } + + function _stringify_object() { + if (object === null) return 'null' + var result = [] + , len = 0 + , braces + + if (Array.isArray(object)) { + braces = '[]' + for (var i=0; i options._splitMax - recursiveLvl * options.indent.length || len > options._splitMin) ) { + // remove trailing comma in multiline if asked to + if (options.no_trailing_comma && result.length) { + result[result.length-1] = result[result.length-1].substring(0, result[result.length-1].length-1) + } + + var innerStuff = result.map(function(x) {return indent(x, 1)}).join('') + return braces[0] + + (options.indent ? '\n' : '') + + innerStuff + + indent(braces[1]) + } else { + // always remove trailing comma in one-lined arrays + if (result.length) { + result[result.length-1] = result[result.length-1].substring(0, result[result.length-1].length-1) + } + + var innerStuff = result.join(options.indent ? ' ' : '') + return braces[0] + + innerStuff + + braces[1] + } + } + + function _stringify_nonobject(object) { + if (typeof(options.replacer) === 'function') { + object = options.replacer.call(null, currentKey, object) + } + + switch(typeof(object)) { + case 'string': + return _stringify_str(object) + + case 'number': + if (object === 0 && 1/object < 0) { + // Opinionated decision warning: + // + // I want cross-platform negative zero in all js engines + // I know they're equal, but why lose that tiny bit of + // information needlessly? + return '-0' + } + if (options.mode === 'json' && !Number.isFinite(object)) { + // json don't support infinity (= sucks) + return 'null' + } + return object.toString() + + case 'boolean': + return object.toString() + + case 'undefined': + return undefined + + case 'function': +// return custom_type() + + default: + // fallback for something weird + return JSON.stringify(object) + } + } + + if (options._stringify_key) { + return _stringify_key(object) + } + + if (typeof(object) === 'object') { + if (object === null) return 'null' + + var str + if (typeof(str = object.toJSON5) === 'function' && options.mode !== 'json') { + object = str.call(object, currentKey) + + } else if (typeof(str = object.toJSON) === 'function') { + object = str.call(object, currentKey) + } + + if (object === null) return 'null' + if (typeof(object) !== 'object') return _stringify_nonobject(object) + + if (object.constructor === Number || object.constructor === Boolean || object.constructor === String) { + object = object.valueOf() + return _stringify_nonobject(object) + + } else if (object.constructor === Date) { + // only until we can't do better + return _stringify_nonobject(object.toISOString()) + + } else { + if (typeof(options.replacer) === 'function') { + object = options.replacer.call(null, currentKey, object) + if (typeof(object) !== 'object') return _stringify_nonobject(object) + } + + return _stringify_object(object) + } + } else { + return _stringify_nonobject(object) + } +} + +/* + * stringify(value, options) + * or + * stringify(value, replacer, space) + * + * where: + * value - anything + * options - object + * replacer - function or array + * space - boolean or number or string + */ +module.exports.stringify = function stringifyJSON(object, options, _space) { + // support legacy syntax + if (typeof(options) === 'function' || Array.isArray(options)) { + options = { + replacer: options + } + } else if (typeof(options) === 'object' && options !== null) { + // nothing to do + } else { + options = {} + } + if (_space != null) options.indent = _space + + if (options.indent == null) options.indent = '\t' + if (options.quote == null) options.quote = "'" + if (options.ascii == null) options.ascii = false + if (options.mode == null) options.mode = 'simple' + + if (options.mode === 'json') { + // json only supports double quotes (= sucks) + options.quote = '"' + + // json don't support trailing commas (= sucks) + options.no_trailing_comma = true + + // json don't support unquoted property names (= sucks) + options.quote_keys = true + } + + // why would anyone use such objects? + if (typeof(options.indent) === 'object') { + if (options.indent.constructor === Number + || options.indent.constructor === Boolean + || options.indent.constructor === String) + options.indent = options.indent.valueOf() + } + + // gap is capped at 10 characters + if (typeof(options.indent) === 'number') { + if (options.indent >= 0) { + options.indent = Array(Math.min(~~options.indent, 10) + 1).join(' ') + } else { + options.indent = false + } + } else if (typeof(options.indent) === 'string') { + options.indent = options.indent.substr(0, 10) + } + + if (options._splitMin == null) options._splitMin = 50 + if (options._splitMax == null) options._splitMax = 70 + + return _stringify(object, options, 0, '') +} + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/unicode.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/unicode.js new file mode 100644 index 00000000000..1a29143c2d6 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/unicode.js @@ -0,0 +1,71 @@ + +// This is autogenerated with esprima tools, see: +// https://github.com/ariya/esprima/blob/master/esprima.js +// +// PS: oh God, I hate Unicode + +// ECMAScript 5.1/Unicode v6.3.0 NonAsciiIdentifierStart: + +var Uni = module.exports + +module.exports.isWhiteSpace = function isWhiteSpace(x) { + // section 7.2, table 2 + return x === '\u0020' + || x === '\u00A0' + || x === '\uFEFF' // <-- this is not a Unicode WS, only a JS one + || (x >= '\u0009' && x <= '\u000D') // 9 A B C D + + // + whitespace characters from unicode, category Zs + || x === '\u1680' + || x === '\u180E' + || (x >= '\u2000' && x <= '\u200A') // 0 1 2 3 4 5 6 7 8 9 A + || x === '\u2028' + || x === '\u2029' + || x === '\u202F' + || x === '\u205F' + || x === '\u3000' +} + +module.exports.isWhiteSpaceJSON = function isWhiteSpaceJSON(x) { + return x === '\u0020' + || x === '\u0009' + || x === '\u000A' + || x === '\u000D' +} + +module.exports.isLineTerminator = function isLineTerminator(x) { + // ok, here is the part when JSON is wrong + // section 7.3, table 3 + return x === '\u000A' + || x === '\u000D' + || x === '\u2028' + || x === '\u2029' +} + +module.exports.isLineTerminatorJSON = function isLineTerminatorJSON(x) { + return x === '\u000A' + || x === '\u000D' +} + +module.exports.isIdentifierStart = function isIdentifierStart(x) { + return x === '$' + || x === '_' + || (x >= 'A' && x <= 'Z') + || (x >= 'a' && x <= 'z') + || (x >= '\u0080' && Uni.NonAsciiIdentifierStart.test(x)) +} + +module.exports.isIdentifierPart = function isIdentifierPart(x) { + return x === '$' + || x === '_' + || (x >= 'A' && x <= 'Z') + || (x >= 'a' && x <= 'z') + || (x >= '0' && x <= '9') // <-- addition to Start + || (x >= '\u0080' && Uni.NonAsciiIdentifierPart.test(x)) +} + +module.exports.NonAsciiIdentifierStart = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/ + +// ECMAScript 5.1/Unicode v6.3.0 NonAsciiIdentifierPart: + +module.exports.NonAsciiIdentifierPart = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0\u08A2-\u08AC\u08E4-\u08FE\u0900-\u0963\u0966-\u096F\u0971-\u0977\u0979-\u097F\u0981-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C82\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191C\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1D00-\u1DE6\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA697\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7B\uAA80-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE26\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/ diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/utils.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/utils.js new file mode 100644 index 00000000000..a8476b6c463 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/lib/utils.js @@ -0,0 +1,46 @@ +var FS = require('fs') +var jju = require('../') + +// this function registers json5 extension, so you +// can do `require("./config.json5")` kind of thing +module.exports.register = function() { + var r = require, e = 'extensions' + r[e]['.json5'] = function(m, f) { + /*eslint no-sync:0*/ + m.exports = jju.parse(FS.readFileSync(f, 'utf8')) + } +} + +// this function monkey-patches JSON.parse, so it +// will return an exact position of error in case +// of parse failure +module.exports.patch_JSON_parse = function() { + var _parse = JSON.parse + JSON.parse = function(text, rev) { + try { + return _parse(text, rev) + } catch(err) { + // this call should always throw + require('jju').parse(text, { + mode: 'json', + legacy: true, + reviver: rev, + reserved_keys: 'replace', + null_prototype: false, + }) + + // if it didn't throw, but original parser did, + // this is an error in this library and should be reported + throw err + } + } +} + +// this function is an express/connect middleware +// that accepts uploads in application/json5 format +module.exports.middleware = function() { + return function(req, res, next) { + throw Error('this function is removed, use express-json5 instead') + } +} + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/package.json b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/package.json new file mode 100644 index 00000000000..bdcdae6b461 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/package.json @@ -0,0 +1,63 @@ +{ + "name": "jju", + "version": "1.2.0", + "description": "a set of utilities to work with JSON / JSON5 documents", + "author": { + "name": "Alex Kocharin", + "email": "alex@kocharin.ru" + }, + "repository": { + "type": "git", + "url": "git://github.com/rlidwka/jju" + }, + "bugs": { + "url": "https://github.com/rlidwka/jju/issues" + }, + "homepage": "http://rlidwka.github.io/jju/", + "devDependencies": { + "mocha": ">=1.21.0", + "js-yaml": ">=3.1.0", + "eslint": "~0.4.2" + }, + "scripts": { + "test": "mocha test/*.js", + "lint": "eslint -c ./.eslint.yaml ./lib" + }, + "keywords": [ + "json", + "json5", + "parser", + "serializer", + "data" + ], + "publishConfig": { + "registry": "https://registry.npmjs.org/" + }, + "license": { + "type": "WTFPL", + "url": "http://www.wtfpl.net/txt/copying/" + }, + "gitHead": "6f1b2a8321cb0dfcffc50378b3632853cf529671", + "_id": "jju@1.2.0", + "_shasum": "add5b586fec853b44929d78bf94864ab577c02e9", + "_from": "jju@>=1.1.0 <2.0.0", + "_npmVersion": "2.0.1", + "_nodeVersion": "1.1.1", + "_npmUser": { + "name": "rlidwka", + "email": "alex@kocharin.ru" + }, + "maintainers": [ + { + "name": "rlidwka", + "email": "alex@kocharin.ru" + } + ], + "dist": { + "shasum": "add5b586fec853b44929d78bf94864ab577c02e9", + "tarball": "http://registry.npmjs.org/jju/-/jju-1.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/jju/-/jju-1.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/package.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/package.yaml new file mode 100644 index 00000000000..cab7b5d0bca --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/package.yaml @@ -0,0 +1,46 @@ +# use "yapm install ." if you're installing this from git repository + +# "jju" stands for "json/json5 utils" +name: jju + +version: 1.2.0 +description: a set of utilities to work with JSON / JSON5 documents + +author: + name: Alex Kocharin + email: alex@kocharin.ru + +repository: + type: git + url: git://github.com/rlidwka/jju + +bugs: + url: https://github.com/rlidwka/jju/issues + +homepage: http://rlidwka.github.io/jju/ + +devDependencies: + mocha: '>=1.21.0' + js-yaml: '>=3.1.0' + + # linting tools + eslint: '~0.4.2' + +scripts: + test: 'mocha test/*.js' + lint: 'eslint -c ./.eslint.yaml ./lib' + +keywords: + - json + - json5 + - parser + - serializer + - data + +publishConfig: + registry: https://registry.npmjs.org/ + +license: + type: WTFPL + url: http://www.wtfpl.net/txt/copying/ + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/portable-json5-tests.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/portable-json5-tests.yaml new file mode 100644 index 00000000000..5bf6ac38fe1 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/portable-json5-tests.yaml @@ -0,0 +1,916 @@ +# vi:set ts=2 sts=2 sw=2 et: +# +# Copyright (c) JD 2456730 Alex Kocharin +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# The original file is available here: +# https://github.com/rlidwka/jju/tree/master/test/portable-json5-tests.yaml +# +# ---------------------------------------------------------------------------- +# +# Portable JSON5 test suite. +# +# This file contains an actual YAML data and it may include fancy syntax. +# If your platform does not support YAML, you might wish to pre-process it +# using a generic YAML parser. +# + +%YAML 1.2 +--- +# +# "input" is an arbitrary JSON5 you have to parse +# "output" is a normalized JSON you have to compare your result with, +# or !error (null) if your input should result in parser error +# +# Types of tests: +# +# - basic - Tests that every JSON5 parser should pass. +# +# - advanced - Tests that bring close compatibility with javascript. Not +# strictly required, but nice to have for completeness. +# +# - extra - Extra test cases you can follow at your discretion. +# +# Questionable features like elisions go to extra. All valid javascript, but +# invalid json5 also goes to extra. Feel free to ignore this section if you +# want to. Thus, eval(input) is a complete json5 parser, that should pass all +# basic and advanced tests. +# + +# Basic types in minimal form +# --------------------------- + +type-no-data: + type: extra + output: !error + input: '' + +type-null: + type: basic + output: null + input: > + null + +# undefined is not supported, +# null should be used instead +type-no-undefined: + type: extra + output: !error + input: > + undefined + +type-no-raw: + type: extra + output: !error + input: > + foobar + +type-bool-true: + type: basic + output: true + input: > + true + +type-bool-false: + type: basic + output: false + input: > + false + +type-number: + type: basic + output: 0 + input: > + 0 + +type-string: + type: basic + output: "" + input: > + "" + +type-object: + type: basic + output: {} + input: > + {} + +type-array: + type: basic + output: [] + input: > + [] + +# Numbers: special +# ---------------- + +# note: it's hard to test this +# just add `1/x < 0` check in your code somewhere +num-negative-zero: + type: extra + output: -0.0 + input: > + -0 + +num-nan: + type: basic + output: .nan + input: > + NaN + +num-signed-nan: + type: basic + output: .nan + input: > + +NaN + +num-positive-inf: + type: basic + output: +.inf + input: > + Infinity + +num-negative-inf: + type: basic + output: -.inf + input: > + -Infinity + +num-inf-exact-case: + type: extra + output: !error + input: > + INFINITY + +# Numbers: hexadecimal +# -------------------- + +num-hex-zero: + type: basic + output: 0 + input: > + 0x0 + +num-cut-hex: + type: basic + output: !error + input: > + 0x + +num-all-hex: + type: basic + output: 12841684683518 + input: > + 0xBADF00DCAFE + +num-mixed-case: + type: basic + output: 3735928559 + input: > + 0xDeAdBEef + +num-signed-hex: + type: advanced + output: 31 + input: > + +0x1F + +num-negative-hex: + type: advanced + output: -31 + input: > + -0x1f + +num-bad-hex: + type: advanced + output: !error + input: > + 0xBADxF00D + +num-no-hex-float: + type: advanced + output: !error + input: > + 0x12.345 + +# this is not actually an exponent :) +num-hex-exponent: + type: advanced + output: 4836 + input: > + 0x0012e4 + +# Numbers: octal +# -------------- + +# Octals are primarily used in config files +# to set up a file mask (like 0777) +# +# Note: they will have 0o12345 syntax instead +# of 012345 in the ES6, so we'll need to switch +# as well in the future + +num-octal: + type: extra + output: 342391 + input: > + 01234567 + +num-octal-zeroes: + type: extra + output: -24000 + input: > + -000000056700 + +num-bad-octal: + type: extra + output: !error + input: > + 012345678 + +num-no-octal-float: + type: extra + output: !error + input: > + 012.345 + +num-no-octal-exp: + type: extra + output: !error + input: > + 0123e4 + +# Numbers: floating point +# ----------------------- + +num-float: + type: basic + output: 123.456 + input: > + 123.456 + +num-signed-foat: + type: basic + output: -0.00098765 + input: > + -0.00098765 + +num-omit-trailing-mantissa: + type: basic + output: 1234000 + input: > + 1234.e3 + +num-omit-leading-mantissa: + type: advanced + output: -123.4 + input: > + -.1234e3 + +num-bad-float: + type: advanced + output: !error + input: > + 0.12.345 + +num-bad-sum: + type: extra + output: !error + input: > + 0.12+345 + +num-uc-exp: + type: advanced + output: -1230000 + input: > + -123E+4 + +num-float-exp: + type: basic + output: 123000 + input: > + 0.0123e7 + +num-bad-exp: + type: extra + output: !error + input: > + 123e7.3 + +num-bad-char: + type: extra + output: !error + input: > + 123a456 + +num-no-exp: + type: advanced + output: !error + input: > + 123e + +num-zero-exp: + type: advanced + output: -0.0 + input: > + -.00e-0 + +num-dec-base-signed-exp: + type: advanced + output: 0.00000123 + input: > + 1230000E-012 + +# String: quotes +# -------------- + +string-double-quotes: + type: basic + output: foobar + input: > + "foobar" + +string-single-quotes: + type: basic + output: foobar + input: > + 'foobar' + +string-open: + type: basic + output: !error + input: > + "\\\\\\\\\\\\\" + +string-not-open: + type: basic + output: "\\\\\\\\\\\\\\" + input: > + "\\\\\\\\\\\\\\" + +string-continuation: + type: advanced + output: " foo bar " + input: > + " foo \ + bar \ + " + +string-win-continuation: + type: advanced + output: "foobar" + input: "'foo\\\r\nbar'" + +string-win-reverse-continuation: + type: advanced + output: !error + input: "'foo\\\n\rbar'" + +string-unicode-continuation: + type: advanced + output: "foobarbaz" + input: "'foo\\\u2028bar\\\u2029baz'" + +string-multi-bad-continuation: + type: advanced + output: !error + input: > + foo\ + + bar + +string-bad-ending: + type: basic + output: !error + input: "'foo\rbar'" + +string-bad-ending-2028: + type: advanced + output: !error + input: "'foo\u2028bar'" + +string-bad-ending-2029: + type: advanced + output: !error + input: "'foo\u2029bar'" + +string-literal-unicode: + type: advanced + output: "foo\uFEFF\u2030bar\u1234" + input: "'foo\uFEFF\u2030bar\u1234'" + +string-control-char: + type: advanced + output: "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0b\x0c\x0e\x0f" + input: "'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0b\x0c\x0e\x0f'" + +# String: escape sequences +# ------------------------ + +string-octal-escape: + type: extra + output: "\x1b[1;32mhi\x1b[m??" + input: > + '\033[1;32mhi\033[m\077\077' + +string-octal-two-digits: + type: extra + output: "\n\x1c\x2e\x07890\x01" + input: > + '\12\34\56\78\90\1' + +string-octal-three-digits: + type: extra + output: "\n34.78\xff 0" + input: > + '\01234\5678\377\400' + +string-hex-escape: + type: extra + output: "\x01\x23\xab\xcd\xef" + input: > + "\x01\x23\xab\xCd\xEF" + +# \0 is *not* an octal escape sequence, +# and is allowed even in strict mode +string-zero-point: + type: basic + output: "\0" + input: > + '\0' + +string-escape-double-quotes: + type: basic + output: "\"''" + input: > + "\"'\'" + +string-escape-single-quotes: + type: basic + output: " '\"\" " + input: > + ' \'"\" ' + +string-escape-json-chars: + type: basic + output: "\\\/\b\f\n\r\t" + input: > + "\\\/\b\f\n\r\t" + +# this character was left out of +# json spec for whatever reason +string-escape-slash-v: + type: basic + output: "\v" + input: > + "\v" + +string-unicode-escape: + type: basic + output: "\u0000\uffffx\ufeff\u1234\u9f6a\u2028\uabcd" + input: > + "\u0000\uFFFFx\uFeFf\u1234\u9F6a\u2028\uabcd" + +string-arbitrary-escape: + type: advanced + output: "X12Uqwe\r\tyiopasd\fghjklzc\u000b\b\nm9 " + input: > + '\X12\U\q\w\e\r\t\y\i\o\p\a\s\d\f\g\h\j\k\l\z\c\v\b\n\m\9\ ' + +string-bad-unicode: + type: advanced + output: !error + input: > + '\uEFGH' + +string-incomplete-unicode: + type: advanced + output: !error + input: > + '\u$' + +string-bad-hex: + type: advanced + output: !error + input: > + '\xFG' + +string-incomplete-hex: + type: advanced + output: !error + input: > + '\x$' + +# Object literals +# --------------- + +object-nested: + type: basic + output: {q:{'w':{"e":[1]}}} + input: | + {q:{'w':{"e":[1]}}} + +object-trailing-comma: + type: basic + output: {foo: 'bar'} + input: | + {foo: 'bar',} + +object-leading-comma-style: + type: basic + output: {q: 1,w: 2,e: 3} + input: | + { q: 1 + , w: 2 + , e: 3 + } + +object-incomplete: + type: basic + output: !error + input: | + {q:1,w:2,{} + +object-isnt-array: + type: basic + output: !error + input: | + {1,2} + +object-no-single-comma: + type: basic + output: !error + input: | + {,} + +object-no-elisions: + type: basic + output: !error + input: | + {q:1,,w:2} + +# Objects: keys +# ------------- + +object-singlequoted: + type: basic + output: {q: 1,w: 2,e: 3} + input: | + {'q':1,'w':2,'e':3} + +object-doublequoted: + type: basic + output: {q: 1,w: 2,e: 3} + input: | + {"q":1,"w":2,"e":3} + +object-unquoted: + type: basic + output: {$FOO_bar123: 'baz'} + input: > + {$FOO_bar123: 'baz'} + +object-no-first-digit: + type: advanced + output: !error + input: > + {123foo: bar} + +object-unquoted-unicode: + type: advanced + output: {"\u1f04\u03bb\u03c6\u03b1": baz} + input: "{\u1f04\u03bb\u03c6\u03b1:'baz'}" + +object-unicode-escape-key: + type: advanced + output: {foo: 'bar', "\u1f04\u03bb\u03c6\u03b1": baz, "qwe\u1f04rty": quux} + input: | + {foo:'bar', \u1f04\u03bb\u03c6\u03b1:'baz', qwe\u1f04rty: "quux"} + +object-no-raw-literal: + type: extra + output: !error + input: | + {foo: bar} + +object-bad-literal: + type: advanced + output: !error + input: | + {foo-bar: 123} + +object-no-space-in-key: + type: advanced + output: !error + input: | + {foo bar: 123} + +object-no-comment-in-key: + type: advanced + output: !error + input: | + {foo/*bar*/baz: 123} + +object-float-keys: + type: advanced + output: {'1': 'one', '3.1415': 'pi'} + input: | + {1:'one', 3.1415:'pi'} + +object-no-negative: + type: advanced + output: !error + input: | + {-5: 123} + +object-exponent-keys: + type: advanced + output: {'1': 'exp', '1000': 'pos', '0.001': 'neg'} + input: | + {1e0: 'exp', 1e+3: 'pos', 1e-3: 'neg'} + +object-octal-keys: + type: extra + output: {'668': 1} + input: | + {01234: 1} + +object-hex-keys: + type: advanced + output: {'51966': 1} + input: | + {0xCAFE: 1} + +object-null-keys: + type: basic + output: {'null': null} + input: | + {null: null} + +object-no-array-keys: + type: extra + output: !error + input: | + {[]: 123} + +object-no-empty-keys: + type: basic + output: !error + input: | + {: 123} + +object-empty-string-key: + type: basic + output: {s: {'': 1}, m: {'': 2}} + input: | + {s: {'': 1}, m: {"": 2}} + +object-bad-unicode-space: + type: advanced + output: !error + input: | + { \u0020foobar: 123 } + +object-bad-unicode-dash: + type: advanced + output: !error + input: | + { foo\u002dbar: 123} + +object-incomplete-unicode-sequence: + type: advanced + output: !error + input: | + { foo\u12f: 123 } + +object-double-escape: + type: advanced + output: !error + input: | + { foo\\u1234bar: 123 } + +object-we-arent-es3: + type: basic + output: {new: 1, delete: 2, throw: 3} + input: | + {new: 1, delete: 2, throw: 3} + +object-last-digits: + type: basic + output: {$123e2: 1, abc123: 2} + input: | + {$123e2: 1, abc123: 2} + +object-unicode-in-string: + type: advanced + output: {"\uff13qwe": 123} + input: | + {"\uff13qwe": 123} + +object-unicode-esc-in-string: + type: advanced + output: {"\\uff13qwe": 123} + input: | + {"\\uff13qwe": 123} + +object-unicode-digits-first-esc: + type: advanced + output: !error + input: | + {\uff13qwe: 123} + +object-unicode-digits-first-lit: + type: advanced + output: !error + input: "{\uff13qwe: 123}" + +object-unicode-weirdness-esc: + type: advanced + output: {"digit\uff13": 1, "comb\u094F": 2, "punct\u2040": 3, "zwnj\u200C": 4} + input: | + {digit\uff13: 1, comb\u094F: 2, punct\u2040: 3, zwnj\u200C: 4} + +object-unicode-weirdness-lit: + type: advanced + output: {"digit\uff13": 1, "comb\u094F": 2, "punct\u2040": 3, "zwnj\u200C": 4} + input: "{digit\uff13: 1, comb\u094F: 2, punct\u2040: 3, zwnj\u200C: 4}" + +# Array literals +# -------------- + +array-all-types: + type: basic + output: [1.2,"3,4",{},[],null,+.inf] + input: | + [1.2,"3,4",{},[],null,Infinity] + +array-trailing-comma: + type: basic + output: [1,2,3,4] + input: | + [1,2,3,4,] + +array-leading-comma-style: + type: basic + output: [quux,foo,bar,baz] + input: | + [ 'quux' + , 'foo' + , 'bar' + , 'baz' + ] + +array-incomplete: + type: basic + output: !error + input: | + [1,2,3,[] + +array-nested: + type: basic + output: [[[[[[]]]]],[[],[]]] + input: | + [[[[[[/*[]*/]]]]],[[],[]]] + +array-isnt-object: + type: extra + output: !error + input: | + [1:2] + +array-no-single-comma: + type: extra + output: !error + input: | + [,] + +array-no-elisions: + type: extra + output: !error + input: | + [1,,2,3] + +# Comments +# -------- + +comment-single: + type: basic + output: foobar + input: | + // blahblah + "foobar" + // another one + +comment-multi: + type: basic + output: foobar + input: | + /* + * 123 + */ + "foobar" + /**/ + +comment-single-newlines: + type: advanced + output: [ 123, 456, 789 ] + input: "[// foo\r123,// bar\u2028456,// baz\u2029789]" + +comment-inside: + type: advanced + output: [123, '// foo', '/* bar'] + input: > + [ + /* + " // */ 123, // ", + "// foo", + '/* bar', + ] + +comment-in-token: + type: advanced + output: !error + input: + 123/*comment*/456 + +comment-java-style: + type: basic + output: 123 + input: + /*****************/ + 123 + /****************/ + +comment-object: + type: basic + output: {q: 123} + input: /**/{/**/q/**/:/**/123/**/,/**/}// + +# Whitespace +# ---------- + +ws-no-whitespace: + type: basic + output: {"foo":bar,bar:["qwe",null,[],{}],"baz":123} + input: '{foo:"bar","bar":["qwe",null,[],{}],"baz":123}' + +ws-allow-prefix: + type: basic + output: 123 + input: " \t123" + +ws-unicode-spaces: + type: advanced + output: { foo : 123 } + input: " + \u0020\u00A0\uFEFF + { + \x09\x0A\x0B\x0C\x0D\u1680\u180E + foo + \u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A + : + \u2028\u2029\u202F\u205F\u3000 + 123 + \uFEFF + }" + +ws-unicode-newlines: + type: advanced + output: [ 123, 456 ] + input: " + [ + \u000D + 123, + \u2028 + 456, + \u2029 + ] + " + +# Multiple tokens +# --------------- + +multi-string-nospace: + type: basic + output: !error + input: '"foo""bar"' + +multi-string: + type: basic + output: !error + input: '"foo" "bar"' + +# note: valid javascript +multi-array: + type: extra + output: !error + input: '[0] [0]' + +multi-object: + type: basic + output: !error + input: '{} {}' +... diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_analyze.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_analyze.js new file mode 100644 index 00000000000..2a24e01eac2 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_analyze.js @@ -0,0 +1,53 @@ +var _assert = require('assert') +var analyze = require('../').analyze + +function addTest(a, b) { + if (typeof(describe) === 'function') { + it('test_analyze: ' + a + ' == ' + b, function() { + _assert.equal(a, b) + }) + } else { + _assert.equal(a, b) + } +} + +var t = analyze(JSON.stringify(require('os').networkInterfaces())) +addTest(t.has_whitespace, false) +addTest(t.has_comments, false) +addTest(t.has_newlines, false) +addTest(t.newline, '\n') +addTest(t.quote, '"') +addTest(t.quote_keys, true) +addTest(t.indent, '') + +var t = analyze(JSON.stringify(require('os').networkInterfaces(), null, 2)) +addTest(t.has_whitespace, true) +addTest(t.has_comments, false) +addTest(t.has_newlines, true) +addTest(t.newline, '\n') +addTest(t.quote, '"') +addTest(t.quote_keys, true) +addTest(t.indent, ' ') + +var t = analyze(JSON.stringify(require('os').networkInterfaces(), null, 3)) +addTest(t.indent, ' ') + +var t = analyze(JSON.stringify(require('os').networkInterfaces(), null, '\t')) +addTest(t.indent, '\t') + +var t = analyze(JSON.stringify(require('os').networkInterfaces(), null, 3).replace(/\n/g, '\r\n')) +addTest(t.indent, ' ') +addTest(t.newline, '\r\n') + +var t = analyze(JSON.stringify(require('os').networkInterfaces()).replace(/"/g, "'")) +addTest(t.quote, "'") +addTest(t.quote_keys, true) + +var t = analyze("{foo:'bar', 'bar':\"baz\", 'baz':\"quux\"}") +addTest(t.quote, "'") +addTest(t.quote_keys, false) + +var t = analyze("{foo:'bar', \"bar\":'baz', \"baz\":\"quux\"}") +addTest(t.quote, '"') +addTest(t.quote_keys, false) + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_document.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_document.js new file mode 100644 index 00000000000..5f1ef2aaf6a --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_document.js @@ -0,0 +1,214 @@ +var assert = require('assert') +var create = require('../lib/document').Document +var jju = require('..') + +var str = '{ x\r\n:\n1, y: {"..z.": 123, t: null, s:"123", a:[ 1,2,{x:3},] }}\n' +var d = create(str) +assert.equal(d + '', str) +assert.deepEqual(d.get(''), {x:1,y:{'..z.':123,t:null,s:'123',a:[1,2,{x:3}]}}) +assert.deepEqual(d.get('x'), 1) +assert.deepEqual(d.get('x.x'), undefined) +assert.deepEqual(d.get('x.x.x.x'), undefined) +assert.strictEqual(d.get('y.x'), undefined) +assert.deepEqual(d.get('y.s'), '123') +assert.strictEqual(d.get('y.t'), null) +assert.strictEqual(d.get('y.t.x'), undefined) +assert.equal(d.has(''), true) +assert.equal(d.has('x'), true) +assert.equal(d.has('x.x'), false) +assert.equal(d.has('x.x.x.x'), false) +assert.equal(d.has('y.x'), false) +assert.equal(d.has('y'), true) +assert.equal(d.has('y.s'), true) +assert.equal(d.has('y.t'), true) +assert.equal(d.has('a'), false) + +// arrays +assert.deepEqual(d.get('y.a'), [1,2,{x:3}]) +assert.deepEqual(d.get('y.a.0'), 1) +assert.deepEqual(d.get('y.a.2.x'), 3) +assert.deepEqual(d.get('y.a.10'), undefined) +assert.deepEqual(d.has('y.a.0'), true) +assert.deepEqual(d.has('y.a.10'), false) +assert.deepEqual(d.get('y.a.2'), {x:3}) +assert.deepEqual(d.get('y.a.-1'), undefined) + +// controversial +assert.strictEqual(d.get('y.s.0'), undefined) +assert.equal(d.has('y.s.0'), false) + +// paths +assert.deepEqual(d.get([]), {x:1,y:{'..z.':123,t:null,s:'123',a:[1,2,{x:3}]}}) +assert.strictEqual(d.has([]), true) +assert.strictEqual(d.get(['y','..z.']), 123) +assert.strictEqual(d.has(['y','..z.']), true) +assert.deepEqual(d.get(['y','a',2,'x']), 3) +assert.deepEqual(create('[1]').set(0, 4).get(''), [4]) +assert.deepEqual(create('[1]').set(1, 4).get(''), [1,4]) +assert.deepEqual(create('[1]').has(0), true) +assert.deepEqual(create('[1]').has(1), false) +assert.deepEqual(create('[1]').get(0), 1) + +// invalid paths +assert.throws(function() { create('[1]').set(null, 4) }, /invalid path type/i) +assert.throws(function() { create('[1]').set({}, 4) }, /invalid path type/i) +assert.throws(function() { create('[1]').set(/./, 4) }, /invalid path type/i) +assert.throws(function() { create('[1]').set(function(){}, 4) }, /invalid path type/i) +assert.throws(function() { create('[1]').set(false, 4) }, /invalid path type/i) +assert.throws(function() { create('[1]').set(undefined, 4) }, /invalid path type/i) + +// set root +assert.strictEqual(create(str).set('', 4).get(''), 4) +assert.strictEqual(create(str).set('', null).get(''), null) +assert.strictEqual(create(str).set('', {x:4}).get('x'), 4) +assert.deepEqual(create(str).set('', [1,2,3]).get(''), [1,2,3]) +assert.strictEqual(create('1').set('', 4).get(''), 4) +assert.strictEqual(create('null').set('', 4).get(''), 4) +assert.strictEqual(create('[]').set('', 4).get(''), 4) +assert.strictEqual(create('{}').set('', 4).get(''), 4) + +// set 1st level +assert.deepEqual(create('{}').set('x', 4).get('x'), 4) +assert.deepEqual(create('{a:{b:[]}}').set('a.b.0', 4).get('a'), {b:[4]}) +//assert.deepEqual(create('1').set('x', 4).get('x'), 4) +//assert.deepEqual(create('null').set('x', 4).get('x'), 4) + +// array: boundaries +assert.strictEqual(create('[]').set('0', 4).get('0'), 4) +assert.strictEqual(create('[1,2,3]').set('2', 4).get('2'), 4) +assert.strictEqual(create('[1,2,3]').set('3', 4).get('3'), 4) + +// various error cases +assert.throws(function() { create('1').set('x', 4) }, /set key .* of an non-object/) +assert.throws(function() { create('null').set('x', 4) }, /set key .* of an non-object/) +assert.throws(function() { create('[]').set('x', 4) }, /set key .* of an array/) +assert.throws(function() { create('""').set('x', 4) }, /set key .* of an non-object/) +assert.throws(function() { create('{}').set('x.x.x', 4) }, /set key .* of an non-object/) +assert.throws(function() { create('1').set('1', 4) }, /set key .* of an non-object/) +assert.throws(function() { create('null').set('1', 4) }, /set key .* of an non-object/) +assert.throws(function() { create('""').set('1', 4) }, /set key .* of an non-object/) +assert.throws(function() { create('[]').set('-1', 4) }, /set key .* of an array/) +assert.throws(function() { create('[]').set('1', 4) }, /set key .* out of bounds/) +assert.throws(function() { create('[1,2,3]').set('4', 4) }, /set key .* out of bounds/) +assert.throws(function() { create('{a:{b:[]}}').set('a.b.x', 4) }, /set key .* of an array/) + +// unsetting stuff +assert.throws(function() { create('[]').unset('') }, /can't remove root document/) + +// arrays: handling spaces correctly +assert.equal(create("[]").set(0,{})+"", '[{}]') +assert.equal(create("[0]").set(1,{})+"", '[0,{}]') +assert.equal(create("[0,]").set(1,{})+"", '[0,{},]') +assert.equal(create("[ ]").set(0,{})+"", '[{} ]') +assert.equal(create("[ 0 , ]").set(1,{})+"", '[ 0 , {}, ]') +assert.equal(create("[ 0 ]").set(1,{})+"", '[ 0, {} ]') +assert.equal(create("{}").set('y',{})+"", '{"y":{}}') +assert.equal(create("{x:1}").set('y',{})+"", '{x:1,y:{}}') +assert.equal(create("{x:1,}").set('y',{})+"", '{x:1,y:{},}') +assert.equal(create("{ }").set('y',{})+"", '{"y":{} }') +assert.equal(create("{ x:1 , }").set('y',{})+"", '{ x:1 , y:{}, }') +assert.equal(create("{ x:1 }").set('y',{})+"", '{ x:1, y:{} }') + +// deleting elements +assert.throws(function() { create('[]').unset('0') }, /unset key .* out of bounds/) +assert.throws(function() { create('[1,2]').unset('2') }, /unset key .* out of bounds/) +assert.throws(function() { create('[1,2,3]').unset('0') }, /in the middle of an array/) + +// CommonJS assert spec is "awesome" +assert.deepEqual(create('[1,2]').unset('1').get(''), [1]) +assert.deepEqual(create('[1,2]').unset('1').get('').length, 1) +assert.deepEqual(create('[1,2,3]').unset('2').unset('1').get(''), [1]) +assert.deepEqual(create('[1,2,3]').unset('2').unset('1').get('').length, 1) +assert.deepEqual(create('[1]').unset('0').get(''), []) +assert.deepEqual(create('[1]').unset('0').get('').length, 0) + +assert.deepEqual(create('{x:{y:"z"}, z:4}').unset('x').get(''), {z:4}) +assert.throws(function() { create('[1,2]').unset('') }, /root/) + +// getting crazy +//assert.deepEqual(create(str).set('a.b.c.d.e', 1).get('a'), {b:{c:{d:{e:1}}}}) + +// update: arrays +assert.deepEqual(create("[1]").update([2,3])+"", '[2,3]') +assert.deepEqual(create("[1]").update([2,3,4])+"", '[2,3,4]') +assert.deepEqual(create("[]").update([2])+"", '[2]') +assert.deepEqual(create("[2]").update([])+"", '[]') +assert.deepEqual(create("[2,3,4]").update([2,3])+"", '[2,3]') +assert.deepEqual(create("[2,3,4]").update([])+"", '[]') +assert.deepEqual(create("[]").update([2,3,4])+"", '[2,3,4]') +assert.deepEqual(create(" /*zz*/ [ 2 , 3 , 4 ] /*xx*/ ").update([])+"", ' /*zz*/ [ ] /*xx*/ ') +assert.deepEqual(create(" /*zz*/ [ ] /*xx*/ ").update([2,3,4])+"", ' /*zz*/ [2,3,4 ] /*xx*/ ') + +// update: objects +assert.deepEqual(create("{x:1}").update({x:1,y:2,z:3})+"", '{x:1,y:2,z:3}') +assert.deepEqual(create("{x:1}").update({x:2,z:3,t:4})+"", '{x:2,z:3,t:4}') +assert.deepEqual(create("{}").update({x:1,y:2})+"", '{"x":1,"y":2}') +assert.deepEqual(create("{x:1}").update({})+"", '{}') +assert.deepEqual(create("{x:1,y:2}").update({x:1})+"", '{x:1}') +assert.deepEqual(create(" /*zz*/ { x /*a*/ : /*b*/ 2 , y:3 , z //\n: 4 } /*xx*/ ").update({})+"", ' /*zz*/ { } /*xx*/ ') +assert.deepEqual(create(" /*zz*/ { } /*xx*/ ").update({x: 2, y: 3, z: 4})+"", ' /*zz*/ {"x":2,"y":3,"z":4 } /*xx*/ ') + +// remove trailing comma +assert.deepEqual(create("{x:1,}").update({})+"", '{}') +assert.deepEqual(create("[0,]").update([])+"", '[]') +assert.deepEqual(create("[0 /*z*/ , /*z*/]").update([])+"", '[ /*z*/]') + +// mode +assert.equal(create('{"test":123}', {mode:'json'}).update({q:1,w:2})+'', '{"q":1,"w":2}') + +assert.equal(create('{1:2}').update({ a: 1, b: [1,2], c: 3})+'', '{a:1,b:[1,2],c:3}') + +// undef +//assert.throws(function(){ jju.update(undefined, undefined) }, /root doc/) +assert.equal(jju.update(undefined, undefined), '') +assert.equal(jju.update(undefined, 42), '42') +assert.equal(jju.update(undefined, {x: 5}), '{"x":5}') + +/* + * real test + */ +var upd = { name: 'yapm', + version: '0.6.0', + description: 'npm wrapper allowing to use package.yaml instead of package.json', + author: { name: 'Alex Kocharin', email: 'alex@kocharin.ru' }, + keywords: + [ 'package manager', + 'modules', + 'install', + 'package.yaml', + 'package.json5', + 'yaml', + 'json5', + 'npm' ], + preferGlobal: true, + homepage: 'https://npmjs.org/doc/', + repository: { type: 'git', url: 'https://github.com/rlidwka/yapm' }, + bugs: { url: 'http://github.com/rlidwka/yapm/issues' }, + main: './yapm.js', + bin: { yapm: './yapm.js' }, + dependencies: { npm: '*', 'js-yaml': '*', through: '*', 'json5-utils': '*' }, + devDependencies: { async: '*' }, + optionalDependencies: { 'yaml-update': '*' }, + test_nonascii: 'тест' } + +assert.deepEqual(create(create('{"garbage":"garbage"}').update(upd)).get(''), upd) +assert.deepEqual(JSON.parse(create('{"garbage":"garbage"}', {mode:'json',legacy:true}).update(upd)), upd) + +//console.log(create('{"garbage":"garbage"}').update(upd)+'') + +//assert.deepEqual(create(" [ ] //").set(0,{})+"" [ ,{}] // + + +//node -e 'console.log(require("./document").Document("{}").set("",[1,2,3])+"")'[1, 2, 3] + +//alex@elu:~/json5-utils/lib$ node -e 'console.log(require("./document").Document("[]").set("0",[1,2,3]).get(""))' +//[ [ 1, 2, 3 ] ] + + +/*assert.equal(create('"test"').get(''), 'test') +assert.equal(create('"test"').get([]), 'test') +assert.equal(create('"test"').get(false), 'test') +assert.equal(create(undefined).get(''), undefined) + +//assert.equal(create('"test"').set('', 'foo').toString(), '"foo"') +*/ diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_errors.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_errors.js new file mode 100644 index 00000000000..8b2cdb7dcbd --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_errors.js @@ -0,0 +1,56 @@ +var assert = require('assert') +var parse = require('../').parse + +function addTest(arg, row, col, errRegExp) { + var fn = function() { + try { + parse(arg) + } catch(err) { + if (row !== undefined) assert.equal(err.row, row, 'wrong row: ' + err.row) + if (col !== undefined) assert.equal(err.column, col, 'wrong column: ' + err.column) + if (errRegExp) assert(errRegExp.exec(err.message)) + return + } + throw Error("no error") + } + + if (typeof(describe) === 'function') { + it('test_errors: ' + JSON.stringify(arg), fn) + } else { + fn() + } +} + +// semicolon will be unexpected, so it indicates an error position +addTest(';', 1, 1) +addTest('\n\n\n;', 4, 1) +addTest('\r\n;', 2, 1) +addTest('\n\r;', 3, 1) +addTest('\n\u2028;', 3, 1) +addTest('\n\u2029;', 3, 1) +addTest('[\n1\n,\n;', 4, 1) +addTest('{\n;', 2, 1) +addTest('{\n1\n:\n;', 4, 1) +addTest('.e3', 1, 3, /"\.e3"/) + +// line continuations +addTest('["\\\n",\n;', 3, 1) +addTest('["\\\r\n",\n;', 3, 1) +addTest('["\\\u2028",\n;', 3, 1) +addTest('["\\\u2029",\n;', 3, 1) + +// bareword rewind +addTest('nulz', 1, 1) + +// no data +addTest(' ', 1, 3, /No data.*whitespace/) +addTest('blah', 1, 1, /Unexpected token 'b'/) +addTest('', 1, 1, /No data.*empty input/) + +try { + parse('{{{{{{{{{') +} catch(err) { + var x = err.stack.match(/parseObject/g) + assert(!x || x.length < 2, "shouldn't blow up the stack with internal calls") +} + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_parse.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_parse.js new file mode 100644 index 00000000000..d33e61ee7e3 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_parse.js @@ -0,0 +1,171 @@ +var assert = require('assert') +var parse = require('../').parse + +function addTest(arg, bulk) { + function fn_json5() { + //console.log('testing: ', arg) + try { + var x = parse(arg) + } catch(err) { + x = 'fail' + } + try { + var z = eval('(function(){"use strict"\nreturn ('+String(arg)+'\n)\n})()') + } catch(err) { + z = 'fail' + } + assert.deepEqual(x, z) + } + + function fn_strict() { + //console.log('testing: ', arg) + try { + var x = parse(arg, {mode: 'json'}) + } catch(err) { + x = 'fail' + } + try { + var z = JSON.parse(arg) + } catch(err) { + z = 'fail' + } + assert.deepEqual(x, z) + } + + if (typeof(describe) === 'function' && !bulk) { + it('test_parse_json5: ' + JSON.stringify(arg), fn_json5) + it('test_parse_strict: ' + JSON.stringify(arg), fn_strict) + } else { + fn_json5() + fn_strict() + } +} + +addTest('"\\uaaaa\\u0000\\uFFFF\\uFaAb"') +addTest(' "\\xaa\\x00\xFF\xFa\0\0" ') +addTest('"\\\'\\"\\b\\f\\t\\n\\r\\v"') +addTest('"\\q\\w\\e\\r\\t\\y\\\\i\\o\\p\\[\\/\\\\"') +addTest('"\\\n\\\r\n\\\n"') +addTest('\'\\\n\\\r\n\\\n\'') +addTest(' null') +addTest('true ') +addTest('false') +addTest(' Infinity ') +addTest('+Infinity') +addTest('[]') +addTest('[ 0xA2, 0X024324AaBf]') +addTest('-0x12') +addTest(' [1,2,3,4,5]') +addTest('[1,2,3,4,5,] ') +addTest('[1e-13]') +addTest('[null, true, false]') +addTest(' [1,2,"3,4,",5,]') +addTest('[ 1,\n2,"3,4," \r\n,\n5,]') +addTest('[ 1 , 2 , 3 , 4 , 5 , ]') +addTest('{} ') +addTest('{"2":1,"3":null,}') +addTest('{ "2 " : 1 , "3":null , }') +addTest('{ \"2\" : 25e245 , \"3\": 23 }') +addTest('{"2":1,"3":nul,}') +addTest('{:1,"3":nul,}') +addTest('[1,2] // ssssssssss 3,4,5,] ') +addTest('[1,2 , // ssssssssss \n//xxx\n3,4,5,] ') +addTest('[1,2 /* ssssssssss 3,4,*/ /* */ , 5 ] ') +addTest('[1,2 /* ssssssssss 3,4,*/ /* * , 5 ] ') +addTest('{"3":1,"3":,}') +addTest('{ чйуач:1, щцкшчлм : 4,}') +addTest('{ qef-:1 }') +addTest('{ $$$:1 , ___: 3}') +addTest('{3:1,2:1}') +addTest('{3.4e3:1}') +addTest('{-3e3:1}') +addTest('{+3e3:1}') +addTest('{.3e3:1}') + +for (var i=0; i<200; i++) { + addTest('"' + String.fromCharCode(i) + '"', true) +} + +// strict JSON test cases +addTest('"\\xaa"') +addTest('"\\0"') +addTest('"\0"') +addTest('"\\v"') +addTest('{null: 123}') +addTest("{'null': 123}") + +assert.throws(function() { + parse('0o') +}) + +assert.strictEqual(parse('01234567'), 342391) +assert.strictEqual(parse('0o1234567'), 342391) + +// undef +assert.strictEqual(parse(undefined), undefined) + +// whitespaces +addTest('[1,\r\n2,\r3,\n]') +'\u0020\u00A0\uFEFF\x09\x0A\x0B\x0C\x0D\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000'.split('').forEach(function(x) { + addTest(x+'[1,'+x+'2]'+x) + addTest('"'+x+'"'+x) +}) +'\u000A\u000D\u2028\u2029'.split('').forEach(function(x) { + addTest(x+'[1,'+x+'2]'+x) + addTest('"\\'+x+'"'+x) +}) + +/* weird ES6 stuff, not working + +if (process.version > 'v0.11.7') { + assert(Array.isArray(parse('{__proto__:[]}').__proto__)) + assert.equal(parse('{__proto__:{xxx:5}}').xxx, undefined) + assert.equal(parse('{__proto__:{xxx:5}}').__proto__.xxx, 5) + + var o1 = parse('{"__proto__":[]}') + assert.deepEqual([], o1.__proto__) + assert.deepEqual(["__proto__"], Object.keys(o1)) + assert.deepEqual([], Object.getOwnPropertyDescriptor(o1, "__proto__").value) + assert.deepEqual(["__proto__"], Object.getOwnPropertyNames(o1)) + assert(o1.hasOwnProperty("__proto__")) + assert(Object.prototype.isPrototypeOf(o1)) + + // Parse a non-object value as __proto__. + var o2 = JSON.parse('{"__proto__":5}') + assert.deepEqual(5, o2.__proto__) + assert.deepEqual(["__proto__"], Object.keys(o2)) + assert.deepEqual(5, Object.getOwnPropertyDescriptor(o2, "__proto__").value) + assert.deepEqual(["__proto__"], Object.getOwnPropertyNames(o2)) + assert(o2.hasOwnProperty("__proto__")) + assert(Object.prototype.isPrototypeOf(o2)) +}*/ + +assert.throws(parse.bind(null, "{-1:42}")) + +for (var i=0; i<100; i++) { + var str = '-01.e'.split('') + + var rnd = [1,2,3,4,5].map(function(x) { + x = ~~(Math.random()*str.length) + return str[x] + }).join('') + + try { + var x = parse(rnd) + } catch(err) { + x = 'fail' + } + try { + var y = JSON.parse(rnd) + } catch(err) { + y = 'fail' + } + try { + var z = eval(rnd) + } catch(err) { + z = 'fail' + } + //console.log(rnd, x, y, z) + if (x !== y && x !== z) throw 'ERROR' +} + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_portable.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_portable.js new file mode 100644 index 00000000000..0143e7d8e5b --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_portable.js @@ -0,0 +1,60 @@ +var assert = require('assert') +var FS = require('fs') +var YAML = require('js-yaml') +var jju = require('../') + +function addTest(name, fn) { + if (typeof(describe) === 'function') { + it(name, fn) + } else { + fn() + } +} + +var schema = YAML.Schema.create([ + new YAML.Type('!error', { + kind: 'scalar', + resolve: function (state) { + //state.result = null + return true + }, + }) +]) + +var tests = YAML.safeLoad(FS.readFileSync(__dirname + '/portable-json5-tests.yaml', 'utf8'), { + schema: schema +}) + +if (!Object.is) { + Object.defineProperty(Object, 'is', { + value: function(x, y) { + if (x === y) { + return x !== 0 || 1 / x === 1 / y; + } + return x !== x && y !== y; + }, + configurable: true, + enumerable: false, + writable: true, + }) +} + +for (var k in tests) { + ;(function(k) { + addTest(k, function() { + try { + var result = jju.parse(tests[k].input) + } catch(err) { + result = null + } + + // need deepStrictEqual + if (typeof(result) === 'object') { + assert.deepEqual(result, tests[k].output) + } else { + assert(Object.is(result, tests[k].output), String(result) + ' == ' + tests[k].output) + } + }) + })(k) +} + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_stringify.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_stringify.js new file mode 100644 index 00000000000..c97e38e93c1 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_stringify.js @@ -0,0 +1,89 @@ +var assert = require('assert') +var parse = require('../').parse +var stringify = require('../').stringify + +function deepEqual(x, y) { + if (Number.isNaN(x)) { + return assert(Number.isNaN(y)) + } + assert.deepEqual(x, y) +} + +function addTest(arg, arg2, arg3) { + function fn() { + deepEqual(parse(stringify(arg)), arg2 === undefined ? arg : arg2) + if (arg !== undefined) deepEqual(JSON.parse(stringify(arg, {mode: 'json', indent: false})), (arg3 === undefined ? (arg2 === undefined ? arg : arg2) : arg3)) + } + + if (typeof(describe) === 'function') { + it('test_stringify: ' + JSON.stringify(arg), fn) + } else { + fn() + } +} + +addTest(0) +addTest(-0) +addTest(NaN, undefined, null) +addTest(Infinity, undefined, null) +addTest(-Infinity, undefined, null) +addTest(123) +addTest(19508130958019385.135135) +addTest(-2e123) +addTest(null) +addTest(undefined) +addTest([]) +addTest([,,,,,,,], [null,null,null,null,null,null,null]) +addTest([undefined,null,1,2,3,], [null,null,1,2,3]) +addTest([[[[]]],[[]]]) +addTest({}) +addTest({1:2,3:4}) +addTest({1:{1:{1:{1:4}}}, 3:4}) +addTest({1:undefined, 3:undefined}, {}) +addTest(new Number(4), 4) +addTest(new Boolean(true), true) +addTest(new String('xqefxef'), 'xqefxef') +addTest(new Boolean(), false) + +var r='';for (var i=0; i<5000; i++) {r+=String.fromCharCode(i)} +addTest(r) + +assert.equal("[1, 2, 3]", stringify([1, 2, 3], {indent: 1})) +assert.equal("[1, 2, 3]", stringify([1, 2, 3], {indent: 2})) + +var oddball = Object(42) +oddball.__proto__ = { __proto__: null } +assert.equal('{}', stringify(oddball)) + +/* this WILL throw +var falseNum = Object("37") +falseNum.__proto__ = Number.prototype +assert.equal("{0: '3', 1: '7'}", stringify(falseNum))*/ + +assert.equal(stringify(Infinity), 'Infinity') +assert.equal(stringify(Infinity, {mode: 'json'}), 'null') +assert.equal(stringify(NaN), 'NaN') +assert.equal(stringify(NaN, {mode: 'json'}), 'null') +assert.equal(stringify(-0), '-0') + +assert.equal(stringify('test', null), "'test'") + +var array = [""] +var expected = "''" +for (var i = 0; i < 1000; i++) { + array.push("") + expected = "''," + expected +} +expected = '[' + expected + ']' +assert.equal(expected, stringify(array, {indent: false})) + +assert.strictEqual(stringify([1,2,3], function(){}), undefined) + +// don't stringify prototype +assert.equal('{a: 1}', stringify({a:1,__proto__:{b:2}})) + +// sort keys tests +assert.equal('{a: 1, b: 2, z: 3}', stringify({b:2,a:1,z:3}, {sort_keys: 1})) +assert.equal('{a: 1, b: {a: 2, b: 5, c: 1}, z: 3}', stringify({b:{c:1,a:2,b:5},a:1,z:3}, {sort_keys: 1})) +assert.equal('{a: [3, 5, 1], b: 2, z: 3}', stringify({b:2,a:[3,5,1],z:3}, {sort_keys: 1})) +assert.equal('{b: 2, a: 1, z: 3}', stringify({b:2,a:1,z:3}, {sort_keys: 0})) diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_tokenize.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_tokenize.js new file mode 100644 index 00000000000..64fb7ec93d9 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_tokenize.js @@ -0,0 +1,99 @@ +var assert = require('assert') +var parse = require('../').parse + +function tokenize(arg) { + var result = [] + parse(arg, {_tokenize: function(smth) { + result.push(smth) + }}) + assert.deepEqual(result.map(function(x){return x.raw}).join(''), arg) + return result +} + +function addTest(x, exp) { + function fn(){assert.deepEqual(tokenize(x), exp)} + + if (typeof(describe) === 'function') { + it('test_tokenize: ' + JSON.stringify(x), fn) + } else { + fn() + } +} + +addTest('123', [ { raw: '123', value: 123, type: 'literal', stack: [] }]) + +addTest(' /* zz */\r\n true /* zz */\n', +[ { raw: ' ', type: 'whitespace', stack: [] }, + { raw: '/* zz */', type: 'comment', stack: [] }, + { raw: '\r\n', type: 'newline', stack: [] }, + { raw: ' ', type: 'whitespace', stack: [] }, + { raw: 'true', type: 'literal', value: true, stack: [] }, + { raw: ' ', type: 'whitespace', stack: [] }, + { raw: '/* zz */', type: 'comment', stack: [] }, + { raw: '\n', type: 'newline', stack: [] } ]) + +addTest('{q:123, w : /*zz*/\n\r 345 } ', +[ { raw: '{', type: 'separator', stack: [] }, + { raw: 'q', type: 'key', value: 'q', stack: [] }, + { raw: ':', type: 'separator', stack: [] }, + { raw: '123', type: 'literal', value: 123, stack: ['q'] }, + { raw: ',', type: 'separator', stack: [] }, + { raw: ' ', type: 'whitespace', stack: [] }, + { raw: 'w', type: 'key', value: 'w', stack: [] }, + { raw: ' ', type: 'whitespace', stack: [] }, + { raw: ':', type: 'separator', stack: [] }, + { raw: ' ', type: 'whitespace', stack: [] }, + { raw: '/*zz*/', type: 'comment', stack: [] }, + { raw: '\n', type: 'newline', stack: [] }, + { raw: '\r', type: 'newline', stack: [] }, + { raw: ' ', type: 'whitespace', stack: [] }, + { raw: '345', type: 'literal', value: 345, stack: ['w'] }, + { raw: ' ', type: 'whitespace', stack: [] }, + { raw: '}', type: 'separator', stack: [] }, + { raw: ' ', type: 'whitespace', stack: [] } ]) + +addTest('null /* */// xxx\n//xxx', +[ { raw: 'null', type: 'literal', value: null, stack: [] }, + { raw: ' ', type: 'whitespace', stack: [] }, + { raw: '/* */', type: 'comment', stack: [] }, + { raw: '// xxx', type: 'comment', stack: [] }, + { raw: '\n', type: 'newline', stack: [] }, + { raw: '//xxx', type: 'comment', stack: [] } ]) + +addTest('[1,2,[[],[1]],{},{1:2},{q:{q:{}}},]', +[ { raw: '[', type: 'separator', stack: [] }, + { raw: '1', type: 'literal', value: 1, stack: [0] }, + { raw: ',', type: 'separator', stack: [] }, + { raw: '2', type: 'literal', value: 2, stack: [1] }, + { raw: ',', type: 'separator', stack: [] }, + { raw: '[', type: 'separator', stack: [2] }, + { raw: '[', type: 'separator', stack: [2,0] }, + { raw: ']', type: 'separator', stack: [2,0] }, + { raw: ',', type: 'separator', stack: [2] }, + { raw: '[', type: 'separator', stack: [2,1] }, + { raw: '1', type: 'literal', value: 1, stack: [2,1,0] }, + { raw: ']', type: 'separator', stack: [2,1] }, + { raw: ']', type: 'separator', stack: [2] }, + { raw: ',', type: 'separator', stack: [] }, + { raw: '{', type: 'separator', stack: [3] }, + { raw: '}', type: 'separator', stack: [3] }, + { raw: ',', type: 'separator', stack: [] }, + { raw: '{', type: 'separator', stack: [4] }, + { raw: '1', type: 'key', value: 1, stack: [4] }, + { raw: ':', type: 'separator', stack: [4] }, + { raw: '2', type: 'literal', value: 2, stack: [4,'1'] }, + { raw: '}', type: 'separator', stack: [4] }, + { raw: ',', type: 'separator', stack: [] }, + { raw: '{', type: 'separator', stack: [5] }, + { raw: 'q', type: 'key', value: 'q', stack: [5] }, + { raw: ':', type: 'separator', stack: [5] }, + { raw: '{', type: 'separator', stack: [5,'q'] }, + { raw: 'q', type: 'key', value: 'q', stack: [5,'q'] }, + { raw: ':', type: 'separator', stack: [5,'q'] }, + { raw: '{', type: 'separator', stack: [5,'q','q'] }, + { raw: '}', type: 'separator', stack: [5,'q','q'] }, + { raw: '}', type: 'separator', stack: [5,'q'] }, + { raw: '}', type: 'separator', stack: [5] }, + { raw: ',', type: 'separator', stack: [] }, + { raw: ']', type: 'separator', stack: [] } ]) + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_updates.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_updates.js new file mode 100644 index 00000000000..b7482519a91 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/test_updates.js @@ -0,0 +1,22 @@ +var assert = require('assert') +var FS = require('fs') +var YAML = require('js-yaml') +var jju = require('../') + +function addTest(name, fn) { + if (typeof(describe) === 'function') { + it(name, fn) + } else { + fn() + } +} + +FS.readdirSync(__dirname + '/update').filter(function(file) { + return file.match(/^[^\.].*\.yaml$/) +}).forEach(function(file) { + addTest('update: ' + file, function() { + var test = YAML.load(FS.readFileSync(__dirname + '/update/' + file, 'utf8')) + assert.strictEqual(test.test(jju, test.input), test.output) + }) +}) + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/author.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/author.yaml new file mode 100644 index 00000000000..4b08bb61b49 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/author.yaml @@ -0,0 +1,31 @@ +input: | + { "name": "just-a-demo", + "version": "0.1.2", + "description": "blahblahblah", + "main": "test.js", + "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, + "author": "John Doe ", + "license": "BSD-2-Clause" } + +output: | + { "name": "just-a-demo", + "version": "0.1.2", + "description": "blahblahblah", + "main": "test.js", + "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, + "author": { + "name": "John Doe", + "email": "whoever@google.com" + }, + "license": "BSD-2-Clause" } + +test: !!js/function | + function(jju, input) { + obj = jju.parse(input) + obj.author = { + name: 'John Doe', + email: 'whoever@google.com', + } + return jju.update(input, obj) + } + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/deep-object.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/deep-object.yaml new file mode 100644 index 00000000000..e0795a37874 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/deep-object.yaml @@ -0,0 +1,36 @@ +input: | + { + "foo": { + "bar": { + "baz": { + "quux": "4" + } + } + } + } + +output: | + { + "foo": { + "bar": { + "baz": { + "quux": "4" + }, + "qwe": { + "rty": { + "aaa": { + "bbb": 1 + } + } + } + } + } + } + +test: !!js/function | + function(jju, input) { + obj = jju.parse(input) + obj.foo.bar.qwe = {rty: {aaa: {bbb: 1}}} + return jju.update(input, obj, {mode:'json'}) + } + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/delete.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/delete.yaml new file mode 100644 index 00000000000..b964715d37b --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/delete.yaml @@ -0,0 +1,36 @@ +input: | + { + "name": "test", + "version": "0.0.0", + "dependencies": { + "foo": "1.2.x", + "bar": ">= 1" + }, + "bundleDependencies": [ + "foo", + "bar" + ], + "license": "BSD-2-Clause" + } + +output: | + { + "name": "test", + "version": "0.0.0", + "dependencies": { + "foo": "1.2.x" + }, + "bundleDependencies": [ + "foo" + ], + "license": "BSD-2-Clause" + } + +test: !!js/function | + function(jju, input) { + obj = jju.parse(input) + obj.bundleDependencies.pop() + delete obj.dependencies.bar + return jju.update(input, obj, {mode:'json'}) + } + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/norm-array.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/norm-array.yaml new file mode 100644 index 00000000000..c5b9dd952d1 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/norm-array.yaml @@ -0,0 +1,32 @@ +input: | + { + "name": "test", + "version": "0.0.0", + "bundleDependencies": [ + "foo", + "bar" + ], + "license": "BSD-2-Clause" + } + +output: | + { + "name": "test", + "version": "0.0.0", + "bundleDependencies": [ + "foo", + "bar", + "baz", + "quux" + ], + "license": "BSD-2-Clause" + } + +test: !!js/function | + function(jju, input) { + obj = jju.parse(input) + obj.bundleDependencies.push('baz') + obj.bundleDependencies.push('quux') + return jju.update(input, obj, {mode:'json'}) + } + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/norm-object.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/norm-object.yaml new file mode 100644 index 00000000000..93878675b7a --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/norm-object.yaml @@ -0,0 +1,32 @@ +input: | + { + "name": "test", + "version": "0.0.0", + "dependencies": { + "foobar": "*", + "bazquux": ">= 1.1.1" + }, + "license": "BSD-2-Clause" + } + +output: | + { + "name": "test", + "version": "0.0.0", + "dependencies": { + "foobar": "*", + "bazquux": ">= 1.1.1", + "whatever": "1.2.x", + "qwerty": "1" + }, + "license": "BSD-2-Clause" + } + +test: !!js/function | + function(jju, input) { + obj = jju.parse(input) + obj.dependencies.whatever = '1.2.x' + obj.dependencies.qwerty = '1' + return jju.update(input, obj, {mode:'json'}) + } + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/npm-array-bin.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/npm-array-bin.yaml new file mode 100644 index 00000000000..35e1639bfda --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/npm-array-bin.yaml @@ -0,0 +1,29 @@ +input: | + { "name":"npm-test-array-bin" + , "version":"1.2.5" + , "bin": [ "bin/array-bin" ] + , "scripts": { "test": "node test.js" } } + +# less than ideal, I know... +output: | + { "name":"npm-test-array-bin" + , "version":"1.2.5" + , "bin": {"array-bin":"bin/array-bin"} + , "scripts": { "test": "node test.js" }, "readme": "just an npm test\n", "readmeFilename": "README", "description": "just an npm test", "_id": "npm-test-array-bin@1.2.5", "dist": {"shasum":"9c426a1bd55e98718ab4ddcc01fa57ea83c649f1"}, "_from": "npm-test-array-bin/" } + +test: !!js/function | + function(jju, input) { + obj = + { name: 'npm-test-array-bin', + version: '1.2.5', + bin: { 'array-bin': 'bin/array-bin' }, + scripts: { test: 'node test.js' }, + readme: 'just an npm test\n', + readmeFilename: 'README', + description: 'just an npm test', + _id: 'npm-test-array-bin@1.2.5', + dist: { shasum: '9c426a1bd55e98718ab4ddcc01fa57ea83c649f1' }, + _from: 'npm-test-array-bin/' } + return jju.update(input, obj) + } + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/pkg-json5.yaml b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/pkg-json5.yaml new file mode 100644 index 00000000000..21a5c6eb141 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/node_modules/jju/test/update/pkg-json5.yaml @@ -0,0 +1,36 @@ +input: | + // vim:syntax=javascript + { + name: 'yapm', + version: '1.1.0-1325', // upstream npm@1.3.25 + description: 'A package manager for node (npm fork)', + } + +output: | + // vim:syntax=javascript + { + name: 'yapm', + version: '1.1.0-1325', // upstream npm@1.3.25 + description: 'A package manager for node (npm fork)', + _id: 'yapm@1.1.0-1325', + dist: { + shasum: 'd5aa31c1ad00c1e7e57e07cea1b22c1806a47111', + }, + _from: './zzz', + } + +test: !!js/function | + function(jju, input) { + var upd = { + "name": "yapm", + "version": "1.1.0-1325", + "description": "A package manager for node (npm fork)", + "_id": "yapm@1.1.0-1325", + "dist": { + "shasum": "d5aa31c1ad00c1e7e57e07cea1b22c1806a47111" + }, + "_from": "./zzz" + } + return jju.update(input, upd) + } + diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/package.json b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/package.json new file mode 100644 index 00000000000..9ebc2ff8a6a --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/package.json @@ -0,0 +1,61 @@ +{ + "name": "json-parse-helpfulerror", + "version": "1.0.3", + "description": "A drop-in replacement for JSON.parse that uses `jju` to give helpful errors", + "main": "index.js", + "scripts": { + "test": "lab -c", + "lint": "jslint --edition=latest --terse *.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/smikes/json-parse-helpfulerror.git" + }, + "keywords": [ + "json", + "parse", + "line", + "doublequote", + "error" + ], + "author": { + "name": "Sam Mikes", + "email": "smikes@cubane.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/smikes/json-parse-helpfulerror/issues" + }, + "homepage": "https://github.com/smikes/json-parse-helpfulerror", + "devDependencies": { + "code": "^1.2.1", + "jslint": "^0.7.1", + "lab": "^5.1.1" + }, + "dependencies": { + "jju": "^1.1.0" + }, + "gitHead": "eedb116ec96b5c479be3919b526d6de0a521be5e", + "_id": "json-parse-helpfulerror@1.0.3", + "_shasum": "13f14ce02eed4e981297b64eb9e3b932e2dd13dc", + "_from": "json-parse-helpfulerror@>=1.0.2 <2.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "smikes", + "email": "smikes@cubane.com" + }, + "maintainers": [ + { + "name": "smikes", + "email": "smikes@cubane.com" + } + ], + "dist": { + "shasum": "13f14ce02eed4e981297b64eb9e3b932e2dd13dc", + "tarball": "http://registry.npmjs.org/json-parse-helpfulerror/-/json-parse-helpfulerror-1.0.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/json-parse-helpfulerror/-/json-parse-helpfulerror-1.0.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/test/test.js b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/test/test.js new file mode 100644 index 00000000000..fca458ac080 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/node_modules/json-parse-helpfulerror/test/test.js @@ -0,0 +1,32 @@ +var Code = require('code'), + Lab = require('lab'), + lab = Lab.script(), + jph = require('..'); // 'json-parse-helpfulerror' + +exports.lab = lab; + +lab.test('can parse', function (done) { + var o = jph.parse('{"foo": "bar"}'); + + Code.expect(o.foo).to.equal('bar'); + done(); +}); + +lab.test('helpful error for bad JSON', function (done) { + + var bad = "{'foo': 'bar'}"; + + Code.expect(function () { JSON.parse(bad) }).to.throw(); + + Code.expect(function () { jph.parse(bad) }).to.throw(SyntaxError, "Unexpected token '\\'' at 1:2\n" + bad + '\n ^'); + + done(); +}); + +lab.test('fails if reviver throws', function (done) { + function badReviver() { throw new ReferenceError('silly'); } + + Code.expect(function () { jph.parse('3', badReviver) }).to.throw(ReferenceError, 'silly'); + + done(); +}); \ No newline at end of file diff --git a/deps/npm/node_modules/read-package-json/package.json b/deps/npm/node_modules/read-package-json/package.json index 1fd2f674f78..e83b1f08903 100644 --- a/deps/npm/node_modules/read-package-json/package.json +++ b/deps/npm/node_modules/read-package-json/package.json @@ -1,6 +1,6 @@ { "name": "read-package-json", - "version": "1.2.7", + "version": "2.0.0", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -13,50 +13,30 @@ }, "main": "read-json.js", "scripts": { - "test": "tap test/*.js" + "test": "standard && tap test/*.js" }, "dependencies": { - "github-url-from-git": "^1.3.0", - "github-url-from-username-repo": "~1.0.0", - "glob": "^4.0.2", - "lru-cache": "2", - "normalize-package-data": "^1.0.0", + "glob": "^5.0.3", + "json-parse-helpfulerror": "^1.0.2", + "normalize-package-data": "^2.0.0", "graceful-fs": "2 || 3" }, "devDependencies": { - "tap": "~0.2.5" + "standard": "^3.3.1", + "tap": "^0.7.1" }, "optionalDependencies": { "graceful-fs": "2 || 3" }, "license": "ISC", - "gitHead": "41d6696c527e32a1cb38ebf0b6fc91b489b0499c", + "gitHead": "1a0476fef4ed8a70b48bfdc90070d897b8ad5469", + "readme": "# read-package-json\n\nThis is the thing that npm uses to read package.json files. It\nvalidates some stuff, and loads some default things.\n\nIt keeps a cache of the files you've read, so that you don't end\nup reading the same package.json file multiple times.\n\nNote that if you just want to see what's literally in the package.json\nfile, you can usually do `var data = require('some-module/package.json')`.\n\nThis module is basically only needed by npm, but it's handy to see what\nnpm will see when it looks at your package.\n\n## Usage\n\n```javascript\nvar readJson = require('read-package-json')\n\n// readJson(filename, [logFunction=noop], [strict=false], cb)\nreadJson('/path/to/package.json', console.error, false, function (er, data) {\n if (er) {\n console.error(\"There was an error reading the file\")\n return\n }\n\n console.error('the package data is', data)\n});\n```\n\n## readJson(file, [logFn = noop], [strict = false], cb)\n\n* `file` {String} The path to the package.json file\n* `logFn` {Function} Function to handle logging. Defaults to a noop.\n* `strict` {Boolean} True to enforce SemVer 2.0 version strings, and\n other strict requirements.\n* `cb` {Function} Gets called with `(er, data)`, as is The Node Way.\n\nReads the JSON file and does the things.\n\n## `package.json` Fields\n\nSee `man 5 package.json` or `npm help json`.\n\n## readJson.log\n\nBy default this is a reference to the `npmlog` module. But if that\nmodule can't be found, then it'll be set to just a dummy thing that does\nnothing.\n\nReplace with your own `{log,warn,error}` object for fun loggy time.\n\n## readJson.extras(file, data, cb)\n\nRun all the extra stuff relative to the file, with the parsed data.\n\nModifies the data as it does stuff. Calls the cb when it's done.\n\n## readJson.extraSet = [fn, fn, ...]\n\nArray of functions that are called by `extras`. Each one receives the\narguments `fn(file, data, cb)` and is expected to call `cb(er, data)`\nwhen done or when an error occurs.\n\nOrder is indeterminate, so each function should be completely\nindependent.\n\nMix and match!\n\n## readJson.cache\n\nThe `lru-cache` object that readJson uses to not read the same file over\nand over again. See\n[lru-cache](https://github.com/isaacs/node-lru-cache) for details.\n\n## Other Relevant Files Besides `package.json`\n\nSome other files have an effect on the resulting data object, in the\nfollowing ways:\n\n### `README?(.*)`\n\nIf there is a `README` or `README.*` file present, then npm will attach\na `readme` field to the data with the contents of this file.\n\nOwing to the fact that roughly 100% of existing node modules have\nMarkdown README files, it will generally be assumed to be Markdown,\nregardless of the extension. Please plan accordingly.\n\n### `server.js`\n\nIf there is a `server.js` file, and there is not already a\n`scripts.start` field, then `scripts.start` will be set to `node\nserver.js`.\n\n### `AUTHORS`\n\nIf there is not already a `contributors` field, then the `contributors`\nfield will be set to the contents of the `AUTHORS` file, split by lines,\nand parsed.\n\n### `bindings.gyp`\n\nIf a bindings.gyp file exists, and there is not already a\n`scripts.install` field, then the `scripts.install` field will be set to\n`node-gyp rebuild`.\n\n### `wscript`\n\nIf a wscript file exists, and there is not already a `scripts.install`\nfield, then the `scripts.install` field will be set to `node-waf clean ;\nnode-waf configure build`.\n\nNote that the `bindings.gyp` file supercedes this, since node-waf has\nbeen deprecated in favor of node-gyp.\n\n### `index.js`\n\nIf the json file does not exist, but there is a `index.js` file\npresent instead, and that file has a package comment, then it will try\nto parse the package comment, and use that as the data instead.\n\nA package comment looks like this:\n\n```javascript\n/**package\n * { \"name\": \"my-bare-module\"\n * , \"version\": \"1.2.3\"\n * , \"description\": \"etc....\" }\n **/\n\n// or...\n\n/**package\n{ \"name\": \"my-bare-module\"\n, \"version\": \"1.2.3\"\n, \"description\": \"etc....\" }\n**/\n```\n\nThe important thing is that it starts with `/**package`, and ends with\n`**/`. If the package.json file exists, then the index.js is not\nparsed.\n\n### `{directories.man}/*.[0-9]`\n\nIf there is not already a `man` field defined as an array of files or a\nsingle file, and\nthere is a `directories.man` field defined, then that directory will\nbe searched for manpages.\n\nAny valid manpages found in that directory will be assigned to the `man`\narray, and installed in the appropriate man directory at package install\ntime, when installed globally on a Unix system.\n\n### `{directories.bin}/*`\n\nIf there is not already a `bin` field defined as a string filename or a\nhash of ` : ` pairs, then the `directories.bin`\ndirectory will be searched and all the files within it will be linked as\nexecutables at install time.\n\nWhen installing locally, npm links bins into `node_modules/.bin`, which\nis in the `PATH` environ when npm runs scripts. When\ninstalling globally, they are linked into `{prefix}/bin`, which is\npresumably in the `PATH` environment variable.\n", + "readmeFilename": "README.md", "bugs": { "url": "https://github.com/isaacs/read-package-json/issues" }, "homepage": "https://github.com/isaacs/read-package-json", - "_id": "read-package-json@1.2.7", - "_shasum": "f0b440c461a218f4dbf48b094e80fc65c5248502", - "_from": "read-package-json@>=1.2.7-0 <1.3.0-0", - "_npmVersion": "2.0.0-beta.0", - "_npmUser": { - "name": "othiym23", - "email": "ogd@aoaioxxysz.net" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - }, - { - "name": "othiym23", - "email": "ogd@aoaioxxysz.net" - } - ], - "dist": { - "shasum": "f0b440c461a218f4dbf48b094e80fc65c5248502", - "tarball": "http://registry.npmjs.org/read-package-json/-/read-package-json-1.2.7.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-1.2.7.tgz" + "_id": "read-package-json@2.0.0", + "_shasum": "ca7543298275028d27064b9118e6e501c9b3ae41", + "_from": "read-package-json@>=2.0.0 <2.1.0" } diff --git a/deps/npm/node_modules/read-package-json/read-json.js b/deps/npm/node_modules/read-package-json/read-json.js index acb7d62d815..3f93603f89b 100644 --- a/deps/npm/node_modules/read-package-json/read-json.js +++ b/deps/npm/node_modules/read-package-json/read-json.js @@ -1,382 +1,383 @@ -// vim: set softtabstop=16 shiftwidth=16: - +var fs try { - var fs = require("graceful-fs") + fs = require('graceful-fs') } catch (er) { - var fs = require("fs") + fs = require('fs') } +var path = require('path') -module.exports = readJson +var glob = require('glob') +var normalizeData = require('normalize-package-data') +var safeJSON = require('json-parse-helpfulerror') -var LRU = require("lru-cache") -readJson.cache = new LRU({max: 1000}) -var path = require("path") -var glob = require("glob") -var normalizeData = require("normalize-package-data") +module.exports = readJson // put more stuff on here to customize. readJson.extraSet = [ - gypfile, - serverjs, - scriptpath, - authors, - readme, - mans, - bins, - githead + gypfile, + serverjs, + scriptpath, + authors, + readme, + mans, + bins, + githead ] var typoWarned = {} - function readJson (file, log_, strict_, cb_) { - var log, strict, cb - for (var i = 1; i < arguments.length - 1; i++) { - if (typeof arguments[i] === 'boolean') - strict = arguments[i] - else if (typeof arguments[i] === 'function') - log = arguments[i] - } - if (!log) log = function () {}; - cb = arguments[ arguments.length - 1 ] - - var c = readJson.cache.get(file) - if (c) { - cb = cb.bind(null, null, c) - return process.nextTick(cb); - } - cb = (function (orig) { return function (er, data) { - if (data) readJson.cache.set(file, data); - return orig(er, data) - } })(cb) - readJson_(file, log, strict, cb) + var log, strict, cb + for (var i = 1; i < arguments.length - 1; i++) { + if (typeof arguments[i] === 'boolean') { + strict = arguments[i] + } else if (typeof arguments[i] === 'function') { + log = arguments[i] + } + } + + if (!log) log = function () {} + cb = arguments[ arguments.length - 1 ] + + readJson_(file, log, strict, cb) } - function readJson_ (file, log, strict, cb) { - fs.readFile(file, "utf8", function (er, d) { - parseJson(file, er, d, log, strict, cb) - }) + fs.readFile(file, 'utf8', function (er, d) { + parseJson(file, er, d, log, strict, cb) + }) } - -function stripBOM(content) { - // Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) - // because the buffer-to-string conversion in `fs.readFileSync()` - // translates it to FEFF, the UTF-16 BOM. - if (content.charCodeAt(0) === 0xFEFF) { - content = content.slice(1); - } - return content; +function stripBOM (content) { + // Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + // because the buffer-to-string conversion in `fs.readFileSync()` + // translates it to FEFF, the UTF-16 BOM. + if (content.charCodeAt(0) === 0xFEFF) content = content.slice(1) + return content } - function parseJson (file, er, d, log, strict, cb) { - if (er && er.code === "ENOENT") { - indexjs(file, er, log, strict, cb) - return - } - if (er) return cb(er); - try { - d = JSON.parse(stripBOM(d)) - } catch (er) { - d = parseIndex(d) - if (!d) return cb(parseError(er, file)); - } - extras(file, d, log, strict, cb) -} + if (er && er.code === 'ENOENT') return indexjs(file, er, log, strict, cb) + if (er) return cb(er) + try { + d = safeJSON.parse(stripBOM(d)) + } catch (er) { + d = parseIndex(d) + if (!d) return cb(parseError(er, file)) + } -function indexjs (file, er, log, strict, cb) { - if (path.basename(file) === "index.js") { - return cb(er); - } - var index = path.resolve(path.dirname(file), "index.js") - fs.readFile(index, "utf8", function (er2, d) { - if (er2) return cb(er); - d = parseIndex(d) - if (!d) return cb(er); - extras(file, d, log, strict, cb) - }) + extras(file, d, log, strict, cb) } +function indexjs (file, er, log, strict, cb) { + if (path.basename(file) === 'index.js') return cb(er) + + var index = path.resolve(path.dirname(file), 'index.js') + fs.readFile(index, 'utf8', function (er2, d) { + if (er2) return cb(er) + + d = parseIndex(d) + if (!d) return cb(er) + + extras(file, d, log, strict, cb) + }) +} readJson.extras = extras function extras (file, data, log_, strict_, cb_) { - var log, strict, cb - for (var i = 2; i < arguments.length - 1; i++) { - if (typeof arguments[i] === 'boolean') - strict = arguments[i] - else if (typeof arguments[i] === 'function') - log = arguments[i] - } - if (!log) log = function () {}; - cb = arguments[i] - var set = readJson.extraSet - var n = set.length - var errState = null - set.forEach(function (fn) { - fn(file, data, then) - }) - function then(er) { - if (errState) return; - if (er) return cb(errState = er); - if (--n > 0) return; - final(file, data, log, strict, cb); - } + var log, strict, cb + for (var i = 2; i < arguments.length - 1; i++) { + if (typeof arguments[i] === 'boolean') { + strict = arguments[i] + } else if (typeof arguments[i] === 'function') { + log = arguments[i] + } + } + + if (!log) log = function () {} + cb = arguments[i] + + var set = readJson.extraSet + var n = set.length + var errState = null + set.forEach(function (fn) { + fn(file, data, then) + }) + + function then (er) { + if (errState) return + if (er) return cb(errState = er) + if (--n > 0) return + final(file, data, log, strict, cb) + } } function scriptpath (file, data, cb) { - if (!data.scripts) return cb(null, data); - var k = Object.keys(data.scripts) - k.forEach(scriptpath_, data.scripts) - cb(null, data); + if (!data.scripts) return cb(null, data) + var k = Object.keys(data.scripts) + k.forEach(scriptpath_, data.scripts) + cb(null, data) } -function scriptpath_(key) { - s = this[key] - // This is never allowed, and only causes problems - if (typeof s !== 'string') - return delete this[key] - var spre = /^(\.[\/\\])?node_modules[\/\\].bin[\\\/]/ - if (s.match(spre)) - this[key] = this[key].replace(spre, '') + +function scriptpath_ (key) { + var s = this[key] + // This is never allowed, and only causes problems + if (typeof s !== 'string') return delete this[key] + + var spre = /^(\.[\/\\])?node_modules[\/\\].bin[\\\/]/ + if (s.match(spre)) { + this[key] = this[key].replace(spre, '') + } } function gypfile (file, data, cb) { - var dir = path.dirname(file) - var s = data.scripts || {} - if (s.install || s.preinstall) - return cb(null, data); - glob("*.gyp", { cwd: dir }, function (er, files) { - if (er) return cb(er); - gypfile_(file, data, files, cb) - }) + var dir = path.dirname(file) + var s = data.scripts || {} + if (s.install || s.preinstall) return cb(null, data) + + glob('*.gyp', { cwd: dir }, function (er, files) { + if (er) return cb(er) + gypfile_(file, data, files, cb) + }) } function gypfile_ (file, data, files, cb) { - if (!files.length) return cb(null, data); - var s = data.scripts || {} - s.install = "node-gyp rebuild" - data.scripts = s - data.gypfile = true - return cb(null, data); + if (!files.length) return cb(null, data) + var s = data.scripts || {} + s.install = 'node-gyp rebuild' + data.scripts = s + data.gypfile = true + return cb(null, data) } function serverjs (file, data, cb) { - var dir = path.dirname(file) - var s = data.scripts || {} - if (s.start) return cb(null, data) - glob("server.js", { cwd: dir }, function (er, files) { - if (er) return cb(er); - serverjs_(file, data, files, cb) - }) + var dir = path.dirname(file) + var s = data.scripts || {} + if (s.start) return cb(null, data) + glob('server.js', { cwd: dir }, function (er, files) { + if (er) return cb(er) + serverjs_(file, data, files, cb) + }) } + function serverjs_ (file, data, files, cb) { - if (!files.length) return cb(null, data); - var s = data.scripts || {} - s.start = "node server.js" - data.scripts = s - return cb(null, data) + if (!files.length) return cb(null, data) + var s = data.scripts || {} + s.start = 'node server.js' + data.scripts = s + return cb(null, data) } function authors (file, data, cb) { - if (data.contributors) return cb(null, data); - var af = path.resolve(path.dirname(file), "AUTHORS") - fs.readFile(af, "utf8", function (er, ad) { - // ignore error. just checking it. - if (er) return cb(null, data); - authors_(file, data, ad, cb) - }) + if (data.contributors) return cb(null, data) + var af = path.resolve(path.dirname(file), 'AUTHORS') + fs.readFile(af, 'utf8', function (er, ad) { + // ignore error. just checking it. + if (er) return cb(null, data) + authors_(file, data, ad, cb) + }) } + function authors_ (file, data, ad, cb) { - ad = ad.split(/\r?\n/g).map(function (line) { - return line.replace(/^\s*#.*$/, '').trim() - }).filter(function (line) { - return line - }) - data.contributors = ad - return cb(null, data) + ad = ad.split(/\r?\n/g).map(function (line) { + return line.replace(/^\s*#.*$/, '').trim() + }).filter(function (line) { + return line + }) + data.contributors = ad + return cb(null, data) } -var defDesc = "Unnamed repository; edit this file " + - "'description' to name the repository." -function gitDescription (file, data, cb) { - if (data.description) return cb(null, data); - var dir = path.dirname(file) - // just cuz it'd be nice if this file mattered... - var gitDesc = path.resolve(dir, '.git/description') - fs.readFile(gitDesc, 'utf8', function (er, desc) { - if (desc) desc = desc.trim() - if (!er && desc !== defDesc) - data.description = desc - return cb(null, data) - }) +function readme (file, data, cb) { + if (data.readme) return cb(null, data) + var dir = path.dirname(file) + var globOpts = { cwd: dir, nocase: true, mark: true } + glob('{README,README.*}', globOpts, function (er, files) { + if (er) return cb(er) + // don't accept directories. + files = files.filter(function (file) { + return !file.match(/\/$/) + }) + if (!files.length) return cb() + var fn = preferMarkdownReadme(files) + var rm = path.resolve(dir, fn) + readme_(file, data, rm, cb) + }) } -function readmeDescription (file, data) { - if (data.description) return cb(null, data); - var d = data.readme - if (!d) return; - // the first block of text before the first heading - // that isn't the first line heading - d = d.trim().split('\n') - for (var s = 0; d[s] && d[s].trim().match(/^(#|$)/); s ++); - var l = d.length - for (var e = s + 1; e < l && d[e].trim(); e ++); - data.description = d.slice(s, e).join(' ').trim() +function preferMarkdownReadme (files) { + var fallback = 0 + var re = /\.m?a?r?k?d?o?w?n?$/i + for (var i = 0; i < files.length; i++) { + if (files[i].match(re)) { + return files[i] + } else if (files[i].match(/README$/)) { + fallback = i + } + } + // prefer README.md, followed by README; otherwise, return + // the first filename (which could be README) + return files[fallback] } -function readme (file, data, cb) { - if (data.readme) return cb(null, data); - var dir = path.dirname(file) - var globOpts = { cwd: dir, nocase: true, mark: true } - glob("{README,README.*}", globOpts, function (er, files) { - if (er) return cb(er); - // don't accept directories. - files = files.filter(function (file) { - return !file.match(/\/$/) - }) - if (!files.length) return cb(); - var fn = preferMarkdownReadme(files) - var rm = path.resolve(dir, fn) - readme_(file, data, rm, cb) - }) -} -function preferMarkdownReadme(files) { - var fallback = 0; - var re = /\.m?a?r?k?d?o?w?n?$/i - for (var i = 0; i < files.length; i++) { - if (files[i].match(re)) - return files[i] - else if (files[i].match(/README$/)) - fallback = i - } - // prefer README.md, followed by README; otherwise, return - // the first filename (which could be README) - return files[fallback]; -} -function readme_(file, data, rm, cb) { - var rmfn = path.basename(rm); - fs.readFile(rm, "utf8", function (er, rm) { - // maybe not readable, or something. - if (er) return cb() - data.readme = rm - data.readmeFilename = rmfn - return cb(er, data) - }) +function readme_ (file, data, rm, cb) { + var rmfn = path.basename(rm) + fs.readFile(rm, 'utf8', function (er, rm) { + // maybe not readable, or something. + if (er) return cb() + data.readme = rm + data.readmeFilename = rmfn + return cb(er, data) + }) } function mans (file, data, cb) { - var m = data.directories && data.directories.man - if (data.man || !m) return cb(null, data); - m = path.resolve(path.dirname(file), m) - glob("**/*.[0-9]", { cwd: m }, function (er, mans) { - if (er) return cb(er); - mans_(file, data, mans, cb) - }) + var m = data.directories && data.directories.man + if (data.man || !m) return cb(null, data) + m = path.resolve(path.dirname(file), m) + glob('**/*.[0-9]', { cwd: m }, function (er, mans) { + if (er) return cb(er) + mans_(file, data, mans, cb) + }) } + function mans_ (file, data, mans, cb) { - var m = data.directories && data.directories.man - data.man = mans.map(function (mf) { - return path.resolve(path.dirname(file), m, mf) - }) - return cb(null, data) + var m = data.directories && data.directories.man + data.man = mans.map(function (mf) { + return path.resolve(path.dirname(file), m, mf) + }) + return cb(null, data) } function bins (file, data, cb) { - if (Array.isArray(data.bin)) { - return bins_(file, data, data.bin, cb) - } - var m = data.directories && data.directories.bin - if (data.bin || !m) return cb(null, data); - m = path.resolve(path.dirname(file), m) - glob("**", { cwd: m }, function (er, bins) { - if (er) return cb(er); - bins_(file, data, bins, cb) - }) + if (Array.isArray(data.bin)) return bins_(file, data, data.bin, cb) + + var m = data.directories && data.directories.bin + if (data.bin || !m) return cb(null, data) + + m = path.resolve(path.dirname(file), m) + glob('**', { cwd: m }, function (er, bins) { + if (er) return cb(er) + bins_(file, data, bins, cb) + }) } + function bins_ (file, data, bins, cb) { - var m = data.directories && data.directories.bin || '.' - data.bin = bins.reduce(function (acc, mf) { - if (mf && mf.charAt(0) !== '.') { - var f = path.basename(mf) - acc[f] = path.join(m, mf) - } - return acc - }, {}) - return cb(null, data) + var m = data.directories && data.directories.bin || '.' + data.bin = bins.reduce(function (acc, mf) { + if (mf && mf.charAt(0) !== '.') { + var f = path.basename(mf) + acc[f] = path.join(m, mf) + } + return acc + }, {}) + return cb(null, data) } function githead (file, data, cb) { - if (data.gitHead) return cb(null, data); - var dir = path.dirname(file) - var head = path.resolve(dir, '.git/HEAD') - fs.readFile(head, 'utf8', function (er, head) { - if (er) return cb(null, data); - githead_(file, data, dir, head, cb) - }) + if (data.gitHead) return cb(null, data) + var dir = path.dirname(file) + var head = path.resolve(dir, '.git/HEAD') + fs.readFile(head, 'utf8', function (er, head) { + if (er) return cb(null, data) + githead_(file, data, dir, head, cb) + }) } + function githead_ (file, data, dir, head, cb) { - if (!head.match(/^ref: /)) { - data.gitHead = head.trim() - return cb(null, data) - } - var headFile = head.replace(/^ref: /, '').trim() - headFile = path.resolve(dir, '.git', headFile) - fs.readFile(headFile, 'utf8', function (er, head) { - if (er || !head) return cb(null, data) - head = head.replace(/^ref: /, '').trim() - data.gitHead = head - return cb(null, data) - }) + if (!head.match(/^ref: /)) { + data.gitHead = head.trim() + return cb(null, data) + } + var headFile = head.replace(/^ref: /, '').trim() + headFile = path.resolve(dir, '.git', headFile) + fs.readFile(headFile, 'utf8', function (er, head) { + if (er || !head) return cb(null, data) + head = head.replace(/^ref: /, '').trim() + data.gitHead = head + return cb(null, data) + }) +} + +/** + * Warn if the bin references don't point to anything. This might be better in + * normalize-package-data if it had access to the file path. + */ +function checkBinReferences_ (file, data, warn, cb) { + if (!(data.bin instanceof Object)) return cb() + + var keys = Object.keys(data.bin) + var keysLeft = keys.length + if (!keysLeft) return cb() + + function handleExists (relName, result) { + keysLeft-- + if (!result) warn('No bin file found at ' + relName) + if (!keysLeft) cb() + } + + keys.forEach(function (key) { + var dirName = path.dirname(file) + var relName = data.bin[key] + var binPath = path.resolve(dirName, relName) + fs.exists(binPath, handleExists.bind(null, relName)) + }) } function final (file, data, log, strict, cb) { - var pId = makePackageId(data) - function warn(msg) { - if (typoWarned[pId]) return; - if (log) log("package.json", pId, msg); - } - try { - normalizeData(data, warn, strict) - } - catch (error) { - return cb(error) - } - typoWarned[pId] = true - readJson.cache.set(file, data) - cb(null, data) + var pId = makePackageId(data) + + function warn (msg) { + if (typoWarned[pId]) return + if (log) log('package.json', pId, msg) + } + + try { + normalizeData(data, warn, strict) + } catch (error) { + return cb(error) + } + + checkBinReferences_(file, data, warn, function () { + typoWarned[pId] = true + cb(null, data) + }) } function makePackageId (data) { - var name = cleanString(data.name) - var ver = cleanString(data.version) - return name + "@" + ver + var name = cleanString(data.name) + var ver = cleanString(data.version) + return name + '@' + ver } -function cleanString(str) { - return (!str || typeof(str) !== "string") ? "" : str.trim() + +function cleanString (str) { + return (!str || typeof (str) !== 'string') ? '' : str.trim() } // /**package { "name": "foo", "version": "1.2.3", ... } **/ function parseIndex (data) { - data = data.split(/^\/\*\*package(?:\s|$)/m) - if (data.length < 2) return null - data = data[1] - data = data.split(/\*\*\/$/m) - if (data.length < 2) return null - data = data[0] - data = data.replace(/^\s*\*/mg, "") - try { - return JSON.parse(data) - } catch (er) { - return null - } + data = data.split(/^\/\*\*package(?:\s|$)/m) + + if (data.length < 2) return null + data = data[1] + data = data.split(/\*\*\/$/m) + + if (data.length < 2) return null + data = data[0] + data = data.replace(/^\s*\*/mg, '') + + try { + return safeJSON.parse(data) + } catch (er) { + return null + } } function parseError (ex, file) { - var e = new Error("Failed to parse json\n"+ex.message) - e.code = "EJSONPARSE" - e.file = file - return e + var e = new Error('Failed to parse json\n' + ex.message) + e.code = 'EJSONPARSE' + e.file = file + return e } diff --git a/deps/npm/node_modules/read-package-json/test/basic.js b/deps/npm/node_modules/read-package-json/test/basic.js index 8590f23c07a..5996c8e4eec 100644 --- a/deps/npm/node_modules/read-package-json/test/basic.js +++ b/deps/npm/node_modules/read-package-json/test/basic.js @@ -1,45 +1,46 @@ -// vim: set softtabstop=16 shiftwidth=16: -var tap = require("tap") -var readJson = require("../") -var path = require("path") -var fs = require("fs") -var readme = fs.readFileSync(path.resolve(__dirname, "../README.md"), "utf8") -var package = require("../package.json") +var fs = require('fs') +var path = require('path') + +var tap = require('tap') + +var readJson = require('../') + +var readme = fs.readFileSync(path.resolve(__dirname, '../README.md'), 'utf8') +var pkg = require('../package.json') var isGit try { - fs.readFileSync(path.resolve(__dirname, '../.git/HEAD')); - isGit = true + fs.readFileSync(path.resolve(__dirname, '../.git/HEAD')) + isGit = true } catch (e) { - isGit = false + isGit = false } -console.error("basic test") -tap.test("basic test", function (t) { - var p = path.resolve(__dirname, "../package.json") - readJson(p, function (er, data) { - if (er) throw er; - basic_(t, data) - }) +tap.test('basic test', function (t) { + var p = path.resolve(__dirname, '../package.json') + readJson(p, function (er, data) { + if (er) throw er + basic_(t, data) + }) }) + function basic_ (t, data) { - t.ok(data) - t.equal(data.version, package.version) - t.equal(data._id, data.name + "@" + data.version) - t.equal(data.name, package.name) - t.type(data.author, "object") - t.equal(data.readme, readme) - t.deepEqual(data.scripts, package.scripts) - t.equal(data.main, package.main) - t.equal(data.readmeFilename, 'README.md') - - if (isGit) t.similar(data.gitHead, /^[a-f0-9]{40}$/); - - // optional deps are folded in. - t.deepEqual(data.optionalDependencies, - package.optionalDependencies) - t.has(data.dependencies, package.optionalDependencies) - t.has(data.dependencies, package.dependencies) - - t.deepEqual(data.devDependencies, package.devDependencies) - t.end() + t.ok(data) + t.equal(data.version, pkg.version) + t.equal(data._id, data.name + '@' + data.version) + t.equal(data.name, pkg.name) + t.type(data.author, 'object') + t.equal(data.readme, readme) + t.deepEqual(data.scripts, pkg.scripts) + t.equal(data.main, pkg.main) + t.equal(data.readmeFilename, 'README.md') + + if (isGit) t.similar(data.gitHead, /^[a-f0-9]{40}$/) + + // optional deps are folded in. + t.deepEqual(data.optionalDependencies, pkg.optionalDependencies) + t.has(data.dependencies, pkg.optionalDependencies) + t.has(data.dependencies, pkg.dependencies) + + t.deepEqual(data.devDependencies, pkg.devDependencies) + t.end() } diff --git a/deps/npm/node_modules/read-package-json/test/bin.js b/deps/npm/node_modules/read-package-json/test/bin.js new file mode 100644 index 00000000000..3e0e0e9be64 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/test/bin.js @@ -0,0 +1,43 @@ +var path = require('path') + +var tap = require('tap') + +var readJson = require('../') + +var createWarningCollector = function () { + var warn = function (msg) { + warn.warnings.push(arguments) + } + warn.warnings = [] + return warn +} + +tap.test('Bin test', function (t) { + var p = path.resolve(__dirname, 'fixtures/bin.json') + var warn = createWarningCollector() + readJson(p, warn, function (er, data) { + t.equals(warn.warnings.length, 0) + t.deepEqual(data.bin, {'bin-test': './bin/echo'}) + t.end() + }) +}) + +tap.test('Bad bin test', function (t) { + var p = path.resolve(__dirname, 'fixtures/badbin.json') + var warn = createWarningCollector() + readJson(p, warn, function (er, data) { + t.equals(warn.warnings.length, 1) + t.equals(warn.warnings[0][2], 'No bin file found at ./bin/typo') + t.end() + }) +}) + +tap.test('Empty bin test', function (t) { + var p = path.resolve(__dirname, 'fixtures/emptybin.json') + var warn = createWarningCollector() + readJson(p, warn, function (er, data) { + t.equals(warn.warnings.length, 0) + t.same(data.bin, {}, 'no mapping to bin because object was empty') + t.end() + }) +}) diff --git a/deps/npm/node_modules/read-package-json/test/bom.js b/deps/npm/node_modules/read-package-json/test/bom.js index 33c4f4a1a99..372a4f4abbd 100644 --- a/deps/npm/node_modules/read-package-json/test/bom.js +++ b/deps/npm/node_modules/read-package-json/test/bom.js @@ -1,19 +1,16 @@ -// vim: set softtabstop=16 shiftwidth=16: -var tap = require("tap") -var readJson = require("../") -var path = require("path") -var fs = require("fs") +var tap = require('tap') +var readJson = require('../') +var path = require('path') -console.error("BOM test") -tap.test("BOM test", function (t) { - var p = path.resolve(__dirname, "fixtures/bom.json") - readJson(p, function (er, data) { - if (er) throw er; - p = path.resolve(__dirname, "fixtures/nobom.json") - readJson(p, function (er, data2) { - if (er) throw er; - t.deepEqual(data, data2) - t.end() - }) - }) +tap.test('BOM test', function (t) { + var p = path.resolve(__dirname, 'fixtures/bom.json') + readJson(p, function (er, data) { + if (er) throw er + p = path.resolve(__dirname, 'fixtures/nobom.json') + readJson(p, function (er, data2) { + if (er) throw er + t.deepEqual(data, data2) + t.end() + }) + }) }) diff --git a/deps/npm/node_modules/read-package-json/test/fixtures/badbin.json b/deps/npm/node_modules/read-package-json/test/fixtures/badbin.json new file mode 100644 index 00000000000..06c57f43bcb --- /dev/null +++ b/deps/npm/node_modules/read-package-json/test/fixtures/badbin.json @@ -0,0 +1,11 @@ +{ + "name": "badbin-test", + "description": "my desc", + "repository": { + "type": "git", + "url": "git://github.com/npm/read-package-json.git" + }, + "version": "0.0.1", + "readme": "hello world", + "bin": "./bin/typo" +} diff --git a/deps/npm/node_modules/read-package-json/test/fixtures/bin.json b/deps/npm/node_modules/read-package-json/test/fixtures/bin.json new file mode 100644 index 00000000000..d47a5270c6e --- /dev/null +++ b/deps/npm/node_modules/read-package-json/test/fixtures/bin.json @@ -0,0 +1,11 @@ +{ + "name": "bin-test", + "description": "my desc", + "repository": { + "type": "git", + "url": "git://github.com/npm/read-package-json.git" + }, + "version": "0.0.1", + "readme": "hello world", + "bin": "./bin/echo" +} diff --git a/deps/npm/node_modules/read-package-json/test/fixtures/bin/echo b/deps/npm/node_modules/read-package-json/test/fixtures/bin/echo new file mode 100644 index 00000000000..aaed878509c --- /dev/null +++ b/deps/npm/node_modules/read-package-json/test/fixtures/bin/echo @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "Hello world" \ No newline at end of file diff --git a/deps/npm/node_modules/read-package-json/test/fixtures/emptybin.json b/deps/npm/node_modules/read-package-json/test/fixtures/emptybin.json new file mode 100644 index 00000000000..5e12ed4e9a7 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/test/fixtures/emptybin.json @@ -0,0 +1,11 @@ +{ + "name": "emptybin-test", + "description": "my desc", + "repository": { + "type": "git", + "url": "git://github.com/npm/read-package-json.git" + }, + "version": "0.0.1", + "readme": "hello world", + "bin": {} +} diff --git a/deps/npm/node_modules/read-package-json/test/fixtures/erroneous.json b/deps/npm/node_modules/read-package-json/test/fixtures/erroneous.json new file mode 100644 index 00000000000..212e37ec864 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/test/fixtures/erroneous.json @@ -0,0 +1,4 @@ +{ + 'wrong': 'kind', + 'of': 'quotes' +} diff --git a/deps/npm/node_modules/read-package-json/test/helpful.js b/deps/npm/node_modules/read-package-json/test/helpful.js new file mode 100644 index 00000000000..f5b1a8b1304 --- /dev/null +++ b/deps/npm/node_modules/read-package-json/test/helpful.js @@ -0,0 +1,12 @@ +var tap = require('tap') +var readJson = require('../') +var path = require('path') +var p = path.resolve(__dirname, 'fixtures/erroneous.json') + +tap.test('erroneous package data', function (t) { + readJson(p, function (er, data) { + t.ok(er instanceof Error) + t.ok(er.message.match(/Unexpected token '\\''/)) + t.end() + }) +}) diff --git a/deps/npm/node_modules/read-package-json/test/non-json.js b/deps/npm/node_modules/read-package-json/test/non-json.js index e8d989b6f69..85186320a89 100644 --- a/deps/npm/node_modules/read-package-json/test/non-json.js +++ b/deps/npm/node_modules/read-package-json/test/non-json.js @@ -1,52 +1,57 @@ -// vim: set softtabstop=16 shiftwidth=16: +var path = require('path') + var tap = require('tap') + var readJson = require('../') -var path = require('path') -var fs = require('fs') -var expect = -{ name: 'read-package-json', + +var expect = { + name: 'read-package-json', version: '0.1.1', - author: - { name: 'Isaac Z. Schlueter', - email: 'i@izs.me', - url: 'http://blog.izs.me/' }, + author: { + name: 'Isaac Z. Schlueter', + email: 'i@izs.me', + url: 'http://blog.izs.me/' + }, description: 'The thing npm uses to read package.json files with semantics and defaults and validation', - repository: - { type: 'git', - url: 'git://github.com/isaacs/read-package-json.git' }, - bugs: {url: "https://github.com/isaacs/read-package-json/issues" }, + repository: { + type: 'git', + url: 'git://github.com/isaacs/read-package-json.git' + }, + bugs: { + url: 'https://github.com/isaacs/read-package-json/issues' + }, main: 'read-json.js', scripts: { test: 'tap test/*.js' }, - dependencies: - { glob: '~3.1.9', - 'lru-cache': '~1.1.0', - semver: '~1.0.14', - slide: '~1.1.3', - npmlog: '0', - 'graceful-fs': '~1.1.8' }, + dependencies: { + glob: '~3.1.9', + 'lru-cache': '~1.1.0', + semver: '~1.0.14', + slide: '~1.1.3', + npmlog: '0', + 'graceful-fs': '~1.1.8' + }, devDependencies: { tap: '~0.2.5' }, - homepage: "https://github.com/isaacs/read-package-json", - optionalDependencies: { npmlog: '0', 'graceful-fs': '~1.1.8' }, + homepage: 'https://github.com/isaacs/read-package-json#readme', + optionalDependencies: { npmlog: '0', 'graceful-fs': '~1.1.8' }, _id: 'read-package-json@0.1.1', - readme: 'ERROR: No README data found!' } + readme: 'ERROR: No README data found!' +} tap.test('from css', function (t) { - var c = path.join(__dirname, 'fixtures', 'not-json.css') - readJson(c, function (er, d) { - t.same(d, expect) - t.end() - }) + var c = path.join(__dirname, 'fixtures', 'not-json.css') + readJson(c, function (er, d) { + t.same(d, expect) + t.end() + }) }) tap.test('from js', function (t) { - readJson(__filename, function (er, d) { - t.same(d, expect) - t.end() - }) + readJson(__filename, function (er, d) { + t.same(d, expect) + t.end() + }) }) - - /**package { "name": "read-package-json", @@ -76,4 +81,3 @@ tap.test('from js', function (t) { } } **/ - diff --git a/deps/npm/node_modules/read-package-json/test/readmes.js b/deps/npm/node_modules/read-package-json/test/readmes.js index 1c1cee1b3c0..c74cafb9250 100644 --- a/deps/npm/node_modules/read-package-json/test/readmes.js +++ b/deps/npm/node_modules/read-package-json/test/readmes.js @@ -1,29 +1,28 @@ -// vim: set softtabstop=16 shiftwidth=16: -var tap = require("tap") -var readJson = require("../") -var path = require("path") -var fs = require("fs") -var p = path.resolve(__dirname, "fixtures/readmes/package.json") +var path = require('path') + +var tap = require('tap') +var p = path.resolve(__dirname, 'fixtures/readmes/package.json') + +var readJson = require('../') var expect = {} var expect = { - "name" : "readmes", - "version" : "99.999.999999999", - "readme" : "*markdown*\n", - "readmeFilename" : "README.md", - "description" : "*markdown*", - "_id" : "readmes@99.999.999999999" + 'name': 'readmes', + 'version': '99.999.999999999', + 'readme': '*markdown*\n', + 'readmeFilename': 'README.md', + 'description': '*markdown*', + '_id': 'readmes@99.999.999999999' } -console.error("readme test") -tap.test("readme test", function (t) { - readJson(p, function (er, data) { - if (er) throw er; - test(t, data) - }) +tap.test('readme test', function (t) { + readJson(p, function (er, data) { + t.ifError(er, 'read README without error') + test(t, data) + }) }) -function test(t, data) { - t.deepEqual(data, expect) - t.end() +function test (t, data) { + t.deepEqual(data, expect) + t.end() } diff --git a/deps/npm/node_modules/read/LICENSE b/deps/npm/node_modules/read/LICENSE new file mode 100644 index 00000000000..19129e315fe --- /dev/null +++ b/deps/npm/node_modules/read/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/read/node_modules/mute-stream/LICENSE b/deps/npm/node_modules/read/node_modules/mute-stream/LICENSE index 0c44ae716db..19129e315fe 100644 --- a/deps/npm/node_modules/read/node_modules/mute-stream/LICENSE +++ b/deps/npm/node_modules/read/node_modules/mute-stream/LICENSE @@ -1,27 +1,15 @@ -Copyright (c) Isaac Z. Schlueter ("Author") -All rights reserved. +The ISC License -The BSD License +Copyright (c) Isaac Z. Schlueter and Contributors -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/read/node_modules/mute-stream/package.json b/deps/npm/node_modules/read/node_modules/mute-stream/package.json index 5e699801fc7..9cdb3028456 100644 --- a/deps/npm/node_modules/read/node_modules/mute-stream/package.json +++ b/deps/npm/node_modules/read/node_modules/mute-stream/package.json @@ -1,6 +1,6 @@ { "name": "mute-stream", - "version": "0.0.4", + "version": "0.0.5", "main": "mute.js", "directories": { "test": "test" @@ -13,7 +13,7 @@ }, "repository": { "type": "git", - "url": "git://github.com/isaacs/mute-stream" + "url": "git://github.com/isaacs/mute-stream.git" }, "keywords": [ "mute", @@ -25,13 +25,31 @@ "email": "i@izs.me", "url": "http://blog.izs.me/" }, - "license": "BSD", + "license": "ISC", "description": "Bytes go in, but they don't come out (when muted).", - "readme": "# mute-stream\n\nBytes go in, but they don't come out (when muted).\n\nThis is a basic pass-through stream, but when muted, the bytes are\nsilently dropped, rather than being passed through.\n\n## Usage\n\n```javascript\nvar MuteStream = require('mute-stream')\n\nvar ms = new MuteStream(options)\n\nms.pipe(process.stdout)\nms.write('foo') // writes 'foo' to stdout\nms.mute()\nms.write('bar') // does not write 'bar'\nms.unmute()\nms.write('baz') // writes 'baz' to stdout\n\n// can also be used to mute incoming data\nvar ms = new MuteStream\ninput.pipe(ms)\n\nms.on('data', function (c) {\n console.log('data: ' + c)\n})\n\ninput.emit('data', 'foo') // logs 'foo'\nms.mute()\ninput.emit('data', 'bar') // does not log 'bar'\nms.unmute()\ninput.emit('data', 'baz') // logs 'baz'\n```\n\n## Options\n\nAll options are optional.\n\n* `replace` Set to a string to replace each character with the\n specified string when muted. (So you can show `****` instead of the\n password, for example.)\n\n* `prompt` If you are using a replacement char, and also using a\n prompt with a readline stream (as for a `Password: *****` input),\n then specify what the prompt is so that backspace will work\n properly. Otherwise, pressing backspace will overwrite the prompt\n with the replacement character, which is weird.\n\n## ms.mute()\n\nSet `muted` to `true`. Turns `.write()` into a no-op.\n\n## ms.unmute()\n\nSet `muted` to `false`\n\n## ms.isTTY\n\nTrue if the pipe destination is a TTY, or if the incoming pipe source is\na TTY.\n\n## Other stream methods...\n\nThe other standard readable and writable stream methods are all\navailable. The MuteStream object acts as a facade to its pipe source\nand destination.\n", - "readmeFilename": "README.md", + "gitHead": "17d9854a315f56088d039534f87b740e470a9af0", "bugs": { "url": "https://github.com/isaacs/mute-stream/issues" }, - "_id": "mute-stream@0.0.4", - "_from": "mute-stream@~0.0.4" + "homepage": "https://github.com/isaacs/mute-stream#readme", + "_id": "mute-stream@0.0.5", + "_shasum": "8fbfabb0a98a253d3184331f9e8deb7372fac6c0", + "_from": "mute-stream@>=0.0.4 <0.1.0", + "_npmVersion": "2.10.0", + "_nodeVersion": "2.0.1", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "8fbfabb0a98a253d3184331f9e8deb7372fac6c0", + "tarball": "http://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "_resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz" } diff --git a/deps/npm/node_modules/read/package.json b/deps/npm/node_modules/read/package.json index c5be57230bd..b424aa3c0cc 100644 --- a/deps/npm/node_modules/read/package.json +++ b/deps/npm/node_modules/read/package.json @@ -1,6 +1,6 @@ { "name": "read", - "version": "1.0.5", + "version": "1.0.6", "main": "lib/read.js", "dependencies": { "mute-stream": "~0.0.4" @@ -21,15 +21,34 @@ "type": "git", "url": "git://github.com/isaacs/read.git" }, - "license": "BSD", + "license": "ISC", "scripts": { "test": "tap test/*.js" }, - "readme": "## read\n\nFor reading user input from stdin.\n\nSimilar to the `readline` builtin's `question()` method, but with a\nfew more features.\n\n## USAGE\n\n```javascript\nvar read = require(\"read\")\nread(options, callback)\n```\n\nThe callback gets called with either the user input, or the default\nspecified, or an error, as `callback(error, result, isDefault)`\nnode style.\n\n## OPTIONS\n\nEvery option is optional.\n\n* `prompt` What to write to stdout before reading input.\n* `silent` Don't echo the output as the user types it.\n* `replace` Replace silenced characters with the supplied character value.\n* `timeout` Number of ms to wait for user input before giving up.\n* `default` The default value if the user enters nothing.\n* `edit` Allow the user to edit the default value.\n* `terminal` Treat the output as a TTY, whether it is or not.\n* `input` Readable stream to get input data from. (default `process.stdin`)\n* `output` Writeable stream to write prompts to. (default: `process.stdout`)\n\nIf silent is true, and the input is a TTY, then read will set raw\nmode, and read character by character.\n\n## COMPATIBILITY\n\nThis module works sort of with node 0.6. It does not work with node\nversions less than 0.6. It is best on node 0.8.\n\nOn node version 0.6, it will remove all listeners on the input\nstream's `data` and `keypress` events, because the readline module did\nnot fully clean up after itself in that version of node, and did not\nmake it possible to clean up after it in a way that has no potential\nfor side effects.\n\nAdditionally, some of the readline options (like `terminal`) will not\nfunction in versions of node before 0.8, because they were not\nimplemented in the builtin readline module.\n\n## CONTRIBUTING\n\nPatches welcome.\n", - "readmeFilename": "README.md", + "gitHead": "2f5101c8e41332a033e5aa4e27e33fd6e09598e2", "bugs": { "url": "https://github.com/isaacs/read/issues" }, - "_id": "read@1.0.5", - "_from": "read@latest" + "homepage": "https://github.com/isaacs/read#readme", + "_id": "read@1.0.6", + "_shasum": "09873c14ecc114d063fad43b8ca5a33d304721c8", + "_from": "read@1.0.6", + "_npmVersion": "2.10.0", + "_nodeVersion": "2.0.1", + "_npmUser": { + "name": "isaacs", + "email": "isaacs@npmjs.com" + }, + "dist": { + "shasum": "09873c14ecc114d063fad43b8ca5a33d304721c8", + "tarball": "http://registry.npmjs.org/read/-/read-1.0.6.tgz" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/read/-/read-1.0.6.tgz" } diff --git a/deps/npm/node_modules/readable-stream/LICENSE b/deps/npm/node_modules/readable-stream/LICENSE index 0c44ae716db..e3d4e695a4c 100644 --- a/deps/npm/node_modules/readable-stream/LICENSE +++ b/deps/npm/node_modules/readable-stream/LICENSE @@ -1,27 +1,18 @@ -Copyright (c) Isaac Z. Schlueter ("Author") -All rights reserved. +Copyright Joyent, Inc. and other Node contributors. 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 BSD License +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +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/deps/npm/node_modules/readable-stream/README.md b/deps/npm/node_modules/readable-stream/README.md index 34c11897927..e46b823903d 100644 --- a/deps/npm/node_modules/readable-stream/README.md +++ b/deps/npm/node_modules/readable-stream/README.md @@ -2,8 +2,8 @@ ***Node-core streams for userland*** -[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true)](https://nodei.co/npm/readable-stream/) -[![NPM](https://nodei.co/npm-dl/readable-stream.png)](https://nodei.co/npm/readable-stream/) +[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/) +[![NPM](https://nodei.co/npm-dl/readable-stream.png&months=6&height=3)](https://nodei.co/npm/readable-stream/) This package is a mirror of the Streams2 and Streams3 implementations in Node-core. diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/float.patch b/deps/npm/node_modules/readable-stream/float.patch similarity index 99% rename from deps/npm/node_modules/sha/node_modules/readable-stream/float.patch rename to deps/npm/node_modules/readable-stream/float.patch index b984607a41c..7abb6dc30b2 100644 --- a/deps/npm/node_modules/sha/node_modules/readable-stream/float.patch +++ b/deps/npm/node_modules/readable-stream/float.patch @@ -3,36 +3,36 @@ index c5a741c..a2e0d8e 100644 --- a/lib/_stream_duplex.js +++ b/lib/_stream_duplex.js @@ -26,8 +26,8 @@ - + module.exports = Duplex; var util = require('util'); -var Readable = require('_stream_readable'); -var Writable = require('_stream_writable'); +var Readable = require('./_stream_readable'); +var Writable = require('./_stream_writable'); - + util.inherits(Duplex, Readable); - + diff --git a/lib/_stream_passthrough.js b/lib/_stream_passthrough.js index a5e9864..330c247 100644 --- a/lib/_stream_passthrough.js +++ b/lib/_stream_passthrough.js @@ -25,7 +25,7 @@ - + module.exports = PassThrough; - + -var Transform = require('_stream_transform'); +var Transform = require('./_stream_transform'); var util = require('util'); util.inherits(PassThrough, Transform); - + diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 0c3fe3e..90a8298 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -23,10 +23,34 @@ module.exports = Readable; Readable.ReadableState = ReadableState; - + var EE = require('events').EventEmitter; +if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { + return emitter.listeners(type).length; @@ -63,12 +63,12 @@ index 0c3fe3e..90a8298 100644 +} catch (er) { + debug = function() {}; +} - + util.inherits(Readable, Stream); - + @@ -380,7 +404,7 @@ function chunkInvalid(state, chunk) { - - + + function onEofChunk(stream, state) { - if (state.decoder && !state.ended) { + if (state.decoder && !state.ended && state.decoder.end) { @@ -80,9 +80,9 @@ index b1f9fcc..b0caf57 100644 --- a/lib/_stream_transform.js +++ b/lib/_stream_transform.js @@ -64,8 +64,14 @@ - + module.exports = Transform; - + -var Duplex = require('_stream_duplex'); +var Duplex = require('./_stream_duplex'); var util = require('util'); @@ -93,15 +93,15 @@ index b1f9fcc..b0caf57 100644 + } +} util.inherits(Transform, Duplex); - - + + diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index ba2e920..f49288b 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -27,6 +27,12 @@ module.exports = Writable; Writable.WritableState = WritableState; - + var util = require('util'); +if (!util.isUndefined) { + var utilIs = require('core-util-is'); @@ -110,7 +110,7 @@ index ba2e920..f49288b 100644 + } +} var Stream = require('stream'); - + util.inherits(Writable, Stream); @@ -119,7 +125,7 @@ function WritableState(options, stream) { function Writable(options) { @@ -119,29 +119,29 @@ index ba2e920..f49288b 100644 - if (!(this instanceof Writable) && !(this instanceof Stream.Duplex)) + if (!(this instanceof Writable) && !(this instanceof require('./_stream_duplex'))) return new Writable(options); - + this._writableState = new WritableState(options, this); diff --git a/test/simple/test-stream-big-push.js b/test/simple/test-stream-big-push.js index e3787e4..8cd2127 100644 --- a/test/simple/test-stream-big-push.js +++ b/test/simple/test-stream-big-push.js @@ -21,7 +21,7 @@ - + var common = require('../common'); var assert = require('assert'); -var stream = require('stream'); +var stream = require('../../'); var str = 'asdfasdfasdfasdfasdf'; - + var r = new stream.Readable({ diff --git a/test/simple/test-stream-end-paused.js b/test/simple/test-stream-end-paused.js index bb73777..d40efc7 100644 --- a/test/simple/test-stream-end-paused.js +++ b/test/simple/test-stream-end-paused.js @@ -25,7 +25,7 @@ var gotEnd = false; - + // Make sure we don't miss the end event for paused 0-length streams - + -var Readable = require('stream').Readable; +var Readable = require('../../').Readable; var stream = new Readable(); @@ -154,13 +154,13 @@ index b46ee90..0be8366 100644 @@ -22,8 +22,8 @@ var common = require('../common'); var assert = require('assert'); - + -var Readable = require('_stream_readable'); -var Writable = require('_stream_writable'); +var Readable = require('../../lib/_stream_readable'); +var Writable = require('../../lib/_stream_writable'); var util = require('util'); - + util.inherits(TestReadable, Readable); diff --git a/test/simple/test-stream-pipe-cleanup.js b/test/simple/test-stream-pipe-cleanup.js deleted file mode 100644 @@ -295,12 +295,12 @@ index c5d724b..c7d6b7d 100644 --- a/test/simple/test-stream-pipe-error-handling.js +++ b/test/simple/test-stream-pipe-error-handling.js @@ -21,7 +21,7 @@ - + var common = require('../common'); var assert = require('assert'); -var Stream = require('stream').Stream; +var Stream = require('../../').Stream; - + (function testErrorListenerCatches() { var source = new Stream(); diff --git a/test/simple/test-stream-pipe-event.js b/test/simple/test-stream-pipe-event.js @@ -309,25 +309,25 @@ index cb9d5fe..56f8d61 100644 +++ b/test/simple/test-stream-pipe-event.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. - + var common = require('../common'); -var stream = require('stream'); +var stream = require('../../'); var assert = require('assert'); var util = require('util'); - + diff --git a/test/simple/test-stream-push-order.js b/test/simple/test-stream-push-order.js index f2e6ec2..a5c9bf9 100644 --- a/test/simple/test-stream-push-order.js +++ b/test/simple/test-stream-push-order.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. - + var common = require('../common.js'); -var Readable = require('stream').Readable; +var Readable = require('../../').Readable; var assert = require('assert'); - + var s = new Readable({ diff --git a/test/simple/test-stream-push-strings.js b/test/simple/test-stream-push-strings.js index 06f43dc..1701a9a 100644 @@ -336,11 +336,11 @@ index 06f43dc..1701a9a 100644 @@ -22,7 +22,7 @@ var common = require('../common'); var assert = require('assert'); - + -var Readable = require('stream').Readable; +var Readable = require('../../').Readable; var util = require('util'); - + util.inherits(MyStream, Readable); diff --git a/test/simple/test-stream-readable-event.js b/test/simple/test-stream-readable-event.js index ba6a577..a8e6f7b 100644 @@ -349,10 +349,10 @@ index ba6a577..a8e6f7b 100644 @@ -22,7 +22,7 @@ var common = require('../common'); var assert = require('assert'); - + -var Readable = require('stream').Readable; +var Readable = require('../../').Readable; - + (function first() { // First test, not reading when the readable is added. diff --git a/test/simple/test-stream-readable-flow-recursion.js b/test/simple/test-stream-readable-flow-recursion.js @@ -362,10 +362,10 @@ index 2891ad6..11689ba 100644 @@ -27,7 +27,7 @@ var assert = require('assert'); // more data continuously, but without triggering a nextTick // warning or RangeError. - + -var Readable = require('stream').Readable; +var Readable = require('../../').Readable; - + // throw an error if we trigger a nextTick warning. process.throwDeprecation = true; diff --git a/test/simple/test-stream-unshift-empty-chunk.js b/test/simple/test-stream-unshift-empty-chunk.js @@ -373,12 +373,12 @@ index 0c96476..7827538 100644 --- a/test/simple/test-stream-unshift-empty-chunk.js +++ b/test/simple/test-stream-unshift-empty-chunk.js @@ -24,7 +24,7 @@ var assert = require('assert'); - - // This test verifies that stream.unshift(Buffer(0)) or + + // This test verifies that stream.unshift(Buffer(0)) or // stream.unshift('') does not set state.reading=false. -var Readable = require('stream').Readable; +var Readable = require('../../').Readable; - + var r = new Readable(); var nChunks = 10; diff --git a/test/simple/test-stream-unshift-read-race.js b/test/simple/test-stream-unshift-read-race.js @@ -388,14 +388,14 @@ index 83fd9fa..17c18aa 100644 @@ -29,7 +29,7 @@ var assert = require('assert'); // 3. push() after the EOF signaling null is an error. // 4. _read() is not called after pushing the EOF null chunk. - + -var stream = require('stream'); +var stream = require('../../'); var hwm = 10; var r = stream.Readable({ highWaterMark: hwm }); var chunks = 10; @@ -51,7 +51,14 @@ r._read = function(n) { - + function push(fast) { assert(!pushedNull, 'push() after null push'); - var c = pos >= data.length ? null : data.slice(pos, pos + n); @@ -417,10 +417,10 @@ index 5b49e6e..b5321f3 100644 @@ -22,7 +22,7 @@ var common = require('../common'); var assert = require('assert'); - + -var stream = require('stream'); +var stream = require('../../'); - + var queue = []; for (var decode = 0; decode < 2; decode++) { diff --git a/test/simple/test-stream2-basic.js b/test/simple/test-stream2-basic.js @@ -428,26 +428,26 @@ index 3814bf0..248c1be 100644 --- a/test/simple/test-stream2-basic.js +++ b/test/simple/test-stream2-basic.js @@ -21,7 +21,7 @@ - - + + var common = require('../common.js'); -var R = require('_stream_readable'); +var R = require('../../lib/_stream_readable'); var assert = require('assert'); - + var util = require('util'); diff --git a/test/simple/test-stream2-compatibility.js b/test/simple/test-stream2-compatibility.js index 6cdd4e9..f0fa84b 100644 --- a/test/simple/test-stream2-compatibility.js +++ b/test/simple/test-stream2-compatibility.js @@ -21,7 +21,7 @@ - - + + var common = require('../common.js'); -var R = require('_stream_readable'); +var R = require('../../lib/_stream_readable'); var assert = require('assert'); - + var util = require('util'); diff --git a/test/simple/test-stream2-finish-pipe.js b/test/simple/test-stream2-finish-pipe.js index 39b274f..006a19b 100644 @@ -455,12 +455,12 @@ index 39b274f..006a19b 100644 +++ b/test/simple/test-stream2-finish-pipe.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. - + var common = require('../common.js'); -var stream = require('stream'); +var stream = require('../../'); var Buffer = require('buffer').Buffer; - + var r = new stream.Readable(); diff --git a/test/simple/test-stream2-fs.js b/test/simple/test-stream2-fs.js deleted file mode 100644 @@ -605,7 +605,7 @@ index 2fbfbca..667985b 100644 @@ -30,7 +30,7 @@ var PUSHSIZE = 20; var PUSHCOUNT = 1000; var HWM = 50; - + -var Readable = require('stream').Readable; +var Readable = require('../../').Readable; var r = new Readable({ @@ -613,7 +613,7 @@ index 2fbfbca..667985b 100644 }); @@ -39,23 +39,23 @@ var rs = r._readableState; r._read = push; - + r.on('readable', function() { - console.error('>> readable'); + //console.error('>> readable'); @@ -624,7 +624,7 @@ index 2fbfbca..667985b 100644 - console.error(' < %j (%d remain)', ret && ret.length, rs.length); + //console.error(' < %j (%d remain)', ret && ret.length, rs.length); } while (ret && ret.length === READSIZE); - + - console.error('<< after read()', - ret && ret.length, - rs.needReadable, @@ -634,24 +634,24 @@ index 2fbfbca..667985b 100644 + // rs.needReadable, + // rs.length); }); - + var endEmitted = false; r.on('end', function() { endEmitted = true; - console.error('end'); + //console.error('end'); }); - + var pushes = 0; @@ -64,11 +64,11 @@ function push() { return; - + if (pushes++ === PUSHCOUNT) { - console.error(' push(EOF)'); + //console.error(' push(EOF)'); return r.push(null); } - + - console.error(' push #%d', pushes); + //console.error(' push #%d', pushes); if (r.push(new Buffer(PUSHSIZE))) @@ -662,27 +662,27 @@ index 3e6931d..ff47d89 100644 --- a/test/simple/test-stream2-objects.js +++ b/test/simple/test-stream2-objects.js @@ -21,8 +21,8 @@ - - + + var common = require('../common.js'); -var Readable = require('_stream_readable'); -var Writable = require('_stream_writable'); +var Readable = require('../../lib/_stream_readable'); +var Writable = require('../../lib/_stream_writable'); var assert = require('assert'); - + // tiny node-tap lookalike. diff --git a/test/simple/test-stream2-pipe-error-handling.js b/test/simple/test-stream2-pipe-error-handling.js index cf7531c..e3f3e4e 100644 --- a/test/simple/test-stream2-pipe-error-handling.js +++ b/test/simple/test-stream2-pipe-error-handling.js @@ -21,7 +21,7 @@ - + var common = require('../common'); var assert = require('assert'); -var stream = require('stream'); +var stream = require('../../'); - + (function testErrorListenerCatches() { var count = 1000; diff --git a/test/simple/test-stream2-pipe-error-once-listener.js b/test/simple/test-stream2-pipe-error-once-listener.js @@ -691,12 +691,12 @@ index 5e8e3cb..53b2616 100755 +++ b/test/simple/test-stream2-pipe-error-once-listener.js @@ -24,7 +24,7 @@ var common = require('../common.js'); var assert = require('assert'); - + var util = require('util'); -var stream = require('stream'); +var stream = require('../../'); - - + + var Read = function() { diff --git a/test/simple/test-stream2-push.js b/test/simple/test-stream2-push.js index b63edc3..eb2b0e9 100644 @@ -704,7 +704,7 @@ index b63edc3..eb2b0e9 100644 +++ b/test/simple/test-stream2-push.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. - + var common = require('../common.js'); -var stream = require('stream'); +var stream = require('../../'); @@ -716,14 +716,14 @@ index e8a7305..9740a47 100644 --- a/test/simple/test-stream2-read-sync-stack.js +++ b/test/simple/test-stream2-read-sync-stack.js @@ -21,7 +21,7 @@ - + var common = require('../common'); var assert = require('assert'); -var Readable = require('stream').Readable; +var Readable = require('../../').Readable; var r = new Readable(); var N = 256 * 1024; - + diff --git a/test/simple/test-stream2-readable-empty-buffer-no-eof.js b/test/simple/test-stream2-readable-empty-buffer-no-eof.js index cd30178..4b1659d 100644 --- a/test/simple/test-stream2-readable-empty-buffer-no-eof.js @@ -731,13 +731,13 @@ index cd30178..4b1659d 100644 @@ -22,10 +22,9 @@ var common = require('../common'); var assert = require('assert'); - + -var Readable = require('stream').Readable; +var Readable = require('../../').Readable; - + test1(); -test2(); - + function test1() { var r = new Readable(); @@ -88,31 +87,3 @@ function test1() { @@ -777,12 +777,12 @@ index 7c96ffe..04a96f5 100644 --- a/test/simple/test-stream2-readable-from-list.js +++ b/test/simple/test-stream2-readable-from-list.js @@ -21,7 +21,7 @@ - + var assert = require('assert'); var common = require('../common.js'); -var fromList = require('_stream_readable')._fromList; +var fromList = require('../../lib/_stream_readable')._fromList; - + // tiny node-tap lookalike. var tests = []; diff --git a/test/simple/test-stream2-readable-legacy-drain.js b/test/simple/test-stream2-readable-legacy-drain.js @@ -792,23 +792,23 @@ index 675da8e..51fd3d5 100644 @@ -22,7 +22,7 @@ var common = require('../common'); var assert = require('assert'); - + -var Stream = require('stream'); +var Stream = require('../../'); var Readable = Stream.Readable; - + var r = new Readable(); diff --git a/test/simple/test-stream2-readable-non-empty-end.js b/test/simple/test-stream2-readable-non-empty-end.js index 7314ae7..c971898 100644 --- a/test/simple/test-stream2-readable-non-empty-end.js +++ b/test/simple/test-stream2-readable-non-empty-end.js @@ -21,7 +21,7 @@ - + var assert = require('assert'); var common = require('../common.js'); -var Readable = require('_stream_readable'); +var Readable = require('../../lib/_stream_readable'); - + var len = 0; var chunks = new Array(10); diff --git a/test/simple/test-stream2-readable-wrap-empty.js b/test/simple/test-stream2-readable-wrap-empty.js @@ -818,11 +818,11 @@ index 2e5cf25..fd8a3dc 100644 @@ -22,7 +22,7 @@ var common = require('../common'); var assert = require('assert'); - + -var Readable = require('_stream_readable'); +var Readable = require('../../lib/_stream_readable'); var EE = require('events').EventEmitter; - + var oldStream = new EE(); diff --git a/test/simple/test-stream2-readable-wrap.js b/test/simple/test-stream2-readable-wrap.js index 90eea01..6b177f7 100644 @@ -831,40 +831,40 @@ index 90eea01..6b177f7 100644 @@ -22,8 +22,8 @@ var common = require('../common'); var assert = require('assert'); - + -var Readable = require('_stream_readable'); -var Writable = require('_stream_writable'); +var Readable = require('../../lib/_stream_readable'); +var Writable = require('../../lib/_stream_writable'); var EE = require('events').EventEmitter; - + var testRuns = 0, completedRuns = 0; diff --git a/test/simple/test-stream2-set-encoding.js b/test/simple/test-stream2-set-encoding.js index 5d2c32a..685531b 100644 --- a/test/simple/test-stream2-set-encoding.js +++ b/test/simple/test-stream2-set-encoding.js @@ -22,7 +22,7 @@ - + var common = require('../common.js'); var assert = require('assert'); -var R = require('_stream_readable'); +var R = require('../../lib/_stream_readable'); var util = require('util'); - + // tiny node-tap lookalike. diff --git a/test/simple/test-stream2-transform.js b/test/simple/test-stream2-transform.js index 9c9ddd8..a0cacc6 100644 --- a/test/simple/test-stream2-transform.js +++ b/test/simple/test-stream2-transform.js @@ -21,8 +21,8 @@ - + var assert = require('assert'); var common = require('../common.js'); -var PassThrough = require('_stream_passthrough'); -var Transform = require('_stream_transform'); +var PassThrough = require('../../').PassThrough; +var Transform = require('../../').Transform; - + // tiny node-tap lookalike. var tests = []; diff --git a/test/simple/test-stream2-unpipe-drain.js b/test/simple/test-stream2-unpipe-drain.js @@ -872,41 +872,41 @@ index d66dc3c..365b327 100644 --- a/test/simple/test-stream2-unpipe-drain.js +++ b/test/simple/test-stream2-unpipe-drain.js @@ -22,7 +22,7 @@ - + var common = require('../common.js'); var assert = require('assert'); -var stream = require('stream'); +var stream = require('../../'); var crypto = require('crypto'); - + var util = require('util'); diff --git a/test/simple/test-stream2-unpipe-leak.js b/test/simple/test-stream2-unpipe-leak.js index 99f8746..17c92ae 100644 --- a/test/simple/test-stream2-unpipe-leak.js +++ b/test/simple/test-stream2-unpipe-leak.js @@ -22,7 +22,7 @@ - + var common = require('../common.js'); var assert = require('assert'); -var stream = require('stream'); +var stream = require('../../'); - + var chunk = new Buffer('hallo'); - + diff --git a/test/simple/test-stream2-writable.js b/test/simple/test-stream2-writable.js index 704100c..209c3a6 100644 --- a/test/simple/test-stream2-writable.js +++ b/test/simple/test-stream2-writable.js @@ -20,8 +20,8 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. - + var common = require('../common.js'); -var W = require('_stream_writable'); -var D = require('_stream_duplex'); +var W = require('../../').Writable; +var D = require('../../').Duplex; var assert = require('assert'); - + var util = require('util'); diff --git a/test/simple/test-stream3-pause-then-read.js b/test/simple/test-stream3-pause-then-read.js index b91bde3..2f72c15 100644 @@ -915,9 +915,8 @@ index b91bde3..2f72c15 100644 @@ -22,7 +22,7 @@ var common = require('../common'); var assert = require('assert'); - + -var stream = require('stream'); +var stream = require('../../'); var Readable = stream.Readable; var Writable = stream.Writable; - diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_readable.js b/deps/npm/node_modules/readable-stream/lib/_stream_readable.js index 630722099e9..19ab3588984 100644 --- a/deps/npm/node_modules/readable-stream/lib/_stream_readable.js +++ b/deps/npm/node_modules/readable-stream/lib/_stream_readable.js @@ -49,15 +49,29 @@ util.inherits = require('inherits'); var StringDecoder; + +/**/ +var debug = require('util'); +if (debug && debug.debuglog) { + debug = debug.debuglog('stream'); +} else { + debug = function () {}; +} +/**/ + + util.inherits(Readable, Stream); function ReadableState(options, stream) { + var Duplex = require('./_stream_duplex'); + options = options || {}; // the point at which it stops calling _read() to fill the buffer // Note: 0 is a valid value, means "don't call _read preemptively ever" var hwm = options.highWaterMark; - this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; + var defaultHwm = options.objectMode ? 16 : 16 * 1024; + this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; // cast to ints. this.highWaterMark = ~~this.highWaterMark; @@ -66,19 +80,13 @@ function ReadableState(options, stream) { this.length = 0; this.pipes = null; this.pipesCount = 0; - this.flowing = false; + this.flowing = null; this.ended = false; this.endEmitted = false; this.reading = false; - // In streams that never have any data, and do push(null) right away, - // the consumer can miss the 'end' event if they do some I/O before - // consuming the stream. So, we don't emit('end') until some reading - // happens. - this.calledRead = false; - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, becuase any + // or on a later tick. We set this to true at first, because any // actions that shouldn't happen until "later" should generally also // not happen before the first write call. this.sync = true; @@ -94,6 +102,9 @@ function ReadableState(options, stream) { // make all the buffer merging and length checks go away this.objectMode = !!options.objectMode; + if (stream instanceof Duplex) + this.objectMode = this.objectMode || !!options.readableObjectMode; + // Crypto is kind of old and crusty. Historically, its default string // encoding is 'binary' so we have to make this configurable. // Everything else in the universe uses 'utf8', though. @@ -120,6 +131,8 @@ function ReadableState(options, stream) { } function Readable(options) { + var Duplex = require('./_stream_duplex'); + if (!(this instanceof Readable)) return new Readable(options); @@ -138,7 +151,7 @@ function Readable(options) { Readable.prototype.push = function(chunk, encoding) { var state = this._readableState; - if (typeof chunk === 'string' && !state.objectMode) { + if (util.isString(chunk) && !state.objectMode) { encoding = encoding || state.defaultEncoding; if (encoding !== state.encoding) { chunk = new Buffer(chunk, encoding); @@ -159,7 +172,7 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) { var er = chunkInvalid(state, chunk); if (er) { stream.emit('error', er); - } else if (chunk === null || chunk === undefined) { + } else if (util.isNullOrUndefined(chunk)) { state.reading = false; if (!state.ended) onEofChunk(stream, state); @@ -174,17 +187,24 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) { if (state.decoder && !addToFront && !encoding) chunk = state.decoder.write(chunk); - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) { - state.buffer.unshift(chunk); - } else { + if (!addToFront) state.reading = false; - state.buffer.push(chunk); - } - if (state.needReadable) - emitReadable(stream); + // if we want the data now, just emit it. + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit('data', chunk); + stream.read(0); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) + state.buffer.unshift(chunk); + else + state.buffer.push(chunk); + + if (state.needReadable) + emitReadable(stream); + } maybeReadMore(stream, state); } @@ -217,6 +237,7 @@ Readable.prototype.setEncoding = function(enc) { StringDecoder = require('string_decoder/').StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; + return this; }; // Don't raise the hwm > 128MB @@ -240,7 +261,7 @@ function howMuchToRead(n, state) { if (state.objectMode) return n === 0 ? 0 : 1; - if (n === null || isNaN(n)) { + if (isNaN(n) || util.isNull(n)) { // only flow one buffer at a time if (state.flowing && state.buffer.length) return state.buffer[0].length; @@ -272,12 +293,11 @@ function howMuchToRead(n, state) { // you can override either this method, or the async _read(n) below. Readable.prototype.read = function(n) { + debug('read', n); var state = this._readableState; - state.calledRead = true; var nOrig = n; - var ret; - if (typeof n !== 'number' || n > 0) + if (!util.isNumber(n) || n > 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we @@ -286,7 +306,11 @@ Readable.prototype.read = function(n) { if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { - emitReadable(this); + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) + endReadable(this); + else + emitReadable(this); return null; } @@ -294,28 +318,9 @@ Readable.prototype.read = function(n) { // if we've ended, and we're now clear, then finish it up. if (n === 0 && state.ended) { - ret = null; - - // In cases where the decoder did not receive enough data - // to produce a full chunk, then immediately received an - // EOF, state.buffer will contain [, ]. - // howMuchToRead will see this and coerce the amount to - // read to zero (because it's looking at the length of the - // first in state.buffer), and we'll end up here. - // - // This can only happen via state.decoder -- no other venue - // exists for pushing a zero-length chunk into state.buffer - // and triggering this behavior. In this case, we return our - // remaining data and end the stream, if appropriate. - if (state.length > 0 && state.decoder) { - ret = fromList(n, state); - state.length -= ret.length; - } - if (state.length === 0) endReadable(this); - - return ret; + return null; } // All the actual chunk generation logic needs to be @@ -342,17 +347,23 @@ Readable.prototype.read = function(n) { // if we need a readable event, then we need to do some reading. var doRead = state.needReadable; + debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some - if (state.length - n <= state.highWaterMark) + if (state.length === 0 || state.length - n < state.highWaterMark) { doRead = true; + debug('length less than watermark', doRead); + } // however, if we've ended, then there's no point, and if we're already // reading, then it's unnecessary. - if (state.ended || state.reading) + if (state.ended || state.reading) { doRead = false; + debug('reading or ended', doRead); + } if (doRead) { + debug('do read'); state.reading = true; state.sync = true; // if the length is currently zero, then we *need* a readable event. @@ -363,18 +374,18 @@ Readable.prototype.read = function(n) { state.sync = false; } - // If _read called its callback synchronously, then `reading` - // will be false, and we need to re-evaluate how much data we - // can return to the user. + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. if (doRead && !state.reading) n = howMuchToRead(nOrig, state); + var ret; if (n > 0) ret = fromList(n, state); else ret = null; - if (ret === null) { + if (util.isNull(ret)) { state.needReadable = true; n = 0; } @@ -386,21 +397,21 @@ Readable.prototype.read = function(n) { if (state.length === 0 && !state.ended) state.needReadable = true; - // If we happened to read() exactly the remaining amount in the - // buffer, and the EOF has been seen at this point, then make sure - // that we emit 'end' on the very next tick. - if (state.ended && !state.endEmitted && state.length === 0) + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended && state.length === 0) endReadable(this); + if (!util.isNull(ret)) + this.emit('data', ret); + return ret; }; function chunkInvalid(state, chunk) { var er = null; - if (!Buffer.isBuffer(chunk) && - 'string' !== typeof chunk && - chunk !== null && - chunk !== undefined && + if (!util.isBuffer(chunk) && + !util.isString(chunk) && + !util.isNullOrUndefined(chunk) && !state.objectMode) { er = new TypeError('Invalid non-string/buffer chunk'); } @@ -418,12 +429,8 @@ function onEofChunk(stream, state) { } state.ended = true; - // if we've ended and we have some data left, then emit - // 'readable' now to make sure it gets picked up. - if (state.length > 0) - emitReadable(stream); - else - endReadable(stream); + // emit 'readable' now to make sure it gets picked up. + emitReadable(stream); } // Don't emit readable right away in sync mode, because this can trigger @@ -432,20 +439,22 @@ function onEofChunk(stream, state) { function emitReadable(stream) { var state = stream._readableState; state.needReadable = false; - if (state.emittedReadable) - return; - - state.emittedReadable = true; - if (state.sync) - process.nextTick(function() { + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + if (state.sync) + process.nextTick(function() { + emitReadable_(stream); + }); + else emitReadable_(stream); - }); - else - emitReadable_(stream); + } } function emitReadable_(stream) { + debug('emit readable'); stream.emit('readable'); + flow(stream); } @@ -468,6 +477,7 @@ function maybeReadMore_(stream, state) { var len = state.length; while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { + debug('maybeReadMore read 0'); stream.read(0); if (len === state.length) // didn't get any data, stop spinning. @@ -502,6 +512,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) { break; } state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && @@ -515,11 +526,14 @@ Readable.prototype.pipe = function(dest, pipeOpts) { dest.on('unpipe', onunpipe); function onunpipe(readable) { - if (readable !== src) return; - cleanup(); + debug('onunpipe'); + if (readable === src) { + cleanup(); + } } function onend() { + debug('onend'); dest.end(); } @@ -531,6 +545,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) { dest.on('drain', ondrain); function cleanup() { + debug('cleanup'); // cleanup event handlers once the pipe is broken dest.removeListener('close', onclose); dest.removeListener('finish', onfinish); @@ -539,19 +554,34 @@ Readable.prototype.pipe = function(dest, pipeOpts) { dest.removeListener('unpipe', onunpipe); src.removeListener('end', onend); src.removeListener('end', cleanup); + src.removeListener('data', ondata); // if the reader is waiting for a drain event from this // specific writer, then it would cause it to never start // flowing again. // So, if this is awaiting a drain, then we just call it now. // If we don't know, then assume that we are waiting for one. - if (!dest._writableState || dest._writableState.needDrain) + if (state.awaitDrain && + (!dest._writableState || dest._writableState.needDrain)) ondrain(); } + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + if (false === ret) { + debug('false write response, pause', + src._readableState.awaitDrain); + src._readableState.awaitDrain++; + src.pause(); + } + } + // if the dest has an error, then stop piping into it. // however, don't suppress the throwing behavior for this. function onerror(er) { + debug('onerror', er); unpipe(); dest.removeListener('error', onerror); if (EE.listenerCount(dest, 'error') === 0) @@ -575,12 +605,14 @@ Readable.prototype.pipe = function(dest, pipeOpts) { } dest.once('close', onclose); function onfinish() { + debug('onfinish'); dest.removeListener('close', onclose); unpipe(); } dest.once('finish', onfinish); function unpipe() { + debug('unpipe'); src.unpipe(dest); } @@ -589,16 +621,8 @@ Readable.prototype.pipe = function(dest, pipeOpts) { // start the flow if it hasn't been started already. if (!state.flowing) { - // the handler that waits for readable events after all - // the data gets sucked out in flow. - // This would be easier to follow with a .once() handler - // in flow(), but that is too slow. - this.on('readable', pipeOnReadable); - - state.flowing = true; - process.nextTick(function() { - flow(src); - }); + debug('pipe resume'); + src.resume(); } return dest; @@ -606,63 +630,15 @@ Readable.prototype.pipe = function(dest, pipeOpts) { function pipeOnDrain(src) { return function() { - var dest = this; var state = src._readableState; - state.awaitDrain--; - if (state.awaitDrain === 0) + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) + state.awaitDrain--; + if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) { + state.flowing = true; flow(src); - }; -} - -function flow(src) { - var state = src._readableState; - var chunk; - state.awaitDrain = 0; - - function write(dest, i, list) { - var written = dest.write(chunk); - if (false === written) { - state.awaitDrain++; } - } - - while (state.pipesCount && null !== (chunk = src.read())) { - - if (state.pipesCount === 1) - write(state.pipes, 0, null); - else - forEach(state.pipes, write); - - src.emit('data', chunk); - - // if anyone needs a drain, then we have to wait for that. - if (state.awaitDrain > 0) - return; - } - - // if every destination was unpiped, either before entering this - // function, or in the while loop, then stop flowing. - // - // NB: This is a pretty rare edge case. - if (state.pipesCount === 0) { - state.flowing = false; - - // if there were data event listeners added, then switch to old mode. - if (EE.listenerCount(src, 'data') > 0) - emitDataEvents(src); - return; - } - - // at this point, no one needed a drain, so we just ran out of data - // on the next readable event, start it over again. - state.ranOut = true; -} - -function pipeOnReadable() { - if (this._readableState.ranOut) { - this._readableState.ranOut = false; - flow(this); - } + }; } @@ -685,7 +661,6 @@ Readable.prototype.unpipe = function(dest) { // got a match. state.pipes = null; state.pipesCount = 0; - this.removeListener('readable', pipeOnReadable); state.flowing = false; if (dest) dest.emit('unpipe', this); @@ -700,7 +675,6 @@ Readable.prototype.unpipe = function(dest) { var len = state.pipesCount; state.pipes = null; state.pipesCount = 0; - this.removeListener('readable', pipeOnReadable); state.flowing = false; for (var i = 0; i < len; i++) @@ -728,8 +702,11 @@ Readable.prototype.unpipe = function(dest) { Readable.prototype.on = function(ev, fn) { var res = Stream.prototype.on.call(this, ev, fn); - if (ev === 'data' && !this._readableState.flowing) - emitDataEvents(this); + // If listening to data, and it has not explicitly been paused, + // then call resume to start the flow of data on the next tick. + if (ev === 'data' && false !== this._readableState.flowing) { + this.resume(); + } if (ev === 'readable' && this.readable) { var state = this._readableState; @@ -738,7 +715,11 @@ Readable.prototype.on = function(ev, fn) { state.emittedReadable = false; state.needReadable = true; if (!state.reading) { - this.read(0); + var self = this; + process.nextTick(function() { + debug('readable nexttick read 0'); + self.read(0); + }); } else if (state.length) { emitReadable(this, state); } @@ -752,63 +733,54 @@ Readable.prototype.addListener = Readable.prototype.on; // pause() and resume() are remnants of the legacy readable stream API // If the user uses them, then switch into old mode. Readable.prototype.resume = function() { - emitDataEvents(this); - this.read(0); - this.emit('resume'); + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + state.flowing = true; + if (!state.reading) { + debug('resume read 0'); + this.read(0); + } + resume(this, state); + } + return this; }; +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(function() { + resume_(stream, state); + }); + } +} + +function resume_(stream, state) { + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) + stream.read(0); +} + Readable.prototype.pause = function() { - emitDataEvents(this, true); - this.emit('pause'); + debug('call pause flowing=%j', this._readableState.flowing); + if (false !== this._readableState.flowing) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + return this; }; -function emitDataEvents(stream, startPaused) { +function flow(stream) { var state = stream._readableState; - + debug('flow', state.flowing); if (state.flowing) { - // https://github.com/isaacs/readable-stream/issues/16 - throw new Error('Cannot switch to old mode now.'); + do { + var chunk = stream.read(); + } while (null !== chunk && state.flowing); } - - var paused = startPaused || false; - var readable = false; - - // convert to an old-style stream. - stream.readable = true; - stream.pipe = Stream.prototype.pipe; - stream.on = stream.addListener = Stream.prototype.on; - - stream.on('readable', function() { - readable = true; - - var c; - while (!paused && (null !== (c = stream.read()))) - stream.emit('data', c); - - if (c === null) { - readable = false; - stream._readableState.needReadable = true; - } - }); - - stream.pause = function() { - paused = true; - this.emit('pause'); - }; - - stream.resume = function() { - paused = false; - if (readable) - process.nextTick(function() { - stream.emit('readable'); - }); - else - this.read(0); - this.emit('resume'); - }; - - // now make it start, just in case it hadn't already. - stream.emit('readable'); } // wrap an old-style stream as the async data source. @@ -820,6 +792,7 @@ Readable.prototype.wrap = function(stream) { var self = this; stream.on('end', function() { + debug('wrapped end'); if (state.decoder && !state.ended) { var chunk = state.decoder.end(); if (chunk && chunk.length) @@ -830,14 +803,10 @@ Readable.prototype.wrap = function(stream) { }); stream.on('data', function(chunk) { + debug('wrapped data'); if (state.decoder) chunk = state.decoder.write(chunk); - - // don't skip over falsy values in objectMode - //if (state.objectMode && util.isNullOrUndefined(chunk)) - if (state.objectMode && (chunk === null || chunk === undefined)) - return; - else if (!state.objectMode && (!chunk || !chunk.length)) + if (!chunk || !state.objectMode && !chunk.length) return; var ret = self.push(chunk); @@ -850,8 +819,7 @@ Readable.prototype.wrap = function(stream) { // proxy all the other methods. // important when wrapping filters and duplexes. for (var i in stream) { - if (typeof stream[i] === 'function' && - typeof this[i] === 'undefined') { + if (util.isFunction(stream[i]) && util.isUndefined(this[i])) { this[i] = function(method) { return function() { return stream[method].apply(stream, arguments); }}(i); @@ -867,6 +835,7 @@ Readable.prototype.wrap = function(stream) { // when we try to consume some more bytes, simply unpause the // underlying stream. self._read = function(n) { + debug('wrapped _read', n); if (paused) { paused = false; stream.resume(); @@ -955,7 +924,7 @@ function endReadable(stream) { if (state.length > 0) throw new Error('endReadable called on non-empty stream'); - if (!state.endEmitted && state.calledRead) { + if (!state.endEmitted) { state.ended = true; process.nextTick(function() { // Check that we didn't get one last unshift. diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_transform.js b/deps/npm/node_modules/readable-stream/lib/_stream_transform.js index eb188df3e86..905c5e45075 100644 --- a/deps/npm/node_modules/readable-stream/lib/_stream_transform.js +++ b/deps/npm/node_modules/readable-stream/lib/_stream_transform.js @@ -97,7 +97,7 @@ function afterTransform(stream, er, data) { ts.writechunk = null; ts.writecb = null; - if (data !== null && data !== undefined) + if (!util.isNullOrUndefined(data)) stream.push(data); if (cb) @@ -117,7 +117,7 @@ function Transform(options) { Duplex.call(this, options); - var ts = this._transformState = new TransformState(options, this); + this._transformState = new TransformState(options, this); // when the writable side finishes, then flush out anything remaining. var stream = this; @@ -130,8 +130,8 @@ function Transform(options) { // sync guard flag. this._readableState.sync = false; - this.once('finish', function() { - if ('function' === typeof this._flush) + this.once('prefinish', function() { + if (util.isFunction(this._flush)) this._flush(function(er) { done(stream, er); }); @@ -179,7 +179,7 @@ Transform.prototype._write = function(chunk, encoding, cb) { Transform.prototype._read = function(n) { var ts = this._transformState; - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) { ts.transforming = true; this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); } else { @@ -197,7 +197,6 @@ function done(stream, er) { // if there's nothing in the write buffer, then that means // that nothing more will ever be provided var ws = stream._writableState; - var rs = stream._readableState; var ts = stream._transformState; if (ws.length) diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_writable.js b/deps/npm/node_modules/readable-stream/lib/_stream_writable.js index 4bdaa4fa491..db8539cd5b8 100644 --- a/deps/npm/node_modules/readable-stream/lib/_stream_writable.js +++ b/deps/npm/node_modules/readable-stream/lib/_stream_writable.js @@ -48,18 +48,24 @@ function WriteReq(chunk, encoding, cb) { } function WritableState(options, stream) { + var Duplex = require('./_stream_duplex'); + options = options || {}; // the point at which write() starts returning false // Note: 0 is a valid value, means that we always return false if // the entire buffer is not flushed immediately on write() var hwm = options.highWaterMark; - this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; + var defaultHwm = options.objectMode ? 16 : 16 * 1024; + this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; // object stream flag to indicate whether or not this stream // contains buffers or objects. this.objectMode = !!options.objectMode; + if (stream instanceof Duplex) + this.objectMode = this.objectMode || !!options.writableObjectMode; + // cast to ints. this.highWaterMark = ~~this.highWaterMark; @@ -90,8 +96,11 @@ function WritableState(options, stream) { // a flag to see when we're in the middle of a write. this.writing = false; + // when true all writes will be buffered until .uncork() call + this.corked = 0; + // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, becuase any + // or on a later tick. We set this to true at first, because any // actions that shouldn't happen until "later" should generally also // not happen before the first write call. this.sync = true; @@ -114,6 +123,14 @@ function WritableState(options, stream) { this.buffer = []; + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + // True if the error was already emitted and should not be thrown again this.errorEmitted = false; } @@ -156,10 +173,9 @@ function writeAfterEnd(stream, state, cb) { // how many bytes or characters. function validChunk(stream, state, chunk, cb) { var valid = true; - if (!Buffer.isBuffer(chunk) && - 'string' !== typeof chunk && - chunk !== null && - chunk !== undefined && + if (!util.isBuffer(chunk) && + !util.isString(chunk) && + !util.isNullOrUndefined(chunk) && !state.objectMode) { var er = new TypeError('Invalid non-string/buffer chunk'); stream.emit('error', er); @@ -175,31 +191,54 @@ Writable.prototype.write = function(chunk, encoding, cb) { var state = this._writableState; var ret = false; - if (typeof encoding === 'function') { + if (util.isFunction(encoding)) { cb = encoding; encoding = null; } - if (Buffer.isBuffer(chunk)) + if (util.isBuffer(chunk)) encoding = 'buffer'; else if (!encoding) encoding = state.defaultEncoding; - if (typeof cb !== 'function') + if (!util.isFunction(cb)) cb = function() {}; if (state.ended) writeAfterEnd(this, state, cb); - else if (validChunk(this, state, chunk, cb)) + else if (validChunk(this, state, chunk, cb)) { + state.pendingcb++; ret = writeOrBuffer(this, state, chunk, encoding, cb); + } return ret; }; +Writable.prototype.cork = function() { + var state = this._writableState; + + state.corked++; +}; + +Writable.prototype.uncork = function() { + var state = this._writableState; + + if (state.corked) { + state.corked--; + + if (!state.writing && + !state.corked && + !state.finished && + !state.bufferProcessing && + state.buffer.length) + clearBuffer(this, state); + } +}; + function decodeChunk(state, chunk, encoding) { if (!state.objectMode && state.decodeStrings !== false && - typeof chunk === 'string') { + util.isString(chunk)) { chunk = new Buffer(chunk, encoding); } return chunk; @@ -210,7 +249,7 @@ function decodeChunk(state, chunk, encoding) { // If we return false, then we need a drain event, so set that flag. function writeOrBuffer(stream, state, chunk, encoding, cb) { chunk = decodeChunk(state, chunk, encoding); - if (Buffer.isBuffer(chunk)) + if (util.isBuffer(chunk)) encoding = 'buffer'; var len = state.objectMode ? 1 : chunk.length; @@ -221,30 +260,36 @@ function writeOrBuffer(stream, state, chunk, encoding, cb) { if (!ret) state.needDrain = true; - if (state.writing) + if (state.writing || state.corked) state.buffer.push(new WriteReq(chunk, encoding, cb)); else - doWrite(stream, state, len, chunk, encoding, cb); + doWrite(stream, state, false, len, chunk, encoding, cb); return ret; } -function doWrite(stream, state, len, chunk, encoding, cb) { +function doWrite(stream, state, writev, len, chunk, encoding, cb) { state.writelen = len; state.writecb = cb; state.writing = true; state.sync = true; - stream._write(chunk, encoding, state.onwrite); + if (writev) + stream._writev(chunk, state.onwrite); + else + stream._write(chunk, encoding, state.onwrite); state.sync = false; } function onwriteError(stream, state, sync, er, cb) { if (sync) process.nextTick(function() { + state.pendingcb--; cb(er); }); - else + else { + state.pendingcb--; cb(er); + } stream._writableState.errorEmitted = true; stream.emit('error', er); @@ -270,8 +315,12 @@ function onwrite(stream, er) { // Check if we're actually ready to finish, but don't emit yet var finished = needFinish(stream, state); - if (!finished && !state.bufferProcessing && state.buffer.length) + if (!finished && + !state.corked && + !state.bufferProcessing && + state.buffer.length) { clearBuffer(stream, state); + } if (sync) { process.nextTick(function() { @@ -286,9 +335,9 @@ function onwrite(stream, er) { function afterWrite(stream, state, finished, cb) { if (!finished) onwriteDrain(stream, state); + state.pendingcb--; cb(); - if (finished) - finishMaybe(stream, state); + finishMaybe(stream, state); } // Must force callback to be called on nextTick, so that we don't @@ -306,51 +355,82 @@ function onwriteDrain(stream, state) { function clearBuffer(stream, state) { state.bufferProcessing = true; - for (var c = 0; c < state.buffer.length; c++) { - var entry = state.buffer[c]; - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - - doWrite(stream, state, len, chunk, encoding, cb); - - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - c++; - break; + if (stream._writev && state.buffer.length > 1) { + // Fast case, write everything using _writev() + var cbs = []; + for (var c = 0; c < state.buffer.length; c++) + cbs.push(state.buffer[c].callback); + + // count the one we are adding, as well. + // TODO(isaacs) clean this up + state.pendingcb++; + doWrite(stream, state, true, state.length, state.buffer, '', function(err) { + for (var i = 0; i < cbs.length; i++) { + state.pendingcb--; + cbs[i](err); + } + }); + + // Clear buffer + state.buffer = []; + } else { + // Slow case, write chunks one-by-one + for (var c = 0; c < state.buffer.length; c++) { + var entry = state.buffer[c]; + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, false, len, chunk, encoding, cb); + + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + c++; + break; + } } + + if (c < state.buffer.length) + state.buffer = state.buffer.slice(c); + else + state.buffer.length = 0; } state.bufferProcessing = false; - if (c < state.buffer.length) - state.buffer = state.buffer.slice(c); - else - state.buffer.length = 0; } Writable.prototype._write = function(chunk, encoding, cb) { cb(new Error('not implemented')); + }; +Writable.prototype._writev = null; + Writable.prototype.end = function(chunk, encoding, cb) { var state = this._writableState; - if (typeof chunk === 'function') { + if (util.isFunction(chunk)) { cb = chunk; chunk = null; encoding = null; - } else if (typeof encoding === 'function') { + } else if (util.isFunction(encoding)) { cb = encoding; encoding = null; } - if (typeof chunk !== 'undefined' && chunk !== null) + if (!util.isNullOrUndefined(chunk)) this.write(chunk, encoding); + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + // ignore unnecessary end() calls. if (!state.ending && !state.finished) endWritable(this, state, cb); @@ -364,11 +444,22 @@ function needFinish(stream, state) { !state.writing); } +function prefinish(stream, state) { + if (!state.prefinished) { + state.prefinished = true; + stream.emit('prefinish'); + } +} + function finishMaybe(stream, state) { var need = needFinish(stream, state); if (need) { - state.finished = true; - stream.emit('finish'); + if (state.pendingcb === 0) { + prefinish(stream, state); + state.finished = true; + stream.emit('finish'); + } else + prefinish(stream, state); } return need; } diff --git a/deps/npm/node_modules/readable-stream/node_modules/core-util-is/package.json b/deps/npm/node_modules/readable-stream/node_modules/core-util-is/package.json index 4eb9ce4f3c1..b67333380c2 100644 --- a/deps/npm/node_modules/readable-stream/node_modules/core-util-is/package.json +++ b/deps/npm/node_modules/readable-stream/node_modules/core-util-is/package.json @@ -5,7 +5,7 @@ "main": "lib/util.js", "repository": { "type": "git", - "url": "git://github.com/isaacs/core-util-is" + "url": "git://github.com/isaacs/core-util-is.git" }, "keywords": [ "util", @@ -29,26 +29,9 @@ }, "readme": "# core-util-is\n\nThe `util.is*` functions introduced in Node v0.12.\n", "readmeFilename": "README.md", - "homepage": "https://github.com/isaacs/core-util-is", + "homepage": "https://github.com/isaacs/core-util-is#readme", "_id": "core-util-is@1.0.1", - "dist": { - "shasum": "6b07085aef9a3ccac6ee53bf9d3df0c1521a5538", - "tarball": "http://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" - }, - "_from": "core-util-is@>=1.0.0 <1.1.0", - "_npmVersion": "1.3.23", - "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - } - ], - "directories": {}, "_shasum": "6b07085aef9a3ccac6ee53bf9d3df0c1521a5538", "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz", - "scripts": {} + "_from": "core-util-is@>=1.0.0 <1.1.0" } diff --git a/deps/npm/node_modules/readable-stream/node_modules/isarray/package.json b/deps/npm/node_modules/readable-stream/node_modules/isarray/package.json index fc7904b67b9..fb1eb3786d8 100644 --- a/deps/npm/node_modules/readable-stream/node_modules/isarray/package.json +++ b/deps/npm/node_modules/readable-stream/node_modules/isarray/package.json @@ -28,27 +28,11 @@ "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" + "bugs": { + "url": "https://github.com/juliangruber/isarray/issues" }, - "maintainers": [ - { - "name": "juliangruber", - "email": "julian@juliangruber.com" - } - ], - "directories": {}, + "_id": "isarray@0.0.1", "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "bugs": { - "url": "https://github.com/juliangruber/isarray/issues" - } + "_from": "isarray@0.0.1" } diff --git a/deps/npm/node_modules/readable-stream/node_modules/string_decoder/package.json b/deps/npm/node_modules/readable-stream/node_modules/string_decoder/package.json index 0364d54ba46..ee707023591 100644 --- a/deps/npm/node_modules/readable-stream/node_modules/string_decoder/package.json +++ b/deps/npm/node_modules/readable-stream/node_modules/string_decoder/package.json @@ -22,33 +22,13 @@ "browserify" ], "license": "MIT", - "gitHead": "d46d4fd87cf1d06e031c23f1ba170ca7d4ade9a0", + "readme": "**string_decoder.js** (`require('string_decoder')`) from Node.js core\n\nCopyright Joyent, Inc. and other Node contributors. See LICENCE file for details.\n\nVersion numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. **Prefer the stable version over the unstable.**\n\nThe *build/* directory contains a build script that will scrape the source from the [joyent/node](https://github.com/joyent/node) repo given a specific Node version.", + "readmeFilename": "README.md", "bugs": { "url": "https://github.com/rvagg/string_decoder/issues" }, "_id": "string_decoder@0.10.31", "_shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94", - "_from": "string_decoder@>=0.10.0 <0.11.0", - "_npmVersion": "1.4.23", - "_npmUser": { - "name": "rvagg", - "email": "rod@vagg.org" - }, - "maintainers": [ - { - "name": "substack", - "email": "mail@substack.net" - }, - { - "name": "rvagg", - "email": "rod@vagg.org" - } - ], - "dist": { - "shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94", - "tarball": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" - }, - "directories": {}, "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "readme": "ERROR: No README data found!" + "_from": "string_decoder@>=0.10.0 <0.11.0" } diff --git a/deps/npm/node_modules/readable-stream/package.json b/deps/npm/node_modules/readable-stream/package.json index 2fbd99751fb..fbc5e7fa498 100644 --- a/deps/npm/node_modules/readable-stream/package.json +++ b/deps/npm/node_modules/readable-stream/package.json @@ -1,7 +1,7 @@ { "name": "readable-stream", - "version": "1.0.32", - "description": "Streams2, a user-land copy of the stream library from Node.js v0.10.x", + "version": "1.1.13", + "description": "Streams3, a user-land copy of the stream library from Node.js v0.11.x", "main": "readable.js", "dependencies": { "core-util-is": "~1.0.0", @@ -17,7 +17,7 @@ }, "repository": { "type": "git", - "url": "git://github.com/isaacs/readable-stream" + "url": "git://github.com/isaacs/readable-stream.git" }, "keywords": [ "readable", @@ -33,16 +33,15 @@ "url": "http://blog.izs.me/" }, "license": "MIT", - "gitHead": "2024ad52b1e475465488b4ad39eb41d067ffcbb9", + "gitHead": "3b672fd7ae92acf5b4ffdbabf74b372a0a56b051", "bugs": { "url": "https://github.com/isaacs/readable-stream/issues" }, "homepage": "https://github.com/isaacs/readable-stream", - "_id": "readable-stream@1.0.32", - "_shasum": "6b44a88ba984cd0ec0834ae7d59a47c39aef48ec", - "_from": "readable-stream@*", - "_npmVersion": "2.0.2", - "_nodeVersion": "0.10.31", + "_id": "readable-stream@1.1.13", + "_shasum": "f6eef764f514c89e2b9e23146a75ba106756d23e", + "_from": "readable-stream@>=1.1.13 <1.2.0", + "_npmVersion": "1.4.23", "_npmUser": { "name": "rvagg", "email": "rod@vagg.org" @@ -62,10 +61,10 @@ } ], "dist": { - "shasum": "6b44a88ba984cd0ec0834ae7d59a47c39aef48ec", - "tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.32.tgz" + "shasum": "f6eef764f514c89e2b9e23146a75ba106756d23e", + "tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.32.tgz", + "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz", "readme": "ERROR: No README data found!" } diff --git a/deps/npm/node_modules/readable-stream/readable.js b/deps/npm/node_modules/readable-stream/readable.js index 4d1ddfc734e..09b8bf5091a 100644 --- a/deps/npm/node_modules/readable-stream/readable.js +++ b/deps/npm/node_modules/readable-stream/readable.js @@ -1,4 +1,5 @@ exports = module.exports = require('./lib/_stream_readable.js'); +exports.Stream = require('stream'); exports.Readable = exports; exports.Writable = require('./lib/_stream_writable.js'); exports.Duplex = require('./lib/_stream_duplex.js'); diff --git a/deps/npm/node_modules/realize-package-specifier/LICENSE b/deps/npm/node_modules/realize-package-specifier/LICENSE new file mode 100644 index 00000000000..45055763dc8 --- /dev/null +++ b/deps/npm/node_modules/realize-package-specifier/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2015, Rebecca Turner + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/realize-package-specifier/README.md b/deps/npm/node_modules/realize-package-specifier/README.md index 577014a48cb..dac3b64c51a 100644 --- a/deps/npm/node_modules/realize-package-specifier/README.md +++ b/deps/npm/node_modules/realize-package-specifier/README.md @@ -13,6 +13,8 @@ realizePackageSpecifier("foo.tar.gz", ".", function (err, package) { }) ``` +## Using + * realizePackageSpecifier(*spec*, [*where*,] *callback*) Parses *spec* using `npm-package-arg` and then uses stat to check to see if @@ -34,14 +36,17 @@ new type of `directory`. 2) The `local` type only refers to tarballs. 2) For all `local` and `directory` type results spec will contain the full path of the local package. -## Result Objects +## Result Object The full definition of the result object is: * `name` - If known, the `name` field expected in the resulting pkg. * `type` - One of the following strings: * `git` - A git repo - * `github` - A github shorthand, like `user/project` + * `hosted` - A hosted project, from github, bitbucket or gitlab. Originally + either a full url pointing at one of these services or a shorthand like + `user/project` or `github:user/project` for github or `bitbucket:user/project` + for bitbucket. * `tag` - A tagged version, like `"foo@latest"` * `version` - A specific version number, like `"foo@1.2.3"` * `range` - A version range, like `"foo@2.x"` @@ -49,6 +54,12 @@ The full definition of the result object is: * `directory` - A local package directory * `remote` - An http url (presumably to a tgz) * `spec` - The "thing". URL, the range, git repo, etc. +* `hosted` - If type=hosted this will be an object with the following keys: + * `type` - github, bitbucket or gitlab + * `ssh` - The ssh path for this git repo + * `sshurl` - The ssh URL for this git repo + * `https` - The HTTPS URL for this git repo + * `directUrl` - The URL for the package.json in this git repo * `raw` - The original un-modified string that was provided. * `rawSpec` - The part after the `name@...`, as it was originally provided. diff --git a/deps/npm/node_modules/realize-package-specifier/index.js b/deps/npm/node_modules/realize-package-specifier/index.js index 261ad663077..30214b2da37 100644 --- a/deps/npm/node_modules/realize-package-specifier/index.js +++ b/deps/npm/node_modules/realize-package-specifier/index.js @@ -14,6 +14,7 @@ module.exports = function (spec, where, cb) { catch (e) { return cb(e) } + if ((dep.type == "range" || dep.type == "version") && dep.name != dep.raw) return cb(null, dep) var specpath = dep.type == "local" ? path.resolve(where, dep.spec) : path.resolve(dep.rawSpec? dep.rawSpec: dep.name) diff --git a/deps/npm/node_modules/realize-package-specifier/package.json b/deps/npm/node_modules/realize-package-specifier/package.json index 53645763748..b14b24beffe 100644 --- a/deps/npm/node_modules/realize-package-specifier/package.json +++ b/deps/npm/node_modules/realize-package-specifier/package.json @@ -1,6 +1,6 @@ { "name": "realize-package-specifier", - "version": "1.2.0", + "version": "3.0.1", "description": "Like npm-package-arg, but more so, producing full file paths and differentiating local tar and directory sources.", "main": "index.js", "scripts": { @@ -9,7 +9,7 @@ "license": "ISC", "repository": { "type": "git", - "url": "https://github.com/npm/realize-package-specifier.git" + "url": "git+https://github.com/npm/realize-package-specifier.git" }, "author": { "name": "Rebecca Turner", @@ -19,35 +19,39 @@ "homepage": "https://github.com/npm/realize-package-specifier", "dependencies": { "dezalgo": "^1.0.1", - "npm-package-arg": "^2.1.3" + "npm-package-arg": "^4.0.0" }, "devDependencies": { "require-inject": "^1.1.0", "tap": "^0.4.12" }, - "gitHead": "39016343d5bd5572ab39374323e9588e54985910", + "gitHead": "4f50130fa6b5e80954a90ea12bab382f53d890b1", "bugs": { "url": "https://github.com/npm/realize-package-specifier/issues" }, - "_id": "realize-package-specifier@1.2.0", - "_shasum": "93364e40dee38369f92e9b0c76124500342132f2", - "_from": "realize-package-specifier@>=1.2.0 <1.3.0", - "_npmVersion": "2.1.2", - "_nodeVersion": "0.10.32", + "_id": "realize-package-specifier@3.0.1", + "_shasum": "fde32e926448e38f99334d95b7b08d51e3a98d9f", + "_from": "realize-package-specifier@>=3.0.0 <3.1.0", + "_npmVersion": "2.10.1", + "_nodeVersion": "2.0.2", "_npmUser": { - "name": "iarna", - "email": "me@re-becca.org" + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + }, + "dist": { + "shasum": "fde32e926448e38f99334d95b7b08d51e3a98d9f", + "tarball": "http://registry.npmjs.org/realize-package-specifier/-/realize-package-specifier-3.0.1.tgz" }, "maintainers": [ { "name": "iarna", "email": "me@re-becca.org" + }, + { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" } ], - "dist": { - "shasum": "93364e40dee38369f92e9b0c76124500342132f2", - "tarball": "http://registry.npmjs.org/realize-package-specifier/-/realize-package-specifier-1.2.0.tgz" - }, "directories": {}, - "_resolved": "https://registry.npmjs.org/realize-package-specifier/-/realize-package-specifier-1.2.0.tgz" + "_resolved": "https://registry.npmjs.org/realize-package-specifier/-/realize-package-specifier-3.0.1.tgz" } diff --git a/deps/npm/node_modules/realize-package-specifier/test/basic.js b/deps/npm/node_modules/realize-package-specifier/test/basic.js index d5d8fc6c07f..7fe659fbf62 100644 --- a/deps/npm/node_modules/realize-package-specifier/test/basic.js +++ b/deps/npm/node_modules/realize-package-specifier/test/basic.js @@ -4,15 +4,17 @@ var requireInject = require("require-inject") var path = require("path") var re = { - tarball: /[\/\\]a.tar.gz$/, - packagedir: /[\/\\]b$/, - packagejson: /[\/\\]b[\/\\]package.json$/, - nonpackagedir: /[\/\\]c$/, - nopackagejson: /[\/\\]c[\/\\]package.json$/, - remotename: /[\/\\]d$/, - packagedirlikegithub: /[\/\\]e[\/\\]1$/, - packagejsonlikegithub: /[\/\\]e[\/\\]1[\/\\]package.json$/, - github: /[\/\\]e[\/\\]2$/ + tarball: /[/\\]a.tar.gz$/, + packagedir: /[/\\]b$/, + packagejson: /[/\\]b[/\\]package.json$/, + nonpackagedir: /[/\\]c$/, + nopackagejson: /[/\\]c[/\\]package.json$/, + remotename: /[/\\]d$/, + packagedirlikegithub: /[/\\]e[/\\]1$/, + packagejsonlikegithub: /[/\\]e[/\\]1[/\\]package.json$/, + github: /[/\\]e[/\\]2$/, + localrangefile: /[/\\]1[.]0[.]0$/, + localverfile: /[/\\]1$/ } var rps = requireInject("../index", { @@ -45,6 +47,12 @@ var rps = requireInject("../index", { else if (re.github.test(path)) { callback(new Error("EFILENOTFOUND")) } + else if (re.localverfile.test(path)) { + callback(null,{isDirectory:function(){ return false }}) + } + else if (re.localrangefile.test(path)) { + callback(null,{isDirectory:function(){ return false }}) + } else { throw new Error("Unknown stat fixture path: "+path) } @@ -53,7 +61,7 @@ var rps = requireInject("../index", { }) test("realize-package-specifier", function (t) { - t.plan(10) + t.plan(13) rps("a.tar.gz", function (err, result) { t.is(result.type, "local", "local tarball") }) @@ -82,11 +90,18 @@ test("realize-package-specifier", function (t) { t.is(result.type, "directory", "local package directory") }) rps("e/2", function (err, result) { - t.is(result.type, "github", "github package dependency") + t.is(result.type, "hosted", "hosted package dependency") + t.is(result.hosted.type, "github", "github package dependency") + }) + rps("1", function (err, result) { + t.is(result.type, "local", "range like local file is still a local file") + }) + rps("1.0.0", function (err, result) { + t.is(result.type, "local", "version like local file is still a local file") }) }) test("named realize-package-specifier", function (t) { - t.plan(10) + t.plan(13) rps("a@a.tar.gz", function (err, result) { t.is(result.type, "local", "named local tarball") @@ -116,6 +131,13 @@ test("named realize-package-specifier", function (t) { t.is(result.type, "directory", "local package directory") }) rps("e@e/2", function (err, result) { - t.is(result.type, "github", "github package dependency") + t.is(result.type, "hosted", "hosted package dependency") + t.is(result.hosted.type, "github", "github package dependency") + }) + rps("e@1", function (err, result) { + t.is(result.type, "range", "range like specifier is never a local file") + }) + rps("e@1.0.0", function (err, result) { + t.is(result.type, "version", "version like specifier is never a local file") }) }) diff --git a/deps/npm/node_modules/realize-package-specifier/test/npa-basic.js b/deps/npm/node_modules/realize-package-specifier/test/npa-basic.js index be07aa56a38..bd7ab4aec37 100644 --- a/deps/npm/node_modules/realize-package-specifier/test/npa-basic.js +++ b/deps/npm/node_modules/realize-package-specifier/test/npa-basic.js @@ -64,11 +64,11 @@ test("npa-basic", function (t) { rawSpec: "=v1.2.3" }, - "git+ssh://git@github.com/user/foo#1.2.3": { + "git+ssh://git@notgithub.com/user/foo#1.2.3": { name: null, type: "git", - spec: "ssh://git@github.com/user/foo#1.2.3", - raw: "git+ssh://git@github.com/user/foo#1.2.3" + spec: "ssh://git@notgithub.com/user/foo#1.2.3", + raw: "git+ssh://git@notgithub.com/user/foo#1.2.3" }, "git+file://path/to/repo#1.2.3": { @@ -78,19 +78,19 @@ test("npa-basic", function (t) { raw: "git+file://path/to/repo#1.2.3" }, - "git://github.com/user/foo": { + "git://notgithub.com/user/foo": { name: null, type: "git", - spec: "git://github.com/user/foo", - raw: "git://github.com/user/foo" + spec: "git://notgithub.com/user/foo", + raw: "git://notgithub.com/user/foo" }, - "@foo/bar@git+ssh://github.com/user/foo": { + "@foo/bar@git+ssh://notgithub.com/user/foo": { name: "@foo/bar", scope: "@foo", - spec: "ssh://github.com/user/foo", - rawSpec: "git+ssh://github.com/user/foo", - raw: "@foo/bar@git+ssh://github.com/user/foo" + spec: "ssh://notgithub.com/user/foo", + rawSpec: "git+ssh://notgithub.com/user/foo", + raw: "@foo/bar@git+ssh://notgithub.com/user/foo" }, "/path/to/foo": { @@ -99,28 +99,18 @@ test("npa-basic", function (t) { spec: "/path/to/foo", raw: "/path/to/foo" }, - "file:path/to/foo": { name: null, type: "local", spec: path.resolve(__dirname,"..","path/to/foo"), raw: "file:path/to/foo" }, - - "file:~/path/to/foo": { - name: null, - type: "local", - spec: path.resolve(__dirname,"..","~/path/to/foo"), - raw: "file:~/path/to/foo" - }, - "file:../path/to/foo": { name: null, type: "local", spec: path.resolve(__dirname,"..","../path/to/foo"), raw: "file:../path/to/foo" }, - "file:///path/to/foo": { name: null, type: "local", @@ -135,41 +125,6 @@ test("npa-basic", function (t) { raw: "https://server.com/foo.tgz" }, - "user/foo-js": { - name: null, - type: "github", - spec: "user/foo-js", - raw: "user/foo-js" - }, - - "user/foo-js#bar/baz": { - name: null, - type: "github", - spec: "user/foo-js#bar/baz", - raw: "user/foo-js#bar/baz" - }, - - "user..blerg--/..foo-js# . . . . . some . tags / / /": { - name: null, - type: "github", - spec: "user..blerg--/..foo-js# . . . . . some . tags / / /", - raw: "user..blerg--/..foo-js# . . . . . some . tags / / /" - }, - - "user/foo-js#bar/baz/bin": { - name: null, - type: "github", - spec: "user/foo-js#bar/baz/bin", - raw: "user/foo-js#bar/baz/bin" - }, - - "foo@user/foo-js": { - name: "foo", - type: "github", - spec: "user/foo-js", - raw: "foo@user/foo-js" - }, - "foo@latest": { name: "foo", type: "tag", @@ -189,9 +144,9 @@ test("npa-basic", function (t) { Object.keys(tests).forEach(function (arg) { rps(arg, path.resolve(__dirname,'..'), function(err, res) { - t.notOk(err, "No error") - t.type(res, "Result") - t.has(res, tests[arg]) + t.notOk(err, arg + " no error") + t.type(res, "Result", arg + " got right result time") + t.has(res, tests[arg], arg + " result has correct values") }) }) diff --git a/deps/npm/node_modules/realize-package-specifier/test/npa-bitbucket.js b/deps/npm/node_modules/realize-package-specifier/test/npa-bitbucket.js new file mode 100644 index 00000000000..4381e6c401e --- /dev/null +++ b/deps/npm/node_modules/realize-package-specifier/test/npa-bitbucket.js @@ -0,0 +1,86 @@ +var test = require("tap").test; +var rps = require("../index.js") +var path = require("path") + +test("npa-bitbucket", function (t) { + t.setMaxListeners(999) + + var tests = { + "bitbucket:user/foo-js": { + name: null, + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "bitbucket:user/foo-js", + raw: "bitbucket:user/foo-js" + }, + + "bitbucket:user/foo-js#bar/baz": { + name: null, + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "bitbucket:user/foo-js#bar/baz", + raw: "bitbucket:user/foo-js#bar/baz" + }, + + "bitbucket:user..blerg--/..foo-js# . . . . . some . tags / / /": { + name: null, + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "bitbucket:user..blerg--/..foo-js# . . . . . some . tags / / /", + raw: "bitbucket:user..blerg--/..foo-js# . . . . . some . tags / / /" + }, + + "bitbucket:user/foo-js#bar/baz/bin": { + name: null, + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "bitbucket:user/foo-js#bar/baz/bin", + raw: "bitbucket:user/foo-js#bar/baz/bin" + }, + + "foo@bitbucket:user/foo-js": { + name: "foo", + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "bitbucket:user/foo-js", + raw: "foo@bitbucket:user/foo-js" + }, + + "git+ssh://git@bitbucket.org/user/foo#1.2.3": { + name: null, + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "git+ssh://git@bitbucket.org/user/foo.git#1.2.3", + raw: "git+ssh://git@bitbucket.org/user/foo#1.2.3" + }, + + "https://bitbucket.org/user/foo.git": { + name: null, + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "https://bitbucket.org/user/foo.git", + raw: "https://bitbucket.org/user/foo.git" + }, + + "@foo/bar@git+ssh://bitbucket.org/user/foo": { + name: "@foo/bar", + scope: "@foo", + type: "hosted", + hosted: { type: "bitbucket" }, + spec: "git+ssh://git@bitbucket.org/user/foo.git", + rawSpec: "git+ssh://bitbucket.org/user/foo", + raw: "@foo/bar@git+ssh://bitbucket.org/user/foo" + } + } + + t.plan( Object.keys(tests).length * 3 ) + + Object.keys(tests).forEach(function (arg) { + rps(arg, path.resolve(__dirname,'..'), function(err, res) { + t.notOk(err, "No error") + t.type(res, "Result") + t.has(res, tests[arg]) + }) + }) + +}) diff --git a/deps/npm/node_modules/realize-package-specifier/test/npa-github.js b/deps/npm/node_modules/realize-package-specifier/test/npa-github.js new file mode 100644 index 00000000000..b0c405e7def --- /dev/null +++ b/deps/npm/node_modules/realize-package-specifier/test/npa-github.js @@ -0,0 +1,110 @@ +var test = require("tap").test; +var rps = require("../index.js") +var path = require("path") + +test("npa-github", function (t) { + t.setMaxListeners(999) + + var tests = { + "user/foo-js": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "github:user/foo-js", + raw: "user/foo-js" + }, + + "user/foo-js#bar/baz": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "github:user/foo-js#bar/baz", + raw: "user/foo-js#bar/baz" + }, + + "user..blerg--/..foo-js# . . . . . some . tags / / /": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "github:user..blerg--/..foo-js# . . . . . some . tags / / /", + raw: "user..blerg--/..foo-js# . . . . . some . tags / / /" + }, + + "user/foo-js#bar/baz/bin": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "github:user/foo-js#bar/baz/bin", + raw: "user/foo-js#bar/baz/bin" + }, + + "foo@user/foo-js": { + name: "foo", + type: "hosted", + hosted: { type: "github" }, + spec: "github:user/foo-js", + raw: "foo@user/foo-js" + }, + + "github:user/foo-js": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "github:user/foo-js", + raw: "github:user/foo-js" + }, + + "git+ssh://git@github.com/user/foo#1.2.3": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "git+ssh://git@github.com/user/foo.git#1.2.3", + raw: "git+ssh://git@github.com/user/foo#1.2.3" + }, + + "git://github.com/user/foo": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "git://github.com/user/foo.git", + raw: "git://github.com/user/foo" + }, + + "https://github.com/user/foo.git": { + name: null, + type: "hosted", + hosted: { type: "github" }, + spec: "https://github.com/user/foo.git", + raw: "https://github.com/user/foo.git" + }, + + "@foo/bar@git+ssh://github.com/user/foo": { + name: "@foo/bar", + scope: "@foo", + type: "hosted", + hosted: { type: "github" }, + spec: "git+ssh://git@github.com/user/foo.git", + rawSpec: "git+ssh://github.com/user/foo", + raw: "@foo/bar@git+ssh://github.com/user/foo" + }, + + "foo@bar/foo": { + name: "foo", + type: "hosted", + hosted: { type: "github" }, + spec: "github:bar/foo", + raw: "foo@bar/foo" + } + } + + t.plan( Object.keys(tests).length * 3 ) + + Object.keys(tests).forEach(function (arg) { + rps(arg, path.resolve(__dirname,'..'), function(err, res) { + t.notOk(err, "No error") + t.type(res, "Result") + t.has(res, tests[arg]) + }) + }) + +}) diff --git a/deps/npm/node_modules/realize-package-specifier/test/npa-gitlab.js b/deps/npm/node_modules/realize-package-specifier/test/npa-gitlab.js new file mode 100644 index 00000000000..cb1a625bc25 --- /dev/null +++ b/deps/npm/node_modules/realize-package-specifier/test/npa-gitlab.js @@ -0,0 +1,86 @@ +var test = require("tap").test; +var rps = require("../index.js") +var path = require("path") + +test("npa-gitlab", function (t) { + t.setMaxListeners(999) + + var tests = { + "gitlab:user/foo-js": { + name: null, + type: "hosted", + hosted: { type: "gitlab" }, + spec: "gitlab:user/foo-js", + raw: "gitlab:user/foo-js" + }, + + "gitlab:user/foo-js#bar/baz": { + name: null, + type: "hosted", + hosted: { type: "gitlab" }, + spec: "gitlab:user/foo-js#bar/baz", + raw: "gitlab:user/foo-js#bar/baz" + }, + + "gitlab:user..blerg--/..foo-js# . . . . . some . tags / / /": { + name: null, + type: "hosted", + hosted: { type: "gitlab" }, + spec: "gitlab:user..blerg--/..foo-js# . . . . . some . tags / / /", + raw: "gitlab:user..blerg--/..foo-js# . . . . . some . tags / / /" + }, + + "gitlab:user/foo-js#bar/baz/bin": { + name: null, + type: "hosted", + hosted: { type: "gitlab" }, + spec: "gitlab:user/foo-js#bar/baz/bin", + raw: "gitlab:user/foo-js#bar/baz/bin" + }, + + "foo@gitlab:user/foo-js": { + name: "foo", + type: "hosted", + hosted: { type: "gitlab" }, + spec: "gitlab:user/foo-js", + raw: "foo@gitlab:user/foo-js" + }, + + "git+ssh://git@gitlab.com/user/foo#1.2.3": { + name: null, + type: "hosted", + hosted: { type: "gitlab" }, + spec: "git+ssh://git@gitlab.com/user/foo.git#1.2.3", + raw: "git+ssh://git@gitlab.com/user/foo#1.2.3" + }, + + "https://gitlab.com/user/foo.git": { + name: null, + type: "hosted", + hosted: { type: "gitlab" }, + spec: "https://gitlab.com/user/foo.git", + raw: "https://gitlab.com/user/foo.git" + }, + + "@foo/bar@git+ssh://gitlab.com/user/foo": { + name: "@foo/bar", + scope: "@foo", + type: "hosted", + hosted: { type: "gitlab" }, + spec: "git+ssh://git@gitlab.com/user/foo.git", + rawSpec: "git+ssh://gitlab.com/user/foo", + raw: "@foo/bar@git+ssh://gitlab.com/user/foo" + } + } + + t.plan( Object.keys(tests).length * 3 ) + + Object.keys(tests).forEach(function (arg) { + rps(arg, path.resolve(__dirname,'..'), function(err, res) { + t.notOk(err, "No error") + t.type(res, "Result") + t.has(res, tests[arg]) + }) + }) + +}) diff --git a/deps/npm/node_modules/request/.eslintrc b/deps/npm/node_modules/request/.eslintrc index 9c3350d6bb7..e79f481f0ce 100644 --- a/deps/npm/node_modules/request/.eslintrc +++ b/deps/npm/node_modules/request/.eslintrc @@ -3,6 +3,8 @@ "node": true }, "rules": { + // 2-space indentation + "indent": [2, 2], // Disallow semi-colons, unless needed to disambiguate statement "semi": [2, "never"], // Require strings to use single quotes @@ -17,6 +19,27 @@ "no-unused-vars": [2, {"args":"none"}], // Allow leading underscores for method names // REASON: we use underscores to denote private methods - "no-underscore-dangle": 0 + "no-underscore-dangle": 0, + // Allow multi spaces around operators since they are + // used for alignment. This is not consistent in the + // code. + "no-multi-spaces": 0, + // Style rule is: most objects use { beforeColon: false, afterColon: true }, unless aligning which uses: + // + // { + // beforeColon : true, + // afterColon : true + // } + // + // eslint can't handle this, so the check is disabled. + "key-spacing": 0, + // Allow shadowing vars in outer scope (needs discussion) + "no-shadow": 0, + // Use if () { } + // ^ space + "space-after-keywords": [2, "always"], + // Use if () { } + // ^ space + "space-before-blocks": [2, "always"] } } diff --git a/deps/npm/node_modules/request/.npmignore b/deps/npm/node_modules/request/.npmignore index 80e59ef5251..53fc9efa995 100644 --- a/deps/npm/node_modules/request/.npmignore +++ b/deps/npm/node_modules/request/.npmignore @@ -1,2 +1,3 @@ +coverage tests node_modules diff --git a/deps/npm/node_modules/request/.travis.yml b/deps/npm/node_modules/request/.travis.yml index 742c7dfa0c5..bd0f638eb70 100644 --- a/deps/npm/node_modules/request/.travis.yml +++ b/deps/npm/node_modules/request/.travis.yml @@ -1,9 +1,12 @@ language: node_js node_js: - - "0.8" + - "io.js" + - "0.12" - "0.10" +after_script: ./node_modules/.bin/istanbul cover ./node_modules/tape/bin/tape tests/test-*.js --report lcovonly && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js --verbose webhooks: urls: https://webhooks.gitter.im/e/237280ed4796c19cc626 on_success: change # options: [always|never|change] default: always on_failure: always # options: [always|never|change] default: always on_start: false # default: false +sudo: false diff --git a/deps/npm/node_modules/request/CHANGELOG.md b/deps/npm/node_modules/request/CHANGELOG.md index 11f571f23af..2de0061ad32 100644 --- a/deps/npm/node_modules/request/CHANGELOG.md +++ b/deps/npm/node_modules/request/CHANGELOG.md @@ -1,954 +1,493 @@ ## Change Log -### upcoming (2014/07/09 12:10 +00:00) -- [#946](https://github.com/mikeal/request/pull/946) defaults: merge headers (@aj0strow) -- [#844](https://github.com/mikeal/request/pull/844) Add support for HTTP[S]_PROXY environment variables. Fixes #595. (@jvmccarthy) - -### v2.37.1 (2014/07/07 17:25 +00:00) -- [8711b2f](https://github.com/mikeal/request/commit/8711b2f3489553a7ddae69fa8c9f538182c9d5c8) 2.37.1 (@mikeal) - -### v2.37.0 (2014/07/07 17:25 +00:00) -- [79472b2](https://github.com/mikeal/request/commit/79472b263cde77504a354913a16bdc9fbdc9ed5d) append secureOptions to poolKey (@medovob) -- [#907](https://github.com/mikeal/request/pull/907) append secureOptions to poolKey (@medovob) -- [b223a8a](https://github.com/mikeal/request/commit/b223a8add0cbdd4e699a52da66aeb0f0cb17a0c3) expose tough-cookie's getCookiesSync (@charlespwd) -- [f4dcad0](https://github.com/mikeal/request/commit/f4dcad0fa6e2f2388abae508ad7256a1e1214ab2) test getCookies method (@charlespwd) -- [adcf62b](https://github.com/mikeal/request/commit/adcf62bf45ec19a28198ca8d3f37e7d7babc883a) update readme (@charlespwd) -- [4fdf13b](https://github.com/mikeal/request/commit/4fdf13b57dcd20b9fe03c0956f5df70c82d6e4a3) Merge branch 'charlespwd-master' (@lalitkapoor) -- [83e370d](https://github.com/mikeal/request/commit/83e370d54ca2a5fb162e40e7e705e1e9d702ba0a) Bump version of hawk dep. (@samccone) -- [#927](https://github.com/mikeal/request/pull/927) Bump version of hawk dep. (@samccone) -- [c42dcec](https://github.com/mikeal/request/commit/c42dcec10a307cb2299861f87720d491a89142b4) package.json: use OSI-style license name (@isaacs) -- [8892cb7](https://github.com/mikeal/request/commit/8892cb7bb8945807ff25038e888222d4e902acc8) Swap mime module. (@eiriksm) -- [d92395e](https://github.com/mikeal/request/commit/d92395e638cbfe5c31eb4ff54941b98b09057486) Make package.json so node .8 understands it. (@eiriksm) -- [6ebd748](https://github.com/mikeal/request/commit/6ebd748a02a49976d41ebbc4f8396acf8fda1c14) Add some additional hacks to work in the browser. (@eiriksm) -- [#943](https://github.com/mikeal/request/pull/943) New mime module (@eiriksm) -- [561454d](https://github.com/mikeal/request/commit/561454d18a68b7a03163308f6d29e127afe97426) Add some code comments about why we do the extra checks. (@eiriksm) -- [#944](https://github.com/mikeal/request/pull/944) Make request work with browserify (@eiriksm) -- [6a0add7](https://github.com/mikeal/request/commit/6a0add70b2687cf751b3446a15a513a1fd141738) defaults: merge headers (@aj0strow) -- [407c1ad](https://github.com/mikeal/request/commit/407c1ada61afca4d4ba50155c6d9430754541df1) prefer late return statement (@aj0strow) -- [4ab40ba](https://github.com/mikeal/request/commit/4ab40ba2f9aca8958cab149eb9cfbd9edb5534aa) Added support for manual querystring in form option (@charlespwd) -- [a55627c](https://github.com/mikeal/request/commit/a55627cd9f468cefb2971bb501ebc0c2fc27aa8b) Updated README (@charlespwd) -- [#949](https://github.com/mikeal/request/pull/949) Manually enter querystring in form option (@charlespwd) -- [10246c8](https://github.com/mikeal/request/commit/10246c84819db14b32fccca040029b06449242a3) [PATCH v2] Add support for gzip content decoding (@kevinoid) -- [6180c5f](https://github.com/mikeal/request/commit/6180c5f45c01fb2158b9a44f894a34263479fa84) check for content-length header before setting it in nextTick (@camilleanne) -- [#951](https://github.com/mikeal/request/pull/951) Add support for gzip content decoding (@kevinoid) -- [849c681](https://github.com/mikeal/request/commit/849c681846ce3b5492bd47261de391377a3ac19b) Silence EventEmitter memory leak warning #311 (@watson) -- [#955](https://github.com/mikeal/request/pull/955) check for content-length header before setting it in nextTick (@camilleanne) -- [#957](https://github.com/mikeal/request/pull/957) Silence EventEmitter memory leak warning #311 (@watson) -- [c1d951e](https://github.com/mikeal/request/commit/c1d951e536bd41c957f0cade41d051c9d41d1462) Fixing for 0.8 (@mikeal) -- [4851118](https://github.com/mikeal/request/commit/48511186495888a5f0cb15a107325001ac91990e) 2.37.0 (@mikeal) - -### v2.36.1 (2014/05/19 20:59 +00:00) -- [c3914fc](https://github.com/mikeal/request/commit/c3914fcd4a74faf6dbf0fb6a4a188e871e0c51b8) 2.36.1 (@mikeal) - -### v2.36.0 (2014/05/19 20:59 +00:00) -- [76a96de](https://github.com/mikeal/request/commit/76a96de75580042aa780e9587ff7a22522119c3f) Reventing lodash merge change. (@mikeal) -- [b8bb57e](https://github.com/mikeal/request/commit/b8bb57efb17e72e2ac6d957c05c3f2570c7ba6a0) 2.36.0 (@mikeal) - -### v2.35.1 (2014/05/17 20:57 +00:00) -- [4bbd153](https://github.com/mikeal/request/commit/4bbd1532a68cadf1a88dd69c277645e9b781f364) 2.35.1 (@mikeal) - -### v2.35.0 (2014/05/17 20:57 +00:00) -- [2833da3](https://github.com/mikeal/request/commit/2833da3c3c1c34f4130ad1ba470354fc32410691) initial changelog (@lalitkapoor) -- [49319e6](https://github.com/mikeal/request/commit/49319e6c09a8a169c95a8d282c900f9fecd50371) Merge branch 'master' of https://github.com/mikeal/request into create-changelog-based-on-pull-requests (@lalitkapoor) -- [#815](https://github.com/mikeal/request/pull/815) Create changelog based on pull requests (@lalitkapoor) -- [4b6ce1a](https://github.com/mikeal/request/commit/4b6ce1ac0f79cb8fa633e281d3eb4c0cb61794e1) It appears that secureOptions is an undocumented feature to fix issues with broken server. See joynet/node #5119 (@nw) -- [#821](https://github.com/mikeal/request/pull/821) added secureOptions back (@nw) -- [eddd488](https://github.com/mikeal/request/commit/eddd4889fb1bc95c741749e79d9749aab3e103fc) Fixing #825 (@mikeal) -- [4627a7a](https://github.com/mikeal/request/commit/4627a7a14078494ded8c66c19c43efd07324cbd8) improve error reporting for invalid protocols (@FND) -- [#840](https://github.com/mikeal/request/pull/840) improve error reporting for invalid protocols (@FND) -- [#810](https://github.com/mikeal/request/pull/810) add some exposition to mpu example in README.md (@mikermcneil) -- [8a0e2d6](https://github.com/mikeal/request/commit/8a0e2d65351560858275c73505df12b537f4d001) Added support for HTTP_PROXY and HTTPS_PROXY environment variables, if the proxy option isn't already set. (@jvmccarthy) -- [f60d348](https://github.com/mikeal/request/commit/f60d348dc1840ee6d7b709efcc2b3cd1a03aef63) Fix word consistency -- [#850](https://github.com/mikeal/request/pull/850) Fix word consistency in readme (@0xNobody) -- [#809](https://github.com/mikeal/request/pull/809) upgrade tunnel-proxy to 0.4.0 (@ksato9700) -- [e86377c](https://github.com/mikeal/request/commit/e86377c0c1e7695c3997f7802175ca37f5a5113b) Won't use HTTP(S)_PROXY env var if proxy explicitly set to null. (@jvmccarthy) -- [f1bb537](https://github.com/mikeal/request/commit/f1bb537ee2440bd664ea8c445ac3a2c6e31e9932) Add support for RFC 6750 Bearer Tokens -- [ba51a26](https://github.com/mikeal/request/commit/ba51a26079ec52c0a9145fbe8b6796d46e79bb8e) Add documentation about auth.bearer (@phedny) -- [#861](https://github.com/mikeal/request/pull/861) Add support for RFC 6750 Bearer Tokens (@phedny) -- [b8ee579](https://github.com/mikeal/request/commit/b8ee5790ace95440a56074f6afe866f4662e9e88) Fix typo (@dandv) -- [#866](https://github.com/mikeal/request/pull/866) Fix typo (@dandv) -- [b292b59](https://github.com/mikeal/request/commit/b292b59fadecb35dac3bee0959c4b4b782e772e3) Clean code syntax in test-pipes.js (@tgohn) -- [f7996d5](https://github.com/mikeal/request/commit/f7996d5fcfed85e03f293a7c9739e385b64ecaad) Add test for request.pipefilter (@tgohn) -- [#869](https://github.com/mikeal/request/pull/869) Pipefilter test (@tgohn) -- [86b99b6](https://github.com/mikeal/request/commit/86b99b671a3c86f4f963a6c67047343fd8edae8f) Fix typo in form example (@mscdex) -- [2ba4808](https://github.com/mikeal/request/commit/2ba48083ddf2607f85e2c479e0d254483c2610fe) failing test (@lalitkapoor) -- [39396b0](https://github.com/mikeal/request/commit/39396b0bb2e90eb7ec4dfcf5d2e731a2cb156f5c) extend passed in options (@lalitkapoor) -- [#891](https://github.com/mikeal/request/pull/891) fixes 857 - options object is mutated by calling request (@lalitkapoor) -- [54a51c6](https://github.com/mikeal/request/commit/54a51c665887e162ccb9f6b17b9c1f3b017ccc29) merge options (@vohof) -- [25b95db](https://github.com/mikeal/request/commit/25b95dbdddf874f014386a0a9fe35a7c903b7415) tilde? (@vohof) -- [#897](https://github.com/mikeal/request/pull/897) merge with default options (@vohof) -- [a1e4b1a](https://github.com/mikeal/request/commit/a1e4b1a9c2f39ce565fd023bb604da139f689d43) Fixes #555 (@pigulla) -- [#901](https://github.com/mikeal/request/pull/901) Fixes #555 (@pigulla) -- [6498a5f](https://github.com/mikeal/request/commit/6498a5f1ae68050cfeabf8f34f75bc72b08f1805) 2.35.0 (@mikeal) - -### v2.34.1 (2014/02/18 19:35 +00:00) -- [aefea20](https://github.com/mikeal/request/commit/aefea20b215ff1a48f0d8d27dcac0186604e3b2d) 2.34.1 (@mikeal) - -### v2.34.0 (2014/02/18 19:35 +00:00) -- [46edc90](https://github.com/mikeal/request/commit/46edc902e6ffdee39038a6702021728cb9d9b8fa) simpler (@joaojeronimo) -- [#781](https://github.com/mikeal/request/pull/781) simpler isReadStream function (@joaojeronimo) -- [fe2f59f](https://github.com/mikeal/request/commit/fe2f59fdc72de5c86404e51ab6bc4e0e8ece95f2) Provide ability to override content-type when `json` option used (@vvo) -- [#785](https://github.com/mikeal/request/pull/785) Provide ability to override content-type when `json` option used (@vvo) -- [d134f01](https://github.com/mikeal/request/commit/d134f012e64702e8f4070d61504b39524e1a07ba) Adds content-length calculation when submitting forms using form-data library. This is related to issue 345. (@Juul) -- [#793](https://github.com/mikeal/request/pull/793) Adds content-length calculation when submitting forms using form-data li... (@Juul) -- [3ebf25c](https://github.com/mikeal/request/commit/3ebf25c5af1194d8f7b3a3330fe89e729532809b) adding failing test (@lalitkapoor) -- [0f57a90](https://github.com/mikeal/request/commit/0f57a90384588727a5446bb1f5bf4e0be2d85780) accept options in arguments (@lalitkapoor) -- [7fb1647](https://github.com/mikeal/request/commit/7fb164731a5aad80c6539e33eda4ad4a51bb7871) silently ignore errors when adding cookie to jar (@lalitkapoor) -- [d6b2b1c](https://github.com/mikeal/request/commit/d6b2b1c279d12cdddc6593060672d49b12e63fea) add additional header test (@lalitkapoor) -- [f29e6df](https://github.com/mikeal/request/commit/f29e6dfadc6c3a45b6190998b6608059f87f3c32) Added the Apache license to the package.json. (@keskival) -- [#802](https://github.com/mikeal/request/pull/802) Added the Apache license to the package.json. (@keskival) -- [#801](https://github.com/mikeal/request/pull/801) 794 ignore cookie parsing and domain errors (@lalitkapoor) -- [54e6dfb](https://github.com/mikeal/request/commit/54e6dfb77d57757d4006982f813ebaab9e005cd5) Rewrite UNIX Domain Socket support into 2.33.1. Add test. (@lyuzashi) -- [3eaed2f](https://github.com/mikeal/request/commit/3eaed2f2e82d9d17a583bcc54270c16a7b674206) Use setImmediate when available, otherwise fallback to nextTick (@lyuzashi) -- [746ca75](https://github.com/mikeal/request/commit/746ca757da24d5011e92e04cb00c90098a7680fd) Indent wrapped buildRequest function (@lyuzashi) -- [#516](https://github.com/mikeal/request/pull/516) UNIX Socket URL Support (@native-digital) -- [9a5b0a8](https://github.com/mikeal/request/commit/9a5b0a81eca9836f05b0192c05c0d41e79034461) initial format (@lalitkapoor) -- [9380a49](https://github.com/mikeal/request/commit/9380a49779ddb081eba5d0ee51e4396d72d52066) upgrade tunnel-proxy to 0.4.0 (@ksato9700) -- [1efea37](https://github.com/mikeal/request/commit/1efea374286c728c3c988ee2264fb44cd8c41d88) add some exposition to mpu example in README.md (@mikermcneil) -- [ba0d63a](https://github.com/mikeal/request/commit/ba0d63ae23a3fc95dfe012df0bd6c8d7e87b1df7) made the language clearer (@mikermcneil) -- [b43aa81](https://github.com/mikeal/request/commit/b43aa81789c0b8c7ae90d2b983f79dde4a125470) 2.34.0 (@mikeal) - -### v2.33.1 (2014/01/16 19:48 +00:00) -- [afcf827](https://github.com/mikeal/request/commit/afcf827559b3223c96ac1bbd19bd1e4a6d7771e3) 2.33.1 (@mikeal) - -### v2.33.0 (2014/01/16 19:48 +00:00) -- [7f1cc8f](https://github.com/mikeal/request/commit/7f1cc8ff5a8d9443e7a793f4655487e722b75b0d) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [3e43d3d](https://github.com/mikeal/request/commit/3e43d3d5175f5f18d1e97b2f5d4ca6ac6c216e4a) 2.33.0 (@mikeal) - -### v2.32.1 (2014/01/16 19:33 +00:00) -- [dd44f39](https://github.com/mikeal/request/commit/dd44f39d37daacbbeb21f9e960f13adbb44eea0a) 2.32.1 (@mikeal) - -### v2.32.0 (2014/01/16 19:33 +00:00) -- [#757](https://github.com/mikeal/request/pull/757) require aws-sign2 (@mafintosh) -- [#744](https://github.com/mikeal/request/pull/744) Use Cookie.parse (@lalitkapoor) -- [5eaee1c](https://github.com/mikeal/request/commit/5eaee1ce4008ede1df15201622ac478c892d6a8a) Upgrade tough-cookie to 0.10.0 (@stash) -- [#763](https://github.com/mikeal/request/pull/763) Upgrade tough-cookie to 0.10.0 (@stash) -- [d2489d0](https://github.com/mikeal/request/commit/d2489d0e24d9a538224f5c8c090dcdeb1f8d4969) Fixed auth error for some servers like twisted. According to rfc 2617 auth scheme token should be case-insensitive. (@bobyrizov) -- [#764](https://github.com/mikeal/request/pull/764) Case-insensitive authentication scheme (@bobyrizov) -- [cbee3d0](https://github.com/mikeal/request/commit/cbee3d04ee9f704501a64edb7b9b6d201e98494b) Use tough-cookie CookieJar sync API (@stash) -- [3eeaf6a](https://github.com/mikeal/request/commit/3eeaf6a90df7b806d91ae1e8e2f56862ece2ea33) Emit error, not cookieError (@stash) -- [#767](https://github.com/mikeal/request/pull/767) Use tough-cookie CookieJar sync API (@stash) -- [9eac534](https://github.com/mikeal/request/commit/9eac534dd11e40bba65456491cb62ad68d8f41fa) 2.32.0 (@mikeal) - -### v2.31.1 (2014/01/08 02:57 +00:00) -- [b1b5e91](https://github.com/mikeal/request/commit/b1b5e9161e149574ba5528c401a70bfadef1a98a) 2.31.1 (@mikeal) - -### v2.31.0 (2014/01/08 02:57 +00:00) -- [dd2577f](https://github.com/mikeal/request/commit/dd2577f8264d4d4b07484dec7094b72c00c8416f) Removing s3 test. (@mikeal) -- [fef5bf3](https://github.com/mikeal/request/commit/fef5bf34258e3695b61c048c683f1d4a7f99b368) Fix callback arguments documentation (@mmalecki) -- [#736](https://github.com/mikeal/request/pull/736) Fix callback arguments documentation (@mmalecki) -- [5531c20](https://github.com/mikeal/request/commit/5531c208678145ef35b06e948190be2fd6a8a1c8) updating README example: cookie jar api changed cookie module changed to tough-cookie (@emkay) -- [#741](https://github.com/mikeal/request/pull/741) README example is using old cookie jar api (@emkay) -- [9d73e5a](https://github.com/mikeal/request/commit/9d73e5a277af141a6e4fa9dbcae5d0c3b755d277) add note about JSON output body type (@iansltx) -- [#742](https://github.com/mikeal/request/pull/742) Add note about JSON output body type (@iansltx) -- [41e20a4](https://github.com/mikeal/request/commit/41e20a4d288e30101e493b383a0e4852a3271a98) Use Cookie.parse (@lalitkapoor) -- [4d09556](https://github.com/mikeal/request/commit/4d095562a5c42ffb41b0ff194e9e6f32c0f44372) updating setCookie example to make it clear that the callback is required (@emkay) -- [#745](https://github.com/mikeal/request/pull/745) updating setCookie example to make it clear that the callback is required (@emkay) -- [b7ede1d](https://github.com/mikeal/request/commit/b7ede1d56f9a2764e4bf764687b81419df817e5a) README: Markdown code highlight (@weakish) -- [#746](https://github.com/mikeal/request/pull/746) README: Markdown code highlight (@weakish) -- [#645](https://github.com/mikeal/request/pull/645) update twitter api url to v1.1 (@mick) -- [20dcd18](https://github.com/mikeal/request/commit/20dcd18ce8e3397ba7e0213da9c760b048ca5b49) require aws-sign2 (@mafintosh) -- [df2c426](https://github.com/mikeal/request/commit/df2c4264321c3db1387ddf9a945d63b9ae7d57b8) 2.31.0 (@mikeal) - -### v2.30.1 (2013/12/13 19:17 +00:00) -- [eba2d40](https://github.com/mikeal/request/commit/eba2d402fcdcf1ac878de8672b1c9f5da856dcc1) 2.30.1 (@mikeal) - -### v2.30.0 (2013/12/13 19:17 +00:00) -- [aee3819](https://github.com/mikeal/request/commit/aee38191557574ef570fd9c764af0af7072cc92a) Fix TypeError when calling request.cookie -- [#728](https://github.com/mikeal/request/pull/728) Fix TypeError when calling request.cookie (@scarletmeow) -- [628ef76](https://github.com/mikeal/request/commit/628ef768b1f52710b8eb4e14be4db69d174d1dcb) better DIGEST support (@dai-shi) -- [d919bc1](https://github.com/mikeal/request/commit/d919bc1ce97fa461c365437a0c739bbaa6b86de7) ignore null authValues (DIGEST) (@dai-shi) -- [75fc209](https://github.com/mikeal/request/commit/75fc209c5a9e6c647a04e42048c30f46c66fc103) DIGEST support: pass algoritm and opaque, add TODO items, test case for compatible mode (@dai-shi) -- [#730](https://github.com/mikeal/request/pull/730) better HTTP DIGEST support (@dai-shi) -- [937a24a](https://github.com/mikeal/request/commit/937a24a168a126f406ee8eb55eb78169ddc53497) JSHINT: Creating global 'for' variable. Should be 'for (var ...'. -- [#732](https://github.com/mikeal/request/pull/732) JSHINT: Creating global 'for' variable. Should be 'for (var ...'. (@Fritz-Lium) -- [f03be23](https://github.com/mikeal/request/commit/f03be2309bd85a89d2e3c208b2fb4be1a2b95c79) Make digest qop regex more robust (see #730) (@nylen) -- [c7d97ae](https://github.com/mikeal/request/commit/c7d97aefaebf773ce62c72e9ec656f0250b7a1e7) 2.30.0 (@mikeal) - -### v2.29.1 (2013/12/06 20:05 +00:00) -- [e0f2c41](https://github.com/mikeal/request/commit/e0f2c41bd4e15518e97dd2f4c134be51ed4cb68b) 2.29.1 (@mikeal) - -### v2.29.0 (2013/12/06 20:05 +00:00) -- [3c2cad1](https://github.com/mikeal/request/commit/3c2cad11301380f4056eb3ca4c0c124f7f7f72f5) make request.defaults(options, requester) run the requester for all methods (@jchris) -- [#727](https://github.com/mikeal/request/pull/727) fix requester bug (@jchris) -- [0c9f875](https://github.com/mikeal/request/commit/0c9f87542cd1f919751d3ed1f00208ce7705f8e7) 2.29.0 (@mikeal) - -### v2.28.1 (2013/12/04 19:42 +00:00) -- [3e6a300](https://github.com/mikeal/request/commit/3e6a300121586da81b871f759a9feec52810474a) 2.28.1 (@mikeal) - -### v2.28.0 (2013/12/04 19:42 +00:00) -- [ac26f43](https://github.com/mikeal/request/commit/ac26f43d9a8212289f92056d3029c207f755cef4) Update request.js (@wprl) -- [adc2cb6](https://github.com/mikeal/request/commit/adc2cb6721e5980e8ed667a3f558cce8c89ee6c2) Use random cnonce (@wprl) -- [ff16a9d](https://github.com/mikeal/request/commit/ff16a9daf93e01cecee7fabec64c3e1b423f7db5) Add test for random cnonce (@wprl) -- [df64c2b](https://github.com/mikeal/request/commit/df64c2bc8f691ecc6f6c214e2254bab439830b88) Restore whitespace (@wprl) -- [#630](https://github.com/mikeal/request/pull/630) Send random cnonce for HTTP Digest requests (@wprl) -- [aca5a16](https://github.com/mikeal/request/commit/aca5a169c44cc658e8310691a2ae1cfc4c2b0958) update twitter api url to v1.1 (@mick) -- [abcbadd](https://github.com/mikeal/request/commit/abcbadd1b2a113c34a37b62d36ddcfd74452850e) Test case for #304. (@diversario) -- [b8cf874](https://github.com/mikeal/request/commit/b8cf8743b66d8eee4048561a7d81659f053393c8) fix failure when running with NODE_DEBUG=request, and a test for that (@jrgm) -- [e6c7d1f](https://github.com/mikeal/request/commit/e6c7d1f6d23922480c09427d5f54f84eec60b7af) quiet, but check that stderr output has something reasonable for debug (@jrgm) -- [#659](https://github.com/mikeal/request/pull/659) fix failure when running with NODE_DEBUG=request, and a test for that (@jrgm) -- [23164e4](https://github.com/mikeal/request/commit/23164e4f33bd0837d796037c3d0121db23653c34) option.tunnel to explicitly disable tunneling (@seanmonstar) -- [#662](https://github.com/mikeal/request/pull/662) option.tunnel to explicitly disable tunneling (@seanmonstar) -- [#656](https://github.com/mikeal/request/pull/656) Test case for #304. (@diversario) -- [da16120](https://github.com/mikeal/request/commit/da16120a8f0751b305a341c012dbdcfd62e83585) Change `secureOptions' to `secureProtocol' for HTTPS request (@richarddong) -- [43d9d0a](https://github.com/mikeal/request/commit/43d9d0a76974d2c61681ddee04479d514ebfa320) add `ciphers' and `secureProtocol' to `options' in `getAgent' (@richarddong) -- [#666](https://github.com/mikeal/request/pull/666) make `ciphers` and `secureProtocol` to work in https request (@richarddong) -- [524e035](https://github.com/mikeal/request/commit/524e0356b73240409a11989d369511419526b5ed) change cookie module (@sxyizhiren) -- [#674](https://github.com/mikeal/request/pull/674) change cookie module,to tough-cookie.please check it . (@sxyizhiren) -- [e8dbcc8](https://github.com/mikeal/request/commit/e8dbcc83d4eff3c14e03bd754174e2c5d45f2872) tests: Fixed test-timeout.js events unit test (@Turbo87) -- [aed1c71](https://github.com/mikeal/request/commit/aed1c71fac0047b66a236a990a5569445cfe995d) Added Travis CI configuration file (@Turbo87) -- [#683](https://github.com/mikeal/request/pull/683) Travis CI support (@Turbo87) -- [8bfa640](https://github.com/mikeal/request/commit/8bfa6403ce03cbd3f3de6b82388bfcc314e56c61) dependencies: Set `tough-cookie` as optional dependency (@Turbo87) -- [bcc138d](https://github.com/mikeal/request/commit/bcc138da67b7e1cf29dc7d264a73d8b1d1f4b0e4) dependencies: Set `form-data` as optional dependency (@Turbo87) -- [751ac28](https://github.com/mikeal/request/commit/751ac28b7f13bfeff2a0e920ca2926a005dcb6f0) dependencies: Set `tunnel-agent` as optional dependency (@Turbo87) -- [6d7c1c9](https://github.com/mikeal/request/commit/6d7c1c9d8e3a300ff6f2a93e7f3361799acf716b) dependencies: Set `http-signature` as optional dependency (@Turbo87) -- [733f1e3](https://github.com/mikeal/request/commit/733f1e3ae042a513a18cde1c6e444b18ee07ad66) Added .npmignore file (@Turbo87) -- [e2fc346](https://github.com/mikeal/request/commit/e2fc346b7e5e470fcd36189bcadf63c53feebb22) dependencies: Set `hawk` as optional dependency (@Turbo87) -- [e87d45f](https://github.com/mikeal/request/commit/e87d45fe89ea220035bf07696a70292763f7135f) dependencies: Set `aws-sign` as optional dependency (@Turbo87) -- [1cd81ba](https://github.com/mikeal/request/commit/1cd81ba30908b77cff2fa618aeb232fefaa53ada) lib: Added optional() function (@Turbo87) -- [28c2c38](https://github.com/mikeal/request/commit/28c2c3820feab0cc719df213a60838db019f3e1a) dependencies: Set `oauth-sign` as optional dependency (@Turbo87) -- [2ceddf7](https://github.com/mikeal/request/commit/2ceddf7e793feb99c5b6a76998efe238965b22cd) TravisCI: Test with and without optional dependencies (@Turbo87) -- [#682](https://github.com/mikeal/request/pull/682) Optional dependencies (@Turbo87) -- [2afab5b](https://github.com/mikeal/request/commit/2afab5b665a2e03becbc4a42ad481bb737405655) Handle blank password in basic auth. (@diversario) -- [cabe5a6](https://github.com/mikeal/request/commit/cabe5a62dc71282ce8725672184efe9d97ba79a5) Handle `auth.password` and `auth.username`. (@diversario) -- [#690](https://github.com/mikeal/request/pull/690) Handle blank password in basic auth. (@diversario) -- [33100c3](https://github.com/mikeal/request/commit/33100c3c7fa678f592374f7b2526fe9a0499b6f6) Typo (@VRMink) -- [#694](https://github.com/mikeal/request/pull/694) Typo in README (@ExxKA) -- [9072ff1](https://github.com/mikeal/request/commit/9072ff1556bcb002772838a94e1541585ef68f02) Edited README.md for formatting and clarity of phrasing (@Zearin) -- [#696](https://github.com/mikeal/request/pull/696) Edited README.md for formatting and clarity of phrasing (@Zearin) -- [07ee58d](https://github.com/mikeal/request/commit/07ee58d3a8145740ba34cc724f123518e4b3d1c3) Fixing listing in callback part of docs. (@lukasz-zak) -- [#710](https://github.com/mikeal/request/pull/710) Fixing listing in callback part of docs. (@lukasz-zak) -- [8ee21d0](https://github.com/mikeal/request/commit/8ee21d0dcc637090f98251eba22b9f4fd1602f0e) Request.multipart no longer crashes when header 'Content-type' is present (@pastaclub) -- [#715](https://github.com/mikeal/request/pull/715) Request.multipart no longer crashes when header 'Content-type' present (@pastaclub) -- [8b04ca6](https://github.com/mikeal/request/commit/8b04ca6ad8d025c275e40b806a69112ac53bd416) doc: Removed use of gendered pronouns (@oztu) -- [#719](https://github.com/mikeal/request/pull/719) Made a comment gender neutral. (@oztu) -- [8795fc6](https://github.com/mikeal/request/commit/8795fc68cce26b9a45d10db9eaffd4bc943aca3a) README.md: add custom HTTP Headers example. (@tcort) -- [#724](https://github.com/mikeal/request/pull/724) README.md: add custom HTTP Headers example. (@tcort) -- [c5d5b1f](https://github.com/mikeal/request/commit/c5d5b1fcf348e768943fe632a9a313d704d35c65) Changing dep. (@mikeal) -- [bf04163](https://github.com/mikeal/request/commit/bf04163883fa9c62d4e1a9fdd64d6efd7723d5f8) 2.28.0 (@mikeal) - -### v2.27.1 (2013/08/15 21:30 +00:00) -- [a80a026](https://github.com/mikeal/request/commit/a80a026e362a9462d6948adc1b0d2831432147d2) 2.27.1 (@mikeal) - -### v2.27.0 (2013/08/15 21:30 +00:00) -- [3627b9c](https://github.com/mikeal/request/commit/3627b9cc7752cfe57ac609ed613509ff61017045) rename Request and remove .DS_Store (@joaojeronimo) -- [920f9b8](https://github.com/mikeal/request/commit/920f9b88f7dd8f8d153e72371b1bf2d16d5e4160) rename Request (@joaojeronimo) -- [c243cc6](https://github.com/mikeal/request/commit/c243cc66131216bb57bcc0fd79c250a7927ee424) for some reason it removed request.js (@joaojeronimo) -- [#619](https://github.com/mikeal/request/pull/619) decouple things a bit (@CrowdProcess) -- [ed4ecc5](https://github.com/mikeal/request/commit/ed4ecc5ae5cd1d9559a937e84638c9234244878b) Try normal stringify first, then fall back to safe stringify (@mikeal) -- [5642ff5](https://github.com/mikeal/request/commit/5642ff56e64c19e8183dcd5b6f9d07cca295a79e) 2.27.0 (@mikeal) - -### v2.26.1 (2013/08/07 16:31 +00:00) -- [b422510](https://github.com/mikeal/request/commit/b422510ba16315c3e0e1293a17f3a8fa7a653a77) 2.26.1 (@mikeal) - -### v2.26.0 (2013/08/07 16:31 +00:00) -- [3b5b62c](https://github.com/mikeal/request/commit/3b5b62cdd4f3b92e63a65d3a7265f5a85b11c4c9) Only include :password in Basic Auth if it's defined (fixes #602) (@bendrucker) -- [#605](https://github.com/mikeal/request/pull/605) Only include ":" + pass in Basic Auth if it's defined (fixes #602) (@bendrucker) -- [cce2c2c](https://github.com/mikeal/request/commit/cce2c2c8ea5b0136932b2432e4e25c0124d58d5a) Moved init of self.uri.pathname (@lexander) -- [08793ec](https://github.com/mikeal/request/commit/08793ec2f266ef88fbe6c947e6b334e04d4b9dc9) Fix all header casing issues forever. (@mikeal) -- [#613](https://github.com/mikeal/request/pull/613) Fixes #583, moved initialization of self.uri.pathname (@lexander) -- [f98ff99](https://github.com/mikeal/request/commit/f98ff990d294165498c9fbf79b2de12722e5c842) Update this old ass readme with some new HOTNESS! (@mikeal) -- [3312010](https://github.com/mikeal/request/commit/3312010f72d035f22b87a6d8d463f0d91b88fea1) markdown badge instead. (@mikeal) -- [9cf657c](https://github.com/mikeal/request/commit/9cf657c1f08bf460911b8bb0a8c5c0d3ae6135c7) Shorter title. (@mikeal) -- [2c61d66](https://github.com/mikeal/request/commit/2c61d66f1dc323bb612729c7320797b79b22034c) put Request out (@joaojeronimo) -- [28513a1](https://github.com/mikeal/request/commit/28513a1b371452699438c0eb73471f8969146264) 2.26.0 (@mikeal) - -### v2.25.1 (2013/07/23 21:51 +00:00) -- [6387b21](https://github.com/mikeal/request/commit/6387b21a9fb2e16ee4dd2ab73b757eca298587b5) 2.25.1 (@mikeal) - -### v2.25.0 (2013/07/23 21:51 +00:00) -- [828f12a](https://github.com/mikeal/request/commit/828f12a1ae0f187deee4d531b2eaf7531169aaf2) 2.25.0 (@mikeal) - -### v2.24.1 (2013/07/23 20:51 +00:00) -- [29ae1bc](https://github.com/mikeal/request/commit/29ae1bc454c03216beeea69d65b538ce4f61e8c1) 2.24.1 (@mikeal) - -### v2.24.0 (2013/07/23 20:51 +00:00) -- [f667318](https://github.com/mikeal/request/commit/f66731870d5f3e0e5655cd89612049b540c34714) Fixed a small typo (@michalstanko) -- [#601](https://github.com/mikeal/request/pull/601) Fixed a small typo (@michalstanko) -- [#594](https://github.com/mikeal/request/pull/594) Emit complete event when there is no callback (@RomainLK) -- [#596](https://github.com/mikeal/request/pull/596) Global agent is being used when pool is specified (@Cauldrath) -- [41ce492](https://github.com/mikeal/request/commit/41ce4926fb08242f19135fd3ae10b18991bc3ee0) New deps. (@mikeal) -- [8176c94](https://github.com/mikeal/request/commit/8176c94d5d17bd14ef4bfe459fbfe9cee5cbcc6f) 2.24.0 (@mikeal) - -### v2.23.1 (2013/07/23 02:45 +00:00) -- [63f31cb](https://github.com/mikeal/request/commit/63f31cb1d170a4af498fbdd7566f867423caf8e3) 2.23.1 (@mikeal) - -### v2.23.0 (2013/07/23 02:44 +00:00) -- [758f598](https://github.com/mikeal/request/commit/758f598de8d6024db3fa8ee7d0a1fc3e45c50f53) Initial commit. Request package. (@mikeal) -- [104cc94](https://github.com/mikeal/request/commit/104cc94839d4b71aaf3681142daefba7ace78c94) Removing unnecessary markup. (@mikeal) -- [12a4cb8](https://github.com/mikeal/request/commit/12a4cb88b949cb4a81d51189d432c25c08522a87) Matching node documentation style. (@mikeal) -- [ab96993](https://github.com/mikeal/request/commit/ab969931106b10b5f8658dc9e0f512c5dfc2a7da) Release tarball. (@mikeal) -- [e7e37ad](https://github.com/mikeal/request/commit/e7e37ad537081a040ea3e527aac23ae859b40b2c) Removing old tarball. (@mikeal) -- [e66e90d](https://github.com/mikeal/request/commit/e66e90dd814ae7bfbcd52003609d7bde9eafea57) Adding automatic redirect following. (@mikeal) -- [2fc5b84](https://github.com/mikeal/request/commit/2fc5b84832ae42f6ddb081b1909d0a6ca00c8d51) Adding SSL support. (@mikeal) -- [a3ac375](https://github.com/mikeal/request/commit/a3ac375d4b5800a038ae26233425fadc26866fbc) Fixing bug where callback fired for every redirect. (@mikeal) -- [1139efe](https://github.com/mikeal/request/commit/1139efedb5aad4a328c1d8ff45fe77839a69169f) Cleaning up tests. (@mikeal) -- [bb49fe6](https://github.com/mikeal/request/commit/bb49fe6709fa06257f4b7aadc2e450fd45a41328) Rolling version. (@mikeal) -- [4ff3493](https://github.com/mikeal/request/commit/4ff349371931ec837339aa9082c4ac7ddd4c7c35) Updates to README.md (@mikeal) -- [1c9cf71](https://github.com/mikeal/request/commit/1c9cf719c92b02ba85c4e47bd2b92a3303cbe1cf) Adding optional body buffer. (@mikeal) -- [49dfef4](https://github.com/mikeal/request/commit/49dfef42630c4fda6fb208534c00638dc0f06a6b) Rolling version. (@mikeal) -- [ab40cc8](https://github.com/mikeal/request/commit/ab40cc850652e325fcc3b0a44ee7303ae0a7b77f) Preserve the original full path. (@mikeal) -- [6d70f62](https://github.com/mikeal/request/commit/6d70f62c356f18098ca738b3dbedcf212ac3d8d8) Rolling version. (@mikeal) -- [e2ca15a](https://github.com/mikeal/request/commit/e2ca15a0f7e986e3063977ee9bd2eb69e86bdb1f) Fixing bugs and rolling version. (@mikeal) -- [8165254](https://github.com/mikeal/request/commit/81652543d3a09553cbf33095a7932dec53ccecc2) Cleanup. Fixing '' === '/' path bug. (@mikeal) -- [a0536a4](https://github.com/mikeal/request/commit/a0536a46d0b91e204fbde1e4341461bc827c9542) Rolling version. (@mikeal) -- [9ccaad7](https://github.com/mikeal/request/commit/9ccaad7dce05e5dcc3eacaf1500404622a0d8067) Adding stream support for request and response bodies. (@mikeal) -- [585166d](https://github.com/mikeal/request/commit/585166d979d4476e460e9835cc0516d04a9a3e11) Rolling version. (@mikeal) -- [41111c8](https://github.com/mikeal/request/commit/41111c88d711da80ea123df238d62038b89769bf) Bugfix release for response stream. (@mikeal) -- [86e375d](https://github.com/mikeal/request/commit/86e375d093700affe4d6d2b76a7acedbe8da140c) Remove host header when we add it. (@mikeal) -- [3a6277c](https://github.com/mikeal/request/commit/3a6277c81cfd3457c760f2aaea44852ef832a1e8) Rolling version. (@mikeal) -- [7a11f69](https://github.com/mikeal/request/commit/7a11f69d5353ecc1319e2e91ca4aefbaf0338136) writing requestBodyStream into request (@beanieboi) -- [186e9cf](https://github.com/mikeal/request/commit/186e9cf692511d768f8016d311609a0a0a315af6) Using sys.pump (@mikeal) -- [09e7ade](https://github.com/mikeal/request/commit/09e7ade541e1d40316a3f153128871a353e707b1) Fixing host port addition. Rolling version. (@mikeal) -- [cec3f3f](https://github.com/mikeal/request/commit/cec3f3f619322f27e2a82c7fd8971722f98d04d6) Using builtin base64. (@mikeal) -- [2a2e2a2](https://github.com/mikeal/request/commit/2a2e2a2f5c4760d4da3caa1a0f2d14c31a4222dc) new structure. new convenience methods (@mikeal) -- [f835b5f](https://github.com/mikeal/request/commit/f835b5fb605506b8ecd3c17bebe9ed54f0066cfc) removing old files. (@mikeal) -- [91616c4](https://github.com/mikeal/request/commit/91616c4e4f488f75a8b04b5b6f0ceef7e814cffd) Adding better redirect handling. (@mikeal) -- [3a95433](https://github.com/mikeal/request/commit/3a95433cbec9693a16ff365148489a058720ae7c) Fixing tests. (@mikeal) -- [38eb1d2](https://github.com/mikeal/request/commit/38eb1d2fa8dea582bb7c3fb37a7b05ff91857a46) By popular demand, proxy support! Not really tested yet but it seems to kinda work. (@mikeal) -- [45d41df](https://github.com/mikeal/request/commit/45d41dff63f36b25b3403e59c8b172b7aa9ed373) Added proxy auth. (@mikeal) -- [85e3d97](https://github.com/mikeal/request/commit/85e3d97e0dced39a3769c4e3f2707ba3aaab1eaa) Fixing for non-proxy case. (@mikeal) -- [f796da7](https://github.com/mikeal/request/commit/f796da74849d2b0732bd1bae1d2dcaf1243142c1) Fixing relative uri's for forwards. (@mikeal) -- [dead30e](https://github.com/mikeal/request/commit/dead30ebef9c3ff806b895e2bd32f52ba3988c69) Adding support for specifying an encoding for the response body. (@mikeal) -- [9433344](https://github.com/mikeal/request/commit/943334488dcc8e7f90727b86f9eb1bc502c33b4f) Removing debugging statement (@mikeal) -- [41efb7a](https://github.com/mikeal/request/commit/41efb7a7dcca3b47e97c23c6cdbd3e860d3bd82b) Error on maxRedirects exceeded. (@mikeal) -- [9549570](https://github.com/mikeal/request/commit/95495701fa4e99a3ab85acdab71ecdaabe0dbd45) Allow options.url, people do it all the time, might as well just support it. (@mikeal) -- [21a53c0](https://github.com/mikeal/request/commit/21a53c016edcc113e809219639807b46d29dba36) Pumping version. (@mikeal) -- [aca9782](https://github.com/mikeal/request/commit/aca9782285fe1d727570fe8d799561f45d49048e) Fixing byteLength !== string lenght issues. (@mikeal) -- [a77c296](https://github.com/mikeal/request/commit/a77c296431eda2a211f59bdb88654c4a64ed4ef3) Don't rely on automatic semicolon insertion (pretty please :) (@papandreou) -- [8b02f29](https://github.com/mikeal/request/commit/8b02f29c9019dd1d1dd291dd85889b26f592a137) Also set content-length when options.body is the empty string. (@papandreou) -- [023281c](https://github.com/mikeal/request/commit/023281ca9b4414a9bc0170c2b08aaf886a7a08f7) Simplified boolean logic. (@papandreou) -- [4f897fd](https://github.com/mikeal/request/commit/4f897fdd6c7c93bea73dbf34623f09af63bb1ed4) Simplified check for whether response.headers.location starts with "http:" or "https:". (@papandreou) -- [6d7db85](https://github.com/mikeal/request/commit/6d7db85cadf401dffdec07a4d66822207898c69e) Fixed double var declaration. (@papandreou) -- [97255cf](https://github.com/mikeal/request/commit/97255cfd2a4aa8f34d307e7cd96fe1c1f13cb26a) Process redirects as soon as the response arrives. Prevents the uninteresting redirect response from being pumped into responseBodyStream. (@papandreou) -- [b2af15f](https://github.com/mikeal/request/commit/b2af15f4fcbe1115cf8b53c5ae89fbf2365bfffc) New feature: If options.noBuffer is true, don't buffer up the response, just return it. Most of the time getting a readable stream is much more flexible than having the option to pipe the response into a writable stream. For one thing, the stream can be paused. (@papandreou) -- [fee5f89](https://github.com/mikeal/request/commit/fee5f89159a8f36b25df509c55093bf7ebd1c993) A few fixes/changes from papandreou's code, also added new semantics for onResponse. (@mikeal) -- [fa72fcb](https://github.com/mikeal/request/commit/fa72fcb950029b222f0621e2d49304e35d08c380) Updated documentation. (@mikeal) -- [4fc7209](https://github.com/mikeal/request/commit/4fc72098e7eeb9518951b9306115340ffdcce7ce) Fix for both onResponse and callback (@mikeal) -- [3153436](https://github.com/mikeal/request/commit/3153436404fca865a65649d46eb22d9797128c9d) Adding license information. (@mikeal) -- [59570de](https://github.com/mikeal/request/commit/59570dec37913c7e530303a83f03781d9aca958c) Fix for unescaping passwords for basic auth. (@notmatt) -- [0d771ab](https://github.com/mikeal/request/commit/0d771ab7882b97d776179972c51c59386f91b953) require querystring (@notmatt) -- [875f79b](https://github.com/mikeal/request/commit/875f79b6a40340457fafafdadac813cfa5343689) Allow request's body to be an object. (@Stanley) -- [86895b9](https://github.com/mikeal/request/commit/86895b9c37f7b412b7df963c2a75361ff402d8c5) Merge branch 'master' of github.com:Stanley/request (@Stanley) -- [4c9c984](https://github.com/mikeal/request/commit/4c9c984cb37bfd4e901ce24b0e9b283604c27bf4) Better tests. (@mikeal) -- [02f6b38](https://github.com/mikeal/request/commit/02f6b38c1697a55ed43940d1fd0bef6225d4faa2) Added specs for body option (@Stanley) -- [af66607](https://github.com/mikeal/request/commit/af666072a22b8df4d75fe71885139059f56ea5ee) Made specs pass (@Stanley) -- [641ec05](https://github.com/mikeal/request/commit/641ec052dd95797816e781b2c3ac2524841db7cb) Merge branch 'master' of https://github.com/Stanley/request into jsonbody (@mikeal) -- [ab4c96b](https://github.com/mikeal/request/commit/ab4c96be1c002c10806d967a4b266543f8b0267c) Moved spec tests to normal node script tests. Style changes to code and docs. (@mikeal) -- [fc2a7ef](https://github.com/mikeal/request/commit/fc2a7ef301c1266938a5aeb539e4f3fc3b5191dd) Clearer wording for json option. (@mikeal) -- [01371d7](https://github.com/mikeal/request/commit/01371d728082e22aabeb840da82a30aec62d7d8a) Removing specs loader. (@mikeal) -- [560dadd](https://github.com/mikeal/request/commit/560dadd6cbd293622c66cd82b5506704c9850b13) Adding newline to end of test files, makes for cleaner diffs in the future. (@mikeal) -- [a0348dd](https://github.com/mikeal/request/commit/a0348dd0fef462c3c678a639619c27101c757035) Add pass message when tests finish. (@mikeal) -- [da77a0e](https://github.com/mikeal/request/commit/da77a0e152c1dd43f5c1e698110d23e4d32280db) Adding better debug message on failures for GET tests. (@mikeal) -- [6aade82](https://github.com/mikeal/request/commit/6aade822a90724a47176771d137e30b0a702e7ef) throw on error. (@mikeal) -- [4f41b8d](https://github.com/mikeal/request/commit/4f41b8dbbf9a93c53d5ccdf483c9d7803e279916) Rolling version. (@mikeal) -- [7cf01f0](https://github.com/mikeal/request/commit/7cf01f0481afb367b5d0d4878645ac535cfe9a2e) master is moving to node v0.3.6+ (@mikeal) -- [cb403a4](https://github.com/mikeal/request/commit/cb403a4cfdbe3d98feb9151fdbdae1e1436e59ab) Initial support for 0.3.6+.\n\nExperimental support for Request objects as streams. It's untested and requires a pending patch to node.js (@mikeal) -- [a3c80f9](https://github.com/mikeal/request/commit/a3c80f98f42f25d4cb02d5d9e34ba0e67cc89293) Adding defaults call. (@mikeal) -- [55f22f9](https://github.com/mikeal/request/commit/55f22f96365c57aa8687de951e3f9ed982eba408) Request will keep it's own agent pool so that it can expose a maxSockets setting for easy pool sizing. (@mikeal) -- [004741c](https://github.com/mikeal/request/commit/004741c23dc0eaf61f111161bb913ba418e033e4) Fixing reference error. (@mikeal) -- [8548541](https://github.com/mikeal/request/commit/85485414150fbac58b08126b3684f81dcb930bf1) Simplified pool implementation. (@mikeal) -- [9121c47](https://github.com/mikeal/request/commit/9121c47e4cbe47bccc20a75e0e6c6c098dce04fb) Default to globalPool. (@mikeal) -- [9ec3490](https://github.com/mikeal/request/commit/9ec3490aefd52f05b57e6db13730ace54b4439d1) Support for https. Requires pending patch in node core for consistent Agent API. (@mikeal) -- [146b154](https://github.com/mikeal/request/commit/146b154a1a31ae7a30aa9f28e891e4824af548fa) Fixes for reference errors. (@mikeal) -- [8756120](https://github.com/mikeal/request/commit/8756120f83ceb94f8ba600acba274ba512696eef) Only create an agent when a relevant option is passed. (@mikeal) -- [cc3cf03](https://github.com/mikeal/request/commit/cc3cf0322847982875ff32a7cef25c39c29630ba) New HTTP client doesn't require such explicit error listener management. (@mikeal) -- [f7c0379](https://github.com/mikeal/request/commit/f7c0379b99ac7989df7f934be67cc3ae979591bb) Fixing bug in .pipe() handling. Thanks tanepiper. (@mikeal) -- [897a7ef](https://github.com/mikeal/request/commit/897a7ef020cefcb7a36c04a11e286238df8ecdaa) Fixes for streams, docs, and convenience methods. (@mikeal) -- [7c2899a](https://github.com/mikeal/request/commit/7c2899a046b750eda495b23b2d58604260deddbc) Doc fixes. (@mikeal) -- [f535fe1](https://github.com/mikeal/request/commit/f535fe1008c8f11bb37e16f95fe287ed93343704) Doc fixes. (@mikeal) -- [d1deb5b](https://github.com/mikeal/request/commit/d1deb5b4dda4474fe9d480ad42ace664d89e73ee) Pipe tests, all passing! (@mikeal) -- [d67a041](https://github.com/mikeal/request/commit/d67a041783df8d724662d82f9fb792db1be3f4f0) Moving basic example to the top. (@mikeal) -- [6a98b9e](https://github.com/mikeal/request/commit/6a98b9e4a561b516b14d325c48785a9d6f40c514) Do not mix encoding option with pipeing. (@mikeal) -- [06b67ef](https://github.com/mikeal/request/commit/06b67ef01f73572a6a9b586854d4c21be427bdb2) Disable pooling with {pool:false} (@mikeal) -- [1c24881](https://github.com/mikeal/request/commit/1c248815b5dfffda43541e367bd4d66955ca0325) Send all arguments passed to stream methods. (@mikeal) -- [7946393](https://github.com/mikeal/request/commit/7946393893e75df24b390b7ab19eb5b9d6c23891) Better errors and warnings for different pipe conditions. (@mikeal) -- [ee2108d](https://github.com/mikeal/request/commit/ee2108db592113a0fe3840c361277fdd89f0c89c) Removing commented out legacy code. (@mikeal) -- [5f838b3](https://github.com/mikeal/request/commit/5f838b3582eda465f366d7df89c6dd69920405f2) Fixing redirect issue, thanks @linus (@mikeal) -- [c08758e](https://github.com/mikeal/request/commit/c08758e25290ee12278b3eb95d502645e0d66e4e) Adding del alias, thanks tanepiper. (@mikeal) -- [0b7d675](https://github.com/mikeal/request/commit/0b7d6756c120ebf17ce6c70fc1ff4ecd6850e704) Keep require('https') from throwing if node is compiled with --without-ssl. This will still throw for Invalid Protocol if https is used. Which makes more sense and makes request work without SSl support. (@davglass) -- [02fc9f7](https://github.com/mikeal/request/commit/02fc9f7cc8912402a5a98ddefaffa5f6da870562) Rolling version. Pushed new version to npm. (@mikeal) -- [0b30532](https://github.com/mikeal/request/commit/0b30532ee1a3cabb177017acfa7885b157031df2) Sent a patch today to fix this in core but this hack will fix node that predates that fix to core. (@mikeal) -- [5d5d8f4](https://github.com/mikeal/request/commit/5d5d8f43156b04fd3ceb312cfdf47cc2b0c4104d) Rolling version. Pushed new version to npm. (@mikeal) -- [1c00080](https://github.com/mikeal/request/commit/1c000809f1795d2e21635a626cf730aba2049d3e) Fixing reference to tls. (@mikeal) -- [4c355d1](https://github.com/mikeal/request/commit/4c355d1f87fced167e4b21770bfe6f8208f32b53) Be a better stream. (@mikeal) -- [9bed22f](https://github.com/mikeal/request/commit/9bed22f22e007201d4faeebdb486603c3bb088c3) Rolled version and pushed to npm (@mikeal) -- [34df8e2](https://github.com/mikeal/request/commit/34df8e2301dcfd10705b9ff3b257741b0816c8a1) typo in `request.defaults` (@clement) -- [4d7a6d4](https://github.com/mikeal/request/commit/4d7a6d46fa481e43fe873b8c8fad2f7dd816dbb5) default value only if undefined in `request.defaults` + misplaced `return` statement (@clement) -- [243a565](https://github.com/mikeal/request/commit/243a56563f1014318a467e46113b2c61b485f377) Adding support for request(url) (@mikeal) -- [83a9cec](https://github.com/mikeal/request/commit/83a9cec3cb2f7a43a1e10c13da8d0dd72b937965) Fixing case where + is in user or password. (@mikeal) -- [8bb7f98](https://github.com/mikeal/request/commit/8bb7f98ba8b78c217552c979811c07f1299318fe) making Request a duplex stream rather than adding special handling for pipes out. (@mikeal) -- [55a1fde](https://github.com/mikeal/request/commit/55a1fdedcad1e291502ce10010dda7e478a1b503) pause and resume should act on response instead of request (@tobowers) -- [63125a3](https://github.com/mikeal/request/commit/63125a33523e72e449ceef76da57b63522998282) Making request really smart about pipeing to itself so that we can do simple proxy cats (@mikeal) -- [2f9e257](https://github.com/mikeal/request/commit/2f9e257bc39eb329eec660c6d675fb40172fc5a5) Rolling version since master right now has some pretty hot new code in it. (@mikeal) -- [#31](https://github.com/mikeal/request/pull/31) Error on piping a request to a destination (@tobowers) -- [b1f3d54](https://github.com/mikeal/request/commit/b1f3d5439d24b848b2bf3a6459eea74cb0e43df3) The "end" event that was supposed to be emitted to fix a core bug in NodeJS wasn't fired because it wasn't emitted on the response object. (@voxpelli) -- [#35](https://github.com/mikeal/request/pull/35) The "end" event isn't emitted for some responses (@voxpelli) -- [40b1c67](https://github.com/mikeal/request/commit/40b1c676e1d3a292719ad2dd9cf9354c101bad47) Rolling version. (@mikeal) -- [9a28022](https://github.com/mikeal/request/commit/9a28022d0e438d0028e61a53e897689470025e50) Fixing bug in forwarding with new pipes logic. (@mikeal) -- [44e4e56](https://github.com/mikeal/request/commit/44e4e5605b0a9e02036393bcbd3a8d91280f5611) Fixing big bug in forwarding logic. (@mikeal) -- [b0cff72](https://github.com/mikeal/request/commit/b0cff72d63689d96e0b1d49a8a5aef9ccc71cb8b) Added timeout option to abort the request before the response starts responding (@mbrevoort) -- [cc76b10](https://github.com/mikeal/request/commit/cc76b109590437bfae54116e3424b2c6e44a3b3e) corrected spelling error in README (@mbrevoort) -- [#45](https://github.com/mikeal/request/pull/45) Added timeout option (@mbrevoort) -- [1cca56b](https://github.com/mikeal/request/commit/1cca56b29bb670c53d5995e76c0b075a747b5ad7) Fixing for node http client refactor. (@mikeal) -- [2a78aa3](https://github.com/mikeal/request/commit/2a78aa3f827e76c548e001fa519448b24466b518) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [ce12273](https://github.com/mikeal/request/commit/ce12273d3990c1446d3166bbd9e35c0e2435f137) New fs.ReadStream handling hotness. (@mikeal) -- [535e30a](https://github.com/mikeal/request/commit/535e30a4bd4a8e41d97ffa6a4e99630ac09a4bcb) Adding pipe support to HTTP ServerResponse objects. (@mikeal) -- [2f0cf6b](https://github.com/mikeal/request/commit/2f0cf6bf44edbaec4c0a0cb15a679302de7f0aff) Setting proper statusCode. (@mikeal) -- [6e3ecb1](https://github.com/mikeal/request/commit/6e3ecb106c3a32101d80ac0f87968fddd3ac5e2c) Adding test for pipeing file to disc. (@mikeal) -- [bbbb52e](https://github.com/mikeal/request/commit/bbbb52e406b65100b557caa3687a1aa04fab6ff3) Pumping version. (@mikeal) -- [a10b6e4](https://github.com/mikeal/request/commit/a10b6e4c08478364b8079801fdb23f3530fcc85f) Adding reference to Request instance on response to make it easier on inline callbacks. fixes #43. (@mikeal) -- [b9aff1f](https://github.com/mikeal/request/commit/b9aff1fe007dab3f93e666f047fa03a4e8f5f8b7) Add body property to resp when we have it as a shorthand. fixes #28 (@mikeal) -- [411b30d](https://github.com/mikeal/request/commit/411b30dab1fe5b20880113aa801a2fdbb7c35c40) If the error is handled and not throw we would still process redirects. Fixes #34. (@mikeal) -- [8f3c2b4](https://github.com/mikeal/request/commit/8f3c2b4f6dee8838f30e2430a23d5071128148f0) w00t! request 2.0 (@mikeal) -- [9957542](https://github.com/mikeal/request/commit/9957542cc6928443f3a7769510673665b5a90040) valid semver. (@mikeal) -- [31f5ee2](https://github.com/mikeal/request/commit/31f5ee28726ac7e14355cad0c6d2785f9ca422c6) Drastically improved header handling. (@mikeal) -- [c99b8fc](https://github.com/mikeal/request/commit/c99b8fcd706ae035f6248669b017ac2995e45f31) Return destination stream from pipe(). (@mikeal) -- [cba588c](https://github.com/mikeal/request/commit/cba588cec1e204d70f40f8bd11df0e27dc78ef0c) Style fixes. Bye Bye semi-colons. Mostly lined up with npm style. (@mikeal) -- [8515a51](https://github.com/mikeal/request/commit/8515a510ccc0a661d7c28fce6e513a7d71be7f8f) Clearer spacing. Slightly more consistent. (@mikeal) -- [3acd82a](https://github.com/mikeal/request/commit/3acd82a10e7d973fc5dbaa574c2e8906e48e1ee9) add failing test for issue #51 (@benatkin) -- [68c17f6](https://github.com/mikeal/request/commit/68c17f6c9a3d7217368b3b8bc61203e6a14eb4f0) implement parsing json response when json is truthy (@benatkin) -- [1cb1ec1](https://github.com/mikeal/request/commit/1cb1ec114b03394a0a530f245a857d8424cad02d) allow empty string (@benatkin) -- [4f8d2df](https://github.com/mikeal/request/commit/4f8d2df9f845690667a56e7698dbaf23b5028177) support JSON APIs that don't set the write content type (@benatkin) -- [#53](https://github.com/mikeal/request/pull/53) Parse json: Issue #51 (@benatkin) -- [c63e6e9](https://github.com/mikeal/request/commit/c63e6e96378a2b050bddbe1b39337662f304dc95) Adding proxy to docs, don't know why this wasn't already in. (@mikeal) -- [ef767d1](https://github.com/mikeal/request/commit/ef767d12f13a9c78d3df89add7556f5421204843) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [1b12d3a](https://github.com/mikeal/request/commit/1b12d3a9f48a6142d75fa1790c80eb313388ca44) Emit a proper error. (@mikeal) -- [47314d7](https://github.com/mikeal/request/commit/47314d7cb41fe9c3a7717a502bed9cf1b6074ffc) Greatly expanded documentation. (@mikeal) -- [e477369](https://github.com/mikeal/request/commit/e477369b4bbc271248ee8b686c556567570a6cca) Doc refinements. (@mikeal) -- [fe4d221](https://github.com/mikeal/request/commit/fe4d22109bc1411c29b253756d609856327ff146) Fix for newer npm (@mikeal) -- [7b2f788](https://github.com/mikeal/request/commit/7b2f788293e205edc7b46a7fd5304296b5e800e3) More doc cleanup. (@mikeal) -- [f8eb2e2](https://github.com/mikeal/request/commit/f8eb2e229aca38547236d48066a0b3f9f8f67638) Copy headers so that they survive mutation. (@mikeal) -- [59eab0e](https://github.com/mikeal/request/commit/59eab0e5e49c6d32697822f712ed725843e70010) Rolling version. (@mikeal) -- [76bf5f6](https://github.com/mikeal/request/commit/76bf5f6c6e37f6cb972b3d4f1ac495a4ceaaa00d) Improvements to json handling and defaults. (@mikeal) -- [81e2c40](https://github.com/mikeal/request/commit/81e2c4040a9911a242148e1d4a482ac6c745d8eb) Rolling version. (@mikeal) -- [76d8924](https://github.com/mikeal/request/commit/76d8924cab295f80518a71d5903f1e815618414f) Proper checking and handling of json bodies (@mikeal) -- [a8422a8](https://github.com/mikeal/request/commit/a8422a80895ed70e3871c7826a51933a75c51b69) Rolling version. (@mikeal) -- [f236376](https://github.com/mikeal/request/commit/f2363760782c3d532900a86d383c34f3c94f6d5f) Adding pipefilter. (@mikeal) -- [dd85f8d](https://github.com/mikeal/request/commit/dd85f8da969c2cc1825a7dfec6eac430de36440c) Rolling version. (@mikeal) -- [#66](https://github.com/mikeal/request/pull/66) Do not overwrite established content-type headers for read stream deliver (@voodootikigod) -- [b09212f](https://github.com/mikeal/request/commit/b09212f38fe736c2c92a1ee076cae9d0f4c612c3) Do not overwrite established content-type headers for read stream deliveries. (@voodootikigod) -- [01bc25d](https://github.com/mikeal/request/commit/01bc25d25343d73e9f5731b3d0df1cf5923398d4) Only apply workaround on pre-0.5 node.js and move test to assert.equal (@mikeal) -- [d487131](https://github.com/mikeal/request/commit/d487131ebc2f7a4bf265061845f7f3ea2fd3ed34) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [1200df5](https://github.com/mikeal/request/commit/1200df52bd334f9a44a43846159146b8f938fd9e) Rolling version. (@mikeal) -- [8279362](https://github.com/mikeal/request/commit/82793626f6965884a3720d66f5a276d7d4d30873) fix global var leaks (@aheckmann) -- [#67](https://github.com/mikeal/request/pull/67) fixed global variable leaks (@aheckmann) -- [ab91204](https://github.com/mikeal/request/commit/ab9120495a89536c7152e3cdf17d684323b40474) Test that chunked responses are properly toString'ed (@isaacs) -- [9bff39f](https://github.com/mikeal/request/commit/9bff39fa485f28d7f1754e72f026418ca1186783) Properly flatten chunked responses (@isaacs) -- [8e4e956](https://github.com/mikeal/request/commit/8e4e95654391c71c22933ffd422fdc82d20ac059) Fix #52 Make the tests runnable with npm (@isaacs) -- [a9aa9d6](https://github.com/mikeal/request/commit/a9aa9d6d50ef0481553da3e50e40e723a58de10a) Fix #71 Respect the strictSSL flag (@isaacs) -- [#69](https://github.com/mikeal/request/pull/69) Flatten chunked requests properly (@isaacs) -- [#73](https://github.com/mikeal/request/pull/73) Fix #71 Respect the strictSSL flag (@isaacs) -- [#70](https://github.com/mikeal/request/pull/70) add test script to package.json (@isaacs) -- [08ca561](https://github.com/mikeal/request/commit/08ca5617e0d8bcadee98f10f94a49cbf2dd02862) Fixing case where encoding is set. Also cleaning up trailing whitespace because my editor likes to do that now. (@mikeal) -- [0be269f](https://github.com/mikeal/request/commit/0be269f7d9da6c3a14a59d5579546fee9d038960) Fixing case where no body exists. (@mikeal) -- [2f37bbc](https://github.com/mikeal/request/commit/2f37bbc51ff84c3c28ae419138a19bd33a9f0103) Fixing timeout tests. (@mikeal) -- [f551a2f](https://github.com/mikeal/request/commit/f551a2f02a87994249c2fd37dc8f20a29e8bf529) Fixing legacy naming of self as options. (@mikeal) -- [717789e](https://github.com/mikeal/request/commit/717789ec9f690e9d5216ce1c27688eef822940cc) Avoid duplicate emit when using a timeout (@Marsup) -- [#76](https://github.com/mikeal/request/pull/76) Bug when a request fails and a timeout is set (@Marsup) -- [c1d255e](https://github.com/mikeal/request/commit/c1d255e5bcc5791ab69809913fe6d917ab93c8b7) global leakage in request.defaults (@isaacs) -- [14070f2](https://github.com/mikeal/request/commit/14070f269c79cae6ef9e7f7a415867150599bb8e) Don't require SSL for non-SSL requests (@isaacs) -- [4b8f696](https://github.com/mikeal/request/commit/4b8f6965e14c6fb704cf16f5bc011e4787cf32b2) Set proxy auth instead of just setting auth a second time (@isaacs) -- [cd22fbd](https://github.com/mikeal/request/commit/cd22fbdb00b90c5c75187ecf41373cfbb4af5bcd) Merge branch 'proxy-auth-bug' (@isaacs) -- [#78](https://github.com/mikeal/request/pull/78) Don't try to do strictSSL for non-ssl connections (@isaacs) -- [d8c53fc](https://github.com/mikeal/request/commit/d8c53fceca3af385753880395c680f6ec3d4d560) Removing legacy call to sys.puts (@mikeal) -- [731b32b](https://github.com/mikeal/request/commit/731b32b654bb217de3466b8d149ce480988bb24b) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [9c897df](https://github.com/mikeal/request/commit/9c897dffc7e238f10eb7e14c61978d6821c70f56) Enhance redirect handling: (1) response._redirectsFollowed reports the total number of redirects followed instead of being reset to 0; (2) add response.redirects, an array of the response.statusCode and response.headers.location for each redirect. (@danmactough) -- [#81](https://github.com/mikeal/request/pull/81) Enhance redirect handling (@danmactough) -- [4c84001](https://github.com/mikeal/request/commit/4c8400103ec18a0729e29e9ffb17dda65ce02f6d) Document strictSSL option (@isaacs) -- [d517ac0](https://github.com/mikeal/request/commit/d517ac03278b3ebd9a46ca9f263bea68d655822b) allow passing in buffers as multipart bodies (@kkaefer) -- [6563865](https://github.com/mikeal/request/commit/6563865b80573ad3c68834a6633aff6d322b59d5) bugs[web] should be bugs[url] (@isaacs) -- [2625854](https://github.com/mikeal/request/commit/262585480c148c56772dfc8386cfc59d5d262ca0) add option followAllRedirects to follow post/put redirects -- [bc057af](https://github.com/mikeal/request/commit/bc057affb58272d9152766956e5cde4ea51ca043) fix typo, force redirects to always use GET -- [d68b434](https://github.com/mikeal/request/commit/d68b434693dbf848dff4c570c4249a35329cc24f) Support node 0.5.11-style url parsing (@isaacs) -- [#96](https://github.com/mikeal/request/pull/96) Authless parsed url host support (@isaacs) -- [9f66c6d](https://github.com/mikeal/request/commit/9f66c6d79bc6515d870b906df39bd9d6d9164994) Typo, causing 'TypeError: Cannot read property 'length' of undefined' (@isaacs) -- [#97](https://github.com/mikeal/request/pull/97) Typo in previous pull causes TypeError in non-0.5.11 versions (@isaacs) -- [b320e05](https://github.com/mikeal/request/commit/b320e05f2d84510f47a6b6857d091c8cd4d3ae2e) When no request body is being sent set 'content-length':0. fixes #89 (@mikeal) -- [059916c](https://github.com/mikeal/request/commit/059916c545a0faa953cb8ac66b8c3ae243b1c8ce) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [248e9d6](https://github.com/mikeal/request/commit/248e9d65e73ac868948a82d07feaf33387723a1d) Fix for pipe() after response. Added response event, fixed and updated tests, removed deprecated stream objects. (@mikeal) -- [a2e5d6e](https://github.com/mikeal/request/commit/a2e5d6e30d3e101f8c5a034ef0401fdde8608ccf) Fixing double callback firing. node 0.5 is much better about calling errors on the client object which, when aborting on timeout, predictable emits an error which then triggers a double callback. (@mikeal) -- [5f80577](https://github.com/mikeal/request/commit/5f805775e6aeaaf229cc781439b29108fb69f373) Release for 0.6 (@mikeal) -- [bf906de](https://github.com/mikeal/request/commit/bf906de601121b52c433b0af208550f1db892cde) Adding some oauth support, tested with Twitter. (@mikeal) -- [8869b2e](https://github.com/mikeal/request/commit/8869b2e88cc305e224556c5ca75b7b59311911d9) Removing irrelevant comments. (@mikeal) -- [8323eed](https://github.com/mikeal/request/commit/8323eed4915bb73b33544bc276f3840c13969134) Closed issue 82 : handling cookies - added tests too -- [739f841](https://github.com/mikeal/request/commit/739f84166d619778ab96fd0b0f4f1f43e8b0fdda) Closed issue 82 : handling cookies - added tests too -- [7daf841](https://github.com/mikeal/request/commit/7daf8415fb1a4e707ec54eb413169e49d8bbe521) Closed issue 82 : handling cookies - added tests too -- [6c22041](https://github.com/mikeal/request/commit/6c22041a4719bf081c827dda8f35e7b79b4c39d9) changed README -- [3db7f7d](https://github.com/mikeal/request/commit/3db7f7d38e95406b84f06fed52b69038b0250904) Updated README -- [6181b7a](https://github.com/mikeal/request/commit/6181b7a8a4be75bcf75cd3ff6dacb8e910737e92) Documented request.cookie() and request.jar() -- [fc44260](https://github.com/mikeal/request/commit/fc44260d13f0094bfe96d18878a11c6fe88b69e5) Tiny cookie example error on README -- [366831b](https://github.com/mikeal/request/commit/366831b705b5d5ebfbec5f63b4b140cbafcb4515) Remove instanceof check for CookieJar (mikeal suggestion) -- [88488cf](https://github.com/mikeal/request/commit/88488cf076efbd916b0326e0981e280c993963a7) Also add cookie to the user defined cookie jar (mikeal's suggestion) -- [f6fef5b](https://github.com/mikeal/request/commit/f6fef5bfa4ba8e1dfa3022df8991716e5cba7264) Updated cookie documentation in README file -- [b519044](https://github.com/mikeal/request/commit/b5190441a889164dfeb4148fac643fd7a87cfb51) request.defaults({jar: false}) disables cookies && also updated README -- [856a65c](https://github.com/mikeal/request/commit/856a65cd28402efbe3831a68d73937564a27ea9b) Update jar documentation in the options also -- [#102](https://github.com/mikeal/request/pull/102) Implemented cookies - closes issue 82: https://github.com/mikeal/request/issues/82 (@alessioalex) -- [62592e7](https://github.com/mikeal/request/commit/62592e7fe9ee5ecaee80b8f5bc2400e4a277e694) Cookie bugs (@janjongboom) -- [a06ad2f](https://github.com/mikeal/request/commit/a06ad2f955270974409e75c088e1f5d1f5298ff5) Follow redirects should work on PUT and POST requests as well. This is more consistent to other frameworks, e.g. .NET (@janjongboom) -- [bf3f5d3](https://github.com/mikeal/request/commit/bf3f5d30fdabf6946096623fc3398bb66ed19a1f) Cookies shouldn't be discarded when followRedirect = true (@janjongboom) -- [16db85c](https://github.com/mikeal/request/commit/16db85c07e6c2516269299640fdddca6db7bc051) Revert "Follow redirects should work on PUT and POST requests as well. This is more consistent to other frameworks, e.g. .NET" (@janjongboom) -- [841664e](https://github.com/mikeal/request/commit/841664e309f329be98c1a011c634f5291af1eebc) Add test for proxy option (@dominictarr) -- [#105](https://github.com/mikeal/request/pull/105) added test for proxy option. (@dominictarr) -- [50d2d39](https://github.com/mikeal/request/commit/50d2d3934cd86d7142a4aab66017bb1ef82329cf) Fixing test, emitter matches on req.url so it needs the full url. (@mikeal) -- [668a291](https://github.com/mikeal/request/commit/668a291013380af305eba12b1d5c7a5376a74c76) Adding some documentation for OAuth signing support. (@mikeal) -- [04faa3b](https://github.com/mikeal/request/commit/04faa3bf2b1f4ec710414c6ec7231b24767b2f89) Minor improvements in example (@mikeal) -- [0fddc17](https://github.com/mikeal/request/commit/0fddc1798dcd9b213e3f8aec504c61cecf4d7997) Another small fix to the url in the docs. (@mikeal) -- [337649a](https://github.com/mikeal/request/commit/337649a08b4263c0d108cd4621475c8ff9cf8dd0) Add oauth to options. (@mikeal) -- [#86](https://github.com/mikeal/request/pull/86) Can't post binary to multipart requests (@developmentseed) -- [4e4d428](https://github.com/mikeal/request/commit/4e4d4285490be20abf89ff1fb54fb5088c01c00e) Update to Iris Couch URL (@jhs) -- [#110](https://github.com/mikeal/request/pull/110) Update to Iris Couch URL (@iriscouch) -- [d7af099](https://github.com/mikeal/request/commit/d7af0994b382466367f2cafc5376150e661eeb9d) Remove the global `i` as it's causing my test suites to fail with leak detection turned on. (@3rd-Eden) -- [#117](https://github.com/mikeal/request/pull/117) Remove the global `i` (@3rd-Eden) -- [b2a4ad1](https://github.com/mikeal/request/commit/b2a4ad1e7d7553230e932ea093d7f77f38147ef9) Force all cookie keys into lower case as suggested by LinusU (@jhurliman) -- [055a726](https://github.com/mikeal/request/commit/055a7268b40425643d23bd6a4f09c7268dbab680) Applying a modified version of pull request #106 as suggested by janjongboom (@jhurliman) -- [#121](https://github.com/mikeal/request/pull/121) Another patch for cookie handling regression (@jhurliman) -- [a353f4e](https://github.com/mikeal/request/commit/a353f4eeb312ea378d34b624f5c4df33eefa152c) Merge remote-tracking branch 'upstream/master' (@janjongboom) -- [#104](https://github.com/mikeal/request/pull/104) Cookie handling contains bugs (@janjongboom) -- [a3be5ad](https://github.com/mikeal/request/commit/a3be5ad5ea112422ed00da632530b93bcf54727c) Fix encoding of characters like ( (@mikeal) -- [dd2067b](https://github.com/mikeal/request/commit/dd2067bbbf77d1132c9ed480848645136b8a5521) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [ddc4e45](https://github.com/mikeal/request/commit/ddc4e453c3b9a0e11da4df156c5e15206abfc1ef) Pushed new version to npm (@mikeal) -- [feee5eb](https://github.com/mikeal/request/commit/feee5ebd2ca8c09db25b5cb13cd951f7c4322a49) Real fix for encoding issues in javascript and oauth. (@mikeal) -- [23896cd](https://github.com/mikeal/request/commit/23896cdc66d75ec176876167ff21da72b7ff181b) Pushed new version to npm. (@mikeal) -- [a471ed2](https://github.com/mikeal/request/commit/a471ed2ca8acdca1010a0fc20434c5c9956b0d0c) HTTP redirect tests (@jhs) -- [a4a9aa1](https://github.com/mikeal/request/commit/a4a9aa199ff958630791e131092ec332ada00a49) A self-signed certificate for upcoming HTTPS testing (@jhs) -- [10ac6b9](https://github.com/mikeal/request/commit/10ac6b9db40263bec1bf63ee7e057000ffd2d7e9) HTTPS tests, for now a copy of the test-body tests (@jhs) -- [105aed1](https://github.com/mikeal/request/commit/105aed1ff99add1957f91df7efabf406e262f463) Support an "httpModules" object for custom http/https module behavior (@jhs) -- [#112](https://github.com/mikeal/request/pull/112) Support using a custom http-like module (@iriscouch) -- [d05a875](https://github.com/mikeal/request/commit/d05a8753af576fc1adccc7ffe9633690371c05ee) Test for #129 (@mikeal) -- [06cdfaa](https://github.com/mikeal/request/commit/06cdfaa3c29233dac3f47e156f2b5b3a0f0ae4b8) return body as buffer when encoding is null -- [#132](https://github.com/mikeal/request/pull/132) return the body as a Buffer when encoding is set to null (@jahewson) -- [4882e51](https://github.com/mikeal/request/commit/4882e519ed6b8d08795da5de37166148ce0ee440) fixed cookies parsing, updated tests (@afanasy) -- [2be228e](https://github.com/mikeal/request/commit/2be228ec8b48a60028bd1d80c8cbebf23964f913) Change `host` to `hostname` in request hash -- [#135](https://github.com/mikeal/request/pull/135) host vs hostname (@iangreenleaf) -- [e24abc5](https://github.com/mikeal/request/commit/e24abc5cc2c6fa154ae04fe58a16d135eeba4951) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [c99c809](https://github.com/mikeal/request/commit/c99c809bb48b9c0193aae3789c5c844f7f6cbe92) Reverting host -> hostname because it breaks in pre-0.6. (@mikeal) -- [a1134d8](https://github.com/mikeal/request/commit/a1134d855f928fde5c4fe9ee255c111da0195bfc) adding logging (@mikeal) -- [#133](https://github.com/mikeal/request/pull/133) Fixed cookies parsing (@afanasy) -- [9179471](https://github.com/mikeal/request/commit/9179471f9f63b6ba9c9078a35cb888337ce295e8) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [cbb180b](https://github.com/mikeal/request/commit/cbb180b0399074995c235a555e3e3e162d738f7c) Fixes to oauth test. (@mikeal) -- [e1c351f](https://github.com/mikeal/request/commit/e1c351f92958634ccf3fbe78aa2f5b06d9c9a5fa) Published new version. (@mikeal) -- [3ceee86](https://github.com/mikeal/request/commit/3ceee86f1f3aad3a6877d6d3813e087549f3b485) Formatting fixes. (@mikeal) -- [18e1af5](https://github.com/mikeal/request/commit/18e1af5e38168dcb95c8ae29bb234f1ad9bbbdf9) Fixing log error. (@mikeal) -- [edc19b5](https://github.com/mikeal/request/commit/edc19b5249f655714efa0f8fa110cf663b742921) Pushed new version. (@mikeal) -- [f51c32b](https://github.com/mikeal/request/commit/f51c32bd6f4da0419ed8404b610c43ee3f21cf92) added "form" option to readme. (@petejkim) -- [#144](https://github.com/mikeal/request/pull/144) added "form" option to readme (@petejkim) -- [b58022e](https://github.com/mikeal/request/commit/b58022ecda782af93e35e5f9601013b90b09ca73) add "forever" method (@thejh) -- [79d4651](https://github.com/mikeal/request/commit/79d46510ddff2e2c12c69f7ae4072ec489e27b0e) remove logging (@thejh) -- [f87cbf6](https://github.com/mikeal/request/commit/f87cbf6ec6fc0fc2869c340114514c887b304a80) retry on ECONNRESET on reused socket (@thejh) -- [1a91675](https://github.com/mikeal/request/commit/1a916757f4ec48b1282fddfa0aaa0fa6a1bf1267) Multipart requests should respect content-type if set; Issue #145 (@apeace) -- [#146](https://github.com/mikeal/request/pull/146) Multipart should respect content-type if previously set (@apeace) -- [#148](https://github.com/mikeal/request/pull/148) Retry Agent (@thejh) -- [70c5b63](https://github.com/mikeal/request/commit/70c5b63aca29a7d1629fa2909ff5b7199bbf0fd1) Publishing new version to npm. (@mikeal) -- [fc0f04b](https://github.com/mikeal/request/commit/fc0f04bab5d6be56a2c19d47d3e8386bd9a0b29e) Fix: timeout on socket, timeout after redirect -- [ef79e59](https://github.com/mikeal/request/commit/ef79e59bbb88ed3e7d4368fe3ca5eee411bda345) Fix: timeout after redirect 2 -- [c32a218](https://github.com/mikeal/request/commit/c32a218da2296e89a269f1832d95b12c4aa10852) merge master (@jroes) -- [d2d9b54](https://github.com/mikeal/request/commit/d2d9b545e5679b829d33deeba0b22f9050fd78b1) add line to docs describing followAllRedirects option (@jroes) -- [#90](https://github.com/mikeal/request/pull/90) add option followAllRedirects to follow post/put redirects (@jroes) -- [c08ab7e](https://github.com/mikeal/request/commit/c08ab7efaefd39c04deb6986716efe5a6069528e) Emit an event after we create the request object so that people can manipulate it before nextTick(). (@mikeal) -- [#162](https://github.com/mikeal/request/pull/162) Fix issue #159 (@dpetukhov) -- [e77a169](https://github.com/mikeal/request/commit/e77a1695c5c632c067857e99274f28a1d74301fe) fixing streaming example. fixes #164 (@mikeal) -- [ee53386](https://github.com/mikeal/request/commit/ee53386d85975c79b801edbb4f5bb7ff4c5dc90b) fixes #127 (@mikeal) -- [e2cd9de](https://github.com/mikeal/request/commit/e2cd9de9a9d10e1aa4cf4e26006bb30fa5086f0b) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [a0ab977](https://github.com/mikeal/request/commit/a0ab9770a8fb89f970bb3783ed4e6dde9e33511b) Added failing test for #125. (@papandreou) -- [c80800a](https://github.com/mikeal/request/commit/c80800a834b0f8bc0fb40d1fad4d4165a83369fd) Fix cookie jar/headers.cookie collision. Closes #125. (@papandreou) -- [1ac9e2d](https://github.com/mikeal/request/commit/1ac9e2d1bf776728a1fe676dd3693ef66f50f7f7) Redirect test: Also assert that the request cookie doesn't get doubled in the request for the landing page. (@papandreou) -- [07bbf33](https://github.com/mikeal/request/commit/07bbf331e2a0d40d261487f6222e8cafee0e50e3) Fixes #150 (@mikeal) -- [c640eed](https://github.com/mikeal/request/commit/c640eed292c06eac3ec89f60031ddf0fc0add732) Cookie jar handling: Don't double the cookies on each redirect (see discussion on #139). (@papandreou) -- [808de8b](https://github.com/mikeal/request/commit/808de8b0ba49d4bb81590ec37a873e6be4d9a416) Adding some missing mime types #138 (@serby) -- [#161](https://github.com/mikeal/request/pull/161) Fix cookie jar/headers.cookie collision (#125) (@papandreou) -- [#168](https://github.com/mikeal/request/pull/168) Picking off an EasyFix by adding some missing mimetypes. (@serby) -- [2a30487](https://github.com/mikeal/request/commit/2a304879f4218c1e46195d882bc81c0f874be329) bugfix - allow add cookie to wrapped request (defaults) (@fabianonunes) -- [a18b4f1](https://github.com/mikeal/request/commit/a18b4f14559f56cf52ca1b421daa6a934d28d51b) Making pipeDest a public prototype method rather than keeping it private. (@mikeal) -- [#170](https://github.com/mikeal/request/pull/170) can't create a cookie in a wrapped request (defaults) (@fabianonunes) -- [49a0f60](https://github.com/mikeal/request/commit/49a0f604779c91dd1759a02cbb195ccbd8d73f5d) Structural refactor, getting read for composable API. (@mikeal) -- [5daa0b2](https://github.com/mikeal/request/commit/5daa0b28b06cf109614f19e76b0e0b9b25ee3baf) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [e4df85c](https://github.com/mikeal/request/commit/e4df85c72221bf09ee7e1eb54f6c881851bd4164) Composable API for OAuth. (@mikeal) -- [945ec40](https://github.com/mikeal/request/commit/945ec40baef968ddd468c3b4dfce01621e4a0e31) Composable form API (@mikeal) -- [c30b47f](https://github.com/mikeal/request/commit/c30b47f229522a75af85da269157377b4a7dc37d) Use this, return this. (@mikeal) -- [e908644](https://github.com/mikeal/request/commit/e908644a69f9107b954f13635736f1e640216aec) Composable multipart API. (@mikeal) -- [e115677](https://github.com/mikeal/request/commit/e115677b1a03576eb96386986c350f211a4f38cd) Composable jar. Guard against overwrites on retry. (@mikeal) -- [a482e48](https://github.com/mikeal/request/commit/a482e4802e11fd122b12e18d1b18b49850fef823) Updating copyright for the new year. (@mikeal) -- [3c6581a](https://github.com/mikeal/request/commit/3c6581a9d4508fe5d75e111ae0fb94c5e0078404) Adding clobber argument for appending to headers. thanks @isaacs (@mikeal) -- [54e6aca](https://github.com/mikeal/request/commit/54e6aca0ab5982621fc9b35500f2154e50c0c95d) Fixes #144. (@mikeal) -- [12f4997](https://github.com/mikeal/request/commit/12f4997ed83bfbfefa3fc5b5635bc9a6829aa0d7) Fixing clobber. (@mikeal) -- [2f34fd1](https://github.com/mikeal/request/commit/2f34fd13b7ec86cb1c67e0a58664b9e060a34a50) Added support for a "query" option value that is a hash of querystring values that is merged (taking precedence over) with the querystring passed in the uri string. (@csainty) -- [a32d9e7](https://github.com/mikeal/request/commit/a32d9e7069533fb727a71730dbaa0f62ebefb731) Added a js based test runner so I can run tests on windows. (@csainty) -- [e0b6ce0](https://github.com/mikeal/request/commit/e0b6ce063de0c4223c97982128bb8203caf4a331) Tidied up an issue where ?> was being appended to URLs. (@csainty) -- [d47150d](https://github.com/mikeal/request/commit/d47150d6748a452df336d8de9743218028a876db) Refactored to match the composable style (@csainty) -- [b7e0929](https://github.com/mikeal/request/commit/b7e0929837873a8132476bb2b4d2e2a0fdc7cd0f) implemented issue #173 allow uri to be first argument (@twilson63) -- [b7264a6](https://github.com/mikeal/request/commit/b7264a6626481d5da50a28c91ea0be7b688c9daf) removed debug line and reset ports (@twilson63) -- [76598c9](https://github.com/mikeal/request/commit/76598c92bee64376e5d431285ac1bf6783140dbb) removed npm-debug (@twilson63) -- [#177](https://github.com/mikeal/request/pull/177) Issue #173 Support uri as first and optional config as second argument (@twilson63) -- [0f24051](https://github.com/mikeal/request/commit/0f240517dea65337636a49cb1cc2b5327504430e) Renamed query to qs. It was actually my first choice, but there appeared to be conflicts with the qs = require('querystring'). These are no longer present though and must have been unrelated. (@csainty) -- [becedaa](https://github.com/mikeal/request/commit/becedaaa7681b0c4ad5c0a9b9922fc950f091af2) Changed test structure to no longer require a server, modeled on the oauth tests. This also lets me revert some of the changes I had to make to the test server and proxy tests (@csainty) -- [9b2bbf0](https://github.com/mikeal/request/commit/9b2bbf0c12e87a59320efac67759041cd4af913f) Modified how the qs function works, it now no longer tweaks the existing request uri, instead it recreates a new one. This allows me to revert all the other changes I had to make previously and gives a nice clean commit that is self contained. (@csainty) -- [5ac7e26](https://github.com/mikeal/request/commit/5ac7e26ce4f7bf5a334df91df83699891171c0ae) failing test for .pipe(dst, opts) (@substack) -- [3b2422e](https://github.com/mikeal/request/commit/3b2422e62fbd6359b841e59a2c1888db71a22c2c) fix for failing pipe opts test (@substack) -- [8788c8b](https://github.com/mikeal/request/commit/8788c8b8cba96662e9d94a96eb04d96b904adea3) added uri param for post, put, head, del shortcuts (@twilson63) -- [#179](https://github.com/mikeal/request/pull/179) fix to add opts in .pipe(stream, opts) (@substack) -- [#180](https://github.com/mikeal/request/pull/180) Modified the post, put, head and del shortcuts to support uri optional param (@twilson63) -- [37d0699](https://github.com/mikeal/request/commit/37d0699eb681e85b7df4896b0a68b6865e596cb3) Fixing end bug i introduced being stupid. (@mikeal) -- [3a97292](https://github.com/mikeal/request/commit/3a97292f45273fa2cc937c0698ba19964780b4bb) fixed defaults functionality to support (uri, options, callback) (@twilson63) -- [#182](https://github.com/mikeal/request/pull/182) Fix request.defaults to support (uri, options, callback) api (@twilson63) -- [c94b200](https://github.com/mikeal/request/commit/c94b200258fa48697e386121a3e114ab7bed2ecf) Switched npm test from the bash script to a node script so that it is cross-platform. (@csainty) -- [#176](https://github.com/mikeal/request/pull/176) Querystring option (@csainty) -- [3b1e609](https://github.com/mikeal/request/commit/3b1e6094451e8d34c93353177de9d76e9a805e43) Adding defaults test back in. (@mikeal) -- [b4ae0c2](https://github.com/mikeal/request/commit/b4ae0c2d50f018a90a3ec8daa1d14c92a99873b9) Fixing idiotic bug I introduced. (@mikeal) -- [32f76c8](https://github.com/mikeal/request/commit/32f76c8baaf784dc2f4f1871153b1796bcebdcfe) Pushed new version to npm. (@mikeal) -- [00d0d9f](https://github.com/mikeal/request/commit/00d0d9f432182f13a5b8aa2e3a2a144b5c179015) Adding accept header to json support. (@mikeal) -- [0f580e6](https://github.com/mikeal/request/commit/0f580e6f6317c5301a52c0b6963d58e27112abca) Add abort support to the returned request (@itay) -- [4505e6d](https://github.com/mikeal/request/commit/4505e6d39a44229bfe5dc4d9a920233e05a7dfdb) Fixing some edge streaming cases with redirects by reusing the Request object. (@mikeal) -- [eed57af](https://github.com/mikeal/request/commit/eed57af8fe3e16632e9e0043d4d7f4d147dbfb8f) Published new version. (@mikeal) -- [97386b5](https://github.com/mikeal/request/commit/97386b5d7315b5c83702ffc7d0b09e34ecb67e04) Fixing pretty bad bug from the composable refactor. (@mikeal) -- [b693ce6](https://github.com/mikeal/request/commit/b693ce64e16aaa859d4edc86f82fbb11e00d33c0) Move abort to a prototype method, don't raise error (@itay) -- [1330eef](https://github.com/mikeal/request/commit/1330eef3ec84a651a435c95cf1ff1a4003086440) Merge branch 'master' of git://github.com/mikeal/request (@itay) -- [#188](https://github.com/mikeal/request/pull/188) Add abort support to the returned request (@itay) -- [5ff4645](https://github.com/mikeal/request/commit/5ff46453e713da1ae66a0d510eda4919e4080abe) Style changes. (@mikeal) -- [2dbd1e4](https://github.com/mikeal/request/commit/2dbd1e4350c2941b795b0e5ee7c0a00cd04cce09) Fixing new params style on master for head request. (@mikeal) -- [14989b2](https://github.com/mikeal/request/commit/14989b2dfc6830dbdad5364930fba1d2995aba06) Pushed new version to npm. (@mikeal) -- [0ea2351](https://github.com/mikeal/request/commit/0ea2351ef017ada9b8472f8d73086715ebe30c6a) Fixes #190. outdated check on options.json from before we had boolean support. (@mikeal) -- [21bf78c](https://github.com/mikeal/request/commit/21bf78c264316f75f4e6c571461521cda6ccf088) Adds a block on DELETE requests in status 300-400 (@goatslacker) -- [0c0c201](https://github.com/mikeal/request/commit/0c0c20139b28b21a860f72b8ce0124046fae421d) Adds tests for GH-119 Fix (@goatslacker) -- [#193](https://github.com/mikeal/request/pull/193) Fixes GH-119 (@goatslacker) -- [5815a69](https://github.com/mikeal/request/commit/5815a697347f20658dc2bdfd0d06e41d0aa0dac4) Fixes #194. setTimeout only works on node 0.6+ (@mikeal) -- [1ddcd60](https://github.com/mikeal/request/commit/1ddcd605bc8936c5b3534e1cf9aa1b29fa2b060b) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [7b35b4f](https://github.com/mikeal/request/commit/7b35b4ff63bbdf133f0f600a88a87b5723d29bdf) Removing old checks for self.req, it's ensured if start() is called. Implementing early pause/resume for when streams try to pause/resume before any data is emitted. Fixes #195. (@mikeal) -- [f01b79b](https://github.com/mikeal/request/commit/f01b79bb651f64065bac8877739223527f5b5592) Make ForeverAgent work with HTTPS (@isaacs) -- [#197](https://github.com/mikeal/request/pull/197) Make ForeverAgent work with HTTPS (@isaacs) -- [8d85b57](https://github.com/mikeal/request/commit/8d85b57ebb81c9d2d0a6b94aed41bf2ab0e3ad09) Forever inherits bugfix (@isaacs) -- [#198](https://github.com/mikeal/request/pull/198) Bugfix on forever usage of util.inherits (@isaacs) -- [37446f5](https://github.com/mikeal/request/commit/37446f54bb21cf9c83ffa81d354d799ae7ecf9ed) Add a test of HTTPS strict with CA checking (@isaacs) -- [8378d2e](https://github.com/mikeal/request/commit/8378d2ef9b8121a9851d21b3f6ec8304bde61c9d) Support tunneling HTTPS requests over proxies (@isaacs) -- [#199](https://github.com/mikeal/request/pull/199) Tunnel (@isaacs) -- [f0052ac](https://github.com/mikeal/request/commit/f0052ac5e6ca9f3f4aa49f6cda6ba15eb5d8b8e6) Published new version to npm. (@mikeal) -- [cea668f](https://github.com/mikeal/request/commit/cea668f6f7d444831313ccc0e0d301d25f2bd421) Adding more explicit error when undefined is passed as uri or options. (@mikeal) -- [047b7b5](https://github.com/mikeal/request/commit/047b7b52f3b11f4c44a02aeb1c3583940ddb59c7) Fix special method functions that get passed an options object. (@mikeal) -- [746de0e](https://github.com/mikeal/request/commit/746de0ef2f564534b29eeb8f296a59bd2c3086a7) pass through Basic authorization option for HTTPS tunneling -- [6fda9d7](https://github.com/mikeal/request/commit/6fda9d7d75e24cc1302995e41e26a91e03fdfc9a) Always clobber internal objects for qs but preserve old querystring args when clobber is present. (@mikeal) -- [75ca7a2](https://github.com/mikeal/request/commit/75ca7a25bc9c6102e87f3660a25835c7fcd70edb) Merge branch 'master' of https://github.com/mikeal/request -- [3b9f0fd](https://github.com/mikeal/request/commit/3b9f0fd3da4ae74de9ec76e7c66c57a7f8641df2) Fix cookies so that attributes are case insensitive -- [fddbd6e](https://github.com/mikeal/request/commit/fddbd6ee7d531bc4a82f629633b9d1637cb039e8) Properly set cookies during redirects -- [0d0bdb7](https://github.com/mikeal/request/commit/0d0bdb793f908492d4086fae8744f1e33e68d8c6) Remove request body when following non-GET redirects -- [#203](https://github.com/mikeal/request/pull/203) Fix cookie and redirect bugs and add auth support for HTTPS tunnel (@milewise) -- [b5fa773](https://github.com/mikeal/request/commit/b5fa773994de1799cf53491db7f5f3ba32825b20) Replace all occurrences of special chars in RFC3986 (@chriso) -- [bc6cd6c](https://github.com/mikeal/request/commit/bc6cd6ca6c6157bad76f0b2b23d4993f389ba977) documenting additional behavior of json option (@jphaas) -- [80e4e43](https://github.com/mikeal/request/commit/80e4e43186de1e9dcfaa1c9a921451560b91267c) Fixes #215. (@mikeal) -- [51f343b](https://github.com/mikeal/request/commit/51f343b9adfc11ec1b2ddcfb52a57e1e13feacb2) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [89c0f1d](https://github.com/mikeal/request/commit/89c0f1dd324bc65ad9c07436fb2c8220de388c42) titlecase authorization for oauth (@visnup) -- [#217](https://github.com/mikeal/request/pull/217) need to use Authorization (titlecase) header with Tumblr OAuth (@visnup) -- [8c163eb](https://github.com/mikeal/request/commit/8c163eb9349459839fc720658979d5c97a955825) Double quotes are optional, and the space after the ; could be required (@janjongboom) -- [#224](https://github.com/mikeal/request/pull/224) Multipart content-type change (@janjongboom) -- [96f4b9b](https://github.com/mikeal/request/commit/96f4b9b1f7b937a92f3f94f10d6d02f8878b6107) Style changes. (@mikeal) -- [b131c64](https://github.com/mikeal/request/commit/b131c64816f621cf15f8c51e76eb105778b4aad8) Adding safe .toJSON method. fixes #167 (@mikeal) -- [05d6e02](https://github.com/mikeal/request/commit/05d6e02c31ec4e6fcfadbfbe5414e701710f6e55) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [74ca9a4](https://github.com/mikeal/request/commit/74ca9a4852b666d30dd71421e8cc8b8a83177148) Unified error and complete handling. Fixes #171 (@mikeal) -- [a86c7dc](https://github.com/mikeal/request/commit/a86c7dc7d0a7c640c7def4c0215e46e76a11ff56) Fixing followAllRedirects and all the redirect tests. (@mikeal) -- [#211](https://github.com/mikeal/request/pull/211) Replace all occurrences of special chars in RFC3986 (@chriso) -- [7e24e8a](https://github.com/mikeal/request/commit/7e24e8a48d0dcfe10d0cc08b3c4e9627b9a95a97) New version on npm, first 3.0 release candidate. (@mikeal) -- [22e0f0d](https://github.com/mikeal/request/commit/22e0f0d73459c11b81b0f66a2cde85492dd8e38f) Added test for .toJSON() (@mikeal) -- [df32746](https://github.com/mikeal/request/commit/df32746f157948b6ae05e87a35cf1768e065ef0b) Adding toJSON to npm test. (@mikeal) -- [e65bfba](https://github.com/mikeal/request/commit/e65bfba98f0886a059a268dcdceabf41aec1e5cc) New version in npm. (@mikeal) -- [2b95921](https://github.com/mikeal/request/commit/2b959217151aaff7a6e7cc15e2acfccd1bbb9b85) Fixing defaults when url is passed instead of uri. (@mikeal) -- [e0534d8](https://github.com/mikeal/request/commit/e0534d860b4931a7a6e645b328fd4418a5433057) Pushed new version to npm. (@mikeal) -- [d2dc835](https://github.com/mikeal/request/commit/d2dc83538379e9e1fafb94f5698c56b4a5318d8d) don't error when null is passed for options (@polotek) -- [db80bf0](https://github.com/mikeal/request/commit/db80bf0444bd98c45f635f305154b9da20eed328) expose initParams (@polotek) -- [8cf019c](https://github.com/mikeal/request/commit/8cf019c9f9f719694408840823e92da08ab9dac3) allow request.defaults to override the main request method (@polotek) -- [#240](https://github.com/mikeal/request/pull/240) don't error when null is passed for options (@polotek) -- [69d017d](https://github.com/mikeal/request/commit/69d017de57622429f123235cc5855f36b3e18d1c) added dynamic boundary for multipart requests (@zephrax) -- [fc13e18](https://github.com/mikeal/request/commit/fc13e185f5e28a280d347e61622ba708e1cd7bbc) added dynamic boundary for multipart requests (@zephrax) -- [#243](https://github.com/mikeal/request/pull/243) Dynamic boundary (@zephrax) -- [1764176](https://github.com/mikeal/request/commit/176417698a84c53c0a69bdfd2a05a2942919816c) Fixing the set-cookie header (@jeromegn) -- [#246](https://github.com/mikeal/request/pull/246) Fixing the set-cookie header (@jeromegn) -- [6f9da89](https://github.com/mikeal/request/commit/6f9da89348b848479c23192c04b3c0ddd5a4c8bc) do not set content-length header to 0 when self.method is GET or self.method is undefined (@sethbridges) -- [efc0ea4](https://github.com/mikeal/request/commit/efc0ea44d63372a30011822ad9d37bd3d7b85952) Experimental AWS signing. Signing code from knox. (@mikeal) -- [4c08a1c](https://github.com/mikeal/request/commit/4c08a1c10bc0ebb679e212ad87419f6c4cc341eb) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [fdb10eb](https://github.com/mikeal/request/commit/fdb10eb493110b8e6e4f679524f38cef946e3f08) Adding support for aws in options. (@mikeal) -- [dac6a30](https://github.com/mikeal/request/commit/dac6a301ae03207af88fae6f5017e82157b79b41) Fixing upgraded stat size and supporting content-type and content-md5 properly. (@mikeal) -- [98cb503](https://github.com/mikeal/request/commit/98cb50325e1d7789fd9f44523d2315df5f890d10) Allow body === '' /* the empty string */. (@Filirom1) -- [0e9ac12](https://github.com/mikeal/request/commit/0e9ac12c69aaca370fbca94b41358e1c3a2f6170) fixed just another global leak of i (@sreuter) -- [#260](https://github.com/mikeal/request/pull/260) fixed just another leak of 'i' (@sreuter) -- [#255](https://github.com/mikeal/request/pull/255) multipart allow body === '' ( the empty string ) (@Filirom1) -- [#249](https://github.com/mikeal/request/pull/249) Fix for the fix of your (closed) issue #89 where self.headers[content-length] is set to 0 for all methods (@sethbridges) -- [adc9ab1](https://github.com/mikeal/request/commit/adc9ab1f563f3cb4681ac8241fcc75e6099efde2) style changes. making @rwaldron cry (@mikeal) -- [155e6ee](https://github.com/mikeal/request/commit/155e6ee270924d5698d3fea37cefc1926cbaf998) Fixed `pool: false` to not use the global agent (@timshadel) -- [1232a8e](https://github.com/mikeal/request/commit/1232a8e46752619d4d4b51d558e6725faf7bf3aa) JSON test should check for equality (@timshadel) -- [#261](https://github.com/mikeal/request/pull/261) Setting 'pool' to 'false' does NOT disable Agent pooling (@timshadel) -- [#262](https://github.com/mikeal/request/pull/262) JSON test should check for equality (@timshadel) -- [914a723](https://github.com/mikeal/request/commit/914a72300702a78a08263fe98a43d25e25713a70) consumer_key and token_secret need to be encoded for OAuth v1 (@nanodocumet) -- [500e790](https://github.com/mikeal/request/commit/500e790f8773f245ff43dd9c14ec3d5c92fe0b9e) Fix uncontrolled crash when "this.uri" is an invalid URI (@naholyr) -- [#265](https://github.com/mikeal/request/pull/265) uncaughtException when redirected to invalid URI (@naholyr) -- [#263](https://github.com/mikeal/request/pull/263) Bug in OAuth key generation for sha1 (@nanodocumet) -- [f4b87cf](https://github.com/mikeal/request/commit/f4b87cf439453b3ca1d63e85b3aeb3373ee1f17e) I'm not OCD seriously (@TehShrike) -- [#268](https://github.com/mikeal/request/pull/268) I'm not OCD seriously (@TehShrike) -- [fcab7f1](https://github.com/mikeal/request/commit/fcab7f1953cd6fb141a7d98f60580c50b59fb73f) Adding a line break to the preamble as the first part of a multipart was not recognized by a server I was communicating with. (@proksoup) -- [661b62e](https://github.com/mikeal/request/commit/661b62e5319bf0143312404f1fc81c895c46f6e6) Commenting out failing post test. Need to figure out a way to test this now that the default is to use a UUID for the frontier. (@mikeal) -- [7165c86](https://github.com/mikeal/request/commit/7165c867fa5dea4dcb0aab74d2bf8ab5541e3f1b) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [5a7ca9b](https://github.com/mikeal/request/commit/5a7ca9b398c1300c08a28fb7f266054c3ce8c57a) Added drain event and returning the boolean from write to proper handle back pressure when piping. (@mafintosh) -- [#273](https://github.com/mikeal/request/pull/273) Pipe back pressure issue (@mafintosh) -- [f8ae8d1](https://github.com/mikeal/request/commit/f8ae8d18627e4743996d8600f77f4e4c05a2a590) New version in npm. (@mikeal) -- [7ff5dae](https://github.com/mikeal/request/commit/7ff5daef152bcfac5b02e661e5476a57b9693489) Merge remote-tracking branch 'upstream/master' (@proksoup) -- [1f34700](https://github.com/mikeal/request/commit/1f34700e5614ea2a2d78b80dd467c002c3e91cb3) fix tests with boundary by injecting boundry from header (@benatkin) -- [ee2b2c2](https://github.com/mikeal/request/commit/ee2b2c2f7a8625fde4d71d79e19cdc5d98f09955) Like in [node.js](https://github.com/joyent/node/blob/master/lib/net.js#L52) print logs if NODE_DEBUG contains the word request (@Filirom1) -- [#279](https://github.com/mikeal/request/pull/279) fix tests with boundary by injecting boundry from header (@benatkin) -- [3daebaf](https://github.com/mikeal/request/commit/3daebaf2551c8d0df7dac1ebff0af4fe08608768) Merge branch 'master' of https://github.com/mikeal/request (@proksoup) -- [dba2ebf](https://github.com/mikeal/request/commit/dba2ebf09552258f37b60122c19b236064b0d216) Updating with corresponding tests. (@proksoup) -- [396531d](https://github.com/mikeal/request/commit/396531d083c94bc807a25f7c3a50a0c92a00c5f7) Removing console.log of multipart (@proksoup) -- [54226a3](https://github.com/mikeal/request/commit/54226a38816b4169e0a7a5d8b1a7feba78235fec) Okay, trying it as an optional parameter, with a new test in test-body.js to verify (@proksoup) -- [23ae7d5](https://github.com/mikeal/request/commit/23ae7d576cc63d645eecf057112b71d6cb73e7b1) Remove non-"oauth_" parameters from being added into the OAuth Authorization header (@jplock) -- [8b82ef4](https://github.com/mikeal/request/commit/8b82ef4ff0b50b0c8dcfb830f62466fa30662666) Removing guard, there are some cases where this is valid. (@mikeal) -- [82440f7](https://github.com/mikeal/request/commit/82440f76f22a5fca856735af66e2dc3fcf240c0d) Adding back in guard for _started, need to keep some measure of safety but we should defer this restriction for as long as possible. (@mikeal) -- [#282](https://github.com/mikeal/request/pull/282) OAuth Authorization header contains non-"oauth_" parameters (@jplock) -- [087be3e](https://github.com/mikeal/request/commit/087be3ebbada53699d14839374f1679f63f3138f) Remove stray `console.log()` call in multipart generator. (@bcherry) -- [0a8a5ab](https://github.com/mikeal/request/commit/0a8a5ab6a08eaeffd45ef4e028be2259d61bb0ee) Merge remote-tracking branch 'upstream/master' (@proksoup) -- [#241](https://github.com/mikeal/request/pull/241) Composability updates suggested by issue #239 (@polotek) -- [#284](https://github.com/mikeal/request/pull/284) Remove stray `console.log()` call in multipart generator. (@bcherry) -- [8344666](https://github.com/mikeal/request/commit/8344666f682a302c914cce7ae9cea8de054f9240) Fix #206 Change HTTP/HTTPS agent when redirecting between protocols (@isaacs) -- [#272](https://github.com/mikeal/request/pull/272) Boundary begins with CRLF? (@proksoup) -- [#214](https://github.com/mikeal/request/pull/214) documenting additional behavior of json option (@jphaas) -- [#207](https://github.com/mikeal/request/pull/207) Fix #206 Change HTTP/HTTPS agent when redirecting between protocols (@isaacs) -- [9cadd61](https://github.com/mikeal/request/commit/9cadd61d989e85715ea07da8770a3077db41cca3) Allow parser errors to bubble up to request (@mscdex) -- [6a00fea](https://github.com/mikeal/request/commit/6a00fea09eed99257c0aec2bb66fbf109b0f573a) Only add socket error handler callback once (@mscdex) -- [975ea90](https://github.com/mikeal/request/commit/975ea90bed9503c67055b20e36baf4bcba54a052) Fix style (@mscdex) -- [205dfd2](https://github.com/mikeal/request/commit/205dfd2e21c13407d89d3ed92dc2b44b987d962b) Use .once() when listening for parser error (@mscdex) -- [ff9b564](https://github.com/mikeal/request/commit/ff9b5643d6b5679a9e7d7997ec6275dac10b000e) Add a space after if (@Filirom1) -- [#280](https://github.com/mikeal/request/pull/280) Like in node.js print options if NODE_DEBUG contains the word request (@Filirom1) -- [d38e57b](https://github.com/mikeal/request/commit/d38e57bbb3d827aa87427f2130aa5a5a3a973161) Test for #289 (@isaacs) -- [820af58](https://github.com/mikeal/request/commit/820af5839f2a193d091d98f23fd588bd919e3e58) A test of POST redirect following with 303 status (@isaacs) -- [7adc5a2](https://github.com/mikeal/request/commit/7adc5a21869bc92cc3b5e84d32c585952c8e5e87) Use self.encoding when calling Buffer.toString() (@isaacs) -- [#290](https://github.com/mikeal/request/pull/290) A test for #289 (@isaacs) -- [#293](https://github.com/mikeal/request/pull/293) Allow parser errors to bubble up to request (@mscdex) -- [ed68b8d](https://github.com/mikeal/request/commit/ed68b8dd024561e9d47d80df255fb79d783c13a7) Updated the twitter oauth dance. The comments weren't clear. Also removed token_key. No longer needed with twitter oauth. (@joemccann) -- [6bc19cd](https://github.com/mikeal/request/commit/6bc19cda351b59f8e45405499a100abd0b456e42) Forgot to remove token_secret; no longer needed for twitter. (@joemccann) -- [1f21b17](https://github.com/mikeal/request/commit/1f21b17fc4ff3a7011b23e3c9261d66effa3aa40) Adding form-data support. (@mikeal) -- [827e950](https://github.com/mikeal/request/commit/827e950500746eb9d3a3fa6f174416b194c9dedf) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [b211200](https://github.com/mikeal/request/commit/b2112009a31fc7f9122970d392750f62b6e77111) Test fixes for relative import. Adding to run all (@mikeal) -- [1268195](https://github.com/mikeal/request/commit/1268195b75bd5bb3954b4c4f2d9feb80a97994d1) Bundling mime module rather than keep around our own mime-map. (@mikeal) -- [4f51cec](https://github.com/mikeal/request/commit/4f51cecdc363946b957585c3deccfd8c37e19aa0) Docs for the form API, pumping version. (@mikeal) -- [90245d7](https://github.com/mikeal/request/commit/90245d7199215d7b195cf7e36b203ca0bd0a6bd3) Doc fixes. (@mikeal) -- [d98ef41](https://github.com/mikeal/request/commit/d98ef411c560bd1168f242c524a378914ff8eac4) Pushed new version to npm. (@mikeal) -- [3e11937](https://github.com/mikeal/request/commit/3e119375acda2da225afdb1596f6346dbd551fba) Pass servername to tunneling secure socket creation (@isaacs) -- [7725b23](https://github.com/mikeal/request/commit/7725b235fdec8889c0c91d55c99992dc683e2e22) Declare dependencies more sanely (@isaacs) -- [#317](https://github.com/mikeal/request/pull/317) Workaround for #313 (@isaacs) -- [#318](https://github.com/mikeal/request/pull/318) Pass servername to tunneling secure socket creation (@isaacs) -- [0c470bc](https://github.com/mikeal/request/commit/0c470bccf1ec097ae600b6116e6244cb624dc00e) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [0d98e5b](https://github.com/mikeal/request/commit/0d98e5b7ea6bd9c4f21535d3682bbed2f2e05df4) Pushed new version to npm. (@mikeal) -- [64a4448](https://github.com/mikeal/request/commit/64a44488ac8c792a1f548f305fc5c61efe0d77fb) when setting defaults, the wrapper adds the jar method assuming it has the same signature as get, meaning undefined is passed into initParams, which subsequently fails. now passing jar function directly as it has no need of defaults anyway seeing as it only creates a new cookie jar (@StuartHarris) -- [48c9881](https://github.com/mikeal/request/commit/48c988118bda4691fffbfcf30d5a39b6c1438736) Added test to illustrate #321 (@alexindigo) -- [8ce0f2a](https://github.com/mikeal/request/commit/8ce0f2a3b6929cd0f7998e00d850eaf5401afdb7) Added *src* stream removal on redirect. #321 (@alexindigo) -- [c32f0bb](https://github.com/mikeal/request/commit/c32f0bb9feaa71917843856c23b4aae99f78ad4d) Do not try to remove listener from an undefined connection (@strk) -- [#326](https://github.com/mikeal/request/pull/326) Do not try to remove listener from an undefined connection (@CartoDB) -- [#322](https://github.com/mikeal/request/pull/322) Fix + test for piped into request bumped into redirect. #321 (@alexindigo) -- [85b6a63](https://github.com/mikeal/request/commit/85b6a632ac7d3456485fbf931043f10f5f6344a5) New version in npm. (@mikeal) -- [f462bd3](https://github.com/mikeal/request/commit/f462bd3fa421fa5e5ca6c91852333db90297b80e) Rolling trunk version. (@mikeal) -- [8a82c5b](https://github.com/mikeal/request/commit/8a82c5b0990cc58fa4cb7f81814d13ba7ae35453) Adding url to redirect error for better debugging. (@mikeal) -- [013c986](https://github.com/mikeal/request/commit/013c986d0a8b5b2811cd06dd3733f4a3d37df1cc) Better debugging of max redirect errors. (@mikeal) -- [#320](https://github.com/mikeal/request/pull/320) request.defaults() doesn't need to wrap jar() (@redbadger) -- [4797f88](https://github.com/mikeal/request/commit/4797f88b42c3cf8680cbde09bf473678a5707aed) Fix #296 - Only set Content-Type if body exists (@Marsup) -- [f6bcf3e](https://github.com/mikeal/request/commit/f6bcf3eb51982180e813c69cccb942734f815ffe) fixup aws function to work in more situations (@nlf) -- [ba6c88a](https://github.com/mikeal/request/commit/ba6c88af5e771c2a0e007e6166e037a149561e09) added short blurb on using aws (@nlf) -- [#343](https://github.com/mikeal/request/pull/343) Allow AWS to work in more situations, added a note in the README on its usage (@nathan-lafreniere) -- [288c52a](https://github.com/mikeal/request/commit/288c52a2a1579164500c26136552827112801ff1) switch to a case insensitive getter when fetching headers for aws auth signing (@nlf) -- [#332](https://github.com/mikeal/request/pull/332) Fix #296 - Only set Content-Type if body exists (@Marsup) -- [7a16286](https://github.com/mikeal/request/commit/7a162868de65b6de15e00c1f707b5e0f292c5f86) Emit errors for anything in init so that it is catchable in a redirect. (@mikeal) -- [d288d21](https://github.com/mikeal/request/commit/d288d21d709fa81067f5af53737dfde06f842262) fix bug (@azylman) -- [#355](https://github.com/mikeal/request/pull/355) stop sending erroneous headers on redirected requests (@azylman) -- [b0b97f5](https://github.com/mikeal/request/commit/b0b97f53a9e94f3aeaa05e2cda5b820668f6e3b2) delete _form along with everything else on a redirect (@jgautier) -- [#360](https://github.com/mikeal/request/pull/360) Delete self._form along with everything else on redirect (@jgautier) -- [61e3850](https://github.com/mikeal/request/commit/61e3850f0f91ca6732fbd06b46796fbcd2fea1ad) Made it so that if we pass in Content-Length or content-length in the headers, don't make a new version (@danjenkins) -- [#361](https://github.com/mikeal/request/pull/361) Don't create a Content-Length header if we already have it set (@danjenkins) -- [590452d](https://github.com/mikeal/request/commit/590452d6569e68e480d4f40b88022f1b81914ad6) inside oauth.hmacsign: running rfc3986 on base_uri instead of just encodeURIComponent. -- [#362](https://github.com/mikeal/request/pull/362) Running `rfc3986` on `base_uri` in `oauth.hmacsign` instead of just `encodeURIComponent` (@jeffmarshall) -- [f7dc90c](https://github.com/mikeal/request/commit/f7dc90c8dae743d5736dc6c807eecde613eb4fd4) Revert "Merge pull request #362 from jeffmarshall/master" (@mikeal) -- [d631a26](https://github.com/mikeal/request/commit/d631a26e263077eca3d4925de9b0a8d57365ba90) reintroducing the WTF escape + encoding, also fixing a typo. -- [#363](https://github.com/mikeal/request/pull/363) rfc3986 on base_uri, now passes tests (@jeffmarshall) -- [bfe2791](https://github.com/mikeal/request/commit/bfe2791f596b749eed6961159d41a404c3aba0d0) oauth fix. (@mikeal) -- [#344](https://github.com/mikeal/request/pull/344) Make AWS auth signing find headers correctly (@nathan-lafreniere) -- [e863f25](https://github.com/mikeal/request/commit/e863f25336abc7b9f9936c20e0c06da8db0c6593) style change. (@mikeal) -- [3e5a87c](https://github.com/mikeal/request/commit/3e5a87ce28b3bb45861b32f283cd20d0084d78a7) Don't remove x_auth_type for Twitter reverse auth (@drudge) -- [#369](https://github.com/mikeal/request/pull/369) Don't remove x_auth_mode for Twitter reverse auth (@drudge) -- [25d4667](https://github.com/mikeal/request/commit/25d466773c43949e2eea4236ffc62841757fd1f0) x_auth_mode not x_auth_type (@drudge) -- [#370](https://github.com/mikeal/request/pull/370) Twitter reverse auth uses x_auth_mode not x_auth_type (@drudge) -- [cadf4dc](https://github.com/mikeal/request/commit/cadf4dc54f4ee3fae821f6beb1ea6443e528bf6f) massive style commit. (@mikeal) -- [33453a5](https://github.com/mikeal/request/commit/33453a53bc37e4499853b9d929b3603cdf7a31cd) New version in npm. (@mikeal) -- [b638185](https://github.com/mikeal/request/commit/b6381854006470af1d0607f636992c7247b6720f) Setting master version. (@mikeal) -- [8014d2a](https://github.com/mikeal/request/commit/8014d2a5b797f07cf56d2f39a346031436e1b064) correct Host header for proxy tunnel CONNECT (@ypocat) -- [#374](https://github.com/mikeal/request/pull/374) Correct Host header for proxy tunnel CONNECT (@ypocat) -- [8c3e9cb](https://github.com/mikeal/request/commit/8c3e9cb529767cff5e7206e2e76531183085b42a) If one of the request parameters is called "timestamp", the "oauth_timestamp" OAuth parameter will get removed during the parameter cleanup loop. (@jplock) -- [#375](https://github.com/mikeal/request/pull/375) Fix for missing oauth_timestamp parameter (@jplock) -- [69e6dc5](https://github.com/mikeal/request/commit/69e6dc5c80e67bbd7d135c3ceb657a1b2df58763) Fixed headers piping on redirects (@kapetan) -- [#376](https://github.com/mikeal/request/pull/376) Headers lost on redirect (@kapetan) -- [62dbbf3](https://github.com/mikeal/request/commit/62dbbf3d77b0851ba424d4f09d1d0c0be91c1f2d) Resolving the Invalid signature when using "qs" (@landeiro) -- [d4cf4f9](https://github.com/mikeal/request/commit/d4cf4f98e11f9a85b6bdfd0481c85c8ac34061ce) fixes missing host header on retried request when using forever agent -- [#380](https://github.com/mikeal/request/pull/380) Fixes missing host header on retried request when using forever agent (@mac-) -- [#381](https://github.com/mikeal/request/pull/381) Resolving "Invalid signature. Expected signature base string: " (@landeiro) -- [ea2f975](https://github.com/mikeal/request/commit/ea2f975ae83efe956b77cbcd0fd9ad42c0d5192f) Ensure that uuid is treated as a property name, not an index. (@othiym23) -- [#388](https://github.com/mikeal/request/pull/388) Ensure "safe" toJSON doesn't break EventEmitters (@othiym23) -- [11a3bc0](https://github.com/mikeal/request/commit/11a3bc0ea3063f6f0071248e03c8595bfa9fd046) Add more reporting to tests (@mmalecki) -- [#398](https://github.com/mikeal/request/pull/398) Add more reporting to tests (@mmalecki) -- [b85bf63](https://github.com/mikeal/request/commit/b85bf633fe8197dc38855f10016a0a76a8ab600a) Optimize environment lookup to happen once only (@mmalecki) -- [#403](https://github.com/mikeal/request/pull/403) Optimize environment lookup to happen once only (@mmalecki) -- [dbb9a20](https://github.com/mikeal/request/commit/dbb9a205fafd7bf5a05d2dbe7eb2c6833b4387dc) renaming tests/googledoodle.png to match it's actual image type of jpeg (@nfriedly) -- [e2d7d4f](https://github.com/mikeal/request/commit/e2d7d4fd35869354ba14a333a4b4989b648e1971) Add more auth options, including digest support (@nylen) -- [d0d536c](https://github.com/mikeal/request/commit/d0d536c1e5a9a342694ffa5f14ef8fbe8dcfa8bd) Add tests for basic and digest auth (@nylen) -- [85fd359](https://github.com/mikeal/request/commit/85fd359890646ef9f55cc6e5c6a32e74f4fbb786) Document new auth options (@nylen) -- [#338](https://github.com/mikeal/request/pull/338) Add more auth options, including digest support (@nylen) -- [fd2e2fa](https://github.com/mikeal/request/commit/fd2e2fa1e6d580cbc34afd3ae1200682cecb3cf9) Fixed a typo. (@jerem) -- [#415](https://github.com/mikeal/request/pull/415) Fixed a typo. (@jerem) -- [53c1508](https://github.com/mikeal/request/commit/53c1508c9c6a58f7d846de82cad36402497a4a4f) Fix for #417 (@mikeal) -- [b23f985](https://github.com/mikeal/request/commit/b23f985e02da4a96f1369541a128c4204a355666) Fixing merge conflict. (@mikeal) -- [28e8be5](https://github.com/mikeal/request/commit/28e8be5175793ac99236df88e26c0139a143e32d) Lost a forever fix in the previous merge. Fixing. (@mikeal) -- [e4d1e25](https://github.com/mikeal/request/commit/e4d1e25c1648ef91f6baf1ef407c712509af4b66) Copy options before adding callback. (@nrn) -- [22bc67d](https://github.com/mikeal/request/commit/22bc67d7ac739e9c9f74c026f875a0a7c686e29d) Respect specified {Host,host} headers, not just {host} (@andrewschaaf) -- [#430](https://github.com/mikeal/request/pull/430) Respect specified {Host,host} headers, not just {host} (@andrewschaaf) -- [6b11acf](https://github.com/mikeal/request/commit/6b11acf3e29fb84daef4e940314cae5ac2e580c6) Updating form-data. (@mikeal) -- [d195845](https://github.com/mikeal/request/commit/d195845c3e1de42c9aee752eec8efa4dda87ec74) Updating mime (@mikeal) -- [20ba1d6](https://github.com/mikeal/request/commit/20ba1d6d38191aa7545b927a7262a18c5c63575b) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [0150d9f](https://github.com/mikeal/request/commit/0150d9fa13e51d99880013b9ec29343850b40c2f) Consider `options.rejectUnauthorized` when pooling https agents (@mmalecki) -- [3e07b6d](https://github.com/mikeal/request/commit/3e07b6d4b81037d0e6e595670db483708ffa8698) Use `rejectUnauthorized: false` in tests (@mmalecki) -- [3995878](https://github.com/mikeal/request/commit/3995878d9fff18a8707f27ffeb4ed6401086adce) Support `key` and `cert` options (@mmalecki) -- [#433](https://github.com/mikeal/request/pull/433) Added support for HTTPS cert & key (@indexzero) -- [8b0f4e8](https://github.com/mikeal/request/commit/8b0f4e8fba33d578a891218201d87e3316ea9844) Released 2.14.0 (@mikeal) -- [54172c6](https://github.com/mikeal/request/commit/54172c68cab8360372e1e64e3fa14902662950bd) Rolling master version. (@mikeal) -- [aa4a285](https://github.com/mikeal/request/commit/aa4a28586354901b0c9b298a0aa79abb5ed175af) Add patch convenience method. (@mloar) -- [66501b9](https://github.com/mikeal/request/commit/66501b9872abc9a2065430cd5ed4a34dd45c8bee) protect against double callback (@spollack) -- [#444](https://github.com/mikeal/request/pull/444) protect against double callbacks on error path (@spollack) -- [#448](https://github.com/mikeal/request/pull/448) Convenience method for PATCH (@mloar) -- [6f0f8c5](https://github.com/mikeal/request/commit/6f0f8c5ee2b2fdc7118804664c2215fe9cb5a2f2) No longer doing bundle dependencies (@mikeal) -- [3997f98](https://github.com/mikeal/request/commit/3997f980722241c18454a00aeeda07d701c27a8f) No longer using bundle dependencies (@mikeal) -- [cba36ce](https://github.com/mikeal/request/commit/cba36ce64e68bd26e230b65f81256776ac66e686) Adding hawk signing to request. (@mikeal) -- [c7a8be6](https://github.com/mikeal/request/commit/c7a8be6d174eff05a9cb2fda987979e475d8543f) Fixing bug in empty options. (@mikeal) -- [67d753f](https://github.com/mikeal/request/commit/67d753fec99fa1f5a3b35ec0bbbc98896418d86c) node-uuid is much better. (@mikeal) -- [337718b](https://github.com/mikeal/request/commit/337718baa08cafb3e706d275fd7344a3c92363bb) Smarter test runner. (@mikeal) -- [bcc33ac](https://github.com/mikeal/request/commit/bcc33aca57baf6fe2a81fbf5983048c9220c71b1) Moved the cookie jar in to it's own module. (@mikeal) -- [3261be4](https://github.com/mikeal/request/commit/3261be4b5d6f45f62b9f50bec18af770cbb70957) Put aws signing in its own package. (@mikeal) -- [fbed723](https://github.com/mikeal/request/commit/fbed7234d7b532813105efdc4c54777396a6773b) OAuth signing is now in its own library. (@mikeal) -- [ef5ab90](https://github.com/mikeal/request/commit/ef5ab90277fb00d0e8eb1c565b0f6ef8c52601d3) Forever agent is now it's own package. (@mikeal) -- [ca1ed81](https://github.com/mikeal/request/commit/ca1ed813c62c7493dc77108b3efc907cc36930cb) tunneling agent is now it's own library. (@mikeal) -- [5c75621](https://github.com/mikeal/request/commit/5c75621ba5cea18bcf114117112121d361e5f3c9) Moving from main.js to index. cause it's not 2010 anymore. (@mikeal) -- [#413](https://github.com/mikeal/request/pull/413) rename googledoodle.png to .jpg (@nfriedly) -- [b4c4c28](https://github.com/mikeal/request/commit/b4c4c28424d906cd96a2131010b21d7facf8b666) Merge branch 'master' of github.com:mikeal/request (@nrn) -- [#310](https://github.com/mikeal/request/pull/310) Twitter Oauth Stuff Out of Date; Now Updated (@joemccann) -- [8b0e7e8](https://github.com/mikeal/request/commit/8b0e7e8c9d196d7286d1563aa54affcc4c8b0e1d) Comment to explain init() and start(). (@mikeal) -- [43d578d](https://github.com/mikeal/request/commit/43d578dc0206388eeae9584f540d550a06308fc8) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [b7c5ed4](https://github.com/mikeal/request/commit/b7c5ed48b618f71f138f9f08f8d705336f907e01) destroy the response if present when destroying the request (@mafintosh) -- [b279277](https://github.com/mikeal/request/commit/b279277dc2fb4b649640322980315d74db0d13f3) response.abort should be response.destroy (@mafintosh) -- [#454](https://github.com/mikeal/request/pull/454) Destroy the response if present when destroying the request (clean merge) (@mafintosh) -- [#429](https://github.com/mikeal/request/pull/429) Copy options before adding callback. (@nrn) -- [e0e0fb4](https://github.com/mikeal/request/commit/e0e0fb451f17945a02203639e4836aa327b4e30b) hawk 0.9.0 (@hueniverse) -- [#456](https://github.com/mikeal/request/pull/456) hawk 0.9.0 (@hueniverse) -- [2f60bc2](https://github.com/mikeal/request/commit/2f60bc253ff6e28df58a33da24b710b6d506849f) Fixes #453 (@mikeal) -- [805b6e4](https://github.com/mikeal/request/commit/805b6e4fe3afeeb407b4fca2e34e9caabe30f747) Fixing hawk README to match new usage. (@mikeal) -- [8feb957](https://github.com/mikeal/request/commit/8feb957911083bce552d1898b7ffcaa87104cd21) Removing old logref code. (@mikeal) -- [fcf6d67](https://github.com/mikeal/request/commit/fcf6d6765247a2645a233d95468ade2960294074) Safe stringify. (@mikeal) -- [62455bc](https://github.com/mikeal/request/commit/62455bca81e8760f25a2bf1dec2b06c8e915de79) hawk 0.10 (@hueniverse) -- [c361b41](https://github.com/mikeal/request/commit/c361b4140e7e6e4fe2a8f039951b65d54af65f42) hawk 0.10 (@hueniverse) -- [fa1ef30](https://github.com/mikeal/request/commit/fa1ef30dcdac83b271ce38c71975df0ed96b08f7) Strip the UTF8 BOM from a UTF encoded response (@kppullin) -- [9d636c0](https://github.com/mikeal/request/commit/9d636c0b3e882742e15ba989d0c2413f95364680) if query params are empty, then request path shouldn't end with a '?' (@jaipandya) -- [#462](https://github.com/mikeal/request/pull/462) if query params are empty, then request path shouldn't end with a '?' (merges cleanly now) (@jaipandya) -- [#460](https://github.com/mikeal/request/pull/460) hawk 0.10.0 (@hueniverse) -- [#461](https://github.com/mikeal/request/pull/461) Strip the UTF8 BOM from a UTF encoded response (@kppullin) -- [6d29ed7](https://github.com/mikeal/request/commit/6d29ed72e34f3b2b6d8a5cfadd96dd26b3dd246d) Moving response handlers to onResponse. (@mikeal) -- [885d6eb](https://github.com/mikeal/request/commit/885d6ebeb6130c2ab7624304f4a01a898573390b) Using querystring library from visionmedia (@kbackowski) -- [#471](https://github.com/mikeal/request/pull/471) Using querystring library from visionmedia (@kbackowski) -- [346bb42](https://github.com/mikeal/request/commit/346bb42898c5804576d9e9b3adf40123260bf73b) On strictSSL set rejectUnauthorized. (@mikeal) -- [8a45365](https://github.com/mikeal/request/commit/8a453656a705d2fa98fbf9092b1600d2ddadbb5a) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [32cfd3c](https://github.com/mikeal/request/commit/32cfd3cf7b3f23c2b1d36c5ccb475cbb3a4693ff) Style changes. (@mikeal) -- [ec07ee2](https://github.com/mikeal/request/commit/ec07ee2d3eeb90b6d0ad9f6d7f3a36da72276841) Print debug logs NODE_DEBUG=request in environment (@isaacs) -- [681af64](https://github.com/mikeal/request/commit/681af644a2ebccad8bcccb75984f7f10f909b382) Flow data in v0.10-style streams (@isaacs) -- [#473](https://github.com/mikeal/request/pull/473) V0.10 compat (@isaacs) -- [f07a8ba](https://github.com/mikeal/request/commit/f07a8baebf7001addbc0f7d7c869adddc21768ce) Release. (@mikeal) -- [1f947a1](https://github.com/mikeal/request/commit/1f947a1d2728147fbf4f57aa361d0bedcebfc206) Rolling master version. (@mikeal) -- [7a217bb](https://github.com/mikeal/request/commit/7a217bbdced9a05a786fe6534ab52734df342d3e) Reinstate querystring for `unescape` (@shimaore) -- [b0b4ca9](https://github.com/mikeal/request/commit/b0b4ca913e119337e9313a157eee2f08f77ddc38) Test for `unescape` (@shimaore) -- [#475](https://github.com/mikeal/request/pull/475) Use `unescape` from `querystring` (@shimaore) -- [28fc741](https://github.com/mikeal/request/commit/28fc741fa958a9783031189964ef6f6d7e3f3264) Release. (@mikeal) -- [d3e28ef](https://github.com/mikeal/request/commit/d3e28ef7144da4d9f22f8fb475bd5aa6a80fb947) Rolling master version. (@mikeal) -- [8f8bb9e](https://github.com/mikeal/request/commit/8f8bb9ee8c4dcd9eb815249fbe2a7cf54f61b56f) Changing so if Accept header is explicitly set, sending json does not overwrite. (@RoryH) -- [#479](https://github.com/mikeal/request/pull/479) Changing so if Accept header is explicitly set, sending json does not ov... (@RoryH) -- [7694372](https://github.com/mikeal/request/commit/7694372f3dc9d57ac29ca7ee5c00146aa5e1e747) Proper version for latest. (@mikeal) -- [aa208cf](https://github.com/mikeal/request/commit/aa208cf5c682262529d749f592db147182cacfaf) 0.8+ only now (@mikeal) -- [16b5ab9](https://github.com/mikeal/request/commit/16b5ab9151823067b05b382241483ef10811c3e1) Upgrading qs. (@mikeal) -- [7d10c1e](https://github.com/mikeal/request/commit/7d10c1e83b4663f592c773e7fece83435585a06f) Merge branch 'master' of github.com:mikeal/request (@mikeal) -- [b8ca4b4](https://github.com/mikeal/request/commit/b8ca4b474b8215cab44ef8ef789303571b3d016f) pumping hawk version. (@mikeal) -- [9c0e484](https://github.com/mikeal/request/commit/9c0e48430e3a9de8715e77c07c98301399eaf6e3) release (@mikeal) -- [a9f1896](https://github.com/mikeal/request/commit/a9f189697e2a813bee9bff31de32a25e99e55cf2) rolling master version. (@mikeal) -- [560a1f8](https://github.com/mikeal/request/commit/560a1f8b927099e44b75274375a690df2a05de67) Set content-type on input. (@mikeal) -- [5fec436](https://github.com/mikeal/request/commit/5fec436b6602bc8c76133664bca23e98f511b096) Release. (@mikeal) -- [88d8d5b](https://github.com/mikeal/request/commit/88d8d5bc80679b78a39cab8e6d8295728a0a150d) Rolling version. (@mikeal) -- [d05b6ba](https://github.com/mikeal/request/commit/d05b6ba72702c2411b4627d4d89190a5f2aba562) Empty body must be passed as empty string, exclude JSON case (@Olegas) -- [#490](https://github.com/mikeal/request/pull/490) Empty response body (3-rd argument) must be passed to callback as an empty string (@Olegas) -- [8aa13cd](https://github.com/mikeal/request/commit/8aa13cd5b5e22b24466ef0e59fa8b5f1d0f0795a) Added redirect event (@Cauldrath) -- [4d63a04](https://github.com/mikeal/request/commit/4d63a042553c90718bf0b90652921b26c52dcb31) Moving response emit above setHeaders on destination streams (@kenperkins) -- [#498](https://github.com/mikeal/request/pull/498) Moving response emit above setHeaders on destination streams (@kenperkins) -- [c40993f](https://github.com/mikeal/request/commit/c40993fc987b1a8a3cb08cd5699b2f1b2bd4b28b) Fix a regression introduced by cba36ce6 (@nylen) -- [edc2e17](https://github.com/mikeal/request/commit/edc2e17e8154239efa6bd2914435798c18882635) Don't delete headers when retrying a request with proper authentication (@nylen) -- [a375ac1](https://github.com/mikeal/request/commit/a375ac15460f4f3b679f4418d7fc467a5cc94499) Refactor and expand basic auth tests (@nylen) -- [9bc28bf](https://github.com/mikeal/request/commit/9bc28bf912fb0afdd14b36b0ccbafb185a32546a) Cleanup whitespace. (@mikeal) -- [9a35cd2](https://github.com/mikeal/request/commit/9a35cd2248d9492b099c7ee46d68ca017b6a701c) Fix basic auth for passwords that contain colons (@tonistiigi) -- [f724810](https://github.com/mikeal/request/commit/f724810c7b9f82fa1423d0a4d19fcb5aaca98137) Honor the .strictSSL option when using proxies (tunnel-agent) (@jhs) -- [95a2558](https://github.com/mikeal/request/commit/95a25580375be1b9c39cc2e88a36a8387395bc13) Add HTTP Signature support. (@davidlehn) -- [921c973](https://github.com/mikeal/request/commit/921c973015721ee0f92ed670f5e88bca057104cc) * Make password optional to support the format: http://username@hostname/ -- [2759ebb](https://github.com/mikeal/request/commit/2759ebbe07e8563fd3ded698d2236309fb28176b) add 'localAddress' support (@yyfrankyy) -- [#513](https://github.com/mikeal/request/pull/513) add 'localAddress' support (@yyfrankyy) -- [#512](https://github.com/mikeal/request/pull/512) Make password optional to support the format: http://username@hostname/ (@pajato1) -- [#508](https://github.com/mikeal/request/pull/508) Honor the .strictSSL option when using proxies (tunnel-agent) (@iriscouch) -- [5f036e6](https://github.com/mikeal/request/commit/5f036e6f5d3102a89e5401a53090a0627a7850a8) Conflicts: index.js (@nylen) -- [89d2602](https://github.com/mikeal/request/commit/89d2602ef4e3a4e6e51284f6a29b5767c79ffaba) Conflicts: README.md (@davidlehn) -- [#502](https://github.com/mikeal/request/pull/502) Fix POST (and probably other) requests that are retried after 401 Unauthorized (@nylen) -- [eb3e033](https://github.com/mikeal/request/commit/eb3e033170403832fe7070955db32112ec46005f) Merge branch 'master' of git://github.com/mikeal/request (@davidlehn) -- [#510](https://github.com/mikeal/request/pull/510) Add HTTP Signature support. (@digitalbazaar) -- [227d998](https://github.com/mikeal/request/commit/227d9985426214b6ac68702933346000298d7790) Update the internal path variable when querystring is changed (@jblebrun) -- [#519](https://github.com/mikeal/request/pull/519) Update internal path state on post-creation QS changes (@incredible-labs) -- [428b9c1](https://github.com/mikeal/request/commit/428b9c1ad9831b7dfd6cec4ce68df358590c6d65) Fixing test-tunnel.js (@noway421) -- [2417599](https://github.com/mikeal/request/commit/24175993f6c362f7fca5965feb0a11756f00baf3) Improving test-localAddress.js (@noway421) -- [#520](https://github.com/mikeal/request/pull/520) Fixing test-tunnel.js (@noway421) -- [1e37f1b](https://github.com/mikeal/request/commit/1e37f1bea45174e09e6450bc71dfc081c8cd94de) Some explaining comments (@noway421) -- [909b024](https://github.com/mikeal/request/commit/909b024619c9e47f615749661d610cccd8421d80) Updating dependencies (@noway421) -- [#523](https://github.com/mikeal/request/pull/523) Updating dependencies (@noway421) -- [47191e1](https://github.com/mikeal/request/commit/47191e1a5e29714fb0c5f8b2162b2971570df644) 2.17.0 (@mikeal) -- [14def5a](https://github.com/mikeal/request/commit/14def5af5903d03f66bd6c9be534e6b76f47c063) 2.18.0 (@mikeal) -- [56fd6b7](https://github.com/mikeal/request/commit/56fd6b7ec6da162894df0809126d688f30900d25) 2.18.1 (@mikeal) -- [37dd689](https://github.com/mikeal/request/commit/37dd68989670f8937b537579a4299d9649b8aa16) Fixing dep. (@mikeal) -- [dd7209a](https://github.com/mikeal/request/commit/dd7209a84dd40afe87db31c6ab66885e2015cb8f) 2.19.0 (@mikeal) -- [62f3b92](https://github.com/mikeal/request/commit/62f3b9203690d4ad34486fc506fc78a1c9971e03) 2.19.1 (@mikeal) -- [74c6b2e](https://github.com/mikeal/request/commit/74c6b2e315872980ee9a9a000d25e724138f28b1) Adding test for onelineproxy. (@mikeal) -- [2a01cc0](https://github.com/mikeal/request/commit/2a01cc082f544647f7176a992e02668519a694be) Fixing onelineproxy. (@mikeal) -- [8b4c920](https://github.com/mikeal/request/commit/8b4c9203adb372f2ee99b1b012406b482b27c68d) 2.20.0 (@mikeal) -- [d8d4a33](https://github.com/mikeal/request/commit/d8d4a3311d8d31df88fa8a2ab3265872e5cb97ae) 2.20.1 (@mikeal) -- [5937012](https://github.com/mikeal/request/commit/59370123b22e8c971e4ee48c3d0caf920d890bda) dependencies versions bump (@jodaka) -- [#529](https://github.com/mikeal/request/pull/529) dependencies versions bump (@jodaka) -- [#521](https://github.com/mikeal/request/pull/521) Improving test-localAddress.js (@noway421) -- [#503](https://github.com/mikeal/request/pull/503) Fix basic auth for passwords that contain colons (@tonistiigi) -- [#497](https://github.com/mikeal/request/pull/497) Added redirect event (@Cauldrath) -- [297a9ea](https://github.com/mikeal/request/commit/297a9ea827655e5fb406a86907bb0d89b01deae8) fix typo (@fredericosilva) -- [#532](https://github.com/mikeal/request/pull/532) fix typo (@fredericosilva) -- [3691db5](https://github.com/mikeal/request/commit/3691db5a2d0981d4aeabfda5b988a5c69074e187) Allow explicitly empty user field for basic authentication. (@mikeando) -- [#536](https://github.com/mikeal/request/pull/536) Allow explicitly empty user field for basic authentication. (@mikeando) -- [5d36e32](https://github.com/mikeal/request/commit/5d36e324047f79cbbf3bb9b71fef633f02b36367) 2.21.0 (@mikeal) -- [9bd98d6](https://github.com/mikeal/request/commit/9bd98d6052f222aa348635c1acb2e2c99eed0f8c) 2.21.1 (@mikeal) -- [a918e04](https://github.com/mikeal/request/commit/a918e04a8d767a2948567ea29ed3fdd1650c16b1) The exported request function doesn't have an auth method (@tschaub) -- [1ebe1ac](https://github.com/mikeal/request/commit/1ebe1ac2f78e8a6149c03ce68fcb23d56df2316e) exposing Request class (@regality) -- [#542](https://github.com/mikeal/request/pull/542) Expose Request class (@ifit) -- [467573d](https://github.com/mikeal/request/commit/467573d17b4db5f93ed425ace0594370a7820c7c) Update http-signatures version. (@davidlehn) -- [#541](https://github.com/mikeal/request/pull/541) The exported request function doesn't have an auth method (@tschaub) -- [3040bbe](https://github.com/mikeal/request/commit/3040bbe5de846811151dab8dc09944acc93a338e) Fix redirections, (@criloz) -- [#564](https://github.com/mikeal/request/pull/564) Fix redirections (@NebTex) -- [397b435](https://github.com/mikeal/request/commit/397b4350fcf885460d7dced94cf1db1f5c167f80) handle ciphers and secureOptions in agentOptions (@SamPlacette) -- [65a2778](https://github.com/mikeal/request/commit/65a27782db7d2798b6490ea08efacb8f3b0a401c) tests and fix for null agentOptions case (@SamPlacette) -- [#568](https://github.com/mikeal/request/pull/568) use agentOptions to create agent when specified in request (@SamPlacette) -- [c116920](https://github.com/mikeal/request/commit/c116920a2cbef25afe2e1bbcf4df074e1e2f9dbb) Let's see how we do with only the main guard. (@mikeal) -- [f54a335](https://github.com/mikeal/request/commit/f54a3358119298634a7b0c29a21bf1471fc23d98) Fix spelling of "ignoring." (@bigeasy) -- [5cd215f](https://github.com/mikeal/request/commit/5cd215f327e113dc6c062634e405c577986cfd3c) Change isUrl regex to accept mixed case (@lexander) -- [02c8e74](https://github.com/mikeal/request/commit/02c8e749360a47d45e3e7b51b7f751fe498d2f25) #583 added tests for isUrl regex change. (@lexander) -- [#581](https://github.com/mikeal/request/pull/581) Fix spelling of "ignoring." (@bigeasy) -- [#544](https://github.com/mikeal/request/pull/544) Update http-signature version. (@digitalbazaar) -- [e77746b](https://github.com/mikeal/request/commit/e77746bf42e974dc91a84d03f44f750dd7ee0989) global cookie jar disabled by default, send jar: true to enable. (@threepointone) -- [46015ac](https://github.com/mikeal/request/commit/46015ac8d5b74f8107a6ec9fd07c133f46c5d833) 2.22.0 (@mikeal) -- [e5da4a5](https://github.com/mikeal/request/commit/e5da4a5e1a20bf4f23681f7b996f22c5fadae91d) 2.22.1 (@mikeal) -- [#587](https://github.com/mikeal/request/pull/587) Global cookie jar disabled by default (@threepointone) -- [fac9da1](https://github.com/mikeal/request/commit/fac9da1cc426bf0a4bcc5f0b7d0d0aea8b1cce38) Prevent setting headers after they are sent (@wpreul) -- [#589](https://github.com/mikeal/request/pull/589) Prevent setting headers after they are sent (@wpreul) -- [bc1537a](https://github.com/mikeal/request/commit/bc1537ab79064cea532b0d14110ce4e49a663bde) Emit complete event when there is no callback -- [de8508e](https://github.com/mikeal/request/commit/de8508e9feac10563596aeee26727567b3c2e33c) Added check to see if the global pool is being used before using the global agent (@Cauldrath) -- [03441ef](https://github.com/mikeal/request/commit/03441ef919e51a742aaf9e168d917e97e2d9eb6b) 2.23.0 (@mikeal) +### v2.57.0 (2015/05/31) +- [#1615](https://github.com/request/request/pull/1615) Replace '.client' with '.socket' as the former was deprecated in 2.2.0. (@ChALkeR) + +### v2.56.0 (2015/05/28) +- [#1610](https://github.com/request/request/pull/1610) Bump module dependencies (@simov) +- [#1600](https://github.com/request/request/pull/1600) Extract the querystring logic into separate module (@simov) +- [#1607](https://github.com/request/request/pull/1607) Re-generate certificates (@simov) +- [#1599](https://github.com/request/request/pull/1599) Move getProxyFromURI logic below the check for Invaild URI (#1595) (@simov) +- [#1598](https://github.com/request/request/pull/1598) Fix the way http verbs are defined in order to please intellisense IDEs (@simov, @flannelJesus) +- [#1591](https://github.com/request/request/pull/1591) A few minor fixes: (@simov) +- [#1584](https://github.com/request/request/pull/1584) Refactor test-default tests (according to comments in #1430) (@simov) +- [#1585](https://github.com/request/request/pull/1585) Fixing documentation regarding TLS options (#1583) (@mainakae) +- [#1574](https://github.com/request/request/pull/1574) Refresh the oauth_nonce on redirect (#1573) (@simov) +- [#1570](https://github.com/request/request/pull/1570) Discovered tests that weren't properly running (@seanstrom) +- [#1569](https://github.com/request/request/pull/1569) Fix pause before response arrives (@kevinoid) +- [#1558](https://github.com/request/request/pull/1558) Emit error instead of throw (@simov) +- [#1568](https://github.com/request/request/pull/1568) Fix stall when piping gzipped response (@kevinoid) +- [#1560](https://github.com/request/request/pull/1560) Update combined-stream (@apechimp) +- [#1543](https://github.com/request/request/pull/1543) Initial support for oauth_body_hash on json payloads (@simov, @aesopwolf) +- [#1541](https://github.com/request/request/pull/1541) Fix coveralls (@simov) +- [#1540](https://github.com/request/request/pull/1540) Fix recursive defaults for convenience methods (@simov) +- [#1536](https://github.com/request/request/pull/1536) More eslint style rules (@froatsnook) +- [#1533](https://github.com/request/request/pull/1533) Adding dependency status bar to README.md (@YasharF) +- [#1539](https://github.com/request/request/pull/1539) ensure the latest version of har-validator is included (@ahmadnassri) +- [#1516](https://github.com/request/request/pull/1516) forever+pool test (@devTristan) + +### v2.55.0 (2015/04/05) +- [#1520](https://github.com/request/request/pull/1520) Refactor defaults (@simov) +- [#1525](https://github.com/request/request/pull/1525) Delete request headers with undefined value. (@froatsnook) +- [#1521](https://github.com/request/request/pull/1521) Add promise tests (@simov) +- [#1518](https://github.com/request/request/pull/1518) Fix defaults (@simov) +- [#1515](https://github.com/request/request/pull/1515) Allow static invoking of convenience methods (@simov) +- [#1505](https://github.com/request/request/pull/1505) Fix multipart boundary extraction regexp (@simov) +- [#1510](https://github.com/request/request/pull/1510) Fix basic auth form data (@simov) + +### v2.54.0 (2015/03/24) +- [#1501](https://github.com/request/request/pull/1501) HTTP Archive 1.2 support (@ahmadnassri) +- [#1486](https://github.com/request/request/pull/1486) Add a test for the forever agent (@akshayp) +- [#1500](https://github.com/request/request/pull/1500) Adding handling for no auth method and null bearer (@philberg) +- [#1498](https://github.com/request/request/pull/1498) Add table of contents in readme (@simov) +- [#1477](https://github.com/request/request/pull/1477) Add support for qs options via qsOptions key (@simov) +- [#1496](https://github.com/request/request/pull/1496) Parameters encoded to base 64 should be decoded as UTF-8, not ASCII. (@albanm) +- [#1494](https://github.com/request/request/pull/1494) Update eslint (@froatsnook) +- [#1474](https://github.com/request/request/pull/1474) Require Colon in Basic Auth (@erykwalder) +- [#1481](https://github.com/request/request/pull/1481) Fix baseUrl and redirections. (@burningtree) +- [#1469](https://github.com/request/request/pull/1469) Feature/base url (@froatsnook) +- [#1459](https://github.com/request/request/pull/1459) Add option to time request/response cycle (including rollup of redirects) (@aaron-em) +- [#1468](https://github.com/request/request/pull/1468) Re-enable io.js/node 0.12 build (@simov, @mikeal, @BBB) +- [#1442](https://github.com/request/request/pull/1442) Fixed the issue with strictSSL tests on 0.12 & io.js by explicitly setting a cipher that matches the cert. (@BBB, @nicolasmccurdy, @simov, @0x4139) +- [#1460](https://github.com/request/request/pull/1460) localAddress or proxy config is lost when redirecting (@simov, @0x4139) +- [#1453](https://github.com/request/request/pull/1453) Test on Node.js 0.12 and io.js with allowed failures (@nicolasmccurdy) +- [#1426](https://github.com/request/request/pull/1426) Fixing tests to pass on io.js and node 0.12 (only test-https.js stiff failing) (@mikeal) +- [#1446](https://github.com/request/request/pull/1446) Missing HTTP referer header with redirects Fixes #1038 (@simov, @guimonz) +- [#1428](https://github.com/request/request/pull/1428) Deprecate Node v0.8.x (@nylen) +- [#1436](https://github.com/request/request/pull/1436) Add ability to set a requester without setting default options (@tikotzky) +- [#1435](https://github.com/request/request/pull/1435) dry up verb methods (@sethpollack) +- [#1423](https://github.com/request/request/pull/1423) Allow fully qualified multipart content-type header (@simov) +- [#1430](https://github.com/request/request/pull/1430) Fix recursive requester (@tikotzky) +- [#1429](https://github.com/request/request/pull/1429) Throw error when making HEAD request with a body (@tikotzky) +- [#1419](https://github.com/request/request/pull/1419) Add note that the project is broken in 0.12.x (@nylen) +- [#1413](https://github.com/request/request/pull/1413) Fix basic auth (@simov) +- [#1397](https://github.com/request/request/pull/1397) Improve pipe-from-file tests (@nylen) + +### v2.53.0 (2015/02/02) +- [#1396](https://github.com/request/request/pull/1396) Do not rfc3986 escape JSON bodies (@nylen, @simov) +- [#1392](https://github.com/request/request/pull/1392) Improve `timeout` option description (@watson) + +### v2.52.0 (2015/02/02) +- [#1383](https://github.com/request/request/pull/1383) Add missing HTTPS options that were not being passed to tunnel (@brichard19) (@nylen, @brichard19) +- [#1388](https://github.com/request/request/pull/1388) Upgrade mime-types package version (@roderickhsiao) +- [#1389](https://github.com/request/request/pull/1389) Revise Setup Tunnel Function (@seanstrom) +- [#1374](https://github.com/request/request/pull/1374) Allow explicitly disabling tunneling for proxied https destinations (@nylen) +- [#1376](https://github.com/request/request/pull/1376) Use karma-browserify for tests. Add browser test coverage reporter. (@eiriksm) +- [#1366](https://github.com/request/request/pull/1366) Refactor OAuth into separate module (@simov) +- [#1373](https://github.com/request/request/pull/1373) Rewrite tunnel test to be pure Node.js (@nylen) +- [#1371](https://github.com/request/request/pull/1371) Upgrade test reporter (@nylen) +- [#1360](https://github.com/request/request/pull/1360) Refactor basic, bearer, digest auth logic into separate class (@simov) +- [#1354](https://github.com/request/request/pull/1354) Remove circular dependency from debugging code (@nylen) +- [#1351](https://github.com/request/request/pull/1351) Move digest auth into private prototype method (@simov) +- [#1352](https://github.com/request/request/pull/1352) Update hawk dependency to ~2.3.0 (@mridgway) +- [#1353](https://github.com/request/request/pull/1353) Correct travis-ci badge (@dogancelik) +- [#1349](https://github.com/request/request/pull/1349) Make sure we return on errored browser requests. (@eiriksm) +- [#1346](https://github.com/request/request/pull/1346) getProxyFromURI Extraction Refactor (@seanstrom) +- [#1337](https://github.com/request/request/pull/1337) Standardize test ports on 6767 (@nylen) +- [#1341](https://github.com/request/request/pull/1341) Emit FormData error events as Request error events (@nylen, @rwky) +- [#1343](https://github.com/request/request/pull/1343) Clean up readme badges, and add Travis and Coveralls badges (@nylen) +- [#1345](https://github.com/request/request/pull/1345) Update README.md (@Aaron-Hartwig) +- [#1338](https://github.com/request/request/pull/1338) Always wait for server.close() callback in tests (@nylen) +- [#1342](https://github.com/request/request/pull/1342) Add mock https server and redo start of browser tests for this purpose. (@eiriksm) +- [#1339](https://github.com/request/request/pull/1339) Improve auth docs (@nylen) +- [#1335](https://github.com/request/request/pull/1335) Add support for OAuth plaintext signature method (@simov) +- [#1332](https://github.com/request/request/pull/1332) Add clean script to remove test-browser.js after the tests run (@seanstrom) +- [#1327](https://github.com/request/request/pull/1327) Fix errors generating coverage reports. (@nylen) +- [#1330](https://github.com/request/request/pull/1330) Return empty buffer upon empty response body and encoding is set to null (@seanstrom) +- [#1326](https://github.com/request/request/pull/1326) Use faster container-based infrastructure on Travis (@nylen) +- [#1315](https://github.com/request/request/pull/1315) Implement rfc3986 option (@simov, @nylen, @apoco, @DullReferenceException, @mmalecki, @oliamb, @cliffcrosland, @LewisJEllis, @eiriksm, @poislagarde) +- [#1314](https://github.com/request/request/pull/1314) Detect urlencoded form data header via regex (@simov) +- [#1317](https://github.com/request/request/pull/1317) Improve OAuth1.0 server side flow example (@simov) + +### v2.51.0 (2014/12/10) +- [#1310](https://github.com/request/request/pull/1310) Revert changes introduced in https://github.com/request/request/pull/1282 (@simov) + +### v2.50.0 (2014/12/09) +- [#1308](https://github.com/request/request/pull/1308) Add browser test to keep track of browserify compability. (@eiriksm) +- [#1299](https://github.com/request/request/pull/1299) Add optional support for jsonReviver (@poislagarde) +- [#1277](https://github.com/request/request/pull/1277) Add Coveralls configuration (@simov) +- [#1307](https://github.com/request/request/pull/1307) Upgrade form-data, add back browserify compability. Fixes #455. (@eiriksm) +- [#1305](https://github.com/request/request/pull/1305) Fix typo in README.md (@LewisJEllis) +- [#1288](https://github.com/request/request/pull/1288) Update README.md to explain custom file use case (@cliffcrosland) + +### v2.49.0 (2014/11/28) +- [#1295](https://github.com/request/request/pull/1295) fix(proxy): no-proxy false positive (@oliamb) +- [#1292](https://github.com/request/request/pull/1292) Upgrade `caseless` to 0.8.1 (@mmalecki) +- [#1276](https://github.com/request/request/pull/1276) Set transfer encoding for multipart/related to chunked by default (@simov) +- [#1275](https://github.com/request/request/pull/1275) Fix multipart content-type headers detection (@simov) +- [#1269](https://github.com/request/request/pull/1269) adds streams example for review (@tbuchok) +- [#1238](https://github.com/request/request/pull/1238) Add examples README.md (@simov) + +### v2.48.0 (2014/11/12) +- [#1263](https://github.com/request/request/pull/1263) Fixed a syntax error / typo in README.md (@xna2) +- [#1253](https://github.com/request/request/pull/1253) Add multipart chunked flag (@simov, @nylen) +- [#1251](https://github.com/request/request/pull/1251) Clarify that defaults() does not modify global defaults (@nylen) +- [#1250](https://github.com/request/request/pull/1250) Improve documentation for pool and maxSockets options (@nylen) +- [#1237](https://github.com/request/request/pull/1237) Documenting error handling when using streams (@vmattos) +- [#1244](https://github.com/request/request/pull/1244) Finalize changelog command (@nylen) +- [#1241](https://github.com/request/request/pull/1241) Fix typo (@alexanderGugel) +- [#1223](https://github.com/request/request/pull/1223) Show latest version number instead of "upcoming" in changelog (@nylen) +- [#1236](https://github.com/request/request/pull/1236) Document how to use custom CA in README (#1229) (@hypesystem) +- [#1228](https://github.com/request/request/pull/1228) Support for oauth with RSA-SHA1 signing (@nylen) +- [#1216](https://github.com/request/request/pull/1216) Made json and multipart options coexist (@nylen, @simov) +- [#1225](https://github.com/request/request/pull/1225) Allow header white/exclusive lists in any case. (@RReverser) + +### v2.47.0 (2014/10/26) +- [#1222](https://github.com/request/request/pull/1222) Move from mikeal/request to request/request (@nylen) +- [#1220](https://github.com/request/request/pull/1220) update qs dependency to 2.3.1 (@FredKSchott) +- [#1212](https://github.com/request/request/pull/1212) Improve tests/test-timeout.js (@nylen) +- [#1219](https://github.com/request/request/pull/1219) remove old globalAgent workaround for node 0.4 (@request) +- [#1214](https://github.com/request/request/pull/1214) Remove cruft left over from optional dependencies (@nylen) +- [#1215](https://github.com/request/request/pull/1215) Add proxyHeaderExclusiveList option for proxy-only headers. (@RReverser) +- [#1211](https://github.com/request/request/pull/1211) Allow 'Host' header instead of 'host' and remember case across redirects (@nylen) +- [#1208](https://github.com/request/request/pull/1208) Improve release script (@nylen) +- [#1213](https://github.com/request/request/pull/1213) Support for custom cookie store (@nylen, @mitsuru) +- [#1197](https://github.com/request/request/pull/1197) Clean up some code around setting the agent (@FredKSchott) +- [#1209](https://github.com/request/request/pull/1209) Improve multipart form append test (@simov) +- [#1207](https://github.com/request/request/pull/1207) Update changelog (@nylen) +- [#1185](https://github.com/request/request/pull/1185) Stream multipart/related bodies (@simov) + +### v2.46.0 (2014/10/23) +- [#1198](https://github.com/request/request/pull/1198) doc for TLS/SSL protocol options (@shawnzhu) +- [#1200](https://github.com/request/request/pull/1200) Add a Gitter chat badge to README.md (@gitter-badger) +- [#1196](https://github.com/request/request/pull/1196) Upgrade taper test reporter to v0.3.0 (@nylen) +- [#1199](https://github.com/request/request/pull/1199) Fix lint error: undeclared var i (@nylen) +- [#1191](https://github.com/request/request/pull/1191) Move self.proxy decision logic out of init and into a helper (@FredKSchott) +- [#1190](https://github.com/request/request/pull/1190) Move _buildRequest() logic back into init (@FredKSchott) +- [#1186](https://github.com/request/request/pull/1186) Support Smarter Unix URL Scheme (@FredKSchott) +- [#1178](https://github.com/request/request/pull/1178) update form documentation for new usage (@FredKSchott) +- [#1180](https://github.com/request/request/pull/1180) Enable no-mixed-requires linting rule (@nylen) +- [#1184](https://github.com/request/request/pull/1184) Don't forward authorization header across redirects to different hosts (@nylen) +- [#1183](https://github.com/request/request/pull/1183) Correct README about pre and postamble CRLF using multipart and not mult... (@netpoetica) +- [#1179](https://github.com/request/request/pull/1179) Lint tests directory (@nylen) +- [#1169](https://github.com/request/request/pull/1169) add metadata for form-data file field (@dotcypress) +- [#1173](https://github.com/request/request/pull/1173) remove optional dependencies (@seanstrom) +- [#1165](https://github.com/request/request/pull/1165) Cleanup event listeners and remove function creation from init (@FredKSchott) +- [#1174](https://github.com/request/request/pull/1174) update the request.cookie docs to have a valid cookie example (@seanstrom) +- [#1168](https://github.com/request/request/pull/1168) create a detach helper and use detach helper in replace of nextTick (@seanstrom) +- [#1171](https://github.com/request/request/pull/1171) in post can send form data and use callback (@MiroRadenovic) +- [#1159](https://github.com/request/request/pull/1159) accept charset for x-www-form-urlencoded content-type (@seanstrom) +- [#1157](https://github.com/request/request/pull/1157) Update README.md: body with json=true (@Rob--W) +- [#1164](https://github.com/request/request/pull/1164) Disable tests/test-timeout.js on Travis (@nylen) +- [#1153](https://github.com/request/request/pull/1153) Document how to run a single test (@nylen) +- [#1144](https://github.com/request/request/pull/1144) adds documentation for the "response" event within the streaming section (@tbuchok) +- [#1162](https://github.com/request/request/pull/1162) Update eslintrc file to no longer allow past errors (@FredKSchott) +- [#1155](https://github.com/request/request/pull/1155) Support/use self everywhere (@seanstrom) +- [#1161](https://github.com/request/request/pull/1161) fix no-use-before-define lint warnings (@emkay) +- [#1156](https://github.com/request/request/pull/1156) adding curly brackets to get rid of lint errors (@emkay) +- [#1151](https://github.com/request/request/pull/1151) Fix localAddress test on OS X (@nylen) +- [#1145](https://github.com/request/request/pull/1145) documentation: fix outdated reference to setCookieSync old name in README (@FredKSchott) +- [#1131](https://github.com/request/request/pull/1131) Update pool documentation (@FredKSchott) +- [#1143](https://github.com/request/request/pull/1143) Rewrite all tests to use tape (@nylen) +- [#1137](https://github.com/request/request/pull/1137) Add ability to specifiy querystring lib in options. (@jgrund) +- [#1138](https://github.com/request/request/pull/1138) allow hostname and port in place of host on uri (@cappslock) +- [#1134](https://github.com/request/request/pull/1134) Fix multiple redirects and `self.followRedirect` (@blakeembrey) +- [#1130](https://github.com/request/request/pull/1130) documentation fix: add note about npm test for contributing (@FredKSchott) +- [#1120](https://github.com/request/request/pull/1120) Support/refactor request setup tunnel (@seanstrom) +- [#1129](https://github.com/request/request/pull/1129) linting fix: convert double quote strings to use single quotes (@FredKSchott) +- [#1124](https://github.com/request/request/pull/1124) linting fix: remove unneccesary semi-colons (@FredKSchott) + +### v2.45.0 (2014/10/06) +- [#1128](https://github.com/request/request/pull/1128) Add test for setCookie regression (@nylen) +- [#1127](https://github.com/request/request/pull/1127) added tests around using objects as values in a query string (@bcoe) +- [#1103](https://github.com/request/request/pull/1103) Support/refactor request constructor (@nylen, @seanstrom) +- [#1119](https://github.com/request/request/pull/1119) add basic linting to request library (@FredKSchott) +- [#1121](https://github.com/request/request/pull/1121) Revert "Explicitly use sync versions of cookie functions" (@nylen) +- [#1118](https://github.com/request/request/pull/1118) linting fix: Restructure bad empty if statement (@FredKSchott) +- [#1117](https://github.com/request/request/pull/1117) Fix a bad check for valid URIs (@FredKSchott) +- [#1113](https://github.com/request/request/pull/1113) linting fix: space out operators (@FredKSchott) +- [#1116](https://github.com/request/request/pull/1116) Fix typo in `noProxyHost` definition (@FredKSchott) +- [#1114](https://github.com/request/request/pull/1114) linting fix: Added a `new` operator that was missing when creating and throwing a new error (@FredKSchott) +- [#1096](https://github.com/request/request/pull/1096) No_proxy support (@samcday) +- [#1107](https://github.com/request/request/pull/1107) linting-fix: remove unused variables (@FredKSchott) +- [#1112](https://github.com/request/request/pull/1112) linting fix: Make return values consistent and more straitforward (@FredKSchott) +- [#1111](https://github.com/request/request/pull/1111) linting fix: authPieces was getting redeclared (@FredKSchott) +- [#1105](https://github.com/request/request/pull/1105) Use strict mode in request (@FredKSchott) +- [#1110](https://github.com/request/request/pull/1110) linting fix: replace lazy '==' with more strict '===' (@FredKSchott) +- [#1109](https://github.com/request/request/pull/1109) linting fix: remove function call from if-else conditional statement (@FredKSchott) +- [#1102](https://github.com/request/request/pull/1102) Fix to allow setting a `requester` on recursive calls to `request.defaults` (@tikotzky) +- [#1095](https://github.com/request/request/pull/1095) Tweaking engines in package.json (@pdehaan) +- [#1082](https://github.com/request/request/pull/1082) Forward the socket event from the httpModule request (@seanstrom) +- [#972](https://github.com/request/request/pull/972) Clarify gzip handling in the README (@kevinoid) +- [#1089](https://github.com/request/request/pull/1089) Mention that encoding defaults to utf8, not Buffer (@stuartpb) +- [#1088](https://github.com/request/request/pull/1088) Fix cookie example in README.md and make it more clear (@pipi32167) +- [#1027](https://github.com/request/request/pull/1027) Add support for multipart form data in request options. (@crocket) +- [#1076](https://github.com/request/request/pull/1076) use Request.abort() to abort the request when the request has timed-out (@seanstrom) +- [#1068](https://github.com/request/request/pull/1068) add optional postamble required by .NET multipart requests (@netpoetica) + +### v2.43.0 (2014/09/18) +- [#1057](https://github.com/request/request/pull/1057) Defaults should not overwrite defined options (@davidwood) +- [#1046](https://github.com/request/request/pull/1046) Propagate datastream errors, useful in case gzip fails. (@ZJONSSON, @Janpot) +- [#1063](https://github.com/request/request/pull/1063) copy the input headers object #1060 (@finnp) +- [#1031](https://github.com/request/request/pull/1031) Explicitly use sync versions of cookie functions (@ZJONSSON) +- [#1056](https://github.com/request/request/pull/1056) Fix redirects when passing url.parse(x) as URL to convenience method (@nylen) + +### v2.42.0 (2014/09/04) +- [#1053](https://github.com/request/request/pull/1053) Fix #1051 Parse auth properly when using non-tunneling proxy (@isaacs) + +### v2.41.0 (2014/09/04) +- [#1050](https://github.com/request/request/pull/1050) Pass whitelisted headers to tunneling proxy. Organize all tunneling logic. (@isaacs, @Feldhacker) +- [#1035](https://github.com/request/request/pull/1035) souped up nodei.co badge (@rvagg) +- [#1048](https://github.com/request/request/pull/1048) Aws is now possible over a proxy (@steven-aerts) +- [#1039](https://github.com/request/request/pull/1039) extract out helper functions to a helper file (@seanstrom) +- [#1021](https://github.com/request/request/pull/1021) Support/refactor indexjs (@seanstrom) +- [#1033](https://github.com/request/request/pull/1033) Improve and document debug options (@nylen) +- [#1034](https://github.com/request/request/pull/1034) Fix readme headings (@nylen) +- [#1030](https://github.com/request/request/pull/1030) Allow recursive request.defaults (@tikotzky) +- [#1029](https://github.com/request/request/pull/1029) Fix a couple of typos (@nylen) +- [#675](https://github.com/request/request/pull/675) Checking for SSL fault on connection before reading SSL properties (@VRMink) +- [#989](https://github.com/request/request/pull/989) Added allowRedirect function. Should return true if redirect is allowed or false otherwise (@doronin) +- [#1025](https://github.com/request/request/pull/1025) [fixes #1023] Set self._ended to true once response has ended (@mridgway) +- [#1020](https://github.com/request/request/pull/1020) Add back removed debug metadata (@FredKSchott) +- [#1008](https://github.com/request/request/pull/1008) Moving to module instead of cutomer buffer concatenation. (@mikeal) +- [#770](https://github.com/request/request/pull/770) Added dependency badge for README file; (@timgluz, @mafintosh, @lalitkapoor, @stash, @bobyrizov) +- [#1016](https://github.com/request/request/pull/1016) toJSON no longer results in an infinite loop, returns simple objects (@FredKSchott) +- [#1018](https://github.com/request/request/pull/1018) Remove pre-0.4.4 HTTPS fix (@mmalecki) +- [#1006](https://github.com/request/request/pull/1006) Migrate to caseless, fixes #1001 (@mikeal) +- [#995](https://github.com/request/request/pull/995) Fix parsing array of objects (@sjonnet19) +- [#999](https://github.com/request/request/pull/999) Fix fallback for browserify for optional modules. (@eiriksm) +- [#996](https://github.com/request/request/pull/996) Wrong oauth signature when multiple same param keys exist [updated] (@bengl, @hyjin) + +### v2.40.0 (2014/08/06) +- [#992](https://github.com/request/request/pull/992) Fix security vulnerability. Update qs (@poeticninja) +- [#988](https://github.com/request/request/pull/988) “--” -> “—” (@upisfree) +- [#987](https://github.com/request/request/pull/987) Show optional modules as being loaded by the module that reqeusted them (@iarna) + +### v2.39.0 (2014/07/24) +- [#976](https://github.com/request/request/pull/976) Update README.md (@pvoznenko) + +### v2.38.0 (2014/07/22) +- [#952](https://github.com/request/request/pull/952) Adding support to client certificate with proxy use case (@ofirshaked) +- [#884](https://github.com/request/request/pull/884) Documented tough-cookie installation. (@wbyoung) +- [#935](https://github.com/request/request/pull/935) Correct repository url (@fritx) +- [#963](https://github.com/request/request/pull/963) Update changelog (@nylen) +- [#960](https://github.com/request/request/pull/960) Support gzip with encoding on node pre-v0.9.4 (@kevinoid) +- [#953](https://github.com/request/request/pull/953) Add async Content-Length computation when using form-data (@LoicMahieu) +- [#844](https://github.com/request/request/pull/844) Add support for HTTP[S]_PROXY environment variables. Fixes #595. (@jvmccarthy) +- [#946](https://github.com/request/request/pull/946) defaults: merge headers (@aj0strow) + +### v2.37.0 (2014/07/07) +- [#957](https://github.com/request/request/pull/957) Silence EventEmitter memory leak warning #311 (@watson) +- [#955](https://github.com/request/request/pull/955) check for content-length header before setting it in nextTick (@camilleanne) +- [#951](https://github.com/request/request/pull/951) Add support for gzip content decoding (@kevinoid) +- [#949](https://github.com/request/request/pull/949) Manually enter querystring in form option (@charlespwd) +- [#944](https://github.com/request/request/pull/944) Make request work with browserify (@eiriksm) +- [#943](https://github.com/request/request/pull/943) New mime module (@eiriksm) +- [#927](https://github.com/request/request/pull/927) Bump version of hawk dep. (@samccone) +- [#907](https://github.com/request/request/pull/907) append secureOptions to poolKey (@medovob) + +### v2.35.0 (2014/05/17) +- [#901](https://github.com/request/request/pull/901) Fixes #555 (@pigulla) +- [#897](https://github.com/request/request/pull/897) merge with default options (@vohof) +- [#891](https://github.com/request/request/pull/891) fixes 857 - options object is mutated by calling request (@lalitkapoor) +- [#869](https://github.com/request/request/pull/869) Pipefilter test (@tgohn) +- [#866](https://github.com/request/request/pull/866) Fix typo (@dandv) +- [#861](https://github.com/request/request/pull/861) Add support for RFC 6750 Bearer Tokens (@phedny) +- [#809](https://github.com/request/request/pull/809) upgrade tunnel-proxy to 0.4.0 (@ksato9700) +- [#850](https://github.com/request/request/pull/850) Fix word consistency in readme (@0xNobody) +- [#810](https://github.com/request/request/pull/810) add some exposition to mpu example in README.md (@mikermcneil) +- [#840](https://github.com/request/request/pull/840) improve error reporting for invalid protocols (@FND) +- [#821](https://github.com/request/request/pull/821) added secureOptions back (@nw) +- [#815](https://github.com/request/request/pull/815) Create changelog based on pull requests (@lalitkapoor) + +### v2.34.0 (2014/02/18) +- [#516](https://github.com/request/request/pull/516) UNIX Socket URL Support (@lyuzashi) +- [#801](https://github.com/request/request/pull/801) 794 ignore cookie parsing and domain errors (@lalitkapoor) +- [#802](https://github.com/request/request/pull/802) Added the Apache license to the package.json. (@keskival) +- [#793](https://github.com/request/request/pull/793) Adds content-length calculation when submitting forms using form-data li... (@Juul) +- [#785](https://github.com/request/request/pull/785) Provide ability to override content-type when `json` option used (@vvo) +- [#781](https://github.com/request/request/pull/781) simpler isReadStream function (@joaojeronimo) + +### v2.32.0 (2014/01/16) +- [#767](https://github.com/request/request/pull/767) Use tough-cookie CookieJar sync API (@stash) +- [#764](https://github.com/request/request/pull/764) Case-insensitive authentication scheme (@bobyrizov) +- [#763](https://github.com/request/request/pull/763) Upgrade tough-cookie to 0.10.0 (@stash) +- [#744](https://github.com/request/request/pull/744) Use Cookie.parse (@lalitkapoor) +- [#757](https://github.com/request/request/pull/757) require aws-sign2 (@mafintosh) + +### v2.31.0 (2014/01/08) +- [#645](https://github.com/request/request/pull/645) update twitter api url to v1.1 (@mick) +- [#746](https://github.com/request/request/pull/746) README: Markdown code highlight (@weakish) +- [#745](https://github.com/request/request/pull/745) updating setCookie example to make it clear that the callback is required (@emkay) +- [#742](https://github.com/request/request/pull/742) Add note about JSON output body type (@iansltx) +- [#741](https://github.com/request/request/pull/741) README example is using old cookie jar api (@emkay) +- [#736](https://github.com/request/request/pull/736) Fix callback arguments documentation (@mmalecki) + +### v2.30.0 (2013/12/13) +- [#732](https://github.com/request/request/pull/732) JSHINT: Creating global 'for' variable. Should be 'for (var ...'. (@Fritz-Lium) +- [#730](https://github.com/request/request/pull/730) better HTTP DIGEST support (@dai-shi) +- [#728](https://github.com/request/request/pull/728) Fix TypeError when calling request.cookie (@scarletmeow) + +### v2.29.0 (2013/12/06) +- [#727](https://github.com/request/request/pull/727) fix requester bug (@jchris) + +### v2.28.0 (2013/12/04) +- [#724](https://github.com/request/request/pull/724) README.md: add custom HTTP Headers example. (@tcort) +- [#719](https://github.com/request/request/pull/719) Made a comment gender neutral. (@unsetbit) +- [#715](https://github.com/request/request/pull/715) Request.multipart no longer crashes when header 'Content-type' present (@pastaclub) +- [#710](https://github.com/request/request/pull/710) Fixing listing in callback part of docs. (@lukasz-zak) +- [#696](https://github.com/request/request/pull/696) Edited README.md for formatting and clarity of phrasing (@Zearin) +- [#694](https://github.com/request/request/pull/694) Typo in README (@VRMink) +- [#690](https://github.com/request/request/pull/690) Handle blank password in basic auth. (@diversario) +- [#682](https://github.com/request/request/pull/682) Optional dependencies (@Turbo87) +- [#683](https://github.com/request/request/pull/683) Travis CI support (@Turbo87) +- [#674](https://github.com/request/request/pull/674) change cookie module,to tough-cookie.please check it . (@sxyizhiren) +- [#666](https://github.com/request/request/pull/666) make `ciphers` and `secureProtocol` to work in https request (@richarddong) +- [#656](https://github.com/request/request/pull/656) Test case for #304. (@diversario) +- [#662](https://github.com/request/request/pull/662) option.tunnel to explicitly disable tunneling (@seanmonstar) +- [#659](https://github.com/request/request/pull/659) fix failure when running with NODE_DEBUG=request, and a test for that (@jrgm) +- [#630](https://github.com/request/request/pull/630) Send random cnonce for HTTP Digest requests (@wprl) + +### v2.27.0 (2013/08/15) +- [#619](https://github.com/request/request/pull/619) decouple things a bit (@joaojeronimo) + +### v2.26.0 (2013/08/07) +- [#613](https://github.com/request/request/pull/613) Fixes #583, moved initialization of self.uri.pathname (@lexander) +- [#605](https://github.com/request/request/pull/605) Only include ":" + pass in Basic Auth if it's defined (fixes #602) (@bendrucker) + +### v2.24.0 (2013/07/23) +- [#596](https://github.com/request/request/pull/596) Global agent is being used when pool is specified (@Cauldrath) +- [#594](https://github.com/request/request/pull/594) Emit complete event when there is no callback (@RomainLK) +- [#601](https://github.com/request/request/pull/601) Fixed a small typo (@michalstanko) + +### v2.23.0 (2013/07/23) +- [#589](https://github.com/request/request/pull/589) Prevent setting headers after they are sent (@geek) +- [#587](https://github.com/request/request/pull/587) Global cookie jar disabled by default (@threepointone) + +### v2.22.0 (2013/07/05) +- [#544](https://github.com/request/request/pull/544) Update http-signature version. (@davidlehn) +- [#581](https://github.com/request/request/pull/581) Fix spelling of "ignoring." (@bigeasy) +- [#568](https://github.com/request/request/pull/568) use agentOptions to create agent when specified in request (@SamPlacette) +- [#564](https://github.com/request/request/pull/564) Fix redirections (@criloz) +- [#541](https://github.com/request/request/pull/541) The exported request function doesn't have an auth method (@tschaub) +- [#542](https://github.com/request/request/pull/542) Expose Request class (@regality) + +### v2.21.0 (2013/04/30) +- [#536](https://github.com/request/request/pull/536) Allow explicitly empty user field for basic authentication. (@mikeando) +- [#532](https://github.com/request/request/pull/532) fix typo (@fredericosilva) +- [#497](https://github.com/request/request/pull/497) Added redirect event (@Cauldrath) +- [#503](https://github.com/request/request/pull/503) Fix basic auth for passwords that contain colons (@tonistiigi) +- [#521](https://github.com/request/request/pull/521) Improving test-localAddress.js (@noway421) +- [#529](https://github.com/request/request/pull/529) dependencies versions bump (@jodaka) + +### v2.17.0 (2013/04/22) +- [#523](https://github.com/request/request/pull/523) Updating dependencies (@noway421) +- [#520](https://github.com/request/request/pull/520) Fixing test-tunnel.js (@noway421) +- [#519](https://github.com/request/request/pull/519) Update internal path state on post-creation QS changes (@jblebrun) +- [#510](https://github.com/request/request/pull/510) Add HTTP Signature support. (@davidlehn) +- [#502](https://github.com/request/request/pull/502) Fix POST (and probably other) requests that are retried after 401 Unauthorized (@nylen) +- [#508](https://github.com/request/request/pull/508) Honor the .strictSSL option when using proxies (tunnel-agent) (@jhs) +- [#512](https://github.com/request/request/pull/512) Make password optional to support the format: http://username@hostname/ (@pajato1) +- [#513](https://github.com/request/request/pull/513) add 'localAddress' support (@yyfrankyy) +- [#498](https://github.com/request/request/pull/498) Moving response emit above setHeaders on destination streams (@kenperkins) +- [#490](https://github.com/request/request/pull/490) Empty response body (3-rd argument) must be passed to callback as an empty string (@Olegas) +- [#479](https://github.com/request/request/pull/479) Changing so if Accept header is explicitly set, sending json does not ov... (@RoryH) +- [#475](https://github.com/request/request/pull/475) Use `unescape` from `querystring` (@shimaore) +- [#473](https://github.com/request/request/pull/473) V0.10 compat (@isaacs) +- [#471](https://github.com/request/request/pull/471) Using querystring library from visionmedia (@kbackowski) +- [#461](https://github.com/request/request/pull/461) Strip the UTF8 BOM from a UTF encoded response (@kppullin) +- [#460](https://github.com/request/request/pull/460) hawk 0.10.0 (@hueniverse) +- [#462](https://github.com/request/request/pull/462) if query params are empty, then request path shouldn't end with a '?' (merges cleanly now) (@jaipandya) +- [#456](https://github.com/request/request/pull/456) hawk 0.9.0 (@hueniverse) +- [#429](https://github.com/request/request/pull/429) Copy options before adding callback. (@nrn, @nfriedly, @youurayy, @jplock, @kapetan, @landeiro, @othiym23, @mmalecki) +- [#454](https://github.com/request/request/pull/454) Destroy the response if present when destroying the request (clean merge) (@mafintosh) +- [#310](https://github.com/request/request/pull/310) Twitter Oauth Stuff Out of Date; Now Updated (@joemccann, @isaacs, @mscdex) +- [#413](https://github.com/request/request/pull/413) rename googledoodle.png to .jpg (@nfriedly, @youurayy, @jplock, @kapetan, @landeiro, @othiym23, @mmalecki) +- [#448](https://github.com/request/request/pull/448) Convenience method for PATCH (@mloar) +- [#444](https://github.com/request/request/pull/444) protect against double callbacks on error path (@spollack) +- [#433](https://github.com/request/request/pull/433) Added support for HTTPS cert & key (@mmalecki) +- [#430](https://github.com/request/request/pull/430) Respect specified {Host,host} headers, not just {host} (@andrewschaaf) +- [#415](https://github.com/request/request/pull/415) Fixed a typo. (@jerem) +- [#338](https://github.com/request/request/pull/338) Add more auth options, including digest support (@nylen) +- [#403](https://github.com/request/request/pull/403) Optimize environment lookup to happen once only (@mmalecki) +- [#398](https://github.com/request/request/pull/398) Add more reporting to tests (@mmalecki) +- [#388](https://github.com/request/request/pull/388) Ensure "safe" toJSON doesn't break EventEmitters (@othiym23) +- [#381](https://github.com/request/request/pull/381) Resolving "Invalid signature. Expected signature base string: " (@landeiro) +- [#380](https://github.com/request/request/pull/380) Fixes missing host header on retried request when using forever agent (@mac-) +- [#376](https://github.com/request/request/pull/376) Headers lost on redirect (@kapetan) +- [#375](https://github.com/request/request/pull/375) Fix for missing oauth_timestamp parameter (@jplock) +- [#374](https://github.com/request/request/pull/374) Correct Host header for proxy tunnel CONNECT (@youurayy) +- [#370](https://github.com/request/request/pull/370) Twitter reverse auth uses x_auth_mode not x_auth_type (@drudge) +- [#369](https://github.com/request/request/pull/369) Don't remove x_auth_mode for Twitter reverse auth (@drudge) +- [#344](https://github.com/request/request/pull/344) Make AWS auth signing find headers correctly (@nlf) +- [#363](https://github.com/request/request/pull/363) rfc3986 on base_uri, now passes tests (@jeffmarshall) +- [#362](https://github.com/request/request/pull/362) Running `rfc3986` on `base_uri` in `oauth.hmacsign` instead of just `encodeURIComponent` (@jeffmarshall) +- [#361](https://github.com/request/request/pull/361) Don't create a Content-Length header if we already have it set (@danjenkins) +- [#360](https://github.com/request/request/pull/360) Delete self._form along with everything else on redirect (@jgautier) +- [#355](https://github.com/request/request/pull/355) stop sending erroneous headers on redirected requests (@azylman) +- [#332](https://github.com/request/request/pull/332) Fix #296 - Only set Content-Type if body exists (@Marsup) +- [#343](https://github.com/request/request/pull/343) Allow AWS to work in more situations, added a note in the README on its usage (@nlf) +- [#320](https://github.com/request/request/pull/320) request.defaults() doesn't need to wrap jar() (@StuartHarris) +- [#322](https://github.com/request/request/pull/322) Fix + test for piped into request bumped into redirect. #321 (@alexindigo) +- [#326](https://github.com/request/request/pull/326) Do not try to remove listener from an undefined connection (@strk) +- [#318](https://github.com/request/request/pull/318) Pass servername to tunneling secure socket creation (@isaacs) +- [#317](https://github.com/request/request/pull/317) Workaround for #313 (@isaacs) +- [#293](https://github.com/request/request/pull/293) Allow parser errors to bubble up to request (@mscdex) +- [#290](https://github.com/request/request/pull/290) A test for #289 (@isaacs) +- [#280](https://github.com/request/request/pull/280) Like in node.js print options if NODE_DEBUG contains the word request (@Filirom1) +- [#207](https://github.com/request/request/pull/207) Fix #206 Change HTTP/HTTPS agent when redirecting between protocols (@isaacs) +- [#214](https://github.com/request/request/pull/214) documenting additional behavior of json option (@jphaas) +- [#272](https://github.com/request/request/pull/272) Boundary begins with CRLF? (@elspoono, @timshadel, @naholyr, @nanodocumet, @TehShrike) +- [#284](https://github.com/request/request/pull/284) Remove stray `console.log()` call in multipart generator. (@bcherry) +- [#241](https://github.com/request/request/pull/241) Composability updates suggested by issue #239 (@polotek) +- [#282](https://github.com/request/request/pull/282) OAuth Authorization header contains non-"oauth_" parameters (@jplock) +- [#279](https://github.com/request/request/pull/279) fix tests with boundary by injecting boundry from header (@benatkin) +- [#273](https://github.com/request/request/pull/273) Pipe back pressure issue (@mafintosh) +- [#268](https://github.com/request/request/pull/268) I'm not OCD seriously (@TehShrike) +- [#263](https://github.com/request/request/pull/263) Bug in OAuth key generation for sha1 (@nanodocumet) +- [#265](https://github.com/request/request/pull/265) uncaughtException when redirected to invalid URI (@naholyr) +- [#262](https://github.com/request/request/pull/262) JSON test should check for equality (@timshadel) +- [#261](https://github.com/request/request/pull/261) Setting 'pool' to 'false' does NOT disable Agent pooling (@timshadel) +- [#249](https://github.com/request/request/pull/249) Fix for the fix of your (closed) issue #89 where self.headers[content-length] is set to 0 for all methods (@sethbridges, @polotek, @zephrax, @jeromegn) +- [#255](https://github.com/request/request/pull/255) multipart allow body === '' ( the empty string ) (@Filirom1) +- [#260](https://github.com/request/request/pull/260) fixed just another leak of 'i' (@sreuter) +- [#246](https://github.com/request/request/pull/246) Fixing the set-cookie header (@jeromegn) +- [#243](https://github.com/request/request/pull/243) Dynamic boundary (@zephrax) +- [#240](https://github.com/request/request/pull/240) don't error when null is passed for options (@polotek) +- [#211](https://github.com/request/request/pull/211) Replace all occurrences of special chars in RFC3986 (@chriso) +- [#224](https://github.com/request/request/pull/224) Multipart content-type change (@janjongboom) +- [#217](https://github.com/request/request/pull/217) need to use Authorization (titlecase) header with Tumblr OAuth (@visnup) +- [#203](https://github.com/request/request/pull/203) Fix cookie and redirect bugs and add auth support for HTTPS tunnel (@milewise) +- [#199](https://github.com/request/request/pull/199) Tunnel (@isaacs) +- [#198](https://github.com/request/request/pull/198) Bugfix on forever usage of util.inherits (@isaacs) +- [#197](https://github.com/request/request/pull/197) Make ForeverAgent work with HTTPS (@isaacs) +- [#193](https://github.com/request/request/pull/193) Fixes GH-119 (@goatslacker) +- [#188](https://github.com/request/request/pull/188) Add abort support to the returned request (@itay) +- [#176](https://github.com/request/request/pull/176) Querystring option (@csainty) +- [#182](https://github.com/request/request/pull/182) Fix request.defaults to support (uri, options, callback) api (@twilson63) +- [#180](https://github.com/request/request/pull/180) Modified the post, put, head and del shortcuts to support uri optional param (@twilson63) +- [#179](https://github.com/request/request/pull/179) fix to add opts in .pipe(stream, opts) (@substack) +- [#177](https://github.com/request/request/pull/177) Issue #173 Support uri as first and optional config as second argument (@twilson63) +- [#170](https://github.com/request/request/pull/170) can't create a cookie in a wrapped request (defaults) (@fabianonunes) +- [#168](https://github.com/request/request/pull/168) Picking off an EasyFix by adding some missing mimetypes. (@serby) +- [#161](https://github.com/request/request/pull/161) Fix cookie jar/headers.cookie collision (#125) (@papandreou) +- [#162](https://github.com/request/request/pull/162) Fix issue #159 (@dpetukhov) +- [#90](https://github.com/request/request/pull/90) add option followAllRedirects to follow post/put redirects (@jroes) +- [#148](https://github.com/request/request/pull/148) Retry Agent (@thejh) +- [#146](https://github.com/request/request/pull/146) Multipart should respect content-type if previously set (@apeace) +- [#144](https://github.com/request/request/pull/144) added "form" option to readme (@petejkim) +- [#133](https://github.com/request/request/pull/133) Fixed cookies parsing (@afanasy) +- [#135](https://github.com/request/request/pull/135) host vs hostname (@iangreenleaf) +- [#132](https://github.com/request/request/pull/132) return the body as a Buffer when encoding is set to null (@jahewson) +- [#112](https://github.com/request/request/pull/112) Support using a custom http-like module (@jhs) +- [#104](https://github.com/request/request/pull/104) Cookie handling contains bugs (@janjongboom) +- [#121](https://github.com/request/request/pull/121) Another patch for cookie handling regression (@jhurliman) +- [#117](https://github.com/request/request/pull/117) Remove the global `i` (@3rd-Eden) +- [#110](https://github.com/request/request/pull/110) Update to Iris Couch URL (@jhs) +- [#86](https://github.com/request/request/pull/86) Can't post binary to multipart requests (@developmentseed) +- [#105](https://github.com/request/request/pull/105) added test for proxy option. (@dominictarr) +- [#102](https://github.com/request/request/pull/102) Implemented cookies - closes issue 82: https://github.com/mikeal/request/issues/82 (@alessioalex) +- [#97](https://github.com/request/request/pull/97) Typo in previous pull causes TypeError in non-0.5.11 versions (@isaacs) +- [#96](https://github.com/request/request/pull/96) Authless parsed url host support (@isaacs) +- [#81](https://github.com/request/request/pull/81) Enhance redirect handling (@danmactough) +- [#78](https://github.com/request/request/pull/78) Don't try to do strictSSL for non-ssl connections (@isaacs) +- [#76](https://github.com/request/request/pull/76) Bug when a request fails and a timeout is set (@Marsup) +- [#70](https://github.com/request/request/pull/70) add test script to package.json (@isaacs, @aheckmann) +- [#73](https://github.com/request/request/pull/73) Fix #71 Respect the strictSSL flag (@isaacs) +- [#69](https://github.com/request/request/pull/69) Flatten chunked requests properly (@isaacs) +- [#67](https://github.com/request/request/pull/67) fixed global variable leaks (@aheckmann) +- [#66](https://github.com/request/request/pull/66) Do not overwrite established content-type headers for read stream deliver (@voodootikigod) +- [#53](https://github.com/request/request/pull/53) Parse json: Issue #51 (@benatkin) +- [#45](https://github.com/request/request/pull/45) Added timeout option (@mbrevoort) +- [#35](https://github.com/request/request/pull/35) The "end" event isn't emitted for some responses (@voxpelli) +- [#31](https://github.com/request/request/pull/31) Error on piping a request to a destination (@tobowers) \ No newline at end of file diff --git a/deps/npm/node_modules/request/CONTRIBUTING.md b/deps/npm/node_modules/request/CONTRIBUTING.md index 17d383e8e3d..06b1968d974 100644 --- a/deps/npm/node_modules/request/CONTRIBUTING.md +++ b/deps/npm/node_modules/request/CONTRIBUTING.md @@ -26,7 +26,7 @@ There are a few basic ground-rules for contributors: style & testing issues. To diagnose test failures, there are two ways to run a single test file: - `node_modules/.bin/taper tests/test-file.js` - run using the default - [`taper`](/nylen/taper) test reporter. + [`taper`](https://github.com/nylen/taper) test reporter. - `node tests/test-file.js` - view the raw [tap](https://testanything.org/) output. diff --git a/deps/npm/node_modules/request/README.md b/deps/npm/node_modules/request/README.md index 56604207841..d8bd405701c 100644 --- a/deps/npm/node_modules/request/README.md +++ b/deps/npm/node_modules/request/README.md @@ -1,44 +1,73 @@ -# Request — Simplified HTTP client -[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/mikeal/request?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![NPM](https://nodei.co/npm/request.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/request/) +# Request - Simplified HTTP client + +[![npm package](https://nodei.co/npm/request.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/request/) + +[![Build status](https://img.shields.io/travis/request/request.svg?style=flat-square)](https://travis-ci.org/request/request) +[![Coverage](https://img.shields.io/coveralls/request/request.svg?style=flat-square)](https://coveralls.io/r/request/request) +[![Dependency Status](https://img.shields.io/david/request/request.svg?style=flat-square)](https://david-dm.org/request/request) +[![Gitter](https://img.shields.io/badge/gitter-join_chat-blue.svg?style=flat-square)](https://gitter.im/request/request?utm_source=badge) + ## Super simple to use Request is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default. -```javascript +```js var request = require('request'); request('http://www.google.com', function (error, response, body) { if (!error && response.statusCode == 200) { - console.log(body) // Print the google web page. + console.log(body) // Show the HTML for the Google homepage. } }) ``` + +## Table of contents + +- [Streaming](#streaming) +- [Forms](#forms) +- [HTTP Authentication](#http-authentication) +- [Custom HTTP Headers](#custom-http-headers) +- [OAuth Signing](#oauth-signing) +- [Proxies](#proxies) +- [Unix Domain Sockets](#unix-domain-sockets) +- [TLS/SSL Protocol](#tlsssl-protocol) +- [Support for HAR 1.2](#support-for-har-12) +- [**All Available Options**](#requestoptions-callback) + +Request also offers [convenience methods](#convenience-methods) like +`request.defaults` and `request.post`, and there are +lots of [usage examples](#examples) and several +[debugging techniques](#debugging). + + +--- + + ## Streaming You can stream any response to a file stream. -```javascript +```js request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png')) ``` You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types (in this case `application/json`) and use the proper `content-type` in the PUT request (if the headers don’t already provide one). -```javascript +```js fs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json')) ``` Request can also `pipe` to itself. When doing so, `content-type` and `content-length` are preserved in the PUT headers. -```javascript +```js request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png')) ``` Request emits a "response" event when a response is received. The `response` argument will be an instance of [http.IncomingMessage](http://nodejs.org/api/http.html#http_http_incomingmessage). -```javascript +```js request .get('http://google.com/img.png') .on('response', function(response) { @@ -48,9 +77,20 @@ request .pipe(request.put('http://mysite.com/img.png')) ``` +To easily handle errors when streaming requests, listen to the `error` event before piping: + +```js +request + .get('http://mysite.com/doodle.png') + .on('error', function(err) { + console.log(err) + }) + .pipe(fs.createWriteStream('doodle.png')) +``` + Now let’s get fancy. -```javascript +```js http.createServer(function (req, resp) { if (req.url === '/doodle.png') { if (req.method === 'PUT') { @@ -64,7 +104,7 @@ http.createServer(function (req, resp) { You can also `pipe()` from `http.ServerRequest` instances, as well as to `http.ServerResponse` instances. The HTTP method, headers, and entity-body data will be sent. Which means that, if you don't really care about security, you can do: -```javascript +```js http.createServer(function (req, resp) { if (req.url === '/doodle.png') { var x = request('http://mysite.com/doodle.png') @@ -76,13 +116,13 @@ http.createServer(function (req, resp) { And since `pipe()` returns the destination stream in ≥ Node 0.5.x you can do one line proxying. :) -```javascript +```js req.pipe(request('http://mysite.com/doodle.png')).pipe(resp) ``` Also, none of this new functionality conflicts with requests previous features, it just expands them. -```javascript +```js var r = request.defaults({'proxy':'http://localproxy.com'}) http.createServer(function (req, resp) { @@ -94,133 +134,22 @@ http.createServer(function (req, resp) { You can still use intermediate proxies, the requests will still follow HTTP forwards, etc. -## Proxies - -If you specify a `proxy` option, then the request (and any subsequent -redirects) will be sent via a connection to the proxy server. - -If your endpoint is an `https` url, and you are using a proxy, then -request will send a `CONNECT` request to the proxy server *first*, and -then use the supplied connection to connect to the endpoint. - -That is, first it will make a request like: - -``` -HTTP/1.1 CONNECT endpoint-server.com:80 -Host: proxy-server.com -User-Agent: whatever user agent you specify -``` - -and then the proxy server make a TCP connection to `endpoint-server` -on port `80`, and return a response that looks like: - -``` -HTTP/1.1 200 OK -``` - -At this point, the connection is left open, and the client is -communicating directly with the `endpoint-server.com` machine. - -See [the wikipedia page on HTTP Tunneling](http://en.wikipedia.org/wiki/HTTP_tunnel) -for more information. - -By default, when proxying `http` traffic, request will simply make a -standard proxied `http` request. This is done by making the `url` -section of the initial line of the request a fully qualified url to -the endpoint. - -For example, it will make a single request that looks like: - -``` -HTTP/1.1 GET http://endpoint-server.com/some-url -Host: proxy-server.com -Other-Headers: all go here - -request body or whatever -``` - -Because a pure "http over http" tunnel offers no additional security -or other features, it is generally simpler to go with a -straightforward HTTP proxy in this case. However, if you would like -to force a tunneling proxy, you may set the `tunnel` option to `true`. - -If you are using a tunneling proxy, you may set the -`proxyHeaderWhiteList` to share certain headers with the proxy. - -By default, this set is: - -``` -accept -accept-charset -accept-encoding -accept-language -accept-ranges -cache-control -content-encoding -content-language -content-length -content-location -content-md5 -content-range -content-type -connection -date -expect -max-forwards -pragma -proxy-authorization -referer -te -transfer-encoding -user-agent -via -``` - -Note that, when using a tunneling proxy, the `proxy-authorization` -header is *never* sent to the endpoint server, but only to the proxy -server. All other headers are sent as-is over the established -connection. - -### Controlling proxy behaviour using environment variables - -The following environment variables are respected by `request`: +[back to top](#table-of-contents) - * `HTTP_PROXY` / `http_proxy` - * `HTTPS_PROXY` / `https_proxy` - * `NO_PROXY` / `no_proxy` -When `HTTP_PROXY` / `http_proxy` are set, they will be used to proxy non-SSL requests that do not have an explicit `proxy` configuration option present. Similarly, `HTTPS_PROXY` / `https_proxy` will be respected for SSL requests that do not have an explicit `proxy` configuration option. It is valid to define a proxy in one of the environment variables, but then override it for a specific request, using the `proxy` configuration option. Furthermore, the `proxy` configuration option can be explicitly set to false / null to opt out of proxying altogether for that request. - -`request` is also aware of the `NO_PROXY`/`no_proxy` environment variables. These variables provide a granular way to opt out of proxying, on a per-host basis. It should contain a comma separated list of hosts to opt out of proxying. It is also possible to opt of proxying when a particular destination port is used. Finally, the variable may be set to `*` to opt out of the implicit proxy configuration of the other environment variables. - -Here's some examples of valid `no_proxy` values: - - * `google.com` - don't proxy HTTP/HTTPS requests to Google. - * `google.com:443` - don't proxy HTTPS requests to Google, but *do* proxy HTTP requests to Google. - * `google.com:443, yahoo.com:80` - don't proxy HTTPS requests to Google, and don't proxy HTTP requests to Yahoo! - * `*` - ignore `https_proxy`/`http_proxy` environment variables altogether. - -## UNIX Socket - -`request` supports making requests to [UNIX Domain Sockets](http://en.wikipedia.org/wiki/Unix_domain_socket). To make one, use the following URL scheme: - -```javascript -/* Pattern */ 'http://unix:SOCKET:PATH' -/* Example */ request.get('http://unix:/absolute/path/to/unix.socket:/request/path') -``` - -Note: The `SOCKET` path is assumed to be absolute to the root of the host file system. +--- ## Forms `request` supports `application/x-www-form-urlencoded` and `multipart/form-data` form uploads. For `multipart/related` refer to the `multipart` API. + #### application/x-www-form-urlencoded (URL-Encoded Forms) URL-encoded forms are simple. -```javascript +```js request.post('http://service.com/upload', {form:{key:'value'}}) // or request.post('http://service.com/upload').form({key:'value'}) @@ -228,12 +157,13 @@ request.post('http://service.com/upload').form({key:'value'}) request.post({url:'http://service.com/upload', form: {key:'value'}}, function(err,httpResponse,body){ /* ... */ }) ``` + #### multipart/form-data (Multipart Form Uploads) For `multipart/form-data` we use the [form-data](https://github.com/felixge/node-form-data) library by [@felixge](https://github.com/felixge). For the most cases, you can pass your upload form data via the `formData` option. -```javascript +```js var formData = { // Pass a simple key-value pair my_field: 'my_value', @@ -243,10 +173,11 @@ var formData = { my_file: fs.createReadStream(__dirname + '/unicycle.jpg'), // Pass multiple values /w an Array attachments: [ - fs.createReadStream(__dirname + '/attacment1.jpg') + fs.createReadStream(__dirname + '/attachment1.jpg'), fs.createReadStream(__dirname + '/attachment2.jpg') ], // Pass optional meta-data with an 'options' object with style: {value: DATA, options: OPTIONS} + // Use case: for some types of streams, you'll need to provide "file"-related information manually. // See the `form-data` README for more information about options: https://github.com/felixge/node-form-data custom_file: { value: fs.createReadStream('/dev/urandom'), @@ -264,12 +195,11 @@ request.post({url:'http://service.com/upload', formData: formData}, function opt }); ``` -For advanced cases, you can the form-data object itself via `r.form()`. This can be modified until the request is fired on the next cycle of the event-loop. (Note that this calling `form()` will clear the currently set form data for that request.) +For advanced cases, you can access the form-data object itself via `r.form()`. This can be modified until the request is fired on the next cycle of the event-loop. (Note that this calling `form()` will clear the currently set form data for that request.) -```javascript +```js // NOTE: Advanced use-case, for normal use see 'formData' usage above -var r = request.post('http://service.com/upload', function optionalCallback(err, httpResponse, body) { // ... - +var r = request.post('http://service.com/upload', function optionalCallback(err, httpResponse, body) {...}) var form = r.form(); form.append('my_field', 'my_value'); form.append('my_buffer', new Buffer([1, 2, 3])); @@ -277,36 +207,54 @@ form.append('custom_file', fs.createReadStream(__dirname + '/unicycle.jpg'), {fi ``` See the [form-data README](https://github.com/felixge/node-form-data) for more information & examples. + #### multipart/related Some variations in different HTTP implementations require a newline/CRLF before, after, or both before and after the boundary of a `multipart/related` request (using the multipart option). This has been observed in the .NET WebAPI version 4.0. You can turn on a boundary preambleCRLF or postamble by passing them as `true` to your request options. -```javascript - request( - { method: 'PUT' - , preambleCRLF: true - , postambleCRLF: true - , uri: 'http://service.com/upload' - , multipart: - [ { 'content-type': 'application/json' - , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) - } - , { body: 'I am an attachment' } +```js + request({ + method: 'PUT', + preambleCRLF: true, + postambleCRLF: true, + uri: 'http://service.com/upload', + multipart: [ + { + 'content-type': 'application/json' + body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) + }, + { body: 'I am an attachment' }, + { body: fs.createReadStream('image.png') } + ], + // alternatively pass an object containing additional options + multipart: { + chunked: false, + data: [ + { + 'content-type': 'application/json', + body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) + }, + { body: 'I am an attachment' } ] } - , function (error, response, body) { - if (err) { - return console.error('upload failed:', err); - } - console.log('Upload successful! Server responded with:', body); + }, + function (error, response, body) { + if (error) { + return console.error('upload failed:', error); } - ) + console.log('Upload successful! Server responded with:', body); + }) ``` +[back to top](#table-of-contents) + + +--- + ## HTTP Authentication -```javascript +```js request.get('http://some.server.com/').auth('username', 'password', false); // or request.get('http://some.server.com/', { @@ -326,14 +274,27 @@ request.get('http://some.server.com/', { }); ``` -If passed as an option, `auth` should be a hash containing values `user` || `username`, `pass` || `password`, and `sendImmediately` (optional). The method form takes parameters `auth(username, password, sendImmediately)`. +If passed as an option, `auth` should be a hash containing values: + +- `user` || `username` +- `pass` || `password` +- `sendImmediately` (optional) +- `bearer` (optional) + +The method form takes parameters +`auth(username, password, sendImmediately, bearer)`. -`sendImmediately` defaults to `true`, which causes a basic authentication header to be sent. If `sendImmediately` is `false`, then `request` will retry with a proper authentication header after receiving a `401` response from the server (which must contain a `WWW-Authenticate` header indicating the required authentication method). +`sendImmediately` defaults to `true`, which causes a basic or bearer +authentication header to be sent. If `sendImmediately` is `false`, then +`request` will retry with a proper authentication header after receiving a +`401` response from the server (which must contain a `WWW-Authenticate` header +indicating the required authentication method). -Note that you can also use for basic authentication a trick using the URL itself, as specified in [RFC 1738](http://www.ietf.org/rfc/rfc1738.txt). -Simply pass the `user:password` before the host with an `@` sign. +Note that you can also specify basic authentication using the URL itself, as +detailed in [RFC 1738](http://www.ietf.org/rfc/rfc1738.txt). Simply pass the +`user:password` before the host with an `@` sign: -```javascript +```js var username = 'username', password = 'password', url = 'http://' + username + ':' + password + '@some.server.com'; @@ -343,14 +304,65 @@ request({url: url}, function (error, response, body) { }); ``` -Digest authentication is supported, but it only works with `sendImmediately` set to `false`; otherwise `request` will send basic authentication on the initial request, which will probably cause the request to fail. +Digest authentication is supported, but it only works with `sendImmediately` +set to `false`; otherwise `request` will send basic authentication on the +initial request, which will probably cause the request to fail. + +Bearer authentication is supported, and is activated when the `bearer` value is +available. The value may be either a `String` or a `Function` returning a +`String`. Using a function to supply the bearer token is particularly useful if +used in conjuction with `defaults` to allow a single function to supply the +last known token at the time of sending a request, or to compute one on the fly. + +[back to top](#table-of-contents) + + +--- + + +## Custom HTTP Headers + +HTTP Headers, such as `User-Agent`, can be set in the `options` object. +In the example below, we call the github API to find out the number +of stars and forks for the request repository. This requires a +custom `User-Agent` header as well as https. + +```js +var request = require('request'); + +var options = { + url: 'https://api.github.com/repos/request/request', + headers: { + 'User-Agent': 'request' + } +}; + +function callback(error, response, body) { + if (!error && response.statusCode == 200) { + var info = JSON.parse(body); + console.log(info.stargazers_count + " Stars"); + console.log(info.forks_count + " Forks"); + } +} + +request(options, callback); +``` + +[back to top](#table-of-contents) + + +--- -Bearer authentication is supported, and is activated when the `bearer` value is available. The value may be either a `String` or a `Function` returning a `String`. Using a function to supply the bearer token is particularly useful if used in conjuction with `defaults` to allow a single function to supply the last known token at the time or sending a request or to compute one on the fly. ## OAuth Signing -```javascript -// Twitter OAuth +[OAuth version 1.0](https://tools.ietf.org/html/rfc5849) is supported. The +default signing algorithm is +[HMAC-SHA1](https://tools.ietf.org/html/rfc5849#section-3.4.2): + +```js +// OAuth1.0 - 3-legged server side flow (Twitter example) +// step 1 var qs = require('querystring') , oauth = { callback: 'http://mysite.com/callback/' @@ -364,30 +376,40 @@ request.post({url:url, oauth:oauth}, function (e, r, body) { // and construct a URL that a user clicks on (like a sign in button). // The verifier is only available in the response after a user has // verified with twitter that they are authorizing your app. - var access_token = qs.parse(body) + + // step 2 + var req_data = qs.parse(body) + var uri = 'https://api.twitter.com/oauth/authenticate' + + '?' + qs.stringify({oauth_token: req_data.oauth_token}) + // redirect the user to the authorize uri + + // step 3 + // after the user is redirected back to your server + var auth_data = qs.parse(body) , oauth = { consumer_key: CONSUMER_KEY , consumer_secret: CONSUMER_SECRET - , token: access_token.oauth_token - , verifier: access_token.oauth_verifier + , token: auth_data.oauth_token + , token_secret: req_data.oauth_token_secret + , verifier: auth_data.oauth_verifier } , url = 'https://api.twitter.com/oauth/access_token' ; request.post({url:url, oauth:oauth}, function (e, r, body) { - var perm_token = qs.parse(body) + // ready to make signed requests on behalf of the user + var perm_data = qs.parse(body) , oauth = { consumer_key: CONSUMER_KEY , consumer_secret: CONSUMER_SECRET - , token: perm_token.oauth_token - , token_secret: perm_token.oauth_token_secret + , token: perm_data.oauth_token + , token_secret: perm_data.oauth_token_secret } - , url = 'https://api.twitter.com/1.1/users/show.json?' - , params = - { screen_name: perm_token.screen_name - , user_id: perm_token.user_id + , url = 'https://api.twitter.com/1.1/users/show.json' + , qs = + { screen_name: perm_data.screen_name + , user_id: perm_data.user_id } ; - url += qs.stringify(params) request.get({url:url, oauth:oauth, json:true}, function (e, r, user) { console.log(user) }) @@ -395,42 +417,200 @@ request.post({url:url, oauth:oauth}, function (e, r, body) { }) ``` -## Custom HTTP Headers +For [RSA-SHA1 signing](https://tools.ietf.org/html/rfc5849#section-3.4.3), make +the following changes to the OAuth options object: +* Pass `signature_method : 'RSA-SHA1'` +* Instead of `consumer_secret`, specify a `private_key` string in + [PEM format](http://how2ssl.com/articles/working_with_pem_files/) -HTTP Headers, such as `User-Agent`, can be set in the `options` object. -In the example below, we call the github API to find out the number -of stars and forks for the request repository. This requires a -custom `User-Agent` header as well as https. +For [PLAINTEXT signing](http://oauth.net/core/1.0/#anchor22), make +the following changes to the OAuth options object: +* Pass `signature_method : 'PLAINTEXT'` -```javascript -var request = require('request'); +To send OAuth parameters via query params or in a post body as described in The +[Consumer Request Parameters](http://oauth.net/core/1.0/#consumer_req_param) +section of the oauth1 spec: +* Pass `transport_method : 'query'` or `transport_method : 'body'` in the OAuth + options object. +* `transport_method` defaults to `'header'` -var options = { - url: 'https://api.github.com/repos/mikeal/request', - headers: { - 'User-Agent': 'request' - } -}; +To use [Request Body Hash](https://oauth.googlecode.com/svn/spec/ext/body_hash/1.0/oauth-bodyhash.html) you can either +* Manually generate the body hash and pass it as a string `body_hash: '...'` +* Automatically generate the body hash by passing `body_hash: true` -function callback(error, response, body) { - if (!error && response.statusCode == 200) { - var info = JSON.parse(body); - console.log(info.stargazers_count + " Stars"); - console.log(info.forks_count + " Forks"); - } -} +[back to top](#table-of-contents) -request(options, callback); + +--- + + +## Proxies + +If you specify a `proxy` option, then the request (and any subsequent +redirects) will be sent via a connection to the proxy server. + +If your endpoint is an `https` url, and you are using a proxy, then +request will send a `CONNECT` request to the proxy server *first*, and +then use the supplied connection to connect to the endpoint. + +That is, first it will make a request like: + +``` +HTTP/1.1 CONNECT endpoint-server.com:80 +Host: proxy-server.com +User-Agent: whatever user agent you specify +``` + +and then the proxy server make a TCP connection to `endpoint-server` +on port `80`, and return a response that looks like: + +``` +HTTP/1.1 200 OK +``` + +At this point, the connection is left open, and the client is +communicating directly with the `endpoint-server.com` machine. + +See [the wikipedia page on HTTP Tunneling](http://en.wikipedia.org/wiki/HTTP_tunnel) +for more information. + +By default, when proxying `http` traffic, request will simply make a +standard proxied `http` request. This is done by making the `url` +section of the initial line of the request a fully qualified url to +the endpoint. + +For example, it will make a single request that looks like: + +``` +HTTP/1.1 GET http://endpoint-server.com/some-url +Host: proxy-server.com +Other-Headers: all go here + +request body or whatever +``` + +Because a pure "http over http" tunnel offers no additional security +or other features, it is generally simpler to go with a +straightforward HTTP proxy in this case. However, if you would like +to force a tunneling proxy, you may set the `tunnel` option to `true`. + +You can also make a standard proxied `http` request by explicitly setting +`tunnel : false`, but **note that this will allow the proxy to see the traffic +to/from the destination server**. + +If you are using a tunneling proxy, you may set the +`proxyHeaderWhiteList` to share certain headers with the proxy. + +You can also set the `proxyHeaderExclusiveList` to share certain +headers only with the proxy and not with destination host. + +By default, this set is: + +``` +accept +accept-charset +accept-encoding +accept-language +accept-ranges +cache-control +content-encoding +content-language +content-length +content-location +content-md5 +content-range +content-type +connection +date +expect +max-forwards +pragma +proxy-authorization +referer +te +transfer-encoding +user-agent +via ``` +Note that, when using a tunneling proxy, the `proxy-authorization` +header and any headers from custom `proxyHeaderExclusiveList` are +*never* sent to the endpoint server, but only to the proxy server. + + +### Controlling proxy behaviour using environment variables + +The following environment variables are respected by `request`: + + * `HTTP_PROXY` / `http_proxy` + * `HTTPS_PROXY` / `https_proxy` + * `NO_PROXY` / `no_proxy` + +When `HTTP_PROXY` / `http_proxy` are set, they will be used to proxy non-SSL requests that do not have an explicit `proxy` configuration option present. Similarly, `HTTPS_PROXY` / `https_proxy` will be respected for SSL requests that do not have an explicit `proxy` configuration option. It is valid to define a proxy in one of the environment variables, but then override it for a specific request, using the `proxy` configuration option. Furthermore, the `proxy` configuration option can be explicitly set to false / null to opt out of proxying altogether for that request. + +`request` is also aware of the `NO_PROXY`/`no_proxy` environment variables. These variables provide a granular way to opt out of proxying, on a per-host basis. It should contain a comma separated list of hosts to opt out of proxying. It is also possible to opt of proxying when a particular destination port is used. Finally, the variable may be set to `*` to opt out of the implicit proxy configuration of the other environment variables. + +Here's some examples of valid `no_proxy` values: + + * `google.com` - don't proxy HTTP/HTTPS requests to Google. + * `google.com:443` - don't proxy HTTPS requests to Google, but *do* proxy HTTP requests to Google. + * `google.com:443, yahoo.com:80` - don't proxy HTTPS requests to Google, and don't proxy HTTP requests to Yahoo! + * `*` - ignore `https_proxy`/`http_proxy` environment variables altogether. + +[back to top](#table-of-contents) + + +--- + + +## UNIX Domain Sockets + +`request` supports making requests to [UNIX Domain Sockets](http://en.wikipedia.org/wiki/Unix_domain_socket). To make one, use the following URL scheme: + +```js +/* Pattern */ 'http://unix:SOCKET:PATH' +/* Example */ request.get('http://unix:/absolute/path/to/unix.socket:/request/path') +``` + +Note: The `SOCKET` path is assumed to be absolute to the root of the host file system. + +[back to top](#table-of-contents) + + +--- + + ## TLS/SSL Protocol TLS/SSL Protocol options, such as `cert`, `key` and `passphrase`, can be -set in the `agentOptions` property of the `options` object. +set directly in `options` object, in the `agentOptions` property of the `options` object, or even in `https.globalAgent.options`. Keep in mind that, although `agentOptions` allows for a slightly wider range of configurations, the recommendend way is via `options` object directly, as using `agentOptions` or `https.globalAgent.options` would not be applied in the same way in proxied environments (as data travels through a TLS connection instead of an http/https agent). + +```js +var fs = require('fs') + , path = require('path') + , certFile = path.resolve(__dirname, 'ssl/client.crt') + , keyFile = path.resolve(__dirname, 'ssl/client.key') + , caFile = path.resolve(__dirname, 'ssl/ca.cert.pem') + , request = require('request'); + +var options = { + url: 'https://api.some-server.com/', + cert: fs.readFileSync(certFile), + key: fs.readFileSync(keyFile), + passphrase: 'password', + ca: fs.readFileSync(caFile) + } +}; + +request.get(options); +``` + +### Using `options.agentOptions` + In the example below, we call an API requires client side SSL certificate (in PEM format) with passphrase protected private key (in PEM format) and disable the SSLv3 protocol: -```javascript +```js var fs = require('fs') , path = require('path') , certFile = path.resolve(__dirname, 'ssl/client.crt') @@ -440,12 +620,12 @@ var fs = require('fs') var options = { url: 'https://api.some-server.com/', agentOptions: { - 'cert': fs.readFileSync(certFile), - 'key': fs.readFileSync(keyFile), + cert: fs.readFileSync(certFile), + key: fs.readFileSync(keyFile), // Or use `pfx` property replacing `cert` and `key` when using private key, certificate and CA certs in PFX or PKCS12 format: - // 'pfx': fs.readFileSync(pfxFilePath), - 'passphrase': 'password', - 'securityOptions': 'SSL_OP_NO_SSLv3' + // pfx: fs.readFileSync(pfxFilePath), + passphrase: 'password', + securityOptions: 'SSL_OP_NO_SSLv3' } }; @@ -454,62 +634,177 @@ request.get(options); It is able to force using SSLv3 only by specifying `secureProtocol`: -```javascript +```js +request.get({ + url: 'https://api.some-server.com/', + agentOptions: { + secureProtocol: 'SSLv3_method' + } +}); +``` + +It is possible to accept other certificates than those signed by generally allowed Certificate Authorities (CAs). +This can be useful, for example, when using self-signed certificates. +To allow a different certificate, you can specify the signing CA by adding the contents of the CA's certificate file to the `agentOptions`: +```js request.get({ url: 'https://api.some-server.com/', agentOptions: { - 'secureProtocol': 'SSLv3_method' + ca: fs.readFileSync('ca.cert.pem') } }); ``` +[back to top](#table-of-contents) + + +--- + +## Support for HAR 1.2 + +The `options.har` property will override the values: `url`, `method`, `qs`, `headers`, `form`, `formData`, `body`, `json`, as well as construct multipart data and read files from disk when `request.postData.params[].fileName` is present without a matching `value`. + +a validation step will check if the HAR Request format matches the latest spec (v1.2) and will skip parsing if not matching. + +```js + var request = require('request') + request({ + // will be ignored + method: 'GET' + uri: 'http://www.google.com', + + // HTTP Archive Request Object + har: { + url: 'http://www.mockbin.com/har' + method: 'POST', + headers: [ + { + name: 'content-type', + value: 'application/x-www-form-urlencoded' + } + ], + postData: { + mimeType: 'application/x-www-form-urlencoded', + params: [ + { + name: 'foo', + value: 'bar' + }, + { + name: 'hello', + value: 'world' + } + ] + } + } + }) + + // a POST request will be sent to http://www.mockbin.com + // with body an application/x-www-form-urlencoded body: + // foo=bar&hello=world +``` + +[back to top](#table-of-contents) + + +--- + ## request(options, callback) The first argument can be either a `url` or an `options` object. The only required option is `uri`; all others are optional. -* `uri` || `url` - fully qualified uri or a parsed url object from `url.parse()` -* `qs` - object containing querystring values to be appended to the `uri` -* `useQuerystring` - If true, use `querystring` to stringify and parse +- `uri` || `url` - fully qualified uri or a parsed url object from `url.parse()` +- `baseUrl` - fully qualified uri string used as the base url. Most useful with `request.defaults`, for example when you want to do many requests to the same domain. If `baseUrl` is `https://example.com/api/`, then requesting `/end/point?test=true` will fetch `https://example.com/api/end/point?test=true`. When `baseUrl` is given, `uri` must also be a string. +- `method` - http method (default: `"GET"`) +- `headers` - http headers (default: `{}`) + +--- + +- `qs` - object containing querystring values to be appended to the `uri` +- `qsParseOptions` - object containing options to pass to the [qs.parse](https://github.com/hapijs/qs#parsing-objects) method. Alternatively pass options to the [querystring.parse](https://nodejs.org/docs/v0.12.0/api/querystring.html#querystring_querystring_parse_str_sep_eq_options) method using this format `{sep:';', eq:':', options:{}}` +- `qsStringifyOptions` - object containing options to pass to the [qs.stringify](https://github.com/hapijs/qs#stringifying) method. Alternatively pass options to the [querystring.stringify](https://nodejs.org/docs/v0.12.0/api/querystring.html#querystring_querystring_stringify_obj_sep_eq_options) method using this format `{sep:';', eq:':', options:{}}`. For example, to change the way arrays are converted to query strings using the `qs` module pass the `arrayFormat` option with one of `indices|brackets|repeat` +- `useQuerystring` - If true, use `querystring` to stringify and parse querystrings, otherwise use `qs` (default: `false`). Set this option to `true` if you need arrays to be serialized as `foo=bar&foo=baz` instead of the default `foo[0]=bar&foo[1]=baz`. -* `method` - http method (default: `"GET"`) -* `headers` - http headers (default: `{}`) -* `body` - entity body for PATCH, POST and PUT requests. Must be a `Buffer` or `String`, unless `json` is `true`. If `json` is `true`, then `body` must be a JSON-serializable object. -* `form` - when passed an object or a querystring, this sets `body` to a querystring representation of value, and adds `Content-type: application/x-www-form-urlencoded` header. When passed no options, a `FormData` instance is returned (and is piped to request). See "Forms" section above. -* `formData` - Data to pass for a `multipart/form-data` request. See "Forms" section above. -* `multipart` - (experimental) Data to pass for a `multipart/related` request. See "Forms" section above -* `auth` - A hash containing values `user` || `username`, `pass` || `password`, and `sendImmediately` (optional). See documentation above. -* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as JSON. -* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below. -* `preambleCRLF` - append a newline/CRLF before the boundary of your `multipart/form-data` request. -* `postambleCRLF` - append a newline/CRLF at the end of the boundary of your `multipart/form-data` request. -* `followRedirect` - follow HTTP 3xx responses as redirects (default: `true`). This property can also be implemented as function which gets `response` object as a single argument and should return `true` if redirects should continue or `false` otherwise. -* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects (default: `false`) -* `maxRedirects` - the maximum number of redirects to follow (default: `10`) -* `encoding` - Encoding to be used on `setEncoding` of response data. If `null`, the `body` is returned as a `Buffer`. Anything else **(including the default value of `undefined`)** will be passed as the [encoding](http://nodejs.org/api/buffer.html#buffer_buffer) parameter to `toString()` (meaning this is effectively `utf8` by default). -* `pool` - An object describing which agents to use for the request. If this option is omitted the request will use the global agent (as long as [your options allow for it](request.js#L747)). Otherwise, request will search the pool for your custom agent. If no custom agent is found, a new agent will be created and added to the pool. - * A `maxSockets` property can also be provided on the `pool` object to set the max number of sockets for all agents created (ex: `pool: {maxSockets: Infinity}`). -* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request -* `proxy` - An HTTP proxy to be used. Supports proxy Auth with Basic Auth, identical to support for the `url` parameter (by embedding the auth info in the `uri`) -* `oauth` - Options for OAuth HMAC-SHA1 signing. See documentation above. -* `hawk` - Options for [Hawk signing](https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example). -* `strictSSL` - If `true`, requires SSL certificates be valid. **Note:** to use your own certificate authority, you need to specify an agent that was created with that CA as an option. -* `agentOptions` - Object containing user agent options. See documentation above. **Note:** [see tls API doc for TLS/SSL options](http://nodejs.org/api/tls.html#tls_tls_connect_options_callback). - -* `jar` - If `true` and `tough-cookie` is installed, remember cookies for future use (or define your custom cookie jar; see examples section) -* `aws` - `object` containing AWS signing information. Should have the properties `key`, `secret`. Also requires the property `bucket`, unless you’re specifying your `bucket` as part of the path, or the request doesn’t use a bucket (i.e. GET Services) -* `httpSignature` - Options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options. -* `localAddress` - Local interface to bind for network connections. -* `gzip` - If `true`, add an `Accept-Encoding` header to request compressed content encodings from the server (if not already present) and decode supported content encodings in the response. **Note:** Automatic decoding of the response content is performed on the body data returned through `request` (both through the `request` stream and passed to the callback function) but is not performed on the `response` stream (available from the `response` event) which is the unmodified `http.IncomingMessage` object which may contain compressed data. See example below. -* `tunnel` - If `true`, then *always* use a tunneling proxy. If - `false` (default), then tunneling will only be used if the - destination is `https`, or if a previous request in the redirect - chain used a tunneling proxy. -* `proxyHeaderWhiteList` - A whitelist of headers to send to a + +--- + +- `body` - entity body for PATCH, POST and PUT requests. Must be a `Buffer` or `String`, unless `json` is `true`. If `json` is `true`, then `body` must be a JSON-serializable object. +- `form` - when passed an object or a querystring, this sets `body` to a querystring representation of value, and adds `Content-type: application/x-www-form-urlencoded` header. When passed no options, a `FormData` instance is returned (and is piped to request). See "Forms" section above. +- `formData` - Data to pass for a `multipart/form-data` request. See + [Forms](#forms) section above. +- `multipart` - array of objects which contain their own headers and `body` + attributes. Sends a `multipart/related` request. See [Forms](#forms) section + above. + - Alternatively you can pass in an object `{chunked: false, data: []}` where + `chunked` is used to specify whether the request is sent in + [chunked transfer encoding](https://en.wikipedia.org/wiki/Chunked_transfer_encoding) + In non-chunked requests, data items with body streams are not allowed. +- `preambleCRLF` - append a newline/CRLF before the boundary of your `multipart/form-data` request. +- `postambleCRLF` - append a newline/CRLF at the end of the boundary of your `multipart/form-data` request. +- `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as JSON. +- `jsonReviver` - a [reviver function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) that will be passed to `JSON.parse()` when parsing a JSON response body. + +--- + +- `auth` - A hash containing values `user` || `username`, `pass` || `password`, and `sendImmediately` (optional). See documentation above. +- `oauth` - Options for OAuth HMAC-SHA1 signing. See documentation above. +- `hawk` - Options for [Hawk signing](https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example). +- `aws` - `object` containing AWS signing information. Should have the properties `key`, `secret`. Also requires the property `bucket`, unless you’re specifying your `bucket` as part of the path, or the request doesn’t use a bucket (i.e. GET Services) +- `httpSignature` - Options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options. + +--- + +- `followRedirect` - follow HTTP 3xx responses as redirects (default: `true`). This property can also be implemented as function which gets `response` object as a single argument and should return `true` if redirects should continue or `false` otherwise. +- `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects (default: `false`) +- `maxRedirects` - the maximum number of redirects to follow (default: `10`) +- `removeRefererHeader` - removes the referer header when a redirect happens (default: `false`). + +--- + +- `encoding` - Encoding to be used on `setEncoding` of response data. If `null`, the `body` is returned as a `Buffer`. Anything else **(including the default value of `undefined`)** will be passed as the [encoding](http://nodejs.org/api/buffer.html#buffer_buffer) parameter to `toString()` (meaning this is effectively `utf8` by default). +- `gzip` - If `true`, add an `Accept-Encoding` header to request compressed content encodings from the server (if not already present) and decode supported content encodings in the response. **Note:** Automatic decoding of the response content is performed on the body data returned through `request` (both through the `request` stream and passed to the callback function) but is not performed on the `response` stream (available from the `response` event) which is the unmodified `http.IncomingMessage` object which may contain compressed data. See example below. +- `jar` - If `true` and `tough-cookie` is installed, remember cookies for future use (or define your custom cookie jar; see examples section) + +--- + +- `pool` - An object describing which agents to use for the request. If this option is omitted the request will use the global agent (as long as [your options allow for it](request.js#L747)). Otherwise, request will search the pool for your custom agent. If no custom agent is found, a new agent will be created and added to the pool. + - A `maxSockets` property can also be provided on the `pool` object to set the max number of sockets for all agents created (ex: `pool: {maxSockets: Infinity}`). + - Note that if you are sending multiple requests in a loop and creating + multiple new `pool` objects, `maxSockets` will not work as intended. To + work around this, either use [`request.defaults`](#requestdefaultsoptions) + with your pool options or create the pool object with the `maxSockets` + property outside of the loop. +- `timeout` - Integer containing the number of milliseconds to wait for a + request to respond before aborting the request. Note that if the underlying + TCP connection cannot be established, the OS-wide TCP connection timeout will + overrule the `timeout` option ([the default in Linux is around 20 seconds](http://www.sekuda.com/overriding_the_default_linux_kernel_20_second_tcp_socket_connect_timeout)). +- `localAddress` - Local interface to bind for network connections. +- `proxy` - An HTTP proxy to be used. Supports proxy Auth with Basic Auth, identical to support for the `url` parameter (by embedding the auth info in the `uri`) +- `strictSSL` - If `true`, requires SSL certificates be valid. **Note:** to use your own certificate authority, you need to specify an agent that was created with that CA as an option. +- `agentOptions` - Object containing user agent options. See documentation above. **Note:** [see tls API doc for TLS/SSL options](http://nodejs.org/api/tls.html#tls_tls_connect_options_callback). +- `tunnel` - controls the behavior of + [HTTP `CONNECT` tunneling](https://en.wikipedia.org/wiki/HTTP_tunnel#HTTP_CONNECT_tunneling) + as follows: + - `undefined` (default) - `true` if the destination is `https` or a previous + request in the redirect chain used a tunneling proxy, `false` otherwise + - `true` - always tunnel to the destination by making a `CONNECT` request to + the proxy + - `false` - request the destination as a `GET` request. +- `proxyHeaderWhiteList` - A whitelist of headers to send to a tunneling proxy. +- `proxyHeaderExclusiveList` - A whitelist of headers to send + exclusively to a tunneling proxy and not to destination. + +--- + +- `time` - If `true`, the request-response cycle (including all redirects) is timed at millisecond resolution, and the result provided on the response's `elapsedTime` property. + +--- +- `har` - A [HAR 1.2 Request Object](http://www.softwareishard.com/blog/har-12-spec/#request), will be processed from HAR format into options overwriting matching values *(see the [HAR 1.2 section](#support-for-har-1.2) for details)* The callback argument gets 3 arguments: @@ -517,18 +812,29 @@ The callback argument gets 3 arguments: 2. An [`http.IncomingMessage`](http://nodejs.org/api/http.html#http_http_incomingmessage) object 3. The third is the `response` body (`String` or `Buffer`, or JSON object if the `json` option is supplied) +[back to top](#table-of-contents) + + +--- + ## Convenience methods There are also shorthand methods for different HTTP METHODs and some other conveniences. + ### request.defaults(options) -This method returns a wrapper around the normal request API that defaults to whatever options you pass in to it. +This method **returns a wrapper** around the normal request API that defaults +to whatever options you pass to it. + +**Note:** `request.defaults()` **does not** modify the global request API; +instead, it **returns a wrapper** that has your default settings applied to it. -**Note:** You can call `.defaults()` on the wrapper that is returned from `request.defaults` to add/override defaults that were previously defaulted. +**Note:** You can call `.defaults()` on the wrapper that is returned from +`request.defaults` to add/override defaults that were previously defaulted. For example: -```javascript +```js //requests using baseRequest() will set the 'x-token' header var baseRequest = request.defaults({ headers: {x-token: 'my-token'} @@ -545,7 +851,7 @@ var specialRequest = baseRequest.defaults({ Same as `request()`, but defaults to `method: "PUT"`. -```javascript +```js request.put(url) ``` @@ -553,7 +859,7 @@ request.put(url) Same as `request()`, but defaults to `method: "PATCH"`. -```javascript +```js request.patch(url) ``` @@ -561,15 +867,15 @@ request.patch(url) Same as `request()`, but defaults to `method: "POST"`. -```javascript +```js request.post(url) ``` ### request.head -Same as request() but defaults to `method: "HEAD"`. +Same as `request()`, but defaults to `method: "HEAD"`. -```javascript +```js request.head(url) ``` @@ -577,7 +883,7 @@ request.head(url) Same as `request()`, but defaults to `method: "DELETE"`. -```javascript +```js request.del(url) ``` @@ -585,28 +891,52 @@ request.del(url) Same as `request()` (for uniformity). -```javascript +```js request.get(url) ``` ### request.cookie Function that creates a new cookie. -```javascript +```js request.cookie('key1=value1') ``` -### request.jar +### request.jar() Function that creates a new cookie jar. -```javascript +```js request.jar() ``` +[back to top](#table-of-contents) + + +--- + + +## Debugging + +There are at least three ways to debug the operation of `request`: + +1. Launch the node process like `NODE_DEBUG=request node script.js` + (`lib,request,otherlib` works too). + +2. Set `require('request').debug = true` at any time (this does the same thing + as #1). + +3. Use the [request-debug module](https://github.com/nylen/request-debug) to + view request and response headers and bodies. + +[back to top](#table-of-contents) + + +--- + ## Examples: -```javascript +```js var request = require('request') , rand = Math.floor(Math.random()*100000000).toString() ; @@ -637,7 +967,7 @@ that the body data passed through `request` is automatically decompressed while the response object is unmodified and will contain compressed data if the server sent a compressed response. -```javascript +```js var request = require('request') request( { method: 'GET' @@ -664,7 +994,7 @@ the server sent a compressed response. Cookies are disabled by default (else, they would be used in subsequent requests). To enable cookies, set `jar` to `true` (either in `defaults` or `options`) and install `tough-cookie`. -```javascript +```js var request = request.defaults({jar: true}) request('http://www.google.com', function () { request('http://images.google.com') @@ -673,7 +1003,7 @@ request('http://www.google.com', function () { To use a custom cookie jar (instead of `request`’s global cookie jar), set `jar` to an instance of `request.jar()` (either in `defaults` or `options`) -```javascript +```js var j = request.jar() var request = request.defaults({jar:j}) request('http://www.google.com', function () { @@ -683,8 +1013,7 @@ request('http://www.google.com', function () { OR -```javascript -// `npm install --save tough-cookie` before this works +```js var j = request.jar(); var cookie = request.cookie('key1=value1'); var url = 'http://www.google.com'; @@ -694,9 +1023,30 @@ request({url: url, jar: j}, function () { }) ``` -To inspect your cookie jar after a request +To use a custom cookie store (such as a +[`FileCookieStore`](https://github.com/mitsuru/tough-cookie-filestore) +which supports saving to and restoring from JSON files), pass it as a parameter +to `request.jar()`: + +```js +var FileCookieStore = require('tough-cookie-filestore'); +// NOTE - currently the 'cookies.json' file must already exist! +var j = request.jar(new FileCookieStore('cookies.json')); +request = request.defaults({ jar : j }) +request('http://www.google.com', function() { + request('http://images.google.com') +}) +``` + +The cookie store must be a +[`tough-cookie`](https://github.com/goinstant/tough-cookie) +store and it must support synchronous operations; see the +[`CookieStore` API docs](https://github.com/goinstant/tough-cookie/#cookiestore-api) +for details. + +To inspect your cookie jar after a request: -```javascript +```js var j = request.jar() request({url: 'http://www.google.com', jar: j}, function () { var cookie_string = j.getCookieString(uri); // "key1=value1; key2=value2; ..." @@ -705,15 +1055,4 @@ request({url: 'http://www.google.com', jar: j}, function () { }) ``` -## Debugging - -There are at least three ways to debug the operation of `request`: - -1. Launch the node process like `NODE_DEBUG=request node script.js` - (`lib,request,otherlib` works too). - -2. Set `require('request').debug = true` at any time (this does the same thing - as #1). - -3. Use the [request-debug module](https://github.com/nylen/request-debug) to - view request and response headers and bodies. +[back to top](#table-of-contents) diff --git a/deps/npm/node_modules/request/examples/README.md b/deps/npm/node_modules/request/examples/README.md new file mode 100644 index 00000000000..526d71bba6a --- /dev/null +++ b/deps/npm/node_modules/request/examples/README.md @@ -0,0 +1,115 @@ + +# Authentication + +## OAuth + +### OAuth1.0 Refresh Token + +- http://oauth.googlecode.com/svn/spec/ext/session/1.0/drafts/1/spec.html#anchor4 +- https://developer.yahoo.com/oauth/guide/oauth-refreshaccesstoken.html + +```js +request.post('https://api.login.yahoo.com/oauth/v2/get_token', { + oauth: { + consumer_key: '...', + consumer_secret: '...', + token: '...', + token_secret: '...', + session_handle: '...' + } +}, function (err, res, body) { + var result = require('querystring').parse(body) + // assert.equal(typeof result, 'object') +}) +``` + +### OAuth2 Refresh Token + +- https://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-6 + +```js +request.post('https://accounts.google.com/o/oauth2/token', { + form: { + grant_type: 'refresh_token', + client_id: '...', + client_secret: '...', + refresh_token: '...' + }, + json: true +}, function (err, res, body) { + // assert.equal(typeof body, 'object') +}) +``` + +# Multipart + +## multipart/form-data + +### Flickr Image Upload + +- https://www.flickr.com/services/api/upload.api.html + +```js +request.post('https://up.flickr.com/services/upload', { + oauth: { + consumer_key: '...', + consumer_secret: '...', + token: '...', + token_secret: '...' + }, + // all meta data should be included here for proper signing + qs: { + title: 'My cat is awesome', + description: 'Sent on ' + new Date(), + is_public: 1 + }, + // again the same meta data + the actual photo + formData: { + title: 'My cat is awesome', + description: 'Sent on ' + new Date(), + is_public: 1, + photo:fs.createReadStream('cat.png') + }, + json: true +}, function (err, res, body) { + // assert.equal(typeof body, 'object') +}) +``` + +# Streams + +## `POST` data + +Use Request as a Writable stream to easily `POST` Readable streams (like files, other HTTP requests, or otherwise). + +TL;DR: Pipe a Readable Stream onto Request via: + +``` +READABLE.pipe(request.post(URL)); +``` + +A more detailed example: + +```js +var fs = require('fs') + , path = require('path') + , http = require('http') + , request = require('request') + , TMP_FILE_PATH = path.join(path.sep, 'tmp', 'foo') +; + +// write a temporary file: +fs.writeFileSync(TMP_FILE_PATH, 'foo bar baz quk\n'); + +http.createServer(function(req, res) { + console.log('the server is receiving data!\n'); + req + .on('end', res.end.bind(res)) + .pipe(process.stdout) + ; +}).listen(3000).unref(); + +fs.createReadStream(TMP_FILE_PATH) + .pipe(request.post('http://127.0.0.1:3000')) +; +``` diff --git a/deps/npm/node_modules/request/index.js b/deps/npm/node_modules/request/index.js index 033268405df..5872824c829 100755 --- a/deps/npm/node_modules/request/index.js +++ b/deps/npm/node_modules/request/index.js @@ -19,22 +19,27 @@ var extend = require('util')._extend , helpers = require('./lib/helpers') var isFunction = helpers.isFunction - , constructObject = helpers.constructObject - , filterForCallback = helpers.filterForCallback - , constructOptionsFrom = helpers.constructOptionsFrom , paramsHaveRequestBody = helpers.paramsHaveRequestBody // organize params for patch, post, put, head, del function initParams(uri, options, callback) { - callback = filterForCallback([options, callback]) - options = constructOptionsFrom(uri, options) - - return constructObject() - .extend({callback: callback}) - .extend({options: options}) - .extend({uri: options.uri}) - .done() + if (typeof options === 'function') { + callback = options + } + + var params = {} + if (typeof options === 'object') { + params = extend({}, options) + params = extend(params, {uri: uri}) + } else if (typeof uri === 'string') { + params = extend({}, {uri: uri}) + } else { + params = extend({}, uri) + } + + params.callback = callback + return params } function request (uri, options, callback) { @@ -43,134 +48,112 @@ function request (uri, options, callback) { } var params = initParams(uri, options, callback) - options = params.options - options.callback = params.callback - options.uri = params.uri - - return new request.Request(options) -} -function requester(params) { - if(typeof params.options._requester === 'function') { - return params.options._requester + if (params.method === 'HEAD' && paramsHaveRequestBody(params)) { + throw new Error('HTTP HEAD requests MUST NOT include a request body.') } - return request -} -request.get = function (uri, options, callback) { - var params = initParams(uri, options, callback) - params.options.method = 'GET' - return requester(params)(params.uri || null, params.options, params.callback) + return new request.Request(params) } -request.head = function (uri, options, callback) { - var params = initParams(uri, options, callback) - params.options.method = 'HEAD' - - if (paramsHaveRequestBody(params)) { - throw new Error('HTTP HEAD requests MUST NOT include a request body.') +function verbFunc (verb) { + var method = verb === 'del' ? 'DELETE' : verb.toUpperCase() + return function (uri, options, callback) { + var params = initParams(uri, options, callback) + params.method = method + return request(params, params.callback) } - - return requester(params)(params.uri || null, params.options, params.callback) } -request.post = function (uri, options, callback) { - var params = initParams(uri, options, callback) - params.options.method = 'POST' - return requester(params)(params.uri || null, params.options, params.callback) -} +// define like this to please codeintel/intellisense IDEs +request.get = verbFunc('get') +request.head = verbFunc('head') +request.post = verbFunc('post') +request.put = verbFunc('put') +request.patch = verbFunc('patch') +request.del = verbFunc('del') -request.put = function (uri, options, callback) { - var params = initParams(uri, options, callback) - params.options.method = 'PUT' - return requester(params)(params.uri || null, params.options, params.callback) +request.jar = function (store) { + return cookies.jar(store) } -request.patch = function (uri, options, callback) { - var params = initParams(uri, options, callback) - params.options.method = 'PATCH' - return requester(params)(params.uri || null, params.options, params.callback) +request.cookie = function (str) { + return cookies.parse(str) } -request.del = function (uri, options, callback) { - var params = initParams(uri, options, callback) - params.options.method = 'DELETE' - return requester(params)(params.uri || null, params.options, params.callback) -} +function wrapRequestMethod (method, options, requester, verb) { -request.jar = function () { - return cookies.jar() -} + return function (uri, opts, callback) { + var params = initParams(uri, opts, callback) -request.cookie = function (str) { - return cookies.parse(str) -} + var headerlessOptions = extend({}, options) + delete headerlessOptions.headers + params = extend(headerlessOptions, params) -request.defaults = function (options, requester) { - var self = this - var wrap = function (method) { - var headerlessOptions = function (options) { - options = extend({}, options) - delete options.headers - return options + if (options.headers) { + var headers = extend({}, options.headers) + params.headers = extend(headers, params.headers) } - var getHeaders = function (params, options) { - return constructObject() - .extend(options.headers) - .extend(params.options.headers) - .done() + if (verb) { + params.method = (verb === 'del' ? 'DELETE' : verb.toUpperCase()) } - return function (uri, opts, callback) { - var params = initParams(uri, opts, callback) - params.options = extend(headerlessOptions(options), params.options) + if (isFunction(requester)) { + method = requester + } - if (options.headers) { - params.options.headers = getHeaders(params, options) - } + return method(params, params.callback) + } +} - if (isFunction(requester)) { - if (method === self) { - method = requester - } else { - params.options._requester = requester - } - } +request.defaults = function (options, requester) { + var self = this - return method(params.options, params.callback) - } + if (typeof options === 'function') { + requester = options + options = {} } - var defaults = wrap(self) - defaults.get = wrap(self.get) - defaults.patch = wrap(self.patch) - defaults.post = wrap(self.post) - defaults.put = wrap(self.put) - defaults.head = wrap(self.head) - defaults.del = wrap(self.del) - defaults.cookie = wrap(self.cookie) + var defaults = wrapRequestMethod(self, options, requester) + + var verbs = ['get', 'head', 'post', 'put', 'patch', 'del'] + verbs.forEach(function(verb) { + defaults[verb] = wrapRequestMethod(self[verb], options, requester, verb) + }) + + defaults.cookie = wrapRequestMethod(self.cookie, options, requester) defaults.jar = self.jar defaults.defaults = self.defaults return defaults } request.forever = function (agentOptions, optionsArg) { - var options = constructObject() + var options = {} if (optionsArg) { - options.extend(optionsArg) + options = extend({}, optionsArg) } if (agentOptions) { options.agentOptions = agentOptions } - options.extend({forever: true}) - return request.defaults(options.done()) + options.forever = true + return request.defaults(options) } // Exports module.exports = request request.Request = require('./request') -request.debug = process.env.NODE_DEBUG && /\brequest\b/.test(process.env.NODE_DEBUG) request.initParams = initParams + +// Backwards compatibility for request.debug +Object.defineProperty(request, 'debug', { + enumerable : true, + get : function() { + return request.Request.debug + }, + set : function(debug) { + request.Request.debug = debug + } +}) diff --git a/deps/npm/node_modules/request/lib/auth.js b/deps/npm/node_modules/request/lib/auth.js new file mode 100644 index 00000000000..1be1f42587b --- /dev/null +++ b/deps/npm/node_modules/request/lib/auth.js @@ -0,0 +1,153 @@ +'use strict' + +var caseless = require('caseless') + , uuid = require('node-uuid') + , helpers = require('./helpers') + +var md5 = helpers.md5 + , toBase64 = helpers.toBase64 + + +function Auth (request) { + // define all public properties here + this.request = request + this.hasAuth = false + this.sentAuth = false + this.bearerToken = null + this.user = null + this.pass = null +} + +Auth.prototype.basic = function (user, pass, sendImmediately) { + var self = this + if (typeof user !== 'string' || (pass !== undefined && typeof pass !== 'string')) { + self.request.emit('error', new Error('auth() received invalid user or password')) + } + self.user = user + self.pass = pass + self.hasAuth = true + var header = user + ':' + (pass || '') + if (sendImmediately || typeof sendImmediately === 'undefined') { + var authHeader = 'Basic ' + toBase64(header) + self.sentAuth = true + return authHeader + } +} + +Auth.prototype.bearer = function (bearer, sendImmediately) { + var self = this + self.bearerToken = bearer + self.hasAuth = true + if (sendImmediately || typeof sendImmediately === 'undefined') { + if (typeof bearer === 'function') { + bearer = bearer() + } + var authHeader = 'Bearer ' + (bearer || '') + self.sentAuth = true + return authHeader + } +} + +Auth.prototype.digest = function (method, path, authHeader) { + // TODO: More complete implementation of RFC 2617. + // - check challenge.algorithm + // - support algorithm="MD5-sess" + // - handle challenge.domain + // - support qop="auth-int" only + // - handle Authentication-Info (not necessarily?) + // - check challenge.stale (not necessarily?) + // - increase nc (not necessarily?) + // For reference: + // http://tools.ietf.org/html/rfc2617#section-3 + // https://github.com/bagder/curl/blob/master/lib/http_digest.c + + var self = this + + var challenge = {} + var re = /([a-z0-9_-]+)=(?:"([^"]+)"|([a-z0-9_-]+))/gi + for (;;) { + var match = re.exec(authHeader) + if (!match) { + break + } + challenge[match[1]] = match[2] || match[3] + } + + var ha1 = md5(self.user + ':' + challenge.realm + ':' + self.pass) + var ha2 = md5(method + ':' + path) + var qop = /(^|,)\s*auth\s*($|,)/.test(challenge.qop) && 'auth' + var nc = qop && '00000001' + var cnonce = qop && uuid().replace(/-/g, '') + var digestResponse = qop + ? md5(ha1 + ':' + challenge.nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + ha2) + : md5(ha1 + ':' + challenge.nonce + ':' + ha2) + var authValues = { + username: self.user, + realm: challenge.realm, + nonce: challenge.nonce, + uri: path, + qop: qop, + response: digestResponse, + nc: nc, + cnonce: cnonce, + algorithm: challenge.algorithm, + opaque: challenge.opaque + } + + authHeader = [] + for (var k in authValues) { + if (authValues[k]) { + if (k === 'qop' || k === 'nc' || k === 'algorithm') { + authHeader.push(k + '=' + authValues[k]) + } else { + authHeader.push(k + '="' + authValues[k] + '"') + } + } + } + authHeader = 'Digest ' + authHeader.join(', ') + self.sentAuth = true + return authHeader +} + +Auth.prototype.onRequest = function (user, pass, sendImmediately, bearer) { + var self = this + , request = self.request + + var authHeader + if (bearer === undefined && user === undefined) { + self.request.emit('error', new Error('no auth mechanism defined')) + } else if (bearer !== undefined) { + authHeader = self.bearer(bearer, sendImmediately) + } else { + authHeader = self.basic(user, pass, sendImmediately) + } + if (authHeader) { + request.setHeader('authorization', authHeader) + } +} + +Auth.prototype.onResponse = function (response) { + var self = this + , request = self.request + + if (!self.hasAuth || self.sentAuth) { return null } + + var c = caseless(response.headers) + + var authHeader = c.get('www-authenticate') + var authVerb = authHeader && authHeader.split(' ')[0].toLowerCase() + request.debug('reauth', authVerb) + + switch (authVerb) { + case 'basic': + return self.basic(self.user, self.pass, true) + + case 'bearer': + return self.bearer(self.bearerToken, true) + + case 'digest': + return self.digest(request.method, request.path, authHeader) + } +} + +exports.Auth = Auth diff --git a/deps/npm/node_modules/request/lib/cookies.js b/deps/npm/node_modules/request/lib/cookies.js index 017bdb467e4..adde7c6012b 100644 --- a/deps/npm/node_modules/request/lib/cookies.js +++ b/deps/npm/node_modules/request/lib/cookies.js @@ -13,16 +13,13 @@ exports.parse = function(str) { if (typeof str !== 'string') { throw new Error('The cookie function only accepts STRING as param') } - if (!Cookie) { - return null - } return Cookie.parse(str) } // Adapt the sometimes-Async api of tough.CookieJar to our requirements -function RequestJar() { +function RequestJar(store) { var self = this - self._jar = new CookieJar() + self._jar = new CookieJar(store) } RequestJar.prototype.setCookie = function(cookieOrStr, uri, options) { var self = this @@ -37,14 +34,6 @@ RequestJar.prototype.getCookies = function(uri) { return self._jar.getCookiesSync(uri) } -exports.jar = function() { - if (!CookieJar) { - // tough-cookie not loaded, return a stub object: - return { - setCookie: function(){}, - getCookieString: function(){}, - getCookies: function(){} - } - } - return new RequestJar() +exports.jar = function(store) { + return new RequestJar(store) } diff --git a/deps/npm/node_modules/request/lib/debug.js b/deps/npm/node_modules/request/lib/debug.js deleted file mode 100644 index 25e3dedc7ef..00000000000 --- a/deps/npm/node_modules/request/lib/debug.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict' - -var util = require('util') - , request = require('../index') - - -module.exports = function debug() { - if (request.debug) { - console.error('REQUEST %s', util.format.apply(util, arguments)) - } -} diff --git a/deps/npm/node_modules/request/lib/getProxyFromURI.js b/deps/npm/node_modules/request/lib/getProxyFromURI.js new file mode 100644 index 00000000000..c2013a6e125 --- /dev/null +++ b/deps/npm/node_modules/request/lib/getProxyFromURI.js @@ -0,0 +1,79 @@ +'use strict' + +function formatHostname(hostname) { + // canonicalize the hostname, so that 'oogle.com' won't match 'google.com' + return hostname.replace(/^\.*/, '.').toLowerCase() +} + +function parseNoProxyZone(zone) { + zone = zone.trim().toLowerCase() + + var zoneParts = zone.split(':', 2) + , zoneHost = formatHostname(zoneParts[0]) + , zonePort = zoneParts[1] + , hasPort = zone.indexOf(':') > -1 + + return {hostname: zoneHost, port: zonePort, hasPort: hasPort} +} + +function uriInNoProxy(uri, noProxy) { + var port = uri.port || (uri.protocol === 'https:' ? '443' : '80') + , hostname = formatHostname(uri.hostname) + , noProxyList = noProxy.split(',') + + // iterate through the noProxyList until it finds a match. + return noProxyList.map(parseNoProxyZone).some(function(noProxyZone) { + var isMatchedAt = hostname.indexOf(noProxyZone.hostname) + , hostnameMatched = ( + isMatchedAt > -1 && + (isMatchedAt === hostname.length - noProxyZone.hostname.length) + ) + + if (noProxyZone.hasPort) { + return (port === noProxyZone.port) && hostnameMatched + } + + return hostnameMatched + }) +} + +function getProxyFromURI(uri) { + // Decide the proper request proxy to use based on the request URI object and the + // environmental variables (NO_PROXY, HTTP_PROXY, etc.) + // respect NO_PROXY environment variables (see: http://lynx.isc.org/current/breakout/lynx_help/keystrokes/environments.html) + + var noProxy = process.env.NO_PROXY || process.env.no_proxy || '' + + // if the noProxy is a wildcard then return null + + if (noProxy === '*') { + return null + } + + // if the noProxy is not empty and the uri is found return null + + if (noProxy !== '' && uriInNoProxy(uri, noProxy)) { + return null + } + + // Check for HTTP or HTTPS Proxy in environment Else default to null + + if (uri.protocol === 'http:') { + return process.env.HTTP_PROXY || + process.env.http_proxy || null + } + + if (uri.protocol === 'https:') { + return process.env.HTTPS_PROXY || + process.env.https_proxy || + process.env.HTTP_PROXY || + process.env.http_proxy || null + } + + // if none of that works, return null + // (What uri protocol are you using then?) + + return null +} + +module.exports = getProxyFromURI diff --git a/deps/npm/node_modules/request/lib/har.js b/deps/npm/node_modules/request/lib/har.js new file mode 100644 index 00000000000..83453a3274b --- /dev/null +++ b/deps/npm/node_modules/request/lib/har.js @@ -0,0 +1,205 @@ +'use strict' + +var fs = require('fs') +var qs = require('querystring') +var validate = require('har-validator') +var util = require('util') + +function Har (request) { + this.request = request +} + +Har.prototype.reducer = function (obj, pair) { + // new property ? + if (obj[pair.name] === undefined) { + obj[pair.name] = pair.value + return obj + } + + // existing? convert to array + var arr = [ + obj[pair.name], + pair.value + ] + + obj[pair.name] = arr + + return obj +} + +Har.prototype.prep = function (data) { + // construct utility properties + data.queryObj = {} + data.headersObj = {} + data.postData.jsonObj = false + data.postData.paramsObj = false + + // construct query objects + if (data.queryString && data.queryString.length) { + data.queryObj = data.queryString.reduce(this.reducer, {}) + } + + // construct headers objects + if (data.headers && data.headers.length) { + // loweCase header keys + data.headersObj = data.headers.reduceRight(function (headers, header) { + headers[header.name] = header.value + return headers + }, {}) + } + + // construct Cookie header + if (data.cookies && data.cookies.length) { + var cookies = data.cookies.map(function (cookie) { + return cookie.name + '=' + cookie.value + }) + + if (cookies.length) { + data.headersObj.cookie = cookies.join('; ') + } + } + + // prep body + switch (data.postData.mimeType) { + case 'multipart/mixed': + case 'multipart/related': + case 'multipart/form-data': + case 'multipart/alternative': + // reset values + data.postData.mimeType = 'multipart/form-data' + break + + case 'application/x-www-form-urlencoded': + if (!data.postData.params) { + data.postData.text = '' + } else { + data.postData.paramsObj = data.postData.params.reduce(this.reducer, {}) + + // always overwrite + data.postData.text = qs.stringify(data.postData.paramsObj) + } + break + + case 'text/json': + case 'text/x-json': + case 'application/json': + case 'application/x-json': + data.postData.mimeType = 'application/json' + + if (data.postData.text) { + try { + data.postData.jsonObj = JSON.parse(data.postData.text) + } catch (e) { + this.request.debug(e) + + // force back to text/plain + data.postData.mimeType = 'text/plain' + } + } + break + } + + return data +} + +Har.prototype.options = function (options) { + // skip if no har property defined + if (!options.har) { + return options + } + + var har = util._extend({}, options.har) + + // only process the first entry + if (har.log && har.log.entries) { + har = har.log.entries[0] + } + + // add optional properties to make validation successful + har.url = har.url || options.url || options.uri || options.baseUrl || '/' + har.httpVersion = har.httpVersion || 'HTTP/1.1' + har.queryString = har.queryString || [] + har.headers = har.headers || [] + har.cookies = har.cookies || [] + har.postData = har.postData || {} + har.postData.mimeType = har.postData.mimeType || 'application/octet-stream' + + har.bodySize = 0 + har.headersSize = 0 + har.postData.size = 0 + + if (!validate.request(har)) { + return options + } + + // clean up and get some utility properties + var req = this.prep(har) + + // construct new options + if (req.url) { + options.url = req.url + } + + if (req.method) { + options.method = req.method + } + + if (Object.keys(req.queryObj).length) { + options.qs = req.queryObj + } + + if (Object.keys(req.headersObj).length) { + options.headers = req.headersObj + } + + switch (req.postData.mimeType) { + case 'application/x-www-form-urlencoded': + options.form = req.postData.paramsObj + break + + case 'application/json': + if (req.postData.jsonObj) { + options.body = req.postData.jsonObj + options.json = true + } + break + + case 'multipart/form-data': + options.formData = {} + + req.postData.params.forEach(function (param) { + var attachment = {} + + if (!param.fileName && !param.fileName && !param.contentType) { + options.formData[param.name] = param.value + return + } + + // attempt to read from disk! + if (param.fileName && !param.value) { + attachment.value = fs.createReadStream(param.fileName) + } else if (param.value) { + attachment.value = param.value + } + + if (param.fileName) { + attachment.options = { + filename: param.fileName, + contentType: param.contentType ? param.contentType : null + } + } + + options.formData[param.name] = attachment + }) + break + + default: + if (req.postData.text) { + options.body = req.postData.text + } + } + + return options +} + +exports.Har = Har diff --git a/deps/npm/node_modules/request/lib/helpers.js b/deps/npm/node_modules/request/lib/helpers.js index fa5712ffbc2..1d588ca9493 100644 --- a/deps/npm/node_modules/request/lib/helpers.js +++ b/deps/npm/node_modules/request/lib/helpers.js @@ -1,57 +1,26 @@ 'use strict' -var extend = require('util')._extend - , jsonSafeStringify = require('json-stringify-safe') +var jsonSafeStringify = require('json-stringify-safe') , crypto = require('crypto') function deferMethod() { - if(typeof setImmediate === 'undefined') { + if (typeof setImmediate === 'undefined') { return process.nextTick } - - return setImmediate -} - -function constructObject(initialObject) { - initialObject = initialObject || {} - - return { - extend: function (object) { - return constructObject(extend(initialObject, object)) - }, - done: function () { - return initialObject - } - } -} -function constructOptionsFrom(uri, options) { - var params = constructObject() - if (typeof options === 'object') { - params.extend(options).extend({uri: uri}) - } else if (typeof uri === 'string') { - params.extend({uri: uri}) - } else { - params.extend(uri) - } - return params.done() + return setImmediate } function isFunction(value) { return typeof value === 'function' } -function filterForCallback(values) { - var callbacks = values.filter(isFunction) - return callbacks[0] -} - function paramsHaveRequestBody(params) { return ( - params.options.body || - params.options.requestBodyStream || - (params.options.json && typeof params.options.json !== 'boolean') || - params.options.multipart + params.body || + params.requestBodyStream || + (params.json && typeof params.json !== 'boolean') || + params.multipart ) } @@ -74,13 +43,10 @@ function isReadStream (rs) { } function toBase64 (str) { - return (new Buffer(str || '', 'ascii')).toString('base64') + return (new Buffer(str || '', 'utf8')).toString('base64') } exports.isFunction = isFunction -exports.constructObject = constructObject -exports.constructOptionsFrom = constructOptionsFrom -exports.filterForCallback = filterForCallback exports.paramsHaveRequestBody = paramsHaveRequestBody exports.safeStringify = safeStringify exports.md5 = md5 diff --git a/deps/npm/node_modules/request/lib/multipart.js b/deps/npm/node_modules/request/lib/multipart.js new file mode 100644 index 00000000000..03618588cc6 --- /dev/null +++ b/deps/npm/node_modules/request/lib/multipart.js @@ -0,0 +1,109 @@ +'use strict' + +var uuid = require('node-uuid') + , CombinedStream = require('combined-stream') + , isstream = require('isstream') + + +function Multipart (request) { + this.request = request + this.boundary = uuid() + this.chunked = false + this.body = null +} + +Multipart.prototype.isChunked = function (options) { + var self = this + , chunked = false + , parts = options.data || options + + if (!parts.forEach) { + self.request.emit('error', new Error('Argument error, options.multipart.')) + } + + if (options.chunked !== undefined) { + chunked = options.chunked + } + + if (self.request.getHeader('transfer-encoding') === 'chunked') { + chunked = true + } + + if (!chunked) { + parts.forEach(function (part) { + if (typeof part.body === 'undefined') { + self.request.emit('error', new Error('Body attribute missing in multipart.')) + } + if (isstream(part.body)) { + chunked = true + } + }) + } + + return chunked +} + +Multipart.prototype.setHeaders = function (chunked) { + var self = this + + if (chunked && !self.request.hasHeader('transfer-encoding')) { + self.request.setHeader('transfer-encoding', 'chunked') + } + + var header = self.request.getHeader('content-type') + + if (!header || header.indexOf('multipart') === -1) { + self.request.setHeader('content-type', 'multipart/related; boundary=' + self.boundary) + } else { + if (header.indexOf('boundary') !== -1) { + self.boundary = header.replace(/.*boundary=([^\s;]+).*/, '$1') + } else { + self.request.setHeader('content-type', header + '; boundary=' + self.boundary) + } + } +} + +Multipart.prototype.build = function (parts, chunked) { + var self = this + var body = chunked ? new CombinedStream() : [] + + function add (part) { + return chunked ? body.append(part) : body.push(new Buffer(part)) + } + + if (self.request.preambleCRLF) { + add('\r\n') + } + + parts.forEach(function (part) { + var preamble = '--' + self.boundary + '\r\n' + Object.keys(part).forEach(function (key) { + if (key === 'body') { return } + preamble += key + ': ' + part[key] + '\r\n' + }) + preamble += '\r\n' + add(preamble) + add(part.body) + add('\r\n') + }) + add('--' + self.boundary + '--') + + if (self.request.postambleCRLF) { + add('\r\n') + } + + return body +} + +Multipart.prototype.onRequest = function (options) { + var self = this + + var chunked = self.isChunked(options) + , parts = options.data || options + + self.setHeaders(chunked) + self.chunked = chunked + self.body = self.build(parts, chunked) +} + +exports.Multipart = Multipart diff --git a/deps/npm/node_modules/request/lib/oauth.js b/deps/npm/node_modules/request/lib/oauth.js new file mode 100644 index 00000000000..84059724a78 --- /dev/null +++ b/deps/npm/node_modules/request/lib/oauth.js @@ -0,0 +1,144 @@ +'use strict' + +var qs = require('qs') + , caseless = require('caseless') + , uuid = require('node-uuid') + , oauth = require('oauth-sign') + , crypto = require('crypto') + + +function OAuth (request) { + this.request = request + this.params = null +} + +OAuth.prototype.buildParams = function (_oauth, uri, method, query, form, qsLib) { + var oa = {} + for (var i in _oauth) { + oa['oauth_' + i] = _oauth[i] + } + if (!oa.oauth_version) { + oa.oauth_version = '1.0' + } + if (!oa.oauth_timestamp) { + oa.oauth_timestamp = Math.floor( Date.now() / 1000 ).toString() + } + if (!oa.oauth_nonce) { + oa.oauth_nonce = uuid().replace(/-/g, '') + } + if (!oa.oauth_signature_method) { + oa.oauth_signature_method = 'HMAC-SHA1' + } + + var consumer_secret_or_private_key = oa.oauth_consumer_secret || oa.oauth_private_key + delete oa.oauth_consumer_secret + delete oa.oauth_private_key + + var token_secret = oa.oauth_token_secret + delete oa.oauth_token_secret + + var realm = oa.oauth_realm + delete oa.oauth_realm + delete oa.oauth_transport_method + + var baseurl = uri.protocol + '//' + uri.host + uri.pathname + var params = qsLib.parse([].concat(query, form, qsLib.stringify(oa)).join('&')) + + oa.oauth_signature = oauth.sign( + oa.oauth_signature_method, + method, + baseurl, + params, + consumer_secret_or_private_key, + token_secret) + + if (realm) { + oa.realm = realm + } + + return oa +} + +OAuth.prototype.buildBodyHash = function(_oauth, body) { + if (['HMAC-SHA1', 'RSA-SHA1'].indexOf(_oauth.signature_method || 'HMAC-SHA1') < 0) { + this.request.emit('error', new Error('oauth: ' + _oauth.signature_method + + ' signature_method not supported with body_hash signing.')) + } + + var shasum = crypto.createHash('sha1') + shasum.update(body || '') + var sha1 = shasum.digest('hex') + + return new Buffer(sha1).toString('base64') +} + +OAuth.prototype.concatParams = function (oa, sep, wrap) { + wrap = wrap || '' + + var params = Object.keys(oa).filter(function (i) { + return i !== 'realm' && i !== 'oauth_signature' + }).sort() + + if (oa.realm) { + params.splice(0, 1, 'realm') + } + params.push('oauth_signature') + + return params.map(function (i) { + return i + '=' + wrap + oauth.rfc3986(oa[i]) + wrap + }).join(sep) +} + +OAuth.prototype.onRequest = function (_oauth) { + var self = this + self.params = _oauth + + var uri = self.request.uri || {} + , method = self.request.method || '' + , headers = caseless(self.request.headers) + , body = self.request.body || '' + , qsLib = self.request.qsLib || qs + + var form + , query + , contentType = headers.get('content-type') || '' + , formContentType = 'application/x-www-form-urlencoded' + , transport = _oauth.transport_method || 'header' + + if (contentType.slice(0, formContentType.length) === formContentType) { + contentType = formContentType + form = body + } + if (uri.query) { + query = uri.query + } + if (transport === 'body' && (method !== 'POST' || contentType !== formContentType)) { + self.request.emit('error', new Error('oauth: transport_method of body requires POST ' + + 'and content-type ' + formContentType)) + } + + if (!form && typeof _oauth.body_hash === 'boolean') { + _oauth.body_hash = self.buildBodyHash(_oauth, self.request.body.toString()) + } + + var oa = self.buildParams(_oauth, uri, method, query, form, qsLib) + + switch (transport) { + case 'header': + self.request.setHeader('Authorization', 'OAuth ' + self.concatParams(oa, ',', '"')) + break + + case 'query': + self.request.path = (query ? '&' : '?') + self.concatParams(oa, '&') + break + + case 'body': + self.request.body = (form ? form + '&' : '') + self.concatParams(oa, '&') + break + + default: + self.request.emit('error', new Error('oauth: transport_method invalid')) + } +} + +exports.OAuth = OAuth diff --git a/deps/npm/node_modules/request/lib/querystring.js b/deps/npm/node_modules/request/lib/querystring.js new file mode 100644 index 00000000000..baf5e8021f4 --- /dev/null +++ b/deps/npm/node_modules/request/lib/querystring.js @@ -0,0 +1,51 @@ +'use strict' + +var qs = require('qs') + , querystring = require('querystring') + + +function Querystring (request) { + this.request = request + this.lib = null + this.useQuerystring = null + this.parseOptions = null + this.stringifyOptions = null +} + +Querystring.prototype.init = function (options) { + if (this.lib) {return} + + this.useQuerystring = options.useQuerystring + this.lib = (this.useQuerystring ? querystring : qs) + + this.parseOptions = options.qsParseOptions || {} + this.stringifyOptions = options.qsStringifyOptions || {} +} + +Querystring.prototype.stringify = function (obj) { + return (this.useQuerystring) + ? this.rfc3986(this.lib.stringify(obj, + this.stringifyOptions.sep || null, + this.stringifyOptions.eq || null, + this.stringifyOptions)) + : this.lib.stringify(obj, this.stringifyOptions) +} + +Querystring.prototype.parse = function (str) { + return (this.useQuerystring) + ? this.lib.parse(str, + this.parseOptions.sep || null, + this.parseOptions.eq || null, + this.parseOptions) + : this.lib.parse(str, this.parseOptions) +} + +Querystring.prototype.rfc3986 = function (str) { + return str.replace(/[!'()*]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase() + }) +} + +Querystring.prototype.unescape = querystring.unescape + +exports.Querystring = Querystring diff --git a/deps/npm/node_modules/request/lib/redirect.js b/deps/npm/node_modules/request/lib/redirect.js new file mode 100644 index 00000000000..1d4650299fa --- /dev/null +++ b/deps/npm/node_modules/request/lib/redirect.js @@ -0,0 +1,153 @@ +'use strict' + +var url = require('url') +var isUrl = /^https?:/ + +function Redirect (request) { + this.request = request + this.followRedirect = true + this.followRedirects = true + this.followAllRedirects = false + this.allowRedirect = function () {return true} + this.maxRedirects = 10 + this.redirects = [] + this.redirectsFollowed = 0 + this.removeRefererHeader = false +} + +Redirect.prototype.onRequest = function (options) { + var self = this + + if (options.maxRedirects !== undefined) { + self.maxRedirects = options.maxRedirects + } + if (typeof options.followRedirect === 'function') { + self.allowRedirect = options.followRedirect + } + if (options.followRedirect !== undefined) { + self.followRedirects = !!options.followRedirect + } + if (options.followAllRedirects !== undefined) { + self.followAllRedirects = options.followAllRedirects + } + if (self.followRedirects || self.followAllRedirects) { + self.redirects = self.redirects || [] + } + if (options.removeRefererHeader !== undefined) { + self.removeRefererHeader = options.removeRefererHeader + } +} + +Redirect.prototype.redirectTo = function (response) { + var self = this + , request = self.request + + var redirectTo = null + if (response.statusCode >= 300 && response.statusCode < 400 && response.caseless.has('location')) { + var location = response.caseless.get('location') + request.debug('redirect', location) + + if (self.followAllRedirects) { + redirectTo = location + } else if (self.followRedirects) { + switch (request.method) { + case 'PATCH': + case 'PUT': + case 'POST': + case 'DELETE': + // Do not follow redirects + break + default: + redirectTo = location + break + } + } + } else if (response.statusCode === 401) { + var authHeader = request._auth.onResponse(response) + if (authHeader) { + request.setHeader('authorization', authHeader) + redirectTo = request.uri + } + } + return redirectTo +} + +Redirect.prototype.onResponse = function (response) { + var self = this + , request = self.request + + var redirectTo = self.redirectTo(response) + if (!redirectTo || !self.allowRedirect.call(request, response)) { + return false + } + + request.debug('redirect to', redirectTo) + + // ignore any potential response body. it cannot possibly be useful + // to us at this point. + // response.resume should be defined, but check anyway before calling. Workaround for browserify. + if (response.resume) { + response.resume() + } + + if (self.redirectsFollowed >= self.maxRedirects) { + request.emit('error', new Error('Exceeded maxRedirects. Probably stuck in a redirect loop ' + request.uri.href)) + return false + } + self.redirectsFollowed += 1 + + if (!isUrl.test(redirectTo)) { + redirectTo = url.resolve(request.uri.href, redirectTo) + } + + var uriPrev = request.uri + request.uri = url.parse(redirectTo) + + // handle the case where we change protocol from https to http or vice versa + if (request.uri.protocol !== uriPrev.protocol) { + request._updateProtocol() + } + + self.redirects.push( + { statusCode : response.statusCode + , redirectUri: redirectTo + } + ) + if (self.followAllRedirects && response.statusCode !== 401 && response.statusCode !== 307) { + request.method = 'GET' + } + // request.method = 'GET' // Force all redirects to use GET || commented out fixes #215 + delete request.src + delete request.req + delete request.agent + delete request._started + if (response.statusCode !== 401 && response.statusCode !== 307) { + // Remove parameters from the previous response, unless this is the second request + // for a server that requires digest authentication. + delete request.body + delete request._form + if (request.headers) { + request.removeHeader('host') + request.removeHeader('content-type') + request.removeHeader('content-length') + if (request.uri.hostname !== request.originalHost.split(':')[0]) { + // Remove authorization if changing hostnames (but not if just + // changing ports or protocols). This matches the behavior of curl: + // https://github.com/bagder/curl/blob/6beb0eee/lib/http.c#L710 + request.removeHeader('authorization') + } + } + } + + if (!self.removeRefererHeader) { + request.setHeader('referer', request.uri.href) + } + + request.emit('redirect') + + request.init() + + return true +} + +exports.Redirect = Redirect diff --git a/deps/npm/node_modules/request/node_modules/aws-sign2/package.json b/deps/npm/node_modules/request/node_modules/aws-sign2/package.json index 9104550c823..89adc7ded5b 100644 --- a/deps/npm/node_modules/request/node_modules/aws-sign2/package.json +++ b/deps/npm/node_modules/request/node_modules/aws-sign2/package.json @@ -8,7 +8,7 @@ "description": "AWS signing. Originally pulled from LearnBoost/knox, maintained as vendor in request, now a standalone module.", "version": "0.5.0", "repository": { - "url": "https://github.com/mikeal/aws-sign" + "url": "git+https://github.com/mikeal/aws-sign.git" }, "main": "index.js", "dependencies": {}, @@ -22,26 +22,9 @@ "bugs": { "url": "https://github.com/mikeal/aws-sign/issues" }, + "homepage": "https://github.com/mikeal/aws-sign#readme", "_id": "aws-sign2@0.5.0", - "dist": { - "shasum": "c57103f7a17fc037f02d7c2e64b602ea223f7d63", - "tarball": "http://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz" - }, - "_from": "aws-sign2@>=0.5.0 <0.6.0", - "_npmVersion": "1.3.2", - "_npmUser": { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - }, - "maintainers": [ - { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - } - ], - "directories": {}, "_shasum": "c57103f7a17fc037f02d7c2e64b602ea223f7d63", "_resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz", - "homepage": "https://github.com/mikeal/aws-sign", - "scripts": {} + "_from": "aws-sign2@>=0.5.0 <0.6.0" } diff --git a/deps/npm/node_modules/request/node_modules/bl/README.md b/deps/npm/node_modules/request/node_modules/bl/README.md index 1753cc40b10..6b7fb6d3486 100644 --- a/deps/npm/node_modules/request/node_modules/bl/README.md +++ b/deps/npm/node_modules/request/node_modules/bl/README.md @@ -190,6 +190,9 @@ See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html)< ======= -## License + +## License & copyright -**bl** is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details. +Copyright (c) 2013-2014 bl contributors (listed above). + +bl is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details. diff --git a/deps/npm/node_modules/request/node_modules/bl/bl.js b/deps/npm/node_modules/request/node_modules/bl/bl.js index d1ea3b5c2e2..7a2f99788e6 100644 --- a/deps/npm/node_modules/request/node_modules/bl/bl.js +++ b/deps/npm/node_modules/request/node_modules/bl/bl.js @@ -1,4 +1,4 @@ -var DuplexStream = require('readable-stream').Duplex +var DuplexStream = require('readable-stream/duplex') , util = require('util') function BufferList (callback) { diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/.npmignore b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/.npmignore similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/.npmignore rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/.npmignore diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/LICENSE b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/LICENSE similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/LICENSE rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/LICENSE diff --git a/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/README.md b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/README.md new file mode 100644 index 00000000000..5c455f4205b --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/README.md @@ -0,0 +1,14 @@ +# readable-stream + +***Node-core streams for userland*** + +[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/) +[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/) + +This package is a mirror of the Streams2 and Streams3 implementations in Node-core. + +If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core. + +**readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12. + +**readable-stream** uses proper patch-level versioning so if you pin to `"~1.0.0"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `"~1.1.0"` diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/duplex.js b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/duplex.js similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/duplex.js rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/duplex.js diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/lib/_stream_duplex.js b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/lib/_stream_duplex.js rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/lib/_stream_passthrough.js b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/lib/_stream_passthrough.js rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/lib/_stream_readable.js b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js similarity index 78% rename from deps/npm/node_modules/sha/node_modules/readable-stream/lib/_stream_readable.js rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js index 19ab3588984..630722099e9 100644 --- a/deps/npm/node_modules/sha/node_modules/readable-stream/lib/_stream_readable.js +++ b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js @@ -49,29 +49,15 @@ util.inherits = require('inherits'); var StringDecoder; - -/**/ -var debug = require('util'); -if (debug && debug.debuglog) { - debug = debug.debuglog('stream'); -} else { - debug = function () {}; -} -/**/ - - util.inherits(Readable, Stream); function ReadableState(options, stream) { - var Duplex = require('./_stream_duplex'); - options = options || {}; // the point at which it stops calling _read() to fill the buffer // Note: 0 is a valid value, means "don't call _read preemptively ever" var hwm = options.highWaterMark; - var defaultHwm = options.objectMode ? 16 : 16 * 1024; - this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; + this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; // cast to ints. this.highWaterMark = ~~this.highWaterMark; @@ -80,13 +66,19 @@ function ReadableState(options, stream) { this.length = 0; this.pipes = null; this.pipesCount = 0; - this.flowing = null; + this.flowing = false; this.ended = false; this.endEmitted = false; this.reading = false; + // In streams that never have any data, and do push(null) right away, + // the consumer can miss the 'end' event if they do some I/O before + // consuming the stream. So, we don't emit('end') until some reading + // happens. + this.calledRead = false; + // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any + // or on a later tick. We set this to true at first, becuase any // actions that shouldn't happen until "later" should generally also // not happen before the first write call. this.sync = true; @@ -102,9 +94,6 @@ function ReadableState(options, stream) { // make all the buffer merging and length checks go away this.objectMode = !!options.objectMode; - if (stream instanceof Duplex) - this.objectMode = this.objectMode || !!options.readableObjectMode; - // Crypto is kind of old and crusty. Historically, its default string // encoding is 'binary' so we have to make this configurable. // Everything else in the universe uses 'utf8', though. @@ -131,8 +120,6 @@ function ReadableState(options, stream) { } function Readable(options) { - var Duplex = require('./_stream_duplex'); - if (!(this instanceof Readable)) return new Readable(options); @@ -151,7 +138,7 @@ function Readable(options) { Readable.prototype.push = function(chunk, encoding) { var state = this._readableState; - if (util.isString(chunk) && !state.objectMode) { + if (typeof chunk === 'string' && !state.objectMode) { encoding = encoding || state.defaultEncoding; if (encoding !== state.encoding) { chunk = new Buffer(chunk, encoding); @@ -172,7 +159,7 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) { var er = chunkInvalid(state, chunk); if (er) { stream.emit('error', er); - } else if (util.isNullOrUndefined(chunk)) { + } else if (chunk === null || chunk === undefined) { state.reading = false; if (!state.ended) onEofChunk(stream, state); @@ -187,25 +174,18 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) { if (state.decoder && !addToFront && !encoding) chunk = state.decoder.write(chunk); - if (!addToFront) - state.reading = false; - - // if we want the data now, just emit it. - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) { + state.buffer.unshift(chunk); } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) - state.buffer.unshift(chunk); - else - state.buffer.push(chunk); - - if (state.needReadable) - emitReadable(stream); + state.reading = false; + state.buffer.push(chunk); } + if (state.needReadable) + emitReadable(stream); + maybeReadMore(stream, state); } } else if (!addToFront) { @@ -237,7 +217,6 @@ Readable.prototype.setEncoding = function(enc) { StringDecoder = require('string_decoder/').StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; - return this; }; // Don't raise the hwm > 128MB @@ -261,7 +240,7 @@ function howMuchToRead(n, state) { if (state.objectMode) return n === 0 ? 0 : 1; - if (isNaN(n) || util.isNull(n)) { + if (n === null || isNaN(n)) { // only flow one buffer at a time if (state.flowing && state.buffer.length) return state.buffer[0].length; @@ -293,11 +272,12 @@ function howMuchToRead(n, state) { // you can override either this method, or the async _read(n) below. Readable.prototype.read = function(n) { - debug('read', n); var state = this._readableState; + state.calledRead = true; var nOrig = n; + var ret; - if (!util.isNumber(n) || n > 0) + if (typeof n !== 'number' || n > 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we @@ -306,11 +286,7 @@ Readable.prototype.read = function(n) { if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) - endReadable(this); - else - emitReadable(this); + emitReadable(this); return null; } @@ -318,9 +294,28 @@ Readable.prototype.read = function(n) { // if we've ended, and we're now clear, then finish it up. if (n === 0 && state.ended) { + ret = null; + + // In cases where the decoder did not receive enough data + // to produce a full chunk, then immediately received an + // EOF, state.buffer will contain [, ]. + // howMuchToRead will see this and coerce the amount to + // read to zero (because it's looking at the length of the + // first in state.buffer), and we'll end up here. + // + // This can only happen via state.decoder -- no other venue + // exists for pushing a zero-length chunk into state.buffer + // and triggering this behavior. In this case, we return our + // remaining data and end the stream, if appropriate. + if (state.length > 0 && state.decoder) { + ret = fromList(n, state); + state.length -= ret.length; + } + if (state.length === 0) endReadable(this); - return null; + + return ret; } // All the actual chunk generation logic needs to be @@ -347,23 +342,17 @@ Readable.prototype.read = function(n) { // if we need a readable event, then we need to do some reading. var doRead = state.needReadable; - debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some - if (state.length === 0 || state.length - n < state.highWaterMark) { + if (state.length - n <= state.highWaterMark) doRead = true; - debug('length less than watermark', doRead); - } // however, if we've ended, then there's no point, and if we're already // reading, then it's unnecessary. - if (state.ended || state.reading) { + if (state.ended || state.reading) doRead = false; - debug('reading or ended', doRead); - } if (doRead) { - debug('do read'); state.reading = true; state.sync = true; // if the length is currently zero, then we *need* a readable event. @@ -374,18 +363,18 @@ Readable.prototype.read = function(n) { state.sync = false; } - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. + // If _read called its callback synchronously, then `reading` + // will be false, and we need to re-evaluate how much data we + // can return to the user. if (doRead && !state.reading) n = howMuchToRead(nOrig, state); - var ret; if (n > 0) ret = fromList(n, state); else ret = null; - if (util.isNull(ret)) { + if (ret === null) { state.needReadable = true; n = 0; } @@ -397,21 +386,21 @@ Readable.prototype.read = function(n) { if (state.length === 0 && !state.ended) state.needReadable = true; - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended && state.length === 0) + // If we happened to read() exactly the remaining amount in the + // buffer, and the EOF has been seen at this point, then make sure + // that we emit 'end' on the very next tick. + if (state.ended && !state.endEmitted && state.length === 0) endReadable(this); - if (!util.isNull(ret)) - this.emit('data', ret); - return ret; }; function chunkInvalid(state, chunk) { var er = null; - if (!util.isBuffer(chunk) && - !util.isString(chunk) && - !util.isNullOrUndefined(chunk) && + if (!Buffer.isBuffer(chunk) && + 'string' !== typeof chunk && + chunk !== null && + chunk !== undefined && !state.objectMode) { er = new TypeError('Invalid non-string/buffer chunk'); } @@ -429,8 +418,12 @@ function onEofChunk(stream, state) { } state.ended = true; - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); + // if we've ended and we have some data left, then emit + // 'readable' now to make sure it gets picked up. + if (state.length > 0) + emitReadable(stream); + else + endReadable(stream); } // Don't emit readable right away in sync mode, because this can trigger @@ -439,22 +432,20 @@ function onEofChunk(stream, state) { function emitReadable(stream) { var state = stream._readableState; state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) - process.nextTick(function() { - emitReadable_(stream); - }); - else + if (state.emittedReadable) + return; + + state.emittedReadable = true; + if (state.sync) + process.nextTick(function() { emitReadable_(stream); - } + }); + else + emitReadable_(stream); } function emitReadable_(stream) { - debug('emit readable'); stream.emit('readable'); - flow(stream); } @@ -477,7 +468,6 @@ function maybeReadMore_(stream, state) { var len = state.length; while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { - debug('maybeReadMore read 0'); stream.read(0); if (len === state.length) // didn't get any data, stop spinning. @@ -512,7 +502,6 @@ Readable.prototype.pipe = function(dest, pipeOpts) { break; } state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && @@ -526,14 +515,11 @@ Readable.prototype.pipe = function(dest, pipeOpts) { dest.on('unpipe', onunpipe); function onunpipe(readable) { - debug('onunpipe'); - if (readable === src) { - cleanup(); - } + if (readable !== src) return; + cleanup(); } function onend() { - debug('onend'); dest.end(); } @@ -545,7 +531,6 @@ Readable.prototype.pipe = function(dest, pipeOpts) { dest.on('drain', ondrain); function cleanup() { - debug('cleanup'); // cleanup event handlers once the pipe is broken dest.removeListener('close', onclose); dest.removeListener('finish', onfinish); @@ -554,34 +539,19 @@ Readable.prototype.pipe = function(dest, pipeOpts) { dest.removeListener('unpipe', onunpipe); src.removeListener('end', onend); src.removeListener('end', cleanup); - src.removeListener('data', ondata); // if the reader is waiting for a drain event from this // specific writer, then it would cause it to never start // flowing again. // So, if this is awaiting a drain, then we just call it now. // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && - (!dest._writableState || dest._writableState.needDrain)) + if (!dest._writableState || dest._writableState.needDrain) ondrain(); } - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - var ret = dest.write(chunk); - if (false === ret) { - debug('false write response, pause', - src._readableState.awaitDrain); - src._readableState.awaitDrain++; - src.pause(); - } - } - // if the dest has an error, then stop piping into it. // however, don't suppress the throwing behavior for this. function onerror(er) { - debug('onerror', er); unpipe(); dest.removeListener('error', onerror); if (EE.listenerCount(dest, 'error') === 0) @@ -605,14 +575,12 @@ Readable.prototype.pipe = function(dest, pipeOpts) { } dest.once('close', onclose); function onfinish() { - debug('onfinish'); dest.removeListener('close', onclose); unpipe(); } dest.once('finish', onfinish); function unpipe() { - debug('unpipe'); src.unpipe(dest); } @@ -621,8 +589,16 @@ Readable.prototype.pipe = function(dest, pipeOpts) { // start the flow if it hasn't been started already. if (!state.flowing) { - debug('pipe resume'); - src.resume(); + // the handler that waits for readable events after all + // the data gets sucked out in flow. + // This would be easier to follow with a .once() handler + // in flow(), but that is too slow. + this.on('readable', pipeOnReadable); + + state.flowing = true; + process.nextTick(function() { + flow(src); + }); } return dest; @@ -630,17 +606,65 @@ Readable.prototype.pipe = function(dest, pipeOpts) { function pipeOnDrain(src) { return function() { + var dest = this; var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) - state.awaitDrain--; - if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) { - state.flowing = true; + state.awaitDrain--; + if (state.awaitDrain === 0) flow(src); - } }; } +function flow(src) { + var state = src._readableState; + var chunk; + state.awaitDrain = 0; + + function write(dest, i, list) { + var written = dest.write(chunk); + if (false === written) { + state.awaitDrain++; + } + } + + while (state.pipesCount && null !== (chunk = src.read())) { + + if (state.pipesCount === 1) + write(state.pipes, 0, null); + else + forEach(state.pipes, write); + + src.emit('data', chunk); + + // if anyone needs a drain, then we have to wait for that. + if (state.awaitDrain > 0) + return; + } + + // if every destination was unpiped, either before entering this + // function, or in the while loop, then stop flowing. + // + // NB: This is a pretty rare edge case. + if (state.pipesCount === 0) { + state.flowing = false; + + // if there were data event listeners added, then switch to old mode. + if (EE.listenerCount(src, 'data') > 0) + emitDataEvents(src); + return; + } + + // at this point, no one needed a drain, so we just ran out of data + // on the next readable event, start it over again. + state.ranOut = true; +} + +function pipeOnReadable() { + if (this._readableState.ranOut) { + this._readableState.ranOut = false; + flow(this); + } +} + Readable.prototype.unpipe = function(dest) { var state = this._readableState; @@ -661,6 +685,7 @@ Readable.prototype.unpipe = function(dest) { // got a match. state.pipes = null; state.pipesCount = 0; + this.removeListener('readable', pipeOnReadable); state.flowing = false; if (dest) dest.emit('unpipe', this); @@ -675,6 +700,7 @@ Readable.prototype.unpipe = function(dest) { var len = state.pipesCount; state.pipes = null; state.pipesCount = 0; + this.removeListener('readable', pipeOnReadable); state.flowing = false; for (var i = 0; i < len; i++) @@ -702,11 +728,8 @@ Readable.prototype.unpipe = function(dest) { Readable.prototype.on = function(ev, fn) { var res = Stream.prototype.on.call(this, ev, fn); - // If listening to data, and it has not explicitly been paused, - // then call resume to start the flow of data on the next tick. - if (ev === 'data' && false !== this._readableState.flowing) { - this.resume(); - } + if (ev === 'data' && !this._readableState.flowing) + emitDataEvents(this); if (ev === 'readable' && this.readable) { var state = this._readableState; @@ -715,11 +738,7 @@ Readable.prototype.on = function(ev, fn) { state.emittedReadable = false; state.needReadable = true; if (!state.reading) { - var self = this; - process.nextTick(function() { - debug('readable nexttick read 0'); - self.read(0); - }); + this.read(0); } else if (state.length) { emitReadable(this, state); } @@ -733,54 +752,63 @@ Readable.prototype.addListener = Readable.prototype.on; // pause() and resume() are remnants of the legacy readable stream API // If the user uses them, then switch into old mode. Readable.prototype.resume = function() { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - if (!state.reading) { - debug('resume read 0'); - this.read(0); - } - resume(this, state); - } - return this; + emitDataEvents(this); + this.read(0); + this.emit('resume'); }; -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(function() { - resume_(stream, state); - }); - } -} - -function resume_(stream, state) { - state.resumeScheduled = false; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) - stream.read(0); -} - Readable.prototype.pause = function() { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - return this; + emitDataEvents(this, true); + this.emit('pause'); }; -function flow(stream) { +function emitDataEvents(stream, startPaused) { var state = stream._readableState; - debug('flow', state.flowing); + if (state.flowing) { - do { - var chunk = stream.read(); - } while (null !== chunk && state.flowing); + // https://github.com/isaacs/readable-stream/issues/16 + throw new Error('Cannot switch to old mode now.'); } + + var paused = startPaused || false; + var readable = false; + + // convert to an old-style stream. + stream.readable = true; + stream.pipe = Stream.prototype.pipe; + stream.on = stream.addListener = Stream.prototype.on; + + stream.on('readable', function() { + readable = true; + + var c; + while (!paused && (null !== (c = stream.read()))) + stream.emit('data', c); + + if (c === null) { + readable = false; + stream._readableState.needReadable = true; + } + }); + + stream.pause = function() { + paused = true; + this.emit('pause'); + }; + + stream.resume = function() { + paused = false; + if (readable) + process.nextTick(function() { + stream.emit('readable'); + }); + else + this.read(0); + this.emit('resume'); + }; + + // now make it start, just in case it hadn't already. + stream.emit('readable'); } // wrap an old-style stream as the async data source. @@ -792,7 +820,6 @@ Readable.prototype.wrap = function(stream) { var self = this; stream.on('end', function() { - debug('wrapped end'); if (state.decoder && !state.ended) { var chunk = state.decoder.end(); if (chunk && chunk.length) @@ -803,10 +830,14 @@ Readable.prototype.wrap = function(stream) { }); stream.on('data', function(chunk) { - debug('wrapped data'); if (state.decoder) chunk = state.decoder.write(chunk); - if (!chunk || !state.objectMode && !chunk.length) + + // don't skip over falsy values in objectMode + //if (state.objectMode && util.isNullOrUndefined(chunk)) + if (state.objectMode && (chunk === null || chunk === undefined)) + return; + else if (!state.objectMode && (!chunk || !chunk.length)) return; var ret = self.push(chunk); @@ -819,7 +850,8 @@ Readable.prototype.wrap = function(stream) { // proxy all the other methods. // important when wrapping filters and duplexes. for (var i in stream) { - if (util.isFunction(stream[i]) && util.isUndefined(this[i])) { + if (typeof stream[i] === 'function' && + typeof this[i] === 'undefined') { this[i] = function(method) { return function() { return stream[method].apply(stream, arguments); }}(i); @@ -835,7 +867,6 @@ Readable.prototype.wrap = function(stream) { // when we try to consume some more bytes, simply unpause the // underlying stream. self._read = function(n) { - debug('wrapped _read', n); if (paused) { paused = false; stream.resume(); @@ -924,7 +955,7 @@ function endReadable(stream) { if (state.length > 0) throw new Error('endReadable called on non-empty stream'); - if (!state.endEmitted) { + if (!state.endEmitted && state.calledRead) { state.ended = true; process.nextTick(function() { // Check that we didn't get one last unshift. diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/lib/_stream_transform.js b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js similarity index 96% rename from deps/npm/node_modules/sha/node_modules/readable-stream/lib/_stream_transform.js rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js index 905c5e45075..eb188df3e86 100644 --- a/deps/npm/node_modules/sha/node_modules/readable-stream/lib/_stream_transform.js +++ b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js @@ -97,7 +97,7 @@ function afterTransform(stream, er, data) { ts.writechunk = null; ts.writecb = null; - if (!util.isNullOrUndefined(data)) + if (data !== null && data !== undefined) stream.push(data); if (cb) @@ -117,7 +117,7 @@ function Transform(options) { Duplex.call(this, options); - this._transformState = new TransformState(options, this); + var ts = this._transformState = new TransformState(options, this); // when the writable side finishes, then flush out anything remaining. var stream = this; @@ -130,8 +130,8 @@ function Transform(options) { // sync guard flag. this._readableState.sync = false; - this.once('prefinish', function() { - if (util.isFunction(this._flush)) + this.once('finish', function() { + if ('function' === typeof this._flush) this._flush(function(er) { done(stream, er); }); @@ -179,7 +179,7 @@ Transform.prototype._write = function(chunk, encoding, cb) { Transform.prototype._read = function(n) { var ts = this._transformState; - if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) { + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { ts.transforming = true; this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); } else { @@ -197,6 +197,7 @@ function done(stream, er) { // if there's nothing in the write buffer, then that means // that nothing more will ever be provided var ws = stream._writableState; + var rs = stream._readableState; var ts = stream._transformState; if (ws.length) diff --git a/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js new file mode 100644 index 00000000000..4bdaa4fa491 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js @@ -0,0 +1,386 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, cb), and it'll handle all +// the drain event emission and buffering. + +module.exports = Writable; + +/**/ +var Buffer = require('buffer').Buffer; +/**/ + +Writable.WritableState = WritableState; + + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +var Stream = require('stream'); + +util.inherits(Writable, Stream); + +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; +} + +function WritableState(options, stream) { + options = options || {}; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, becuase any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function(er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.buffer = []; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; +} + +function Writable(options) { + var Duplex = require('./_stream_duplex'); + + // Writable ctor is applied to Duplexes, though they're not + // instanceof Writable, they're instanceof Readable. + if (!(this instanceof Writable) && !(this instanceof Duplex)) + return new Writable(options); + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function() { + this.emit('error', new Error('Cannot pipe. Not readable.')); +}; + + +function writeAfterEnd(stream, state, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + process.nextTick(function() { + cb(er); + }); +} + +// If we get something that is not a buffer, string, null, or undefined, +// and we're not in objectMode, then that's an error. +// Otherwise stream chunks are all considered to be of length=1, and the +// watermarks determine how many objects to keep in the buffer, rather than +// how many bytes or characters. +function validChunk(stream, state, chunk, cb) { + var valid = true; + if (!Buffer.isBuffer(chunk) && + 'string' !== typeof chunk && + chunk !== null && + chunk !== undefined && + !state.objectMode) { + var er = new TypeError('Invalid non-string/buffer chunk'); + stream.emit('error', er); + process.nextTick(function() { + cb(er); + }); + valid = false; + } + return valid; +} + +Writable.prototype.write = function(chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (Buffer.isBuffer(chunk)) + encoding = 'buffer'; + else if (!encoding) + encoding = state.defaultEncoding; + + if (typeof cb !== 'function') + cb = function() {}; + + if (state.ended) + writeAfterEnd(this, state, cb); + else if (validChunk(this, state, chunk, cb)) + ret = writeOrBuffer(this, state, chunk, encoding, cb); + + return ret; +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && + state.decodeStrings !== false && + typeof chunk === 'string') { + chunk = new Buffer(chunk, encoding); + } + return chunk; +} + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, chunk, encoding, cb) { + chunk = decodeChunk(state, chunk, encoding); + if (Buffer.isBuffer(chunk)) + encoding = 'buffer'; + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) + state.needDrain = true; + + if (state.writing) + state.buffer.push(new WriteReq(chunk, encoding, cb)); + else + doWrite(stream, state, len, chunk, encoding, cb); + + return ret; +} + +function doWrite(stream, state, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + if (sync) + process.nextTick(function() { + cb(er); + }); + else + cb(er); + + stream._writableState.errorEmitted = true; + stream.emit('error', er); +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + + onwriteStateUpdate(state); + + if (er) + onwriteError(stream, state, sync, er, cb); + else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(stream, state); + + if (!finished && !state.bufferProcessing && state.buffer.length) + clearBuffer(stream, state); + + if (sync) { + process.nextTick(function() { + afterWrite(stream, state, finished, cb); + }); + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) + onwriteDrain(stream, state); + cb(); + if (finished) + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + + for (var c = 0; c < state.buffer.length; c++) { + var entry = state.buffer[c]; + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, len, chunk, encoding, cb); + + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + c++; + break; + } + } + + state.bufferProcessing = false; + if (c < state.buffer.length) + state.buffer = state.buffer.slice(c); + else + state.buffer.length = 0; +} + +Writable.prototype._write = function(chunk, encoding, cb) { + cb(new Error('not implemented')); +}; + +Writable.prototype.end = function(chunk, encoding, cb) { + var state = this._writableState; + + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (typeof chunk !== 'undefined' && chunk !== null) + this.write(chunk, encoding); + + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) + endWritable(this, state, cb); +}; + + +function needFinish(stream, state) { + return (state.ending && + state.length === 0 && + !state.finished && + !state.writing); +} + +function finishMaybe(stream, state) { + var need = needFinish(stream, state); + if (need) { + state.finished = true; + stream.emit('finish'); + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) + process.nextTick(cb); + else + stream.once('finish', cb); + } + state.ended = true; +} diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/core-util-is/README.md b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/README.md similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/core-util-is/README.md rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/README.md diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/core-util-is/float.patch b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/float.patch similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/core-util-is/float.patch rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/float.patch diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/core-util-is/lib/util.js b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/lib/util.js similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/core-util-is/lib/util.js rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/lib/util.js diff --git a/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/package.json b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/package.json new file mode 100644 index 00000000000..b67333380c2 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/package.json @@ -0,0 +1,37 @@ +{ + "name": "core-util-is", + "version": "1.0.1", + "description": "The `util.is*` functions introduced in Node v0.12.", + "main": "lib/util.js", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/core-util-is.git" + }, + "keywords": [ + "util", + "isBuffer", + "isArray", + "isNumber", + "isString", + "isRegExp", + "isThis", + "isThat", + "polyfill" + ], + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/isaacs/core-util-is/issues" + }, + "readme": "# core-util-is\n\nThe `util.is*` functions introduced in Node v0.12.\n", + "readmeFilename": "README.md", + "homepage": "https://github.com/isaacs/core-util-is#readme", + "_id": "core-util-is@1.0.1", + "_shasum": "6b07085aef9a3ccac6ee53bf9d3df0c1521a5538", + "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz", + "_from": "core-util-is@>=1.0.0 <1.1.0" +} diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/core-util-is/util.js b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/util.js similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/core-util-is/util.js rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/util.js diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/isarray/README.md b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/README.md similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/isarray/README.md rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/README.md diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/isarray/build/build.js b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/build/build.js similarity index 99% rename from deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/isarray/build/build.js rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/build/build.js index ec58596aeeb..e1856ef0943 100644 --- a/deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/isarray/build/build.js +++ b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/build/build.js @@ -206,4 +206,3 @@ module.exports = Array.isArray || function (arr) { }); require.alias("isarray/index.js", "isarray/index.js"); - diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/isarray/component.json b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/component.json similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/isarray/component.json rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/component.json diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/isarray/index.js b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/index.js similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/isarray/index.js rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/index.js diff --git a/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json new file mode 100644 index 00000000000..fb1eb3786d8 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json @@ -0,0 +1,38 @@ +{ + "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", + "bugs": { + "url": "https://github.com/juliangruber/isarray/issues" + }, + "_id": "isarray@0.0.1", + "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", + "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "_from": "isarray@0.0.1" +} diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/string_decoder/.npmignore b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/.npmignore similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/string_decoder/.npmignore rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/.npmignore diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/string_decoder/LICENSE b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/LICENSE similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/string_decoder/LICENSE rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/LICENSE diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/string_decoder/README.md b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/README.md similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/string_decoder/README.md rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/README.md diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/string_decoder/index.js b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/index.js similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/node_modules/string_decoder/index.js rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/index.js diff --git a/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json new file mode 100644 index 00000000000..ee707023591 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json @@ -0,0 +1,34 @@ +{ + "name": "string_decoder", + "version": "0.10.31", + "description": "The string_decoder module from Node core", + "main": "index.js", + "dependencies": {}, + "devDependencies": { + "tap": "~0.4.8" + }, + "scripts": { + "test": "tap test/simple/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/rvagg/string_decoder.git" + }, + "homepage": "https://github.com/rvagg/string_decoder", + "keywords": [ + "string", + "decoder", + "browser", + "browserify" + ], + "license": "MIT", + "readme": "**string_decoder.js** (`require('string_decoder')`) from Node.js core\n\nCopyright Joyent, Inc. and other Node contributors. See LICENCE file for details.\n\nVersion numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. **Prefer the stable version over the unstable.**\n\nThe *build/* directory contains a build script that will scrape the source from the [joyent/node](https://github.com/joyent/node) repo given a specific Node version.", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/rvagg/string_decoder/issues" + }, + "_id": "string_decoder@0.10.31", + "_shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94", + "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "_from": "string_decoder@>=0.10.0 <0.11.0" +} diff --git a/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/package.json b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/package.json new file mode 100644 index 00000000000..d4c12cab43a --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/package.json @@ -0,0 +1,46 @@ +{ + "name": "readable-stream", + "version": "1.0.33", + "description": "Streams2, a user-land copy of the stream library from Node.js v0.10.x", + "main": "readable.js", + "dependencies": { + "core-util-is": "~1.0.0", + "isarray": "0.0.1", + "string_decoder": "~0.10.x", + "inherits": "~2.0.1" + }, + "devDependencies": { + "tap": "~0.2.6" + }, + "scripts": { + "test": "tap test/simple/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/readable-stream.git" + }, + "keywords": [ + "readable", + "stream", + "pipe" + ], + "browser": { + "util": false + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "MIT", + "readme": "# readable-stream\n\n***Node-core streams for userland***\n\n[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/)\n[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/)\n\nThis package is a mirror of the Streams2 and Streams3 implementations in Node-core.\n\nIf you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *\"stream\"* module in Node-core.\n\n**readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12.\n\n**readable-stream** uses proper patch-level versioning so if you pin to `\"~1.0.0\"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `\"~1.1.0\"`\n\n", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/isaacs/readable-stream/issues" + }, + "homepage": "https://github.com/isaacs/readable-stream#readme", + "_id": "readable-stream@1.0.33", + "_shasum": "3a360dd66c1b1d7fd4705389860eda1d0f61126c", + "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz", + "_from": "readable-stream@>=1.0.26 <1.1.0" +} diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/passthrough.js b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/passthrough.js similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/passthrough.js rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/passthrough.js diff --git a/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/readable.js b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/readable.js new file mode 100644 index 00000000000..8b5337b5c50 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/readable.js @@ -0,0 +1,8 @@ +var Stream = require('stream'); // hack to fix a circular dependency issue when used with browserify +exports = module.exports = require('./lib/_stream_readable.js'); +exports.Stream = Stream; +exports.Readable = exports; +exports.Writable = require('./lib/_stream_writable.js'); +exports.Duplex = require('./lib/_stream_duplex.js'); +exports.Transform = require('./lib/_stream_transform.js'); +exports.PassThrough = require('./lib/_stream_passthrough.js'); diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/transform.js b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/transform.js similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/transform.js rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/transform.js diff --git a/deps/npm/node_modules/sha/node_modules/readable-stream/writable.js b/deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/writable.js similarity index 100% rename from deps/npm/node_modules/sha/node_modules/readable-stream/writable.js rename to deps/npm/node_modules/request/node_modules/bl/node_modules/readable-stream/writable.js diff --git a/deps/npm/node_modules/request/node_modules/bl/package.json b/deps/npm/node_modules/request/node_modules/bl/package.json index a5692e03c70..d6930087e3c 100644 --- a/deps/npm/node_modules/request/node_modules/bl/package.json +++ b/deps/npm/node_modules/request/node_modules/bl/package.json @@ -1,6 +1,6 @@ { "name": "bl", - "version": "0.9.3", + "version": "0.9.4", "description": "Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!", "main": "bl.js", "scripts": { @@ -9,7 +9,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/rvagg/bl.git" + "url": "git+https://github.com/rvagg/bl.git" }, "homepage": "https://github.com/rvagg/bl", "authors": [ @@ -33,29 +33,13 @@ "faucet": "~0.0.1", "brtapsauce": "~0.3.0" }, - "gitHead": "4987a76bf6bafd7616e62c7023c955e62f3a9461", + "readme": "# bl *(BufferList)*\n\n**A Node.js Buffer list collector, reader and streamer thingy.**\n\n[![NPM](https://nodei.co/npm/bl.png?downloads=true&downloadRank=true)](https://nodei.co/npm/bl/)\n[![NPM](https://nodei.co/npm-dl/bl.png?months=6&height=3)](https://nodei.co/npm/bl/)\n\n**bl** is a storage object for collections of Node Buffers, exposing them with the main Buffer readable API. Also works as a duplex stream so you can collect buffers from a stream that emits them and emit buffers to a stream that consumes them!\n\nThe original buffers are kept intact and copies are only done as necessary. Any reads that require the use of a single original buffer will return a slice of that buffer only (which references the same memory as the original buffer). Reads that span buffers perform concatenation as required and return the results transparently.\n\n```js\nconst BufferList = require('bl')\n\nvar bl = new BufferList()\nbl.append(new Buffer('abcd'))\nbl.append(new Buffer('efg'))\nbl.append('hi') // bl will also accept & convert Strings\nbl.append(new Buffer('j'))\nbl.append(new Buffer([ 0x3, 0x4 ]))\n\nconsole.log(bl.length) // 12\n\nconsole.log(bl.slice(0, 10).toString('ascii')) // 'abcdefghij'\nconsole.log(bl.slice(3, 10).toString('ascii')) // 'defghij'\nconsole.log(bl.slice(3, 6).toString('ascii')) // 'def'\nconsole.log(bl.slice(3, 8).toString('ascii')) // 'defgh'\nconsole.log(bl.slice(5, 10).toString('ascii')) // 'fghij'\n\n// or just use toString!\nconsole.log(bl.toString()) // 'abcdefghij\\u0003\\u0004'\nconsole.log(bl.toString('ascii', 3, 8)) // 'defgh'\nconsole.log(bl.toString('ascii', 5, 10)) // 'fghij'\n\n// other standard Buffer readables\nconsole.log(bl.readUInt16BE(10)) // 0x0304\nconsole.log(bl.readUInt16LE(10)) // 0x0403\n```\n\nGive it a callback in the constructor and use it just like **[concat-stream](https://github.com/maxogden/node-concat-stream)**:\n\n```js\nconst bl = require('bl')\n , fs = require('fs')\n\nfs.createReadStream('README.md')\n .pipe(bl(function (err, data) { // note 'new' isn't strictly required\n // `data` is a complete Buffer object containing the full data\n console.log(data.toString())\n }))\n```\n\nNote that when you use the *callback* method like this, the resulting `data` parameter is a concatenation of all `Buffer` objects in the list. If you want to avoid the overhead of this concatenation (in cases of extreme performance consciousness), then avoid the *callback* method and just listen to `'end'` instead, like a standard Stream.\n\nOr to fetch a URL using [hyperquest](https://github.com/substack/hyperquest) (should work with [request](http://github.com/mikeal/request) and even plain Node http too!):\n```js\nconst hyperquest = require('hyperquest')\n , bl = require('bl')\n , url = 'https://raw.github.com/rvagg/bl/master/README.md'\n\nhyperquest(url).pipe(bl(function (err, data) {\n console.log(data.toString())\n}))\n```\n\nOr, use it as a readable stream to recompose a list of Buffers to an output source:\n\n```js\nconst BufferList = require('bl')\n , fs = require('fs')\n\nvar bl = new BufferList()\nbl.append(new Buffer('abcd'))\nbl.append(new Buffer('efg'))\nbl.append(new Buffer('hi'))\nbl.append(new Buffer('j'))\n\nbl.pipe(fs.createWriteStream('gibberish.txt'))\n```\n\n## API\n\n * new BufferList([ callback ])\n * bl.length\n * bl.append(buffer)\n * bl.get(index)\n * bl.slice([ start[, end ] ])\n * bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])\n * bl.duplicate()\n * bl.consume(bytes)\n * bl.toString([encoding, [ start, [ end ]]])\n * bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8()\n * Streams\n\n--------------------------------------------------------\n\n### new BufferList([ callback | buffer | buffer array ])\nThe constructor takes an optional callback, if supplied, the callback will be called with an error argument followed by a reference to the **bl** instance, when `bl.end()` is called (i.e. from a piped stream). This is a convenient method of collecting the entire contents of a stream, particularly when the stream is *chunky*, such as a network stream.\n\nNormally, no arguments are required for the constructor, but you can initialise the list by passing in a single `Buffer` object or an array of `Buffer` object.\n\n`new` is not strictly required, if you don't instantiate a new object, it will be done automatically for you so you can create a new instance simply with:\n\n```js\nvar bl = require('bl')\nvar myinstance = bl()\n\n// equivilant to:\n\nvar BufferList = require('bl')\nvar myinstance = new BufferList()\n```\n\n--------------------------------------------------------\n\n### bl.length\nGet the length of the list in bytes. This is the sum of the lengths of all of the buffers contained in the list, minus any initial offset for a semi-consumed buffer at the beginning. Should accurately represent the total number of bytes that can be read from the list.\n\n--------------------------------------------------------\n\n### bl.append(buffer)\n`append(buffer)` adds an additional buffer or BufferList to the internal list.\n\n--------------------------------------------------------\n\n### bl.get(index)\n`get()` will return the byte at the specified index.\n\n--------------------------------------------------------\n\n### bl.slice([ start, [ end ] ])\n`slice()` returns a new `Buffer` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively.\n\nIf the requested range spans a single internal buffer then a slice of that buffer will be returned which shares the original memory range of that Buffer. If the range spans multiple buffers then copy operations will likely occur to give you a uniform Buffer.\n\n--------------------------------------------------------\n\n### bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])\n`copy()` copies the content of the list in the `dest` buffer, starting from `destStart` and containing the bytes within the range specified with `srcStart` to `srcEnd`. `destStart`, `start` and `end` are optional and will default to the beginning of the `dest` buffer, and the beginning and end of the list respectively.\n\n--------------------------------------------------------\n\n### bl.duplicate()\n`duplicate()` performs a **shallow-copy** of the list. The internal Buffers remains the same, so if you change the underlying Buffers, the change will be reflected in both the original and the duplicate. This method is needed if you want to call `consume()` or `pipe()` and still keep the original list.Example:\n\n```js\nvar bl = new BufferList()\n\nbl.append('hello')\nbl.append(' world')\nbl.append('\\n')\n\nbl.duplicate().pipe(process.stdout, { end: false })\n\nconsole.log(bl.toString())\n```\n\n--------------------------------------------------------\n\n### bl.consume(bytes)\n`consume()` will shift bytes *off the start of the list*. The number of bytes consumed don't need to line up with the sizes of the internal Buffers—initial offsets will be calculated accordingly in order to give you a consistent view of the data.\n\n--------------------------------------------------------\n\n### bl.toString([encoding, [ start, [ end ]]])\n`toString()` will return a string representation of the buffer. The optional `start` and `end` arguments are passed on to `slice()`, while the `encoding` is passed on to `toString()` of the resulting Buffer. See the [Buffer#toString()](http://nodejs.org/docs/latest/api/buffer.html#buffer_buf_tostring_encoding_start_end) documentation for more information.\n\n--------------------------------------------------------\n\n### bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8()\n\nAll of the standard byte-reading methods of the `Buffer` interface are implemented and will operate across internal Buffer boundaries transparently.\n\nSee the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work.\n\n--------------------------------------------------------\n\n### Streams\n**bl** is a Node **[Duplex Stream](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_duplex)**, so it can be read from and written to like a standard Node stream. You can also `pipe()` to and from a **bl** instance.\n\n--------------------------------------------------------\n\n## Contributors\n\n**bl** is brought to you by the following hackers:\n\n * [Rod Vagg](https://github.com/rvagg)\n * [Matteo Collina](https://github.com/mcollina)\n * [Jarett Cruger](https://github.com/jcrugzz)\n\n=======\n\n\n## License & copyright\n\nCopyright (c) 2013-2014 bl contributors (listed above).\n\nbl is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.\n", + "readmeFilename": "README.md", "bugs": { "url": "https://github.com/rvagg/bl/issues" }, - "_id": "bl@0.9.3", - "_shasum": "c41eff3e7cb31bde107c8f10076d274eff7f7d44", - "_from": "bl@>=0.9.0 <0.10.0", - "_npmVersion": "1.4.27", - "_npmUser": { - "name": "rvagg", - "email": "rod@vagg.org" - }, - "maintainers": [ - { - "name": "rvagg", - "email": "rod@vagg.org" - } - ], - "dist": { - "shasum": "c41eff3e7cb31bde107c8f10076d274eff7f7d44", - "tarball": "http://registry.npmjs.org/bl/-/bl-0.9.3.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/bl/-/bl-0.9.3.tgz", - "readme": "ERROR: No README data found!" + "_id": "bl@0.9.4", + "_shasum": "4702ddf72fbe0ecd82787c00c113aea1935ad0e7", + "_resolved": "https://registry.npmjs.org/bl/-/bl-0.9.4.tgz", + "_from": "bl@>=0.9.0 <0.10.0" } diff --git a/deps/npm/node_modules/request/node_modules/caseless/README.md b/deps/npm/node_modules/request/node_modules/caseless/README.md index 719584c85b7..e5077a21659 100644 --- a/deps/npm/node_modules/request/node_modules/caseless/README.md +++ b/deps/npm/node_modules/request/node_modules/caseless/README.md @@ -1,6 +1,6 @@ ## Caseless -- wrap an object to set and get property with caseless semantics but also preserve caseing. -This library is incredibly useful when working with HTTP headers. It allows you to get/set/check for headers in a caseless manor while also preserving the caseing of headers the first time they are set. +This library is incredibly useful when working with HTTP headers. It allows you to get/set/check for headers in a caseless manner while also preserving the caseing of headers the first time they are set. ## Usage diff --git a/deps/npm/node_modules/request/node_modules/caseless/index.js b/deps/npm/node_modules/request/node_modules/caseless/index.js index 231a997e0a4..ba711f68db1 100644 --- a/deps/npm/node_modules/request/node_modules/caseless/index.js +++ b/deps/npm/node_modules/request/node_modules/caseless/index.js @@ -1,5 +1,5 @@ function Caseless (dict) { - this.dict = dict + this.dict = dict || {} } Caseless.prototype.set = function (name, value, clobber) { if (typeof name === 'object') { @@ -25,12 +25,12 @@ Caseless.prototype.has = function (name) { return false } Caseless.prototype.get = function (name) { - var result, re, match + name = name.toLowerCase() + var result, _key var headers = this.dict Object.keys(headers).forEach(function (key) { - re = new RegExp(name, 'i') - match = key.match(re) - if (match) result = headers[key] + _key = key.toLowerCase() + if (name === _key) result = headers[key] }) return result } diff --git a/deps/npm/node_modules/request/node_modules/caseless/package.json b/deps/npm/node_modules/request/node_modules/caseless/package.json index 3725c102644..d4c0177b1b2 100644 --- a/deps/npm/node_modules/request/node_modules/caseless/package.json +++ b/deps/npm/node_modules/request/node_modules/caseless/package.json @@ -1,6 +1,6 @@ { "name": "caseless", - "version": "0.6.0", + "version": "0.10.0", "description": "Caseless object set/get/has, very useful when working with HTTP headers.", "main": "index.js", "scripts": { @@ -8,7 +8,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/mikeal/caseless" + "url": "git+https://github.com/mikeal/caseless.git" }, "keywords": [ "headers", @@ -27,26 +27,31 @@ "devDependencies": { "tape": "^2.10.2" }, + "gitHead": "9c85efef6c37d48923b79f3f282441414dd691c9", "homepage": "https://github.com/mikeal/caseless", - "_id": "caseless@0.6.0", - "_shasum": "8167c1ab8397fb5bb95f96d28e5a81c50f247ac4", - "_from": "caseless@>=0.6.0 <0.7.0", - "_npmVersion": "1.4.9", + "_id": "caseless@0.10.0", + "_shasum": "ed6b2719adcd1fd18f58dc081c0f1a5b43963909", + "_from": "caseless@>=0.10.0 <0.11.0", + "_npmVersion": "1.4.14", "_npmUser": { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" + "name": "nylen", + "email": "jnylen@gmail.com" }, "maintainers": [ { "name": "mikeal", "email": "mikeal.rogers@gmail.com" + }, + { + "name": "nylen", + "email": "jnylen@gmail.com" } ], "dist": { - "shasum": "8167c1ab8397fb5bb95f96d28e5a81c50f247ac4", - "tarball": "http://registry.npmjs.org/caseless/-/caseless-0.6.0.tgz" + "shasum": "ed6b2719adcd1fd18f58dc081c0f1a5b43963909", + "tarball": "http://registry.npmjs.org/caseless/-/caseless-0.10.0.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/caseless/-/caseless-0.6.0.tgz", + "_resolved": "https://registry.npmjs.org/caseless/-/caseless-0.10.0.tgz", "readme": "ERROR: No README data found!" } diff --git a/deps/npm/node_modules/request/node_modules/caseless/test.js b/deps/npm/node_modules/request/node_modules/caseless/test.js index 5604fa0751f..084bbaf5e93 100644 --- a/deps/npm/node_modules/request/node_modules/caseless/test.js +++ b/deps/npm/node_modules/request/node_modules/caseless/test.js @@ -6,7 +6,7 @@ tape('set get has', function (t) { var headers = {} , c = caseless(headers) ; - t.plan(14) + t.plan(17) c.set('a-Header', 'asdf') t.equal(c.get('a-header'), 'asdf') t.equal(c.has('a-header'), 'a-Header') @@ -30,4 +30,11 @@ tape('set get has', function (t) { t.notOk(c.has('idonotexist')) t.ok(c.del('idonotexist')) + c.set('tva', 'test1') + c.set('tva-header', 'test2') + t.equal(c.has('tva'), 'tva') + t.notOk(c.has('header')) + + t.equal(c.get('tva'), 'test1') + }) diff --git a/deps/npm/node_modules/request/node_modules/combined-stream/License b/deps/npm/node_modules/request/node_modules/combined-stream/License new file mode 100644 index 00000000000..4804b7ab411 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/combined-stream/License @@ -0,0 +1,19 @@ +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/deps/npm/node_modules/request/node_modules/combined-stream/Readme.md b/deps/npm/node_modules/request/node_modules/combined-stream/Readme.md new file mode 100644 index 00000000000..3068adcaff7 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/combined-stream/Readme.md @@ -0,0 +1,139 @@ +# combined-stream + +A stream that emits multiple other streams one after another. + +**NB** This module uses streams1 and will always use streams1 for +compatibility. If you're looking for something to use for your project, please +use a streams2 module, e.g., +[multistream](https://www.npmjs.com/package/multistream). Moreover, this module +is maintained for bugfixes to current downstream consumers, so PRs which add +features generally aren't accepted. + +## 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/deps/npm/node_modules/request/node_modules/combined-stream/lib/combined_stream.js b/deps/npm/node_modules/request/node_modules/combined-stream/lib/combined_stream.js new file mode 100644 index 00000000000..6b5c21b6b42 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/combined-stream/lib/combined_stream.js @@ -0,0 +1,188 @@ +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') + && (typeof stream !== 'boolean') + && (typeof stream !== 'number') + && (!Buffer.isBuffer(stream)); +}; + +CombinedStream.prototype.append = function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + + if (isStreamLike) { + if (!(stream instanceof DelayedStream)) { + var newStream = DelayedStream.create(stream, { + maxDataSize: Infinity, + pauseStream: this.pauseStreams, + }); + stream.on('data', this._checkDataSize.bind(this)); + stream = newStream; + } + + 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(); + return dest; +}; + +CombinedStream.prototype._getNext = function() { + this._currentStream = null; + var stream = this._streams.shift(); + + + if (typeof stream == 'undefined') { + 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; + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause(); + this.emit('pause'); +}; + +CombinedStream.prototype.resume = function() { + if (!this._released) { + this._released = true; + this.writable = true; + this._getNext(); + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume(); + 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/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/.npmignore b/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/.npmignore new file mode 100644 index 00000000000..9daeafb9864 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/.npmignore @@ -0,0 +1 @@ +test diff --git a/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/License b/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/License new file mode 100644 index 00000000000..4804b7ab411 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/License @@ -0,0 +1,19 @@ +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/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/Makefile b/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/Makefile new file mode 100644 index 00000000000..b4ff85a33b6 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/Makefile @@ -0,0 +1,7 @@ +SHELL := /bin/bash + +test: + @./test/run.js + +.PHONY: test + diff --git a/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/Readme.md b/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/Readme.md new file mode 100644 index 00000000000..aca36f9f0bc --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/Readme.md @@ -0,0 +1,141 @@ +# 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.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/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js b/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js new file mode 100644 index 00000000000..b38fc85ff41 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js @@ -0,0 +1,107 @@ +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; +}; + +Object.defineProperty(DelayedStream.prototype, 'readable', { + configurable: true, + enumerable: true, + get: function() { + return this.source.readable; + } +}); + +DelayedStream.prototype.setEncoding = function() { + return this.source.setEncoding.apply(this.source, arguments); +}; + +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/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/package.json b/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/package.json new file mode 100644 index 00000000000..4b4890359df --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/package.json @@ -0,0 +1,64 @@ +{ + "author": { + "name": "Felix Geisendörfer", + "email": "felix@debuggable.com", + "url": "http://debuggable.com/" + }, + "contributors": [ + { + "name": "Mike Atkins", + "email": "apeherder@gmail.com" + } + ], + "name": "delayed-stream", + "description": "Buffers events from a stream until you are ready to handle them.", + "license": "MIT", + "version": "1.0.0", + "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" + }, + "scripts": { + "test": "make test" + }, + "dependencies": {}, + "devDependencies": { + "fake": "0.2.0", + "far": "0.0.1" + }, + "gitHead": "07a9dc99fb8f1a488160026b9ad77493f766fb84", + "bugs": { + "url": "https://github.com/felixge/node-delayed-stream/issues" + }, + "_id": "delayed-stream@1.0.0", + "_shasum": "df3ae199acadfb7d440aaae0b29e2272b24ec619", + "_from": "delayed-stream@>=1.0.0 <2.0.0", + "_npmVersion": "2.8.3", + "_nodeVersion": "1.6.4", + "_npmUser": { + "name": "apechimp", + "email": "apeherder@gmail.com" + }, + "dist": { + "shasum": "df3ae199acadfb7d440aaae0b29e2272b24ec619", + "tarball": "http://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz" + }, + "maintainers": [ + { + "name": "felixge", + "email": "felix@debuggable.com" + }, + { + "name": "apechimp", + "email": "apeherder@gmail.com" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/request/node_modules/combined-stream/package.json b/deps/npm/node_modules/request/node_modules/combined-stream/package.json new file mode 100644 index 00000000000..08d0f270600 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/combined-stream/package.json @@ -0,0 +1,67 @@ +{ + "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": "1.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", + "scripts": { + "test": "node test/run.js" + }, + "engines": { + "node": ">= 0.8" + }, + "dependencies": { + "delayed-stream": "^1.0.0" + }, + "devDependencies": { + "far": "~0.0.7" + }, + "license": "MIT", + "gitHead": "f1a12682aed63acb3cd66857104202a7e7ca5565", + "bugs": { + "url": "https://github.com/felixge/node-combined-stream/issues" + }, + "_id": "combined-stream@1.0.3", + "_shasum": "c224cc35d3cb98e25dead532472a18e8f75df5ab", + "_from": "combined-stream@>=1.0.1 <1.1.0", + "_npmVersion": "2.10.0", + "_nodeVersion": "2.0.1", + "_npmUser": { + "name": "apechimp", + "email": "apeherder@gmail.com" + }, + "dist": { + "shasum": "c224cc35d3cb98e25dead532472a18e8f75df5ab", + "tarball": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.3.tgz" + }, + "maintainers": [ + { + "name": "felixge", + "email": "felix@debuggable.com" + }, + { + "name": "celer", + "email": "dtyree77@gmail.com" + }, + { + "name": "alexindigo", + "email": "iam@alexindigo.com" + }, + { + "name": "apechimp", + "email": "apeherder@gmail.com" + } + ], + "directories": {}, + "_resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/request/node_modules/forever-agent/index.js b/deps/npm/node_modules/request/node_modules/forever-agent/index.js index 1e8efcdf257..416c7abd709 100644 --- a/deps/npm/node_modules/request/node_modules/forever-agent/index.js +++ b/deps/npm/node_modules/request/node_modules/forever-agent/index.js @@ -6,6 +6,17 @@ var util = require('util') , net = require('net') , tls = require('tls') , AgentSSL = require('https').Agent + +function getConnectionName(host, port) { + var name = '' + if (typeof host === 'string') { + name = host + ':' + port + } else { + // For node.js v012.0 and iojs-v1.5.1, host is an object. And any existing localAddress is part of the connection name. + name = host.host + ':' + host.port + ':' + (host.localAddress ? (host.localAddress + ':') : ':') + } + return name +} function ForeverAgent(options) { var self = this @@ -16,7 +27,8 @@ function ForeverAgent(options) { self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets self.minSockets = self.options.minSockets || ForeverAgent.defaultMinSockets self.on('free', function(socket, host, port) { - var name = host + ':' + port + var name = getConnectionName(host, port) + if (self.requests[name] && self.requests[name].length) { self.requests[name].shift().onSocket(socket) } else if (self.sockets[name].length < self.minSockets) { @@ -47,7 +59,14 @@ ForeverAgent.defaultMinSockets = 5 ForeverAgent.prototype.createConnection = net.createConnection ForeverAgent.prototype.addRequestNoreuse = Agent.prototype.addRequest ForeverAgent.prototype.addRequest = function(req, host, port) { - var name = host + ':' + port + var name = getConnectionName(host, port) + + if (typeof host !== 'string') { + var options = host + port = options.port + host = options.host + } + if (this.freeSockets[name] && this.freeSockets[name].length > 0 && !req.useChunkedEncodingByDefault) { var idleSocket = this.freeSockets[name].pop() idleSocket.removeListener('error', idleSocket._onIdleError) diff --git a/deps/npm/node_modules/request/node_modules/forever-agent/package.json b/deps/npm/node_modules/request/node_modules/forever-agent/package.json index 1bb44419367..7bdaaaff0d5 100644 --- a/deps/npm/node_modules/request/node_modules/forever-agent/package.json +++ b/deps/npm/node_modules/request/node_modules/forever-agent/package.json @@ -6,9 +6,10 @@ }, "name": "forever-agent", "description": "HTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.", - "version": "0.5.2", + "version": "0.6.1", + "license": "Apache-2.0", "repository": { - "url": "https://github.com/mikeal/forever-agent" + "url": "git+https://github.com/mikeal/forever-agent.git" }, "main": "index.js", "dependencies": {}, @@ -17,30 +18,14 @@ "engines": { "node": "*" }, + "readme": "forever-agent\n=============\n\nHTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.\n", + "readmeFilename": "README.md", "bugs": { "url": "https://github.com/mikeal/forever-agent/issues" }, - "homepage": "https://github.com/mikeal/forever-agent", - "_id": "forever-agent@0.5.2", - "dist": { - "shasum": "6d0e09c4921f94a27f63d3b49c5feff1ea4c5130", - "tarball": "http://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz" - }, - "_from": "forever-agent@>=0.5.0 <0.6.0", - "_npmVersion": "1.3.21", - "_npmUser": { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - }, - "maintainers": [ - { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - } - ], - "directories": {}, - "_shasum": "6d0e09c4921f94a27f63d3b49c5feff1ea4c5130", - "_resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz", - "readme": "ERROR: No README data found!", - "scripts": {} + "homepage": "https://github.com/mikeal/forever-agent#readme", + "_id": "forever-agent@0.6.1", + "_shasum": "fbc71f0c41adeb37f96c577ad1ed42d8fdacca91", + "_resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "_from": "forever-agent@>=0.6.0 <0.7.0" } diff --git a/deps/npm/node_modules/request/node_modules/form-data/lib/form_data.js b/deps/npm/node_modules/request/node_modules/form-data/lib/form_data.js index b8bd158480d..5b33f554c62 100644 --- a/deps/npm/node_modules/request/node_modules/form-data/lib/form_data.js +++ b/deps/npm/node_modules/request/node_modules/form-data/lib/form_data.js @@ -5,7 +5,7 @@ var http = require('http'); var https = require('https'); var parseUrl = require('url').parse; var fs = require('fs'); -var mime = require('mime'); +var mime = require('mime-types'); var async = require('async'); module.exports = FormData; diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/.jshintrc b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/.jshintrc new file mode 100644 index 00000000000..7427dce48a3 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/.jshintrc @@ -0,0 +1,25 @@ +{ + // Enforcing options + "eqeqeq": false, + "forin": true, + "indent": 4, + "noarg": true, + "undef": true, + "unused": true, + "trailing": true, + "evil": true, + "laxcomma": true, + + // Relaxing options + "onevar": false, + "asi": false, + "eqnull": true, + "expr": false, + "loopfunc": true, + "sub": true, + "browser": true, + "node": true, + "globals": { + "define": true + } +} diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/.travis.yml b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/.travis.yml index 6e5919de39a..6064ca09264 100644 --- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/.travis.yml +++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/.travis.yml @@ -1,3 +1,5 @@ language: node_js node_js: - "0.10" + - "0.12" + - "iojs" diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/README.md b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/README.md index 0bea5311a8b..13b8dd386b8 100644 --- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/README.md +++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/README.md @@ -5,8 +5,16 @@ Async is a utility module which provides straight-forward, powerful functions for working with asynchronous JavaScript. Although originally designed for -use with [Node.js](http://nodejs.org), it can also be used directly in the -browser. Also supports [component](https://github.com/component/component). +use with [Node.js](http://nodejs.org) and installable via `npm install async`, +it can also be used directly in the browser. + +Async is also installable via: + +- [bower](http://bower.io/): `bower install async` +- [component](https://github.com/component/component): `component install + caolan/async` +- [jam](http://jamjs.org/): `jam install async` +- [spm](http://spmjs.io/): `spm install async` Async provides around 20 functions that include the usual 'functional' suspects (`map`, `reduce`, `filter`, `each`…) as well as some common patterns @@ -182,7 +190,7 @@ __Arguments__ * `arr` - An array to iterate over. * `iterator(item, callback)` - A function to apply to each item in `arr`. The iterator is passed a `callback(err)` which must be called once it has - completed. If no error has occured, the `callback` should be run without + completed. If no error has occurred, the `callback` should be run without arguments or with an explicit `null` argument. * `callback(err)` - A callback which is called when all `iterator` functions have finished, or an error occurs. @@ -202,7 +210,7 @@ async.each(openFiles, saveFile, function(err){ ```js // assuming openFiles is an array of file names -async.each(openFiles, function( file, callback) { +async.each(openFiles, function(file, callback) { // Perform operation on file here. console.log('Processing file ' + file); @@ -256,7 +264,7 @@ __Arguments__ * `limit` - The maximum number of `iterator`s to run at any time. * `iterator(item, callback)` - A function to apply to each item in `arr`. The iterator is passed a `callback(err)` which must be called once it has - completed. If no error has occured, the callback should be run without + completed. If no error has occurred, the callback should be run without arguments or with an explicit `null` argument. * `callback(err)` - A callback which is called when all `iterator` functions have finished, or an error occurs. @@ -280,7 +288,7 @@ async.eachLimit(documents, 20, requestApi, function(err){ Produces a new array of values by mapping each value in `arr` through the `iterator` function. The `iterator` is called with an item from `arr` and a callback for when it has finished processing. Each of these callback takes 2 arguments: -an `error`, and the transformed item from `arr`. If `iterator` passes an error to this +an `error`, and the transformed item from `arr`. If `iterator` passes an error to his 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, @@ -536,14 +544,14 @@ By modifying the callback parameter the sorting order can be influenced: ```js //ascending order async.sortBy([1,9,3,5], function(x, callback){ - callback(err, x); + callback(null, x); }, function(err,result){ //result callback } ); //descending order async.sortBy([1,9,3,5], function(x, callback){ - callback(err, x*-1); //<- x*-1 instead of x, turns the order around + callback(null, x*-1); //<- x*-1 instead of x, turns the order around }, function(err,result){ //result callback } ); @@ -913,19 +921,19 @@ __Example__ ```js async.waterfall([ - function(callback){ + function(callback) { callback(null, 'one', 'two'); }, - function(arg1, arg2, callback){ + function(arg1, arg2, callback) { // arg1 now equals 'one' and arg2 now equals 'two' callback(null, 'three'); }, - function(arg1, callback){ + function(arg1, callback) { // arg1 now equals 'three' callback(null, 'done'); } ], function (err, result) { - // result now equals 'done' + // result now equals 'done' }); ``` @@ -972,7 +980,8 @@ add1mul3(4, function (err, result) { ### seq(fn1, fn2...) Version of the compose function that is more natural to read. -Each following function consumes the return value of the latter function. +Each function consumes the return value of the previous function. +It is the equivalent of [`compose`](#compose) with the arguments reversed. Each function is executed with the `this` binding of the composed function. @@ -989,28 +998,20 @@ __Example__ // This example uses `seq` function to avoid overnesting and error // handling clutter. app.get('/cats', function(request, response) { - function handleError(err, data, callback) { - if (err) { - console.error(err); - response.json({ status: 'error', message: err.message }); - } - else { - callback(data); - } - } var User = request.models.User; async.seq( _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data)) - handleError, function(user, fn) { user.getCats(fn); // 'getCats' has signature (callback(err, data)) - }, - handleError, - function(cats) { + } + )(req.session.user_id, function (err, cats) { + if (err) { + console.error(err); + response.json({ status: 'error', message: err.message }); + } else { response.json({ status: 'ok', message: 'Cats found', data: cats }); } - )(req.session.user_id); - } + }); }); ``` @@ -1092,7 +1093,7 @@ methods: * `paused` - a boolean for determining whether the queue is in a paused state * `pause()` - a function that pauses the processing of tasks until `resume()` is called. * `resume()` - a function that resumes the processing of queued tasks when the queue is paused. -* `kill()` - a function that empties remaining tasks from the queue forcing it to go idle. +* `kill()` - a function that removes the `drain` callback and empties remaining tasks from the queue forcing it to go idle. __Example__ @@ -1122,7 +1123,7 @@ q.push({name: 'bar'}, function (err) { // add some items to the queue (batch-wise) q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) { - console.log('finished processing bar'); + console.log('finished processing item'); }); // add some items to the front of the queue @@ -1349,7 +1350,7 @@ new tasks much easier (and the code more readable). Attempts to get a successful response from `task` no more than `times` times before returning an error. If the task is successful, the `callback` will be passed the result -of the successfull task. If all attemps fail, the callback will be passed the error and +of the successful task. If all attempts fail, the callback will be passed the error and result (if any) of the final attempt. __Arguments__ @@ -1474,7 +1475,7 @@ three --------------------------------------- -### nextTick(callback) +### nextTick(callback), setImmediate(callback) Calls `callback` on a later loop around the event loop. In Node.js this just calls `process.nextTick`; in the browser it falls back to `setImmediate(callback)` diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/bower.json b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/bower.json new file mode 100644 index 00000000000..18176881e00 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/bower.json @@ -0,0 +1,38 @@ +{ + "name": "async", + "description": "Higher-order functions and common patterns for asynchronous code", + "version": "0.9.2", + "main": "lib/async.js", + "keywords": [ + "async", + "callback", + "utility", + "module" + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/caolan/async.git" + }, + "devDependencies": { + "nodeunit": ">0.0.0", + "uglify-js": "1.2.x", + "nodelint": ">0.0.0", + "lodash": ">=2.4.1" + }, + "moduleType": [ + "amd", + "globals", + "node" + ], + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "authors": [ + "Caolan McMahon" + ] +} \ No newline at end of file diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/component.json b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/component.json index bbb011548c0..5003a7c52ce 100644 --- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/component.json +++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/component.json @@ -1,11 +1,16 @@ { "name": "async", - "repo": "caolan/async", "description": "Higher-order functions and common patterns for asynchronous code", - "version": "0.1.23", - "keywords": [], - "dependencies": {}, - "development": {}, - "main": "lib/async.js", - "scripts": [ "lib/async.js" ] -} + "version": "0.9.2", + "keywords": [ + "async", + "callback", + "utility", + "module" + ], + "license": "MIT", + "repository": "caolan/async", + "scripts": [ + "lib/async.js" + ] +} \ No newline at end of file diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js old mode 100755 new mode 100644 index 01e8afcc4f1..394c41cada0 --- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js +++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js @@ -42,9 +42,6 @@ }; var _each = function (arr, iterator) { - if (arr.forEach) { - return arr.forEach(iterator); - } for (var i = 0; i < arr.length; i += 1) { iterator(arr[i], i, arr); } @@ -821,23 +818,26 @@ pause: function () { if (q.paused === true) { return; } q.paused = true; - q.process(); }, resume: function () { if (q.paused === false) { return; } q.paused = false; - q.process(); + // Need to call q.process once per concurrent + // worker to preserve full concurrency after pause + for (var w = 1; w <= q.concurrency; w++) { + async.setImmediate(q.process); + } } }; return q; }; - + async.priorityQueue = function (worker, concurrency) { - + function _compareTasks(a, b){ return a.priority - b.priority; }; - + function _binarySearch(sequence, item, compare) { var beg = -1, end = sequence.length - 1; @@ -851,7 +851,7 @@ } return beg; } - + function _insert(q, data, priority, callback) { if (!q.started){ q.started = true; @@ -873,7 +873,7 @@ priority: priority, callback: typeof callback === 'function' ? callback : null }; - + q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item); if (q.saturated && q.tasks.length === q.concurrency) { @@ -882,15 +882,15 @@ async.setImmediate(q.process); }); } - + // Start with a normal queue var q = async.queue(worker, concurrency); - + // Override push to accept second parameter representing priority q.push = function (data, priority, callback) { _insert(q, data, priority, callback); }; - + // Remove unshift function delete q.unshift; diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/package.json b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/package.json index e8f9ed81b6c..98c2e0b4e40 100644 --- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/package.json +++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/package.json @@ -1,28 +1,30 @@ { "name": "async", "description": "Higher-order functions and common patterns for asynchronous code", - "main": "./lib/async", + "main": "lib/async.js", "author": { "name": "Caolan McMahon" }, - "version": "0.9.0", + "version": "0.9.2", + "keywords": [ + "async", + "callback", + "utility", + "module" + ], "repository": { "type": "git", - "url": "https://github.com/caolan/async.git" + "url": "git+https://github.com/caolan/async.git" }, "bugs": { "url": "https://github.com/caolan/async/issues" }, - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/caolan/async/raw/master/LICENSE" - } - ], + "license": "MIT", "devDependencies": { "nodeunit": ">0.0.0", "uglify-js": "1.2.x", - "nodelint": ">0.0.0" + "nodelint": ">0.0.0", + "lodash": ">=2.4.1" }, "jam": { "main": "lib/async.js", @@ -30,31 +32,53 @@ "lib/async.js", "README.md", "LICENSE" + ], + "categories": [ + "Utilities" ] }, "scripts": { "test": "nodeunit test/test-async.js" }, - "homepage": "https://github.com/caolan/async", - "_id": "async@0.9.0", - "dist": { - "shasum": "ac3613b1da9bed1b47510bb4651b8931e47146c7", - "tarball": "http://registry.npmjs.org/async/-/async-0.9.0.tgz" + "spm": { + "main": "lib/async.js" }, + "volo": { + "main": "lib/async.js", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] + }, + "gitHead": "de3a16091d5125384eff4a54deb3998b13c3814c", + "homepage": "https://github.com/caolan/async#readme", + "_id": "async@0.9.2", + "_shasum": "aea74d5e61c1f899613bf64bda66d4c78f2fd17d", "_from": "async@>=0.9.0 <0.10.0", - "_npmVersion": "1.4.3", + "_npmVersion": "2.9.0", + "_nodeVersion": "2.0.1", "_npmUser": { - "name": "caolan", - "email": "caolan.mcmahon@gmail.com" + "name": "beaugunderson", + "email": "beau@beaugunderson.com" }, "maintainers": [ { "name": "caolan", - "email": "caolan@caolanmcmahon.com" + "email": "caolan.mcmahon@gmail.com" + }, + { + "name": "beaugunderson", + "email": "beau@beaugunderson.com" } ], + "dist": { + "shasum": "aea74d5e61c1f899613bf64bda66d4c78f2fd17d", + "tarball": "http://registry.npmjs.org/async/-/async-0.9.2.tgz" + }, "directories": {}, - "_shasum": "ac3613b1da9bed1b47510bb4651b8931e47146c7", - "_resolved": "https://registry.npmjs.org/async/-/async-0.9.0.tgz", + "_resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "readme": "ERROR: No README data found!" } diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/support/sync-package-managers.js b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/support/sync-package-managers.js new file mode 100755 index 00000000000..30cb7c2d0cf --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/async/support/sync-package-managers.js @@ -0,0 +1,53 @@ +#!/usr/bin/env node + +// This should probably be its own module but complaints about bower/etc. +// support keep coming up and I'd rather just enable the workflow here for now +// and figure out where this should live later. -- @beaugunderson + +var fs = require('fs'); +var _ = require('lodash'); + +var packageJson = require('../package.json'); + +var IGNORES = ['**/.*', 'node_modules', 'bower_components', 'test', 'tests']; +var INCLUDES = ['lib/async.js', 'README.md', 'LICENSE']; +var REPOSITORY_NAME = 'caolan/async'; + +packageJson.jam = { + main: packageJson.main, + include: INCLUDES, + categories: ['Utilities'] +}; + +packageJson.spm = { + main: packageJson.main +}; + +packageJson.volo = { + main: packageJson.main, + ignore: IGNORES +}; + +var bowerSpecific = { + moduleType: ['amd', 'globals', 'node'], + ignore: IGNORES, + authors: [packageJson.author] +}; + +var bowerInclude = ['name', 'description', 'version', 'main', 'keywords', + 'license', 'homepage', 'repository', 'devDependencies']; + +var componentSpecific = { + repository: REPOSITORY_NAME, + scripts: [packageJson.main] +}; + +var componentInclude = ['name', 'description', 'version', 'keywords', + 'license']; + +var bowerJson = _.merge({}, _.pick(packageJson, bowerInclude), bowerSpecific); +var componentJson = _.merge({}, _.pick(packageJson, componentInclude), componentSpecific); + +fs.writeFileSync('./bower.json', JSON.stringify(bowerJson, null, 2)); +fs.writeFileSync('./component.json', JSON.stringify(componentJson, null, 2)); +fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2)); diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js b/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js index c18ad980d9c..6b5c21b6b42 100644 --- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js +++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js @@ -30,7 +30,7 @@ CombinedStream.create = function(options) { CombinedStream.isStreamLike = function(stream) { return (typeof stream !== 'function') && (typeof stream !== 'string') - && (typeof stream !== 'boolean') + && (typeof stream !== 'boolean') && (typeof stream !== 'number') && (!Buffer.isBuffer(stream)); }; @@ -40,12 +40,12 @@ CombinedStream.prototype.append = function(stream) { if (isStreamLike) { if (!(stream instanceof DelayedStream)) { - stream.on('data', this._checkDataSize.bind(this)); - - stream = DelayedStream.create(stream, { + var newStream = DelayedStream.create(stream, { maxDataSize: Infinity, pauseStream: this.pauseStreams, }); + stream.on('data', this._checkDataSize.bind(this)); + stream = newStream; } this._handleErrors(stream); @@ -97,7 +97,7 @@ CombinedStream.prototype._pipeNext = function(stream) { var isStreamLike = CombinedStream.isStreamLike(stream); if (isStreamLike) { - stream.on('end', this._getNext.bind(this)) + stream.on('end', this._getNext.bind(this)); stream.pipe(this, {end: false}); return; } @@ -123,6 +123,7 @@ CombinedStream.prototype.pause = function() { return; } + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause(); this.emit('pause'); }; @@ -133,6 +134,7 @@ CombinedStream.prototype.resume = function() { this._getNext(); } + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume(); this.emit('resume'); }; @@ -159,7 +161,7 @@ CombinedStream.prototype._checkDataSize = function() { } var message = - 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'; this._emitError(new Error(message)); }; diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile b/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile index b4ff85a33b6..2d7580746d0 100644 --- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile +++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile @@ -4,4 +4,3 @@ test: @./test/run.js .PHONY: test - diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js b/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js index 9ecad5b8ad1..787539606e6 100644 --- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js +++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js @@ -34,5 +34,3 @@ server.listen(common.PORT, function() { }); }); }); - - diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json b/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json index 080953f1600..57c38da67df 100644 --- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json +++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json @@ -6,7 +6,7 @@ }, "name": "combined-stream", "description": "A stream that emits multiple other streams one after another.", - "version": "0.0.5", + "version": "0.0.7", "homepage": "https://github.com/felixge/node-combined-stream", "repository": { "type": "git", @@ -25,37 +25,13 @@ "devDependencies": { "far": "~0.0.7" }, - "gitHead": "19d9bdd4c20f6806c2ae8adb00a53fb6fd154740", + "readme": "# combined-stream [![Build Status](https://travis-ci.org/felixge/node-combined-stream.svg?branch=master)](https://travis-ci.org/felixge/node-combined-stream)\n\nA stream that emits multiple other streams one after another.\n\n## Installation\n\n``` bash\nnpm install combined-stream\n```\n\n## Usage\n\nHere is a simple example that shows how you can use combined-stream to combine\ntwo files into one:\n\n``` javascript\nvar CombinedStream = require('combined-stream');\nvar fs = require('fs');\n\nvar combinedStream = CombinedStream.create();\ncombinedStream.append(fs.createReadStream('file1.txt'));\ncombinedStream.append(fs.createReadStream('file2.txt'));\n\ncombinedStream.pipe(fs.createWriteStream('combined.txt'));\n```\n\nWhile the example above works great, it will pause all source streams until\nthey are needed. If you don't want that to happen, you can set `pauseStreams`\nto `false`:\n\n``` javascript\nvar CombinedStream = require('combined-stream');\nvar fs = require('fs');\n\nvar combinedStream = CombinedStream.create({pauseStreams: false});\ncombinedStream.append(fs.createReadStream('file1.txt'));\ncombinedStream.append(fs.createReadStream('file2.txt'));\n\ncombinedStream.pipe(fs.createWriteStream('combined.txt'));\n```\n\nHowever, what if you don't have all the source streams yet, or you don't want\nto allocate the resources (file descriptors, memory, etc.) for them right away?\nWell, in that case you can simply provide a callback that supplies the stream\nby calling a `next()` function:\n\n``` javascript\nvar CombinedStream = require('combined-stream');\nvar fs = require('fs');\n\nvar combinedStream = CombinedStream.create();\ncombinedStream.append(function(next) {\n next(fs.createReadStream('file1.txt'));\n});\ncombinedStream.append(function(next) {\n next(fs.createReadStream('file2.txt'));\n});\n\ncombinedStream.pipe(fs.createWriteStream('combined.txt'));\n```\n\n## API\n\n### CombinedStream.create([options])\n\nReturns a new combined stream object. Available options are:\n\n* `maxDataSize`\n* `pauseStreams`\n\nThe effect of those options is described below.\n\n### combinedStream.pauseStreams = `true`\n\nWhether to apply back pressure to the underlaying streams. If set to `false`,\nthe underlaying streams will never be paused. If set to `true`, the\nunderlaying streams will be paused right after being appended, as well as when\n`delayedStream.pipe()` wants to throttle.\n\n### combinedStream.maxDataSize = `2 * 1024 * 1024`\n\nThe maximum amount of bytes (or characters) to buffer for all source streams.\nIf this value is exceeded, `combinedStream` emits an `'error'` event.\n\n### combinedStream.dataSize = `0`\n\nThe amount of bytes (or characters) currently buffered by `combinedStream`.\n\n### combinedStream.append(stream)\n\nAppends the given `stream` to the combinedStream object. If `pauseStreams` is\nset to `true, this stream will also be paused right away.\n\n`streams` can also be a function that takes one parameter called `next`. `next`\nis a function that must be invoked in order to provide the `next` stream, see\nexample above.\n\nRegardless of how the `stream` is appended, combined-stream always attaches an\n`'error'` listener to it, so you don't have to do that manually.\n\nSpecial case: `stream` can also be a String or Buffer.\n\n### combinedStream.write(data)\n\nYou should not call this, `combinedStream` takes care of piping the appended\nstreams into itself for you.\n\n### combinedStream.resume()\n\nCauses `combinedStream` to start drain the streams it manages. The function is\nidempotent, and also emits a `'resume'` event each time which usually goes to\nthe stream that is currently being drained.\n\n### combinedStream.pause();\n\nIf `combinedStream.pauseStreams` is set to `false`, this does nothing.\nOtherwise a `'pause'` event is emitted, this goes to the stream that is\ncurrently being drained, so you can use it to apply back pressure.\n\n### combinedStream.end();\n\nSets `combinedStream.writable` to false, emits an `'end'` event, and removes\nall streams from the queue.\n\n### combinedStream.destroy();\n\nSame as `combinedStream.end()`, except it emits a `'close'` event instead of\n`'end'`.\n\n## License\n\ncombined-stream is licensed under the MIT license.\n", + "readmeFilename": "Readme.md", "bugs": { "url": "https://github.com/felixge/node-combined-stream/issues" }, - "_id": "combined-stream@0.0.5", - "_shasum": "29ed76e5c9aad07c4acf9ca3d32601cce28697a2", - "_from": "combined-stream@>=0.0.4 <0.1.0", - "_npmVersion": "1.4.14", - "_npmUser": { - "name": "alexindigo", - "email": "iam@alexindigo.com" - }, - "maintainers": [ - { - "name": "felixge", - "email": "felix@debuggable.com" - }, - { - "name": "celer", - "email": "celer@scrypt.net" - }, - { - "name": "alexindigo", - "email": "iam@alexindigo.com" - } - ], - "dist": { - "shasum": "29ed76e5c9aad07c4acf9ca3d32601cce28697a2", - "tarball": "http://registry.npmjs.org/combined-stream/-/combined-stream-0.0.5.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.5.tgz", - "readme": "ERROR: No README data found!" + "_id": "combined-stream@0.0.7", + "_shasum": "0137e657baa5a7541c57ac37ac5fc07d73b4dc1f", + "_resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz", + "_from": "combined-stream@>=0.0.4 <0.1.0" } diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/mime/LICENSE b/deps/npm/node_modules/request/node_modules/form-data/node_modules/mime/LICENSE deleted file mode 100644 index 451fc4550c2..00000000000 --- a/deps/npm/node_modules/request/node_modules/form-data/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/deps/npm/node_modules/request/node_modules/form-data/node_modules/mime/README.md b/deps/npm/node_modules/request/node_modules/form-data/node_modules/mime/README.md deleted file mode 100644 index 6ca19bd1e85..00000000000 --- a/deps/npm/node_modules/request/node_modules/form-data/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/deps/npm/node_modules/request/node_modules/form-data/node_modules/mime/mime.js b/deps/npm/node_modules/request/node_modules/form-data/node_modules/mime/mime.js deleted file mode 100644 index 48be0c5e42b..00000000000 --- a/deps/npm/node_modules/request/node_modules/form-data/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/deps/npm/node_modules/request/node_modules/form-data/node_modules/mime/package.json b/deps/npm/node_modules/request/node_modules/form-data/node_modules/mime/package.json deleted file mode 100644 index b666b72a2a1..00000000000 --- a/deps/npm/node_modules/request/node_modules/form-data/node_modules/mime/package.json +++ /dev/null @@ -1,59 +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 <1.3.0", - "_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", - "scripts": {} -} diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/mime/test.js b/deps/npm/node_modules/request/node_modules/form-data/node_modules/mime/test.js deleted file mode 100644 index 2cda1c7ad19..00000000000 --- a/deps/npm/node_modules/request/node_modules/form-data/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/deps/npm/node_modules/request/node_modules/form-data/node_modules/mime/types/mime.types b/deps/npm/node_modules/request/node_modules/form-data/node_modules/mime/types/mime.types deleted file mode 100644 index da8cd691879..00000000000 --- a/deps/npm/node_modules/request/node_modules/form-data/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/deps/npm/node_modules/request/node_modules/form-data/node_modules/mime/types/node.types b/deps/npm/node_modules/request/node_modules/form-data/node_modules/mime/types/node.types deleted file mode 100644 index 55b2cf794ee..00000000000 --- a/deps/npm/node_modules/request/node_modules/form-data/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/deps/npm/node_modules/request/node_modules/form-data/package.json b/deps/npm/node_modules/request/node_modules/form-data/package.json index 7700d99929d..46ec26dff6d 100644 --- a/deps/npm/node_modules/request/node_modules/form-data/package.json +++ b/deps/npm/node_modules/request/node_modules/form-data/package.json @@ -6,7 +6,7 @@ }, "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.1.4", + "version": "0.2.0", "repository": { "type": "git", "url": "git://github.com/felixge/node-form-data.git" @@ -19,9 +19,9 @@ "node": ">= 0.8" }, "dependencies": { + "async": "~0.9.0", "combined-stream": "~0.0.4", - "mime": "~1.2.11", - "async": "~0.9.0" + "mime-types": "~2.0.3" }, "licenses": [ { @@ -35,46 +35,14 @@ "formidable": "~1.0.14", "request": "~2.36.0" }, - "gitHead": "5f5f4809ea685f32658809fa0f13d7eface0e45a", + "readme": "# Form-Data [![Build Status](https://travis-ci.org/felixge/node-form-data.png?branch=master)](https://travis-ci.org/felixge/node-form-data) [![Dependency Status](https://gemnasium.com/felixge/node-form-data.png)](https://gemnasium.com/felixge/node-form-data)\n\nA module to create readable ```\"multipart/form-data\"``` streams. Can be used to submit forms and file uploads to other web applications.\n\nThe API of this module is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd].\n\n[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface\n[streams2-thing]: http://nodejs.org/api/stream.html#stream_compatibility_with_older_node_versions\n\n## Install\n\n```\nnpm install form-data\n```\n\n## Usage\n\nIn this example we are constructing a form with 3 fields that contain a string,\na buffer and a file stream.\n\n``` javascript\nvar FormData = require('form-data');\nvar fs = require('fs');\n\nvar form = new FormData();\nform.append('my_field', 'my value');\nform.append('my_buffer', new Buffer(10));\nform.append('my_file', fs.createReadStream('/foo/bar.jpg'));\n```\n\nAlso you can use http-response stream:\n\n``` javascript\nvar FormData = require('form-data');\nvar http = require('http');\n\nvar form = new FormData();\n\nhttp.request('http://nodejs.org/images/logo.png', function(response) {\n form.append('my_field', 'my value');\n form.append('my_buffer', new Buffer(10));\n form.append('my_logo', response);\n});\n```\n\nOr @mikeal's request stream:\n\n``` javascript\nvar FormData = require('form-data');\nvar request = require('request');\n\nvar form = new FormData();\n\nform.append('my_field', 'my value');\nform.append('my_buffer', new Buffer(10));\nform.append('my_logo', request('http://nodejs.org/images/logo.png'));\n```\n\nIn order to submit this form to a web application, call ```submit(url, [callback])``` method:\n\n``` javascript\nform.submit('http://example.org/', function(err, res) {\n // res – response object (http.IncomingMessage) //\n res.resume(); // for node-0.10.x\n});\n\n```\n\nFor more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods.\n\n### Alternative submission methods\n\nYou can use node's http client interface:\n\n``` javascript\nvar http = require('http');\n\nvar request = http.request({\n method: 'post',\n host: 'example.org',\n path: '/upload',\n headers: form.getHeaders()\n});\n\nform.pipe(request);\n\nrequest.on('response', function(res) {\n console.log(res.statusCode);\n});\n```\n\nOr if you would prefer the `'Content-Length'` header to be set for you:\n\n``` javascript\nform.submit('example.org/upload', function(err, res) {\n console.log(res.statusCode);\n});\n```\n\nTo use custom headers and pre-known length in parts:\n\n``` javascript\nvar CRLF = '\\r\\n';\nvar form = new FormData();\n\nvar options = {\n header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF,\n knownLength: 1\n};\n\nform.append('my_buffer', buffer, options);\n\nform.submit('http://example.com/', function(err, res) {\n if (err) throw err;\n console.log('Done');\n});\n```\n\nForm-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide \"file\"-related information manually:\n\n``` javascript\nsomeModule.stream(function(err, stdout, stderr) {\n if (err) throw err;\n\n var form = new FormData();\n\n form.append('file', stdout, {\n filename: 'unicycle.jpg',\n contentType: 'image/jpg',\n knownLength: 19806\n });\n\n form.submit('http://example.com/', function(err, res) {\n if (err) throw err;\n console.log('Done');\n });\n});\n```\n\nFor edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter:\n\n``` javascript\nform.submit({\n host: 'example.com',\n path: '/probably.php?extra=params',\n auth: 'username:password'\n}, function(err, res) {\n console.log(res.statusCode);\n});\n```\n\nIn case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`:\n\n``` javascript\nform.submit({\n host: 'example.com',\n path: '/surelynot.php',\n headers: {'x-test-header': 'test-header-value'}\n}, function(err, res) {\n console.log(res.statusCode);\n});\n```\n\n## Notes\n\n- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround.\n- If it feels like FormData hangs after submit and you're on ```node-0.10```, please check [Compatibility with Older Node Versions][streams2-thing]\n\n## TODO\n\n- Add new streams (0.10) support and try really hard not to break it for 0.8.x.\n\n## License\n\nForm-Data is licensed under the MIT license.\n", + "readmeFilename": "Readme.md", "bugs": { "url": "https://github.com/felixge/node-form-data/issues" }, - "homepage": "https://github.com/felixge/node-form-data", - "_id": "form-data@0.1.4", - "_shasum": "91abd788aba9702b1aabfa8bc01031a2ac9e3b12", - "_from": "form-data@>=0.1.0 <0.2.0", - "_npmVersion": "1.4.14", - "_npmUser": { - "name": "alexindigo", - "email": "iam@alexindigo.com" - }, - "maintainers": [ - { - "name": "felixge", - "email": "felix@debuggable.com" - }, - { - "name": "idralyuk", - "email": "igor@buran.us" - }, - { - "name": "alexindigo", - "email": "iam@alexindigo.com" - }, - { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - }, - { - "name": "celer", - "email": "dtyree77@gmail.com" - } - ], - "dist": { - "shasum": "91abd788aba9702b1aabfa8bc01031a2ac9e3b12", - "tarball": "http://registry.npmjs.org/form-data/-/form-data-0.1.4.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/form-data/-/form-data-0.1.4.tgz", - "readme": "ERROR: No README data found!" + "homepage": "https://github.com/felixge/node-form-data#readme", + "_id": "form-data@0.2.0", + "_shasum": "26f8bc26da6440e299cbdcfb69035c4f77a6e466", + "_resolved": "https://registry.npmjs.org/form-data/-/form-data-0.2.0.tgz", + "_from": "form-data@>=0.2.0 <0.3.0" } diff --git a/deps/npm/node_modules/request/node_modules/har-validator/LICENSE b/deps/npm/node_modules/request/node_modules/har-validator/LICENSE new file mode 100644 index 00000000000..d52787158d0 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Ahmad Nassri (https://www.ahmadnassri.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/deps/npm/node_modules/request/node_modules/har-validator/README.md b/deps/npm/node_modules/request/node_modules/har-validator/README.md new file mode 100644 index 00000000000..4e580ab8616 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/README.md @@ -0,0 +1,362 @@ +# HAR Validator [![version][npm-version]][npm-url] [![License][npm-license]][license-url] + +Extremely fast HTTP Archive ([HAR](http://www.softwareishard.com/blog/har-12-spec/)) validator using JSON Schema. + +[![Build Status][travis-image]][travis-url] +[![Downloads][npm-downloads]][npm-url] +[![Code Climate][codeclimate-quality]][codeclimate-url] +[![Coverage Status][codeclimate-coverage]][codeclimate-url] +[![Dependencies][david-image]][david-url] + +## Install + +```shell +# to use in cli +npm install --global har-validator + +# to use as a module +npm install --save har-validator +``` + +## Usage + +``` + + Usage: har-validator [options] + + Options: + + -h, --help output usage information + -V, --version output the version number + -s, --schema [name] validate schema name (log, request, response, etc ...) + +``` + +###### Example + +```shell +har-validator har.json + +har-validator --schema request request.json +``` + +## API + +### Validate(data [, callback]) + +Returns `true` or `false`. + +- **data**: `Object` *(Required)* + a full [HAR](http://www.softwareishard.com/blog/har-12-spec/) object + +- **callback**: `Function` + gets two arguments (err, valid) + +```js +var HAR = require('./har.json'); +var validate = require('har-validator'); + +validate(HAR, function (e, valid) { + if (e) console.log(e.errors) + + if (valid) console.log('horray!'); +}); +``` + +### Validate.log(data [, callback]) + +Returns `true` or `false`. + +- **data**: `Object` *(Required)* + a [log](http://www.softwareishard.com/blog/har-12-spec/#log) object + +- **callback**: `Function` + gets two arguments (err, valid) + +```js +var validate = require('har-validator'); + +validate.log(data, function (e, valid) { + if (e) console.log(e.errors) +}); +``` + +### Validate.cache(data [, callback]) + +Returns `true` or `false`. + +- **data**: `Object` *(Required)* + a [cache](http://www.softwareishard.com/blog/har-12-spec/#cache) object + +- **callback**: `Function` + gets two arguments (err, valid) + +```js +var validate = require('har-validator'); + +validate.cache(data, function (e, valid) { + if (e) console.log(e.errors) +}); +``` + +### Validate.cacheEntry(data [, callback]) + +Returns `true` or `false`. + +- **data**: `Object` *(Required)* + a ["beforeRequest" or "afterRequest"](http://www.softwareishard.com/blog/har-12-spec/#cache) objects + +- **callback**: `Function` + gets two arguments (err, valid) + +```js +var validate = require('har-validator'); + +validate.cacheEntry(data, function (e, valid) { + if (e) console.log(e.errors) +}); +``` + +### Validate.content(data [, callback]) + +Returns `true` or `false`. + +- **data**: `Object` *(Required)* + a [content](http://www.softwareishard.com/blog/har-12-spec/#content) object + +- **callback**: `Function` + gets two arguments (err, valid) + +```js +var validate = require('har-validator'); + +validate.content(data, function (e, valid) { + if (e) console.log(e.errors) +}); +``` + +### Validate.cookie(data [, callback]) + +Returns `true` or `false`. + +- **data**: `Object` *(Required)* + a [cookie](http://www.softwareishard.com/blog/har-12-spec/#cookies) object + +- **callback**: `Function` + gets two arguments (err, valid) + +```js +var validate = require('har-validator'); + +validate.cookie(data, function (e, valid) { + if (e) console.log(e.errors) +}); +``` + +### Validate.creator(data [, callback]) + +Returns `true` or `false`. + +- **data**: `Object` *(Required)* + a [creator](http://www.softwareishard.com/blog/har-12-spec/#creator) object + +- **callback**: `Function` + gets two arguments (err, valid) + +```js +var validate = require('har-validator'); + +validate.creator(data, function (e, valid) { + if (e) console.log(e.errors) +}); +``` + +### Validate.entry(data [, callback]) + +Returns `true` or `false`. + +- **data**: `Object` *(Required)* + an [entry](http://www.softwareishard.com/blog/har-12-spec/#entries) object + +- **callback**: `Function` + gets two arguments (err, valid) + +```js +var validate = require('har-validator'); + +validate.entry(data, function (e, valid) { + if (e) console.log(e.errors) +}); +``` + +### Validate.log(data [, callback]) + +alias of [`Validate(data [, callback])`](#validate-data-callback-) + +### Validate.page(data [, callback]) + +Returns `true` or `false`. + +- **data**: `Object` *(Required)* + a [page](http://www.softwareishard.com/blog/har-12-spec/#pages) object + +- **callback**: `Function` + gets two arguments (err, valid) + +```js +var validate = require('har-validator'); + +validate.page(data, function (e, valid) { + if (e) console.log(e.errors) +}); +``` + +### Validate.pageTimings(data [, callback]) + +Returns `true` or `false`. + +- **data**: `Object` *(Required)* + a [pageTimings](http://www.softwareishard.com/blog/har-12-spec/#pageTimings) object + +- **callback**: `Function` + gets two arguments (err, valid) + +```js +var validate = require('har-validator'); + +validate.pageTimings(data, function (e, valid) { + if (e) console.log(e.errors) +}); +``` + +### Validate.postData(data [, callback]) + +Returns `true` or `false`. + +- **data**: `Object` *(Required)* + a [postData](http://www.softwareishard.com/blog/har-12-spec/#postData) object + +- **callback**: `Function` + gets two arguments (err, valid) + +```js +var validate = require('har-validator'); + +validate.postData(data, function (e, valid) { + if (e) console.log(e.errors) +}); +``` + +### Validate.record(data [, callback]) + +Returns `true` or `false`. + +- **data**: `Object` *(Required)* + a [record](http://www.softwareishard.com/blog/har-12-spec/#headers) object + +- **callback**: `Function` + gets two arguments (err, valid) + +```js +var validate = require('har-validator'); + +validate.record(data, function (e, valid) { + if (e) console.log(e.errors) +}); +``` + +### Validate.request(data [, callback]) + +Returns `true` or `false`. + +- **data**: `Object` *(Required)* + a [request](http://www.softwareishard.com/blog/har-12-spec/#request) object + +- **callback**: `Function` + gets two arguments (err, valid) + +```js +var validate = require('har-validator'); + +validate.request(data, function (e, valid) { + if (e) console.log(e.errors) +}); +``` + +### Validate.response(data [, callback]) + +Returns `true` or `false`. + +- **data**: `Object` *(Required)* + a [response](http://www.softwareishard.com/blog/har-12-spec/#response) object + +- **callback**: `Function` + gets two arguments (err, valid) + +```js +var validate = require('har-validator'); + +validate.cacheEntry(data, function (e, valid) { + if (e) console.log(e.errors) +}); +``` + +### Validate.timings(data [, callback]) + +Returns `true` or `false`. + +- **data**: `Object` *(Required)* + a [timings](http://www.softwareishard.com/blog/har-12-spec/#timings) object + +- **callback**: `Function` + gets two arguments (err, valid) + +```js +var validate = require('har-validator'); + +validate.timings(data, function (e, valid) { + if (e) console.log(e.errors) +}); +``` + +## Support + +Donations are welcome to help support the continuous development of this project. + +[![Gratipay][gratipay-image]][gratipay-url] +[![PayPal][paypal-image]][paypal-url] +[![Flattr][flattr-image]][flattr-url] +[![Bitcoin][bitcoin-image]][bitcoin-url] + +## License + +[MIT](LICENSE) © [Ahmad Nassri](https://www.ahmadnassri.com) + +[license-url]: https://github.com/ahmadnassri/har-validator/blob/master/LICENSE + +[travis-url]: https://travis-ci.org/ahmadnassri/har-validator +[travis-image]: https://img.shields.io/travis/ahmadnassri/har-validator.svg?style=flat-square + +[npm-url]: https://www.npmjs.com/package/har-validator +[npm-license]: https://img.shields.io/npm/l/har-validator.svg?style=flat-square +[npm-version]: https://img.shields.io/npm/v/har-validator.svg?style=flat-square +[npm-downloads]: https://img.shields.io/npm/dm/har-validator.svg?style=flat-square + +[codeclimate-url]: https://codeclimate.com/github/ahmadnassri/har-validator +[codeclimate-quality]: https://img.shields.io/codeclimate/github/ahmadnassri/har-validator.svg?style=flat-square +[codeclimate-coverage]: https://img.shields.io/codeclimate/coverage/github/ahmadnassri/har-validator.svg?style=flat-square + +[david-url]: https://david-dm.org/ahmadnassri/har-validator +[david-image]: https://img.shields.io/david/ahmadnassri/har-validator.svg?style=flat-square + +[gratipay-url]: https://www.gratipay.com/ahmadnassri/ +[gratipay-image]: https://img.shields.io/gratipay/ahmadnassri.svg?style=flat-square + +[paypal-url]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UJ2B2BTK9VLRS&on0=project&os0=har-validator +[paypal-image]: http://img.shields.io/badge/paypal-donate-green.svg?style=flat-square + +[flattr-url]: https://flattr.com/submit/auto?user_id=ahmadnassri&url=https://github.com/ahmadnassri/har-validator&title=har-validator&language=&tags=github&category=software +[flattr-image]: http://img.shields.io/badge/flattr-donate-green.svg?style=flat-square + +[bitcoin-image]: http://img.shields.io/badge/bitcoin-1Nb46sZRVG3or7pNaDjthcGJpWhvoPpCxy-green.svg?style=flat-square +[bitcoin-url]: https://www.coinbase.com/checkouts/ae383ae6bb931a2fa5ad11cec115191e?name=har-validator diff --git a/deps/npm/node_modules/request/node_modules/har-validator/bin/har-validator b/deps/npm/node_modules/request/node_modules/har-validator/bin/har-validator new file mode 100755 index 00000000000..ab1db256f79 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/bin/har-validator @@ -0,0 +1,45 @@ +#!/usr/bin/env node + +'use strict' + +var Promise = require('bluebird') + +var chalk = require('chalk') +var cmd = require('commander') +var fs = Promise.promisifyAll(require('fs')) +var path = require('path') +var pkg = require('../package.json') +var validate = Promise.promisifyAll(require('..')) + +cmd + .version(pkg.version) + .usage('[options] ') + .option('-s, --schema [name]', 'validate schema name (log, request, response, etc ...)') + .parse(process.argv) + +if (!cmd.args.length) { + cmd.help() +} + +if (!cmd.schema) { + cmd.schema = 'har' +} + +cmd.args.map(function (fileName) { + var file = chalk.yellow.italic(path.basename(fileName)) + + fs.readFileAsync(fileName) + .then(JSON.parse) + .then(validate[cmd.schema + 'Async']) + .then(function () { + console.log('%s [%s] is valid', chalk.green('✓'), file) + }) + .catch(SyntaxError, function (e) { + console.error('%s [%s] failed to read JSON: %s', chalk.red('✖'), file, chalk.red(e.message)) + }) + .catch(function (e) { + e.errors.map(function (err) { + console.error('%s [%s] failed validation: (%s: %s) %s', chalk.red('✖'), file, chalk.cyan.italic(err.field), chalk.magenta.italic(err.value), chalk.red(err.message)) + }) + }) +}) diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/LICENSE b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/LICENSE new file mode 100644 index 00000000000..a3966cf9359 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Petka Antonov + +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/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/README.md b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/README.md new file mode 100644 index 00000000000..dad5dcfd162 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/README.md @@ -0,0 +1,676 @@ +
                              + Promises/A+ logo + +[![Build Status](https://travis-ci.org/petkaantonov/bluebird.svg?branch=master)](https://travis-ci.org/petkaantonov/bluebird) +[![coverage-98%](http://img.shields.io/badge/coverage-98%-brightgreen.svg?style=flat)](http://petkaantonov.github.io/bluebird/coverage/debug/index.html) + + +# Introduction + +Bluebird is a fully featured [promise](#what-are-promises-and-why-should-i-use-them) library with focus on innovative features and performance + + + +# Topics + +- [Features](#features) +- [Quick start](#quick-start) +- [API Reference and examples](API.md) +- [Support](#support) +- [What are promises and why should I use them?](#what-are-promises-and-why-should-i-use-them) +- [Questions and issues](#questions-and-issues) +- [Error handling](#error-handling) +- [Development](#development) + - [Testing](#testing) + - [Benchmarking](#benchmarks) + - [Custom builds](#custom-builds) + - [For library authors](#for-library-authors) +- [What is the sync build?](#what-is-the-sync-build) +- [License](#license) +- [Snippets for common problems](https://github.com/petkaantonov/bluebird/wiki/Snippets) +- [Promise anti-patterns](https://github.com/petkaantonov/bluebird/wiki/Promise-anti-patterns) +- [Changelog](changelog.md) +- [Optimization guide](#optimization-guide) + +# Features +bluebird logo + +- [Promises A+](http://promisesaplus.com) +- [Synchronous inspection](API.md#synchronous-inspection) +- [Concurrency coordination](API.md#collections) +- [Promisification on steroids](API.md#promisification) +- [Resource management through a parallel of python `with`/C# `using`](API.md#resource-management) +- [Cancellation and timeouts](API.md#cancellation) +- [Parallel for C# `async` and `await`](API.md#generators) +- Mind blowing utilities such as + - [`.bind()`](API.md#binddynamic-thisarg---promise) + - [`.call()`](API.md#callstring-propertyname--dynamic-arg---promise) + - [`Promise.join()`](API.md#promisejoinpromisethenablevalue-promises-function-handler---promise) + - [And](API.md#core) [much](API.md#timers) [more](API.md#utility)! +- [Practical debugging solutions and sane defaults](#error-handling) +- [Sick performance](benchmark/) + +
                              + +# Quick start + +## Node.js + + npm install bluebird + +Then: + +```js +var Promise = require("bluebird"); +``` + +## Browsers + +There are many ways to use bluebird in browsers: + +- Direct downloads + - Full build [bluebird.js](https://cdn.jsdelivr.net/bluebird/latest/bluebird.js) + - Full build minified [bluebird.min.js](https://cdn.jsdelivr.net/bluebird/latest/bluebird.min.js) +- You may use browserify on the main export +- You may use the [bower](http://bower.io) package. + +When using script tags the global variables `Promise` and `P` (alias for `Promise`) become available. + +A [minimal bluebird browser build](#custom-builds) is ≈38.92KB minified*, 11.65KB gzipped and has no external dependencies. + +*Google Closure Compiler using Simple. + +#### Browser support + +Browsers that [implement ECMA-262, edition 3](http://en.wikipedia.org/wiki/Ecmascript#Implementations) and later are supported. + +[![Selenium Test Status](https://saucelabs.com/browser-matrix/petka_antonov.svg)](https://saucelabs.com/u/petka_antonov) + +**Note** that in ECMA-262, edition 3 (IE7, IE8 etc.) it is not possible to use methods that have keyword names like `.catch` and `.finally`. The [API documentation](API.md) always lists a compatible alternative name that you can use if you need to support these browsers. For example `.catch` is replaced with `.caught` and `.finally` with `.lastly`. + +Also, [long stack trace](API.md#promiselongstacktraces---void) support is only available in Chrome, Firefox and Internet Explorer 10+. + +After quick start, see [API Reference and examples](API.md) + +
                              + +# Support + +- Mailing list: [bluebird-js@googlegroups.com](https://groups.google.com/forum/#!forum/bluebird-js) +- IRC: #promises @freenode +- StackOverflow: [bluebird tag](http://stackoverflow.com/questions/tagged/bluebird) +- Bugs and feature requests: [github issue tracker](https://github.com/petkaantonov/bluebird/issues?state=open) + +
                              + +# What are promises and why should I use them? + +You should use promises to turn this: + +```js +fs.readFile("file.json", function(err, val) { + if( err ) { + console.error("unable to read file"); + } + else { + try { + val = JSON.parse(val); + console.log(val.success); + } + catch( e ) { + console.error("invalid json in file"); + } + } +}); +``` + +Into this: + +```js +fs.readFileAsync("file.json").then(JSON.parse).then(function(val) { + console.log(val.success); +}) +.catch(SyntaxError, function(e) { + console.error("invalid json in file"); +}) +.catch(function(e) { + console.error("unable to read file") +}); +``` + +*If you are wondering "there is no `readFileAsync` method on `fs` that returns a promise", see [promisification](API.md#promisification)* + +Actually you might notice the latter has a lot in common with code that would do the same using synchronous I/O: + +```js +try { + var val = JSON.parse(fs.readFileSync("file.json")); + console.log(val.success); +} +//Syntax actually not supported in JS but drives the point +catch(SyntaxError e) { + console.error("invalid json in file"); +} +catch(Error e) { + console.error("unable to read file") +} +``` + +And that is the point - being able to have something that is a lot like `return` and `throw` in synchronous code. + +You can also use promises to improve code that was written with callback helpers: + + +```js +//Copyright Plato http://stackoverflow.com/a/19385911/995876 +//CC BY-SA 2.5 +mapSeries(URLs, function (URL, done) { + var options = {}; + needle.get(URL, options, function (error, response, body) { + if (error) { + return done(error) + } + try { + var ret = JSON.parse(body); + return done(null, ret); + } + catch (e) { + done(e); + } + }); +}, function (err, results) { + if (err) { + console.log(err) + } else { + console.log('All Needle requests successful'); + // results is a 1 to 1 mapping in order of URLs > needle.body + processAndSaveAllInDB(results, function (err) { + if (err) { + return done(err) + } + console.log('All Needle requests saved'); + done(null); + }); + } +}); +``` + +Is more pleasing to the eye when done with promises: + +```js +Promise.promisifyAll(needle); +var options = {}; + +var current = Promise.resolve(); +Promise.map(URLs, function(URL) { + current = current.then(function () { + return needle.getAsync(URL, options); + }); + return current; +}).map(function(responseAndBody){ + return JSON.parse(responseAndBody[1]); +}).then(function (results) { + return processAndSaveAllInDB(results); +}).then(function(){ + console.log('All Needle requests saved'); +}).catch(function (e) { + console.log(e); +}); +``` + +Also promises don't just give you correspondences for synchronous features but can also be used as limited event emitters or callback aggregators. + +More reading: + + - [Promise nuggets](https://promise-nuggets.github.io/) + - [Why I am switching to promises](http://spion.github.io/posts/why-i-am-switching-to-promises.html) + - [What is the the point of promises](http://domenic.me/2012/10/14/youre-missing-the-point-of-promises/#toc_1) + - [Snippets for common problems](https://github.com/petkaantonov/bluebird/wiki/Snippets) + - [Promise anti-patterns](https://github.com/petkaantonov/bluebird/wiki/Promise-anti-patterns) + +# Questions and issues + +If you find a bug in bluebird or have a feature request, file an issue in the [github issue tracker](https://github.com/petkaantonov/bluebird/issues). Anything else, such as questions for help in using the library, should be posted in [StackOverflow](http://stackoverflow.com/questions/tagged/bluebird) under tags `promise` and `bluebird`. + +# Error handling + +This is a problem every promise library needs to handle in some way. Unhandled rejections/exceptions don't really have a good agreed-on asynchronous correspondence. The problem is that it is impossible to predict the future and know if a rejected promise will eventually be handled. + +There are two common pragmatic attempts at solving the problem that promise libraries do. + +The more popular one is to have the user explicitly communicate that they are done and any unhandled rejections should be thrown, like so: + +```js +download().then(...).then(...).done(); +``` + +For handling this problem, in my opinion, this is completely unacceptable and pointless. The user must remember to explicitly call `.done` and that cannot be justified when the problem is forgetting to create an error handler in the first place. + +The second approach, which is what bluebird by default takes, is to call a registered handler if a rejection is unhandled by the start of a second turn. The default handler is to write the stack trace to `stderr` or `console.error` in browsers. This is close to what happens with synchronous code - your code doesn't work as expected and you open console and see a stack trace. Nice. + +Of course this is not perfect, if your code for some reason needs to swoop in and attach error handler to some promise after the promise has been hanging around a while then you will see annoying messages. In that case you can use the `.done()` method to signal that any hanging exceptions should be thrown. + +If you want to override the default handler for these possibly unhandled rejections, you can pass yours like so: + +```js +Promise.onPossiblyUnhandledRejection(function(error){ + throw error; +}); +``` + +If you want to also enable long stack traces, call: + +```js +Promise.longStackTraces(); +``` + +right after the library is loaded. + +In node.js use the environment flag `BLUEBIRD_DEBUG`: + +``` +BLUEBIRD_DEBUG=1 node server.js +``` + +to enable long stack traces in all instances of bluebird. + +Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have already been created. Long stack traces imply a substantial performance penalty, even after using every trick to optimize them. + +Long stack traces are enabled by default in the debug build. + +#### Expected and unexpected errors + +A practical problem with Promises/A+ is that it models Javascript `try-catch` too closely for its own good. Therefore by default promises inherit `try-catch` warts such as the inability to specify the error types that the catch block is eligible for. It is an anti-pattern in every other language to use catch-all handlers because they swallow exceptions that you might not know about. + +Now, Javascript does have a perfectly fine and working way of creating error type hierarchies. It is still quite awkward to use them with the built-in `try-catch` however: + +```js +try { + //code +} +catch(e) { + if( e instanceof WhatIWantError) { + //handle + } + else { + throw e; + } +} +``` + +Without such checking, unexpected errors would be silently swallowed. However, with promises, bluebird brings the future (hopefully) here now and extends the `.catch` to [accept potential error type eligibility](API.md#catchfunction-errorclass-function-handler---promise). + +For instance here it is expected that some evil or incompetent entity will try to crash our server from `SyntaxError` by providing syntactically invalid JSON: + +```js +getJSONFromSomewhere().then(function(jsonString) { + return JSON.parse(jsonString); +}).then(function(object) { + console.log("it was valid json: ", object); +}).catch(SyntaxError, function(e){ + console.log("don't be evil"); +}); +``` + +Here any kind of unexpected error will be automatically reported on `stderr` along with a stack trace because we only register a handler for the expected `SyntaxError`. + +Ok, so, that's pretty neat. But actually not many libraries define error types and it is in fact a complete ghetto out there with ad hoc strings being attached as some arbitrary property name like `.name`, `.type`, `.code`, not having any property at all or even throwing strings as errors and so on. So how can we still listen for expected errors? + +Bluebird defines a special error type `OperationalError` (you can get a reference from `Promise.OperationalError`). This type of error is given as rejection reason by promisified methods when +their underlying library gives an untyped, but expected error. Primitives such as strings, and error objects that are directly created like `new Error("database didn't respond")` are considered untyped. + +Example of such library is the node core library `fs`. So if we promisify it, we can catch just the errors we want pretty easily and have programmer errors be redirected to unhandled rejection handler so that we notice them: + +```js +//Read more about promisification in the API Reference: +//API.md +var fs = Promise.promisifyAll(require("fs")); + +fs.readFileAsync("myfile.json").then(JSON.parse).then(function (json) { + console.log("Successful json") +}).catch(SyntaxError, function (e) { + console.error("file contains invalid json"); +}).catch(Promise.OperationalError, function (e) { + console.error("unable to read file, because: ", e.message); +}); +``` + +The last `catch` handler is only invoked when the `fs` module explicitly used the `err` argument convention of async callbacks to inform of an expected error. The `OperationalError` instance will contain the original error in its `.cause` property but it does have a direct copy of the `.message` and `.stack` too. In this code any unexpected error - be it in our code or the `fs` module - would not be caught by these handlers and therefore not swallowed. + +Since a `catch` handler typed to `Promise.OperationalError` is expected to be used very often, it has a neat shorthand: + +```js +.error(function (e) { + console.error("unable to read file, because: ", e.message); +}); +``` + +See [API documentation for `.error()`](API.md#error-rejectedhandler----promise) + +Finally, Bluebird also supports predicate-based filters. If you pass a +predicate function instead of an error type, the predicate will receive +the error as an argument. The return result will be used to determine whether +the error handler should be called. + +Predicates should allow for very fine grained control over caught errors: +pattern matching, error typesets with set operations and many other techniques +can be implemented on top of them. + +Example of using a predicate-based filter: + +```js +var Promise = require("bluebird"); +var request = Promise.promisify(require("request")); + +function clientError(e) { + return e.code >= 400 && e.code < 500; +} + +request("http://www.google.com").then(function(contents){ + console.log(contents); +}).catch(clientError, function(e){ + //A client error like 400 Bad Request happened +}); +``` + +**Danger:** The JavaScript language allows throwing primitive values like strings. Throwing primitives can lead to worse or no stack traces. Primitives [are not exceptions](http://www.devthought.com/2011/12/22/a-string-is-not-an-error/). You should consider always throwing Error objects when handling exceptions. + +
                              + +#### How do long stack traces differ from e.g. Q? + +Bluebird attempts to have more elaborate traces. Consider: + +```js +Error.stackTraceLimit = 25; +Q.longStackSupport = true; +Q().then(function outer() { + return Q().then(function inner() { + return Q().then(function evenMoreInner() { + a.b.c.d(); + }).catch(function catcher(e){ + console.error(e.stack); + }); + }) +}); +``` + +You will see + + ReferenceError: a is not defined + at evenMoreInner (:7:13) + From previous event: + at inner (:6:20) + +Compare to: + +```js +Error.stackTraceLimit = 25; +Promise.longStackTraces(); +Promise.resolve().then(function outer() { + return Promise.resolve().then(function inner() { + return Promise.resolve().then(function evenMoreInner() { + a.b.c.d() + }).catch(function catcher(e){ + console.error(e.stack); + }); + }); +}); +``` + + ReferenceError: a is not defined + at evenMoreInner (:7:13) + From previous event: + at inner (:6:36) + From previous event: + at outer (:5:32) + From previous event: + at :4:21 + at Object.InjectedScript._evaluateOn (:572:39) + at Object.InjectedScript._evaluateAndWrap (:531:52) + at Object.InjectedScript.evaluate (:450:21) + + +A better and more practical example of the differences can be seen in gorgikosev's [debuggability competition](https://github.com/spion/async-compare#debuggability). + +
                              + +# Development + +For development tasks such as running benchmarks or testing, you need to clone the repository and install dev-dependencies. + +Install [node](http://nodejs.org/) and [npm](https://npmjs.org/) + + git clone git@github.com:petkaantonov/bluebird.git + cd bluebird + npm install + +## Testing + +To run all tests, run + + node tools/test + +If you need to run generator tests run the `tool/test.js` script with `--harmony` argument and node 0.11+: + + node-dev --harmony tools/test + +You may specify an individual test file to run with the `--run` script flag: + + node tools/test --run=cancel.js + + +This enables output from the test and may give a better idea where the test is failing. The paramter to `--run` can be any file name located in `test/mocha` folder. + +#### Testing in browsers + +To run the test in a browser instead of node, pass the flag `--browser` to the test tool + + node tools/test --run=cancel.js --browser + +This will automatically create a server (default port 9999) and open it in your default browser once the tests have been compiled. + +Keep the test tab active because some tests are timing-sensitive and will fail if the browser is throttling timeouts. Chrome will do this for example when the tab is not active. + +#### Supported options by the test tool + +The value of boolean flags is determined by presence, if you want to pass false value for a boolean flag, use the `no-`-prefix e.g. `--no-browser`. + + - `--run=String`. Which tests to run (or compile when testing in browser). Default `"all"`. Can also be a glob string (relative to ./test/mocha folder) + - `--cover=String`. Create code coverage using the String as istanbul reporter. Coverage is created in the ./coverage folder. No coverage is created by default, default reporter is `"html"` (use `--cover` to use default reporter). + - `--browser` - Whether to compile tests for browsers. Default `false`. + - `--port=Number` - Whe port where local server is hosted when testing in browser. Default `9999` + - `--execute-browser-tests` - Whether to execute the compiled tests for browser when using `--browser`. Default `true`. + - `--open-browser` - Whether to open the default browser when executing browser tests. Default `true`. + - `--fake-timers` - Whether to use fake timers (`setTimeout` etc) when running tests in node. Default `true`. + - `--js-hint` - Whether to run JSHint on source files. Default `true`. + - `--saucelabs` Wheter to create a tunnel to sauce labs and run tests in their VMs instead of your browser when compiling tests for browser.Default `false`. + +## Benchmarks + +To run a benchmark, run the given command for a benchmark while on the project root. Requires bash (on windows the mingw32 that comes with git works fine too). + +Node 0.11.2+ is required to run the generator examples. + +### 1\. DoxBee sequential + +Currently the most relevant benchmark is @gorkikosev's benchmark in the article [Analysis of generators and other async patterns in node](http://spion.github.io/posts/analysis-generators-and-other-async-patterns-node.html). The benchmark emulates a situation where n amount of users are making a request in parallel to execute some mixed async/sync action. The benchmark has been modified to include a warm-up phase to minimize any JITing during timed sections. + +Command: `bench doxbee` + +### 2\. Made-up parallel + +This made-up scenario runs 15 shimmed queries in parallel. + +Command: `bench parallel` + +## Custom builds + +Custom builds for browsers are supported through a command-line utility. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                              The following features can be disabled
                              Feature(s)Command line identifier
                              .any and Promise.anyany
                              .race and Promise.racerace
                              .call and .getcall_get
                              .filter and Promise.filterfilter
                              .map and Promise.mapmap
                              .reduce and Promise.reducereduce
                              .props and Promise.propsprops
                              .settle and Promise.settlesettle
                              .some and Promise.somesome
                              .nodeifynodeify
                              Promise.coroutine and Promise.spawngenerators
                              Progressionprogress
                              Promisificationpromisify
                              Cancellationcancel
                              Timerstimers
                              Resource managementusing
                              + + +Make sure you have cloned the repo somewhere and did `npm install` successfully. + +After that you can run: + + node tools/build --features="core" + + +The above builds the most minimal build you can get. You can add more features separated by spaces from the above list: + + node tools/build --features="core filter map reduce" + +The custom build file will be found from `/js/browser/bluebird.js`. It will have a comment that lists the disabled and enabled features. + +Note that the build leaves the `/js/main` etc folders with same features so if you use the folder for node.js at the same time, don't forget to build +a full version afterwards (after having taken a copy of the bluebird.js somewhere): + + node tools/build --debug --main --zalgo --browser --minify + +#### Supported options by the build tool + +The value of boolean flags is determined by presence, if you want to pass false value for a boolean flag, use the `no-`-prefix e.g. `--no-debug`. + + - `--main` - Whether to build the main build. The main build is placed at `js/main` directory. Default `false`. + - `--debug` - Whether to build the debug build. The debug build is placed at `js/debug` directory. Default `false`. + - `--zalgo` - Whether to build the zalgo build. The zalgo build is placed at `js/zalgo` directory. Default `false`. + - `--browser` - Whether to compile the browser build. The browser build file is placed at `js/browser/bluebird.js` Default `false`. + - `--minify` - Whether to minify the compiled browser build. The minified browser build file is placed at `js/browser/bluebird.min.js` Default `true`. + - `--features=String` - See [custom builds](#custom-builds) + +
                              + +## For library authors + +Building a library that depends on bluebird? You should know about a few features. + +If your library needs to do something obtrusive like adding or modifying methods on the `Promise` prototype, uses long stack traces or uses a custom unhandled rejection handler then... that's totally ok as long as you don't use `require("bluebird")`. Instead you should create a file +that creates an isolated copy. For example, creating a file called `bluebird-extended.js` that contains: + +```js + //NOTE the function call right after +module.exports = require("bluebird/js/main/promise")(); +``` + +Your library can then use `var Promise = require("bluebird-extended");` and do whatever it wants with it. Then if the application or other library uses their own bluebird promises they will all play well together because of Promises/A+ thenable assimilation magic. + +You should also know about [`.nodeify()`](API.md#nodeifyfunction-callback---promise) which makes it easy to provide a dual callback/promise API. + +
                              + +## What is the sync build? + +You may now use sync build by: + + var Promise = require("bluebird/zalgo"); + +The sync build is provided to see how forced asynchronity affects benchmarks. It should not be used in real code due to the implied hazards. + +The normal async build gives Promises/A+ guarantees about asynchronous resolution of promises. Some people think this affects performance or just plain love their code having a possibility +of stack overflow errors and non-deterministic behavior. + +The sync build skips the async call trampoline completely, e.g code like: + + async.invoke( this.fn, this, val ); + +Appears as this in the sync build: + + this.fn(val); + +This should pressure the CPU slightly less and thus the sync build should perform better. Indeed it does, but only marginally. The biggest performance boosts are from writing efficient Javascript, not from compromising determinism. + +Note that while some benchmarks are waiting for the next event tick, the CPU is actually not in use during that time. So the resulting benchmark result is not completely accurate because on node.js you only care about how much the CPU is taxed. Any time spent on CPU is time the whole process (or server) is paralyzed. And it is not graceful like it would be with threads. + + +```js +var cache = new Map(); //ES6 Map or DataStructures/Map or whatever... +function getResult(url) { + var resolver = Promise.pending(); + if (cache.has(url)) { + resolver.resolve(cache.get(url)); + } + else { + http.get(url, function(err, content) { + if (err) resolver.reject(err); + else { + cache.set(url, content); + resolver.resolve(content); + } + }); + } + return resolver.promise; +} + + + +//The result of console.log is truly random without async guarantees +function guessWhatItPrints( url ) { + var i = 3; + getResult(url).then(function(){ + i = 4; + }); + console.log(i); +} +``` + +# Optimization guide + +Articles about optimization will be periodically posted in [the wiki section](https://github.com/petkaantonov/bluebird/wiki), polishing edits are welcome. + +A single cohesive guide compiled from the articles will probably be done eventually. + +# License + +The MIT License (MIT) + +Copyright (c) 2014 Petka Antonov + +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/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/changelog.md b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/changelog.md new file mode 100644 index 00000000000..aa145dcb270 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/changelog.md @@ -0,0 +1,1653 @@ +## 2.9.27 (2015-05-30) + +Bugfixes: + + - Fix `sinon.useFakeTimers()` breaking scheduler ([#631](.)) + +Misc: + + - Add nw testing facilities (`node tools/test --nw`) + +## 2.9.26 (2015-05-25) + +Bugfixes: + + - Fix crash in NW [#624](.) + - Fix [`.return()`](.) not supporting `undefined` as return value [#627](.) + +## 2.9.25 (2015-04-28) + +Bugfixes: + + - Fix crash in node 0.8 + +## 2.9.24 (2015-04-02) + +Bugfixes: + + - Fix not being able to load multiple bluebird copies introduced in 2.9.22 ([#559](.), [#561](.), [#560](.)). + +## 2.9.23 (2015-04-02) + +Bugfixes: + + - Fix node.js domain propagation ([#521](.)). + +## 2.9.22 (2015-04-02) + + - Fix `.promisify` crashing in phantom JS ([#556](.)) + +## 2.9.21 (2015-03-30) + + - Fix error object's `'stack'`' overwriting causing an error when its defined to be a setter that throws an error ([#552](.)). + +## 2.9.20 (2015-03-29) + +Bugfixes: + + - Fix regression where there is a long delay between calling `.cancel()` and promise actually getting cancelled in Chrome when long stack traces are enabled + +## 2.9.19 (2015-03-29) + +Bugfixes: + + - Fix crashing in Chrome when long stack traces are disabled + +## 2.9.18 (2015-03-29) + +Bugfixes: + + - Fix settlePromises using trampoline + +## 2.9.17 (2015-03-29) + + +Bugfixes: + + - Fix Chrome DevTools async stack traceability ([#542](.)). + +## 2.9.16 (2015-03-28) + +Features: + + - Use setImmediate if available + +## 2.9.15 (2015-03-26) + +Features: + + - Added `.asCallback` alias for `.nodeify`. + +Bugfixes: + + - Don't always use nextTick, but try to pick up setImmediate or setTimeout in NW. Fixes [#534](.), [#525](.) + - Make progress a core feature. Fixes [#535](.) Note that progress has been removed in 3.x - this is only a fix necessary for 2.x custom builds. + +## 2.9.14 (2015-03-12) + +Bugfixes: + + - Always use process.nextTick. Fixes [#525](.) + +## 2.9.13 (2015-02-27) + +Bugfixes: + + - Fix .each, .filter, .reduce and .map callbacks being called synchornously if the input is immediate. ([#513](.)) + +## 2.9.12 (2015-02-19) + +Bugfixes: + + - Fix memory leak introduced in 2.9.0 ([#502](.)) + +## 2.9.11 (2015-02-19) + +Bugfixes: + + - Fix [#503](.) + +## 2.9.10 (2015-02-18) + +Bugfixes: + + - Fix [#501](.) + +## 2.9.9 (2015-02-12) + +Bugfixes: + + - Fix `TypeError: Cannot assign to read only property 'length'` when jsdom has declared a read-only length for all objects to inherit. + +## 2.9.8 (2015-02-10) + +Bugfixes: + + - Fix regression introduced in 2.9.7 where promisify didn't properly dynamically look up methods on `this` + +## 2.9.7 (2015-02-08) + +Bugfixes: + + - Fix `promisify` not retaining custom properties of the function. This enables promisifying the `"request"` module's export function and its methods at the same time. + - Fix `promisifyAll` methods being dependent on `this` when they are not originally dependent on `this`. This enables e.g. passing promisified `fs` functions directly as callbacks without having to bind them to `fs`. + - Fix `process.nextTick` being used over `setImmediate` in node. + +## 2.9.6 (2015-02-02) + +Bugfixes: + + - Node environment detection can no longer be fooled + +## 2.9.5 (2015-02-02) + +Misc: + + - Warn when [`.then()`](.) is passed non-functions + +## 2.9.4 (2015-01-30) + +Bugfixes: + + - Fix [.timeout()](.) not calling `clearTimeout` with the proper handle in node causing the process to wait for unneeded timeout. This was a regression introduced in 2.9.1. + +## 2.9.3 (2015-01-27) + +Bugfixes: + + - Fix node-webkit compatibility issue ([#467](https://github.com/petkaantonov/bluebird/pull/467)) + - Fix long stack trace support in recent firefox versions + +## 2.9.2 (2015-01-26) + +Bugfixes: + + - Fix critical bug regarding to using promisifyAll in browser that was introduced in 2.9.0 ([#466](https://github.com/petkaantonov/bluebird/issues/466)). + +Misc: + + - Add `"browser"` entry point to package.json + +## 2.9.1 (2015-01-24) + +Features: + + - If a bound promise is returned by the callback to [`Promise.method`](#promisemethodfunction-fn---function) and [`Promise.try`](#promisetryfunction-fn--arraydynamicdynamic-arguments--dynamic-ctx----promise), the returned promise will be bound to the same value + +## 2.9.0 (2015-01-24) + +Features: + + - Add [`Promise.fromNode`](API.md#promisefromnodefunction-resolver---promise) + - Add new paramter `value` for [`Promise.bind`](API.md#promisebinddynamic-thisarg--dynamic-value---promise) + +Bugfixes: + + - Fix several issues with [`cancellation`](API.md#cancellation) and [`.bind()`](API.md#binddynamic-thisarg---promise) interoperation when `thisArg` is a promise or thenable + - Fix promises created in [`disposers`](API#disposerfunction-disposer---disposer) not having proper long stack trace context + - Fix [`Promise.join`](API.md#promisejoinpromisethenablevalue-promises-function-handler---promise) sometimes passing the passed in callback function as the last argument to itself. + +Misc: + + - Reduce minified full browser build file size by not including unused code generation functionality. + - Major internal refactoring related to testing code and source code file layout + +## 2.8.2 (2015-01-20) + +Features: + + - [Global rejection events](https://github.com/petkaantonov/bluebird/blob/master/API.md#global-rejection-events) are now fired both as DOM3 events and as legacy events in browsers + +## 2.8.1 (2015-01-20) + +Bugfixes: + + - Fix long stack trace stiching consistency when rejected from thenables + +## 2.8.0 (2015-01-19) + +Features: + + - Major debuggability improvements: + - Long stack traces have been re-designed. They are now much more readable, + succint, relevant and consistent across bluebird features. + - Long stack traces are supported now in IE10+ + +## 2.7.1 (2015-01-15) + +Bugfixes: + + - Fix [#447](https://github.com/petkaantonov/bluebird/issues/447) + +## 2.7.0 (2015-01-15) + +Features: + + - Added more context to stack traces originating from coroutines ([#421](https://github.com/petkaantonov/bluebird/issues/421)) + - Implemented [global rejection events](https://github.com/petkaantonov/bluebird/blob/master/API.md#global-rejection-events) ([#428](https://github.com/petkaantonov/bluebird/issues/428), [#357](https://github.com/petkaantonov/bluebird/issues/357)) + - [Custom promisifiers](https://github.com/petkaantonov/bluebird/blob/master/API.md#option-promisifier) are now passed the default promisifier which can be used to add enhancements on top of normal node promisification + - [Promisification filters](https://github.com/petkaantonov/bluebird/blob/master/API.md#option-filter) are now passed `passesDefaultFilter` boolean + +Bugfixes: + + - Fix `.noConflict()` call signature ([#446]()) + - Fix `Promise.method`ified functions being called with `undefined` when they were called with no arguments + +## 2.6.4 (2015-01-12) + +Bugfixes: + + - `OperationalErrors` thrown by promisified functions retain custom properties, such as `.code` and `.path`. + +## 2.6.3 (2015-01-12) + +Bugfixes: + + - Fix [#429](https://github.com/petkaantonov/bluebird/issues/429) + - Fix [#432](https://github.com/petkaantonov/bluebird/issues/432) + - Fix [#433](https://github.com/petkaantonov/bluebird/issues/433) + +## 2.6.2 (2015-01-07) + +Bugfixes: + + - Fix [#426](https://github.com/petkaantonov/bluebird/issues/426) + +## 2.6.1 (2015-01-07) + +Bugfixes: + + - Fixed built browser files not being included in the git tag release for bower + +## 2.6.0 (2015-01-06) + +Features: + + - Significantly improve parallel promise performance and memory usage (+50% faster, -50% less memory) + + +## 2.5.3 (2014-12-30) + +## 2.5.2 (2014-12-29) + +Bugfixes: + + - Fix bug where already resolved promise gets attached more handlers while calling its handlers resulting in some handlers not being called + - Fix bug where then handlers are not called in the same order as they would run if Promises/A+ 2.3.2 was implemented as adoption + - Fix bug where using `Object.create(null)` as a rejection reason would crash bluebird + +## 2.5.1 (2014-12-29) + +Bugfixes: + + - Fix `.finally` throwing null error when it is derived from a promise that is resolved with a promise that is resolved with a promise + +## 2.5.0 (2014-12-28) + +Features: + + - [`.get`](#API.md#https://github.com/petkaantonov/bluebird/blob/master/API.md#getstring-propertyname---promise) now supports negative indexing. + +Bugfixes: + + - Fix bug with `Promise.method` wrapped function returning a promise that never resolves if the function returns a promise that is resolved with another promise + - Fix bug with `Promise.delay` never resolving if the value is a promise that is resolved with another promise + +## 2.4.3 (2014-12-28) + +Bugfixes: + + - Fix memory leak as described in [this Promises/A+ spec issue](https://github.com/promises-aplus/promises-spec/issues/179). + +## 2.4.2 (2014-12-21) + +Bugfixes: + + - Fix bug where spread rejected handler is ignored in case of rejection + - Fix synchronous scheduler passed to `setScheduler` causing infinite loop + +## 2.4.1 (2014-12-20) + +Features: + + - Error messages now have links to wiki pages for additional information + - Promises now clean up all references (to handlers, child promises etc) as soon as possible. + +## 2.4.0 (2014-12-18) + +Features: + + - Better filtering of bluebird internal calls in long stack traces, especially when using minified file in browsers + - Small performance improvements for all collection methods + - Promises now delete references to handlers attached to them as soon as possible + - Additional stack traces are now output on stderr/`console.warn` for errors that are thrown in the process/window from rejected `.done()` promises. See [#411](https://github.com/petkaantonov/bluebird/issues/411) + +## 2.3.11 (2014-10-31) + +Bugfixes: + + - Fix [#371](https://github.com/petkaantonov/bluebird/issues/371), [#373](https://github.com/petkaantonov/bluebird/issues/373) + + +## 2.3.10 (2014-10-28) + +Features: + + - `Promise.method` no longer wraps primitive errors + - `Promise.try` no longer wraps primitive errors + +## 2.3.7 (2014-10-25) + +Bugfixes: + + - Fix [#359](https://github.com/petkaantonov/bluebird/issues/359), [#362](https://github.com/petkaantonov/bluebird/issues/362) and [#364](https://github.com/petkaantonov/bluebird/issues/364) + +## 2.3.6 (2014-10-15) + +Features: + + - Implement [`.reflect()`](API.md#reflect---promisepromiseinspection) + +## 2.3.5 (2014-10-06) + +Bugfixes: + + - Fix issue when promisifying methods whose names contain the string 'args' + +## 2.3.4 (2014-09-27) + + - `P` alias was not declared inside WebWorkers + +## 2.3.3 (2014-09-27) + +Bugfixes: + + - Fix [#318](https://github.com/petkaantonov/bluebird/issues/318), [#314](https://github.com/petkaantonov/bluebird/issues/#314) + +## 2.3.2 (2014-08-25) + +Bugfixes: + + - `P` alias for `Promise` now exists in global scope when using browser builds without a module loader, fixing an issue with firefox extensions + +## 2.3.1 (2014-08-23) + +Features: + + - `.using` can now be used with disposers created from different bluebird copy + +## 2.3.0 (2014-08-13) + +Features: + + - [`.bind()`](API.md#binddynamic-thisarg---promise) and [`Promise.bind()`](API.md#promisebinddynamic-thisarg---promise) now await for the resolution of the `thisArg` if it's a promise or a thenable + +Bugfixes: + + - Fix [#276](https://github.com/petkaantonov/bluebird/issues/276) + +## 2.2.2 (2014-07-14) + + - Fix [#259](https://github.com/petkaantonov/bluebird/issues/259) + +## 2.2.1 (2014-07-07) + + - Fix multiline error messages only showing the first line + +## 2.2.0 (2014-07-07) + +Bugfixes: + + - `.any` and `.some` now consistently reject with RangeError when input array contains too few promises + - Fix iteration bug with `.reduce` when input array contains already fulfilled promises + +## 2.1.3 (2014-06-18) + +Bugfixes: + + - Fix [#235](https://github.com/petkaantonov/bluebird/issues/235) + +## 2.1.2 (2014-06-15) + +Bugfixes: + + - Fix [#232](https://github.com/petkaantonov/bluebird/issues/232) + +## 2.1.1 (2014-06-11) + +## 2.1.0 (2014-06-11) + +Features: + + - Add [`promisifier`](API.md#option-promisifier) option to `Promise.promisifyAll()` + - Improve performance of `.props()` and collection methods when used with immediate values + + +Bugfixes: + + - Fix a bug where .reduce calls the callback for an already visited item + - Fix a bug where stack trace limit is calculated to be too small, which resulted in too short stack traces + +Add undocumented experimental `yieldHandler` option to `Promise.coroutine` + +## 2.0.7 (2014-06-08) +## 2.0.6 (2014-06-07) +## 2.0.5 (2014-06-05) +## 2.0.4 (2014-06-05) +## 2.0.3 (2014-06-05) +## 2.0.2 (2014-06-04) +## 2.0.1 (2014-06-04) + +## 2.0.0 (2014-06-04) + +#What's new in 2.0 + +- [Resource management](API.md#resource-management) - never leak resources again +- [Promisification](API.md#promisification) on steroids - entire modules can now be promisified with one line of code +- [`.map()`](API.md#mapfunction-mapper--object-options---promise), [`.each()`](API.md#eachfunction-iterator---promise), [`.filter()`](API.md#filterfunction-filterer--object-options---promise), [`.reduce()`](API.md#reducefunction-reducer--dynamic-initialvalue---promise) reimagined from simple sugar to powerful concurrency coordination tools +- [API Documentation](API.md) has been reorganized and more elaborate examples added +- Deprecated [progression](#progression-migration) and [deferreds](#deferred-migration) +- Improved performance and readability + +Features: + +- Added [`using()`](API.md#promiseusingpromisedisposer-promise-promisedisposer-promise--function-handler---promise) and [`disposer()`](API.md#disposerfunction-disposer---disposer) +- [`.map()`](API.md#mapfunction-mapper--object-options---promise) now calls the handler as soon as items in the input array become fulfilled +- Added a concurrency option to [`.map()`](API.md#mapfunction-mapper--object-options---promise) +- [`.filter()`](API.md#filterfunction-filterer--object-options---promise) now calls the handler as soon as items in the input array become fulfilled +- Added a concurrency option to [`.filter()`](API.md#filterfunction-filterer--object-options---promise) +- [`.reduce()`](API.md#reducefunction-reducer--dynamic-initialvalue---promise) now calls the handler as soon as items in the input array become fulfilled, but in-order +- Added [`.each()`](API.md#eachfunction-iterator---promise) +- [`Promise.resolve()`](API.md#promiseresolvedynamic-value---promise) behaves like `Promise.cast`. `Promise.cast` deprecated. +- [Synchronous inspection](API.md#synchronous-inspection): Removed `.inspect()`, added [`.value()`](API.md#value---dynamic) and [`.reason()`](API.md#reason---dynamic) +- [`Promise.join()`](API.md#promisejoinpromisethenablevalue-promises-function-handler---promise) now takes a function as the last argument +- Added [`Promise.setScheduler()`](API.md#promisesetschedulerfunction-scheduler---void) +- [`.cancel()`](API.md#cancelerror-reason---promise) supports a custom cancellation reason +- [`.timeout()`](API.md#timeoutint-ms--string-message---promise) now cancels the promise instead of rejecting it +- [`.nodeify()`](API.md#nodeifyfunction-callback--object-options---promise) now supports passing multiple success results when mapping promises to nodebacks +- Added `suffix` and `filter` options to [`Promise.promisifyAll()`](API.md#promisepromisifyallobject-target--object-options---object) + +Breaking changes: + +- Sparse array holes are not skipped by collection methods but treated as existing elements with `undefined` value +- `.map()` and `.filter()` do not call the given mapper or filterer function in any specific order +- Removed the `.inspect()` method +- Yielding an array from a coroutine is not supported by default. You can use [`coroutine.addYieldHandler()`](API.md#promisecoroutineaddyieldhandlerfunction-handler---void) to configure the old behavior (or any behavior you want). +- [`.any()`](API.md#any---promise) and [`.some()`](API.md#someint-count---promise) no longer use an array as the rejection reason. [`AggregateError`](API.md#aggregateerror) is used instead. + + +## 1.2.4 (2014-04-27) + +Bugfixes: + + - Fix promisifyAll causing a syntax error when a method name is not a valid identifier + - Fix syntax error when es5.js is used in strict mode + +## 1.2.3 (2014-04-17) + +Bugfixes: + + - Fix [#179](https://github.com/petkaantonov/bluebird/issues/179) + +## 1.2.2 (2014-04-09) + +Bugfixes: + + - Promisified methods from promisifyAll no longer call the original method when it is overriden + - Nodeify doesn't pass second argument to the callback if the promise is fulfilled with `undefined` + +## 1.2.1 (2014-03-31) + +Bugfixes: + + - Fix [#168](https://github.com/petkaantonov/bluebird/issues/168) + +## 1.2.0 (2014-03-29) + +Features: + + - New method: [`.value()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#value---dynamic) + - New method: [`.reason()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#reason---dynamic) + - New method: [`Promise.onUnhandledRejectionHandled()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#promiseonunhandledrejectionhandledfunction-handler---undefined) + - `Promise.map()`, `.map()`, `Promise.filter()` and `.filter()` start calling their callbacks as soon as possible while retaining a correct order. See [`8085922f`](https://github.com/petkaantonov/bluebird/commit/8085922fb95a9987fda0cf2337598ab4a98dc315). + +Bugfixes: + + - Fix [#165](https://github.com/petkaantonov/bluebird/issues/165) + - Fix [#166](https://github.com/petkaantonov/bluebird/issues/166) + +## 1.1.1 (2014-03-18) + +Bugfixes: + + - [#138](https://github.com/petkaantonov/bluebird/issues/138) + - [#144](https://github.com/petkaantonov/bluebird/issues/144) + - [#148](https://github.com/petkaantonov/bluebird/issues/148) + - [#151](https://github.com/petkaantonov/bluebird/issues/151) + +## 1.1.0 (2014-03-08) + +Features: + + - Implement [`Promise.prototype.tap()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#tapfunction-handler---promise) + - Implement [`Promise.coroutine.addYieldHandler()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#promisecoroutineaddyieldhandlerfunction-handler---void) + - Deprecate `Promise.prototype.spawn` + +Bugfixes: + + - Fix already rejected promises being reported as unhandled when handled through collection methods + - Fix browserisfy crashing from checking `process.version.indexOf` + +## 1.0.8 (2014-03-03) + +Bugfixes: + + - Fix active domain being lost across asynchronous boundaries in Node.JS 10.xx + +## 1.0.7 (2014-02-25) + +Bugfixes: + + - Fix handled errors being reported + +## 1.0.6 (2014-02-17) + +Bugfixes: + + - Fix bug with unhandled rejections not being reported + when using `Promise.try` or `Promise.method` without + attaching further handlers + +## 1.0.5 (2014-02-15) + +Features: + + - Node.js performance: promisified functions try to check amount of passed arguments in most optimal order + - Node.js promisified functions will have same `.length` as the original function minus one (for the callback parameter) + +## 1.0.4 (2014-02-09) + +Features: + + - Possibly unhandled rejection handler will always get a stack trace, even if the rejection or thrown error was not an error + - Unhandled rejections are tracked per promise, not per error. So if you create multiple branches from a single ancestor and that ancestor gets rejected, each branch with no error handler with the end will cause a possibly unhandled rejection handler invocation + +Bugfixes: + + - Fix unhandled non-writable objects or primitives not reported by possibly unhandled rejection handler + +## 1.0.3 (2014-02-05) + +Bugfixes: + + - [#93](https://github.com/petkaantonov/bluebird/issues/88) + +## 1.0.2 (2014-02-04) + +Features: + + - Significantly improve performance of foreign bluebird thenables + +Bugfixes: + + - [#88](https://github.com/petkaantonov/bluebird/issues/88) + +## 1.0.1 (2014-01-28) + +Features: + + - Error objects that have property `.isAsync = true` will now be caught by `.error()` + +Bugfixes: + + - Fix TypeError and RangeError shims not working without `new` operator + +## 1.0.0 (2014-01-12) + +Features: + + - `.filter`, `.map`, and `.reduce` no longer skip sparse array holes. This is a backwards incompatible change. + - Like `.map` and `.filter`, `.reduce` now allows returning promises and thenables from the iteration function. + +Bugfixes: + + - [#58](https://github.com/petkaantonov/bluebird/issues/58) + - [#61](https://github.com/petkaantonov/bluebird/issues/61) + - [#64](https://github.com/petkaantonov/bluebird/issues/64) + - [#60](https://github.com/petkaantonov/bluebird/issues/60) + +## 0.11.6-1 (2013-12-29) + +## 0.11.6-0 (2013-12-29) + +Features: + + - You may now return promises and thenables from the filterer function used in `Promise.filter` and `Promise.prototype.filter`. + + - `.error()` now catches additional sources of rejections: + + - Rejections originating from `Promise.reject` + + - Rejections originating from thenables using + the `reject` callback + + - Rejections originating from promisified callbacks + which use the `errback` argument + + - Rejections originating from `new Promise` constructor + where the `reject` callback is called explicitly + + - Rejections originating from `PromiseResolver` where + `.reject()` method is called explicitly + +Bugfixes: + + - Fix `captureStackTrace` being called when it was `null` + - Fix `Promise.map` not unwrapping thenables + +## 0.11.5-1 (2013-12-15) + +## 0.11.5-0 (2013-12-03) + +Features: + + - Improve performance of collection methods + - Improve performance of promise chains + +## 0.11.4-1 (2013-12-02) + +## 0.11.4-0 (2013-12-02) + +Bugfixes: + + - Fix `Promise.some` behavior with arguments like negative integers, 0... + - Fix stack traces of synchronously throwing promisified functions' + +## 0.11.3-0 (2013-12-02) + +Features: + + - Improve performance of generators + +Bugfixes: + + - Fix critical bug with collection methods. + +## 0.11.2-0 (2013-12-02) + +Features: + + - Improve performance of all collection methods + +## 0.11.1-0 (2013-12-02) + +Features: + +- Improve overall performance. +- Improve performance of promisified functions. +- Improve performance of catch filters. +- Improve performance of .finally. + +Bugfixes: + +- Fix `.finally()` rejecting if passed non-function. It will now ignore non-functions like `.then`. +- Fix `.finally()` not converting thenables returned from the handler to promises. +- `.spread()` now rejects if the ultimate value given to it is not spreadable. + +## 0.11.0-0 (2013-12-02) + +Features: + + - Improve overall performance when not using `.bind()` or cancellation. + - Promises are now not cancellable by default. This is backwards incompatible change - see [`.cancellable()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#cancellable---promise) + - [`Promise.delay`](https://github.com/petkaantonov/bluebird/blob/master/API.md#promisedelaydynamic-value-int-ms---promise) + - [`.delay()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#delayint-ms---promise) + - [`.timeout()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#timeoutint-ms--string-message---promise) + +## 0.10.14-0 (2013-12-01) + +Bugfixes: + + - Fix race condition when mixing 3rd party asynchrony. + +## 0.10.13-1 (2013-11-30) + +## 0.10.13-0 (2013-11-30) + +Bugfixes: + + - Fix another bug with progression. + +## 0.10.12-0 (2013-11-30) + +Bugfixes: + + - Fix bug with progression. + +## 0.10.11-4 (2013-11-29) + +## 0.10.11-2 (2013-11-29) + +Bugfixes: + + - Fix `.race()` not propagating bound values. + +## 0.10.11-1 (2013-11-29) + +Features: + + - Improve performance of `Promise.race` + +## 0.10.11-0 (2013-11-29) + +Bugfixes: + + - Fixed `Promise.promisifyAll` invoking property accessors. Only data properties with function values are considered. + +## 0.10.10-0 (2013-11-28) + +Features: + + - Disable long stack traces in browsers by default. Call `Promise.longStackTraces()` to enable them. + +## 0.10.9-1 (2013-11-27) + +Bugfixes: + + - Fail early when `new Promise` is constructed incorrectly + +## 0.10.9-0 (2013-11-27) + +Bugfixes: + + - Promise.props now takes a [thenable-for-collection](https://github.com/petkaantonov/bluebird/blob/f41edac61b7c421608ff439bb5a09b7cffeadcf9/test/mocha/props.js#L197-L217) + - All promise collection methods now reject when a promise-or-thenable-for-collection turns out not to give a collection + +## 0.10.8-0 (2013-11-25) + +Features: + + - All static collection methods take thenable-for-collection + +## 0.10.7-0 (2013-11-25) + +Features: + + - throw TypeError when thenable resolves with itself + - Make .race() and Promise.race() forever pending on empty collections + +## 0.10.6-0 (2013-11-25) + +Bugfixes: + + - Promise.resolve and PromiseResolver.resolve follow thenables too. + +## 0.10.5-0 (2013-11-24) + +Bugfixes: + + - Fix infinite loop when thenable resolves with itself + +## 0.10.4-1 (2013-11-24) + +Bugfixes: + + - Fix a file missing from build. (Critical fix) + +## 0.10.4-0 (2013-11-24) + +Features: + + - Remove dependency of es5-shim and es5-sham when using ES3. + +## 0.10.3-0 (2013-11-24) + +Features: + + - Improve performance of `Promise.method` + +## 0.10.2-1 (2013-11-24) + +Features: + + - Rename PromiseResolver#asCallback to PromiseResolver#callback + +## 0.10.2-0 (2013-11-24) + +Features: + + - Remove memoization of thenables + +## 0.10.1-0 (2013-11-21) + +Features: + + - Add methods `Promise.resolve()`, `Promise.reject()`, `Promise.defer()` and `.resolve()`. + +## 0.10.0-1 (2013-11-17) + +## 0.10.0-0 (2013-11-17) + +Features: + + - Implement `Promise.method()` + - Implement `.return()` + - Implement `.throw()` + +Bugfixes: + + - Fix promises being able to use themselves as resolution or follower value + +## 0.9.11-1 (2013-11-14) + +Features: + + - Implicit `Promise.all()` when yielding an array from generators + +## 0.9.11-0 (2013-11-13) + +Bugfixes: + + - Fix `.spread` not unwrapping thenables + +## 0.9.10-2 (2013-11-13) + +Features: + + - Improve performance of promisified functions on V8 + +Bugfixes: + + - Report unhandled rejections even when long stack traces are disabled + - Fix `.error()` showing up in stack traces + +## 0.9.10-1 (2013-11-05) + +Bugfixes: + + - Catch filter method calls showing in stack traces + +## 0.9.10-0 (2013-11-05) + +Bugfixes: + + - Support primitives in catch filters + +## 0.9.9-0 (2013-11-05) + +Features: + + - Add `Promise.race()` and `.race()` + +## 0.9.8-0 (2013-11-01) + +Bugfixes: + + - Fix bug with `Promise.try` not unwrapping returned promises and thenables + +## 0.9.7-0 (2013-10-29) + +Bugfixes: + + - Fix bug with build files containing duplicated code for promise.js + +## 0.9.6-0 (2013-10-28) + +Features: + + - Improve output of reporting unhandled non-errors + - Implement RejectionError wrapping and `.error()` method + +## 0.9.5-0 (2013-10-27) + +Features: + + - Allow fresh copies of the library to be made + +## 0.9.4-1 (2013-10-27) + +## 0.9.4-0 (2013-10-27) + +Bugfixes: + + - Rollback non-working multiple fresh copies feature + +## 0.9.3-0 (2013-10-27) + +Features: + + - Allow fresh copies of the library to be made + - Add more components to customized builds + +## 0.9.2-1 (2013-10-25) + +## 0.9.2-0 (2013-10-25) + +Features: + + - Allow custom builds + +## 0.9.1-1 (2013-10-22) + +Bugfixes: + + - Fix unhandled rethrown exceptions not reported + +## 0.9.1-0 (2013-10-22) + +Features: + + - Improve performance of `Promise.try` + - Extend `Promise.try` to accept arguments and ctx to make it more usable in promisification of synchronous functions. + +## 0.9.0-0 (2013-10-18) + +Features: + + - Implement `.bind` and `Promise.bind` + +Bugfixes: + + - Fix `.some()` when argument is a pending promise that later resolves to an array + +## 0.8.5-1 (2013-10-17) + +Features: + + - Enable process wide long stack traces through BLUEBIRD_DEBUG environment variable + +## 0.8.5-0 (2013-10-16) + +Features: + + - Improve performance of all collection methods + +Bugfixes: + + - Fix .finally passing the value to handlers + - Remove kew from benchmarks due to bugs in the library breaking the benchmark + - Fix some bluebird library calls potentially appearing in stack traces + +## 0.8.4-1 (2013-10-15) + +Bugfixes: + + - Fix .pending() call showing in long stack traces + +## 0.8.4-0 (2013-10-15) + +Bugfixes: + + - Fix PromiseArray and its sub-classes swallowing possibly unhandled rejections + +## 0.8.3-3 (2013-10-14) + +Bugfixes: + + - Fix AMD-declaration using named module. + +## 0.8.3-2 (2013-10-14) + +Features: + + - The mortals that can handle it may now release Zalgo by `require("bluebird/zalgo");` + +## 0.8.3-1 (2013-10-14) + +Bugfixes: + + - Fix memory leak when using the same promise to attach handlers over and over again + +## 0.8.3-0 (2013-10-13) + +Features: + + - Add `Promise.props()` and `Promise.prototype.props()`. They work like `.all()` for object properties. + +Bugfixes: + + - Fix bug with .some returning garbage when sparse arrays have rejections + +## 0.8.2-2 (2013-10-13) + +Features: + + - Improve performance of `.reduce()` when `initialValue` can be synchronously cast to a value + +## 0.8.2-1 (2013-10-12) + +Bugfixes: + + - Fix .npmignore having irrelevant files + +## 0.8.2-0 (2013-10-12) + +Features: + + - Improve performance of `.some()` + +## 0.8.1-0 (2013-10-11) + +Bugfixes: + + - Remove uses of dynamic evaluation (`new Function`, `eval` etc) when strictly not necessary. Use feature detection to use static evaluation to avoid errors when dynamic evaluation is prohibited. + +## 0.8.0-3 (2013-10-10) + +Features: + + - Add `.asCallback` property to `PromiseResolver`s + +## 0.8.0-2 (2013-10-10) + +## 0.8.0-1 (2013-10-09) + +Features: + + - Improve overall performance. Be able to sustain infinite recursion when using promises. + +## 0.8.0-0 (2013-10-09) + +Bugfixes: + + - Fix stackoverflow error when function calls itself "synchronously" from a promise handler + +## 0.7.12-2 (2013-10-09) + +Bugfixes: + + - Fix safari 6 not using `MutationObserver` as a scheduler + - Fix process exceptions interfering with internal queue flushing + +## 0.7.12-1 (2013-10-09) + +Bugfixes: + + - Don't try to detect if generators are available to allow shims to be used + +## 0.7.12-0 (2013-10-08) + +Features: + + - Promisification now consider all functions on the object and its prototype chain + - Individual promisifcation uses current `this` if no explicit receiver is given + - Give better stack traces when promisified callbacks throw or errback primitives such as strings by wrapping them in an `Error` object. + +Bugfixes: + + - Fix runtime APIs throwing synchronous errors + +## 0.7.11-0 (2013-10-08) + +Features: + + - Deprecate `Promise.promisify(Object target)` in favor of `Promise.promisifyAll(Object target)` to avoid confusion with function objects + - Coroutines now throw error when a non-promise is `yielded` + +## 0.7.10-1 (2013-10-05) + +Features: + + - Make tests pass Internet Explorer 8 + +## 0.7.10-0 (2013-10-05) + +Features: + + - Create browser tests + +## 0.7.9-1 (2013-10-03) + +Bugfixes: + + - Fix promise cast bug when thenable fulfills using itself as the fulfillment value + +## 0.7.9-0 (2013-10-03) + +Features: + + - More performance improvements when long stack traces are enabled + +## 0.7.8-1 (2013-10-02) + +Features: + + - Performance improvements when long stack traces are enabled + +## 0.7.8-0 (2013-10-02) + +Bugfixes: + + - Fix promisified methods not turning synchronous exceptions into rejections + +## 0.7.7-1 (2013-10-02) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.7.7-0 (2013-10-01) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.7.6-0 (2013-09-29) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.7.5-0 (2013-09-28) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.7.4-1 (2013-09-28) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.7.4-0 (2013-09-28) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.7.3-1 (2013-09-28) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.7.3-0 (2013-09-27) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.7.2-0 (2013-09-27) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.7.1-5 (2013-09-26) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.7.1-4 (2013-09-25) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.7.1-3 (2013-09-25) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.7.1-2 (2013-09-24) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.7.1-1 (2013-09-24) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.7.1-0 (2013-09-24) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.7.0-1 (2013-09-23) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.7.0-0 (2013-09-23) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.6.5-2 (2013-09-20) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.6.5-1 (2013-09-18) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.6.5-0 (2013-09-18) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.6.4-1 (2013-09-18) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.6.4-0 (2013-09-18) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.6.3-4 (2013-09-18) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.6.3-3 (2013-09-18) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.6.3-2 (2013-09-16) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.6.3-1 (2013-09-16) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.6.3-0 (2013-09-15) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.6.2-1 (2013-09-14) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.6.2-0 (2013-09-14) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.6.1-0 (2013-09-14) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.6.0-0 (2013-09-13) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.9-6 (2013-09-12) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.9-5 (2013-09-12) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.9-4 (2013-09-12) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.9-3 (2013-09-11) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.9-2 (2013-09-11) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.9-1 (2013-09-11) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.9-0 (2013-09-11) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.8-1 (2013-09-11) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.8-0 (2013-09-11) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.7-0 (2013-09-11) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.6-1 (2013-09-10) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.6-0 (2013-09-10) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.5-1 (2013-09-10) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.5-0 (2013-09-09) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.4-1 (2013-09-08) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.4-0 (2013-09-08) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.3-0 (2013-09-07) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.2-0 (2013-09-07) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.1-0 (2013-09-07) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.5.0-0 (2013-09-07) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.4.0-0 (2013-09-06) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.3.0-1 (2013-09-06) + +Features: + + - feature + +Bugfixes: + + - bugfix + +## 0.3.0 (2013-09-06) diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/browser/bluebird.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/browser/bluebird.js new file mode 100644 index 00000000000..a529187a935 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/browser/bluebird.js @@ -0,0 +1,5102 @@ +/* @preserve + * The MIT License (MIT) + * + * Copyright (c) 2014 Petka Antonov + * + * 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. + * + */ +/** + * bluebird build version 2.9.27 + * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, cancel, using, filter, any, each, timers +*/ +!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.Promise=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 _dereq_=="function"&&_dereq_;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 _dereq_=="function"&&_dereq_;for(var o=0;o 0; +}; + +Async.prototype.throwLater = function(fn, arg) { + if (arguments.length === 1) { + arg = fn; + fn = function () { throw arg; }; + } + var domain = this._getDomain(); + if (domain !== undefined) fn = domain.bind(fn); + if (typeof setTimeout !== "undefined") { + setTimeout(function() { + fn(arg); + }, 0); + } else try { + this._schedule(function() { + fn(arg); + }); + } catch (e) { + throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/m3OTXk\u000a"); + } +}; + +Async.prototype._getDomain = function() {}; + +if (!true) { +if (util.isNode) { + var EventsModule = _dereq_("events"); + + var domainGetter = function() { + var domain = process.domain; + if (domain === null) return undefined; + return domain; + }; + + if (EventsModule.usingDomains) { + Async.prototype._getDomain = domainGetter; + } else { + var descriptor = + Object.getOwnPropertyDescriptor(EventsModule, "usingDomains"); + + if (descriptor) { + if (!descriptor.configurable) { + process.on("domainsActivated", function() { + Async.prototype._getDomain = domainGetter; + }); + } else { + var usingDomains = false; + Object.defineProperty(EventsModule, "usingDomains", { + configurable: false, + enumerable: true, + get: function() { + return usingDomains; + }, + set: function(value) { + if (usingDomains || !value) return; + usingDomains = true; + Async.prototype._getDomain = domainGetter; + util.toFastProperties(process); + process.emit("domainsActivated"); + } + }); + } + } + } +} +} + +function AsyncInvokeLater(fn, receiver, arg) { + var domain = this._getDomain(); + if (domain !== undefined) fn = domain.bind(fn); + this._lateQueue.push(fn, receiver, arg); + this._queueTick(); +} + +function AsyncInvoke(fn, receiver, arg) { + var domain = this._getDomain(); + if (domain !== undefined) fn = domain.bind(fn); + this._normalQueue.push(fn, receiver, arg); + this._queueTick(); +} + +function AsyncSettlePromises(promise) { + var domain = this._getDomain(); + if (domain !== undefined) { + var fn = domain.bind(promise._settlePromises); + this._normalQueue.push(fn, promise, undefined); + } else { + this._normalQueue._pushOne(promise); + } + this._queueTick(); +} + +if (!util.hasDevTools) { + Async.prototype.invokeLater = AsyncInvokeLater; + Async.prototype.invoke = AsyncInvoke; + Async.prototype.settlePromises = AsyncSettlePromises; +} else { + Async.prototype.invokeLater = function (fn, receiver, arg) { + if (this._trampolineEnabled) { + AsyncInvokeLater.call(this, fn, receiver, arg); + } else { + setTimeout(function() { + fn.call(receiver, arg); + }, 100); + } + }; + + Async.prototype.invoke = function (fn, receiver, arg) { + if (this._trampolineEnabled) { + AsyncInvoke.call(this, fn, receiver, arg); + } else { + setTimeout(function() { + fn.call(receiver, arg); + }, 0); + } + }; + + Async.prototype.settlePromises = function(promise) { + if (this._trampolineEnabled) { + AsyncSettlePromises.call(this, promise); + } else { + setTimeout(function() { + promise._settlePromises(); + }, 0); + } + }; +} + +Async.prototype.invokeFirst = function (fn, receiver, arg) { + var domain = this._getDomain(); + if (domain !== undefined) fn = domain.bind(fn); + this._normalQueue.unshift(fn, receiver, arg); + this._queueTick(); +}; + +Async.prototype._drainQueue = function(queue) { + while (queue.length() > 0) { + var fn = queue.shift(); + if (typeof fn !== "function") { + fn._settlePromises(); + continue; + } + var receiver = queue.shift(); + var arg = queue.shift(); + fn.call(receiver, arg); + } +}; + +Async.prototype._drainQueues = function () { + this._drainQueue(this._normalQueue); + this._reset(); + this._drainQueue(this._lateQueue); +}; + +Async.prototype._queueTick = function () { + if (!this._isTickUsed) { + this._isTickUsed = true; + this._schedule(this.drainQueues); + } +}; + +Async.prototype._reset = function () { + this._isTickUsed = false; +}; + +module.exports = new Async(); +module.exports.firstLineError = firstLineError; + +},{"./queue.js":28,"./schedule.js":31,"./util.js":38,"events":39}],3:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL, tryConvertToPromise) { +var rejectThis = function(_, e) { + this._reject(e); +}; + +var targetRejected = function(e, context) { + context.promiseRejectionQueued = true; + context.bindingPromise._then(rejectThis, rejectThis, null, this, e); +}; + +var bindingResolved = function(thisArg, context) { + this._setBoundTo(thisArg); + if (this._isPending()) { + this._resolveCallback(context.target); + } +}; + +var bindingRejected = function(e, context) { + if (!context.promiseRejectionQueued) this._reject(e); +}; + +Promise.prototype.bind = function (thisArg) { + var maybePromise = tryConvertToPromise(thisArg); + var ret = new Promise(INTERNAL); + ret._propagateFrom(this, 1); + var target = this._target(); + if (maybePromise instanceof Promise) { + var context = { + promiseRejectionQueued: false, + promise: ret, + target: target, + bindingPromise: maybePromise + }; + target._then(INTERNAL, targetRejected, ret._progress, ret, context); + maybePromise._then( + bindingResolved, bindingRejected, ret._progress, ret, context); + } else { + ret._setBoundTo(thisArg); + ret._resolveCallback(target); + } + return ret; +}; + +Promise.prototype._setBoundTo = function (obj) { + if (obj !== undefined) { + this._bitField = this._bitField | 131072; + this._boundTo = obj; + } else { + this._bitField = this._bitField & (~131072); + } +}; + +Promise.prototype._isBound = function () { + return (this._bitField & 131072) === 131072; +}; + +Promise.bind = function (thisArg, value) { + var maybePromise = tryConvertToPromise(thisArg); + var ret = new Promise(INTERNAL); + + if (maybePromise instanceof Promise) { + maybePromise._then(function(thisArg) { + ret._setBoundTo(thisArg); + ret._resolveCallback(value); + }, ret._reject, ret._progress, ret, null); + } else { + ret._setBoundTo(thisArg); + ret._resolveCallback(value); + } + return ret; +}; +}; + +},{}],4:[function(_dereq_,module,exports){ +"use strict"; +var old; +if (typeof Promise !== "undefined") old = Promise; +function noConflict() { + try { if (Promise === bluebird) Promise = old; } + catch (e) {} + return bluebird; +} +var bluebird = _dereq_("./promise.js")(); +bluebird.noConflict = noConflict; +module.exports = bluebird; + +},{"./promise.js":23}],5:[function(_dereq_,module,exports){ +"use strict"; +var cr = Object.create; +if (cr) { + var callerCache = cr(null); + var getterCache = cr(null); + callerCache[" size"] = getterCache[" size"] = 0; +} + +module.exports = function(Promise) { +var util = _dereq_("./util.js"); +var canEvaluate = util.canEvaluate; +var isIdentifier = util.isIdentifier; + +var getMethodCaller; +var getGetter; +if (!true) { +var makeMethodCaller = function (methodName) { + return new Function("ensureMethod", " \n\ + return function(obj) { \n\ + 'use strict' \n\ + var len = this.length; \n\ + ensureMethod(obj, 'methodName'); \n\ + switch(len) { \n\ + case 1: return obj.methodName(this[0]); \n\ + case 2: return obj.methodName(this[0], this[1]); \n\ + case 3: return obj.methodName(this[0], this[1], this[2]); \n\ + case 0: return obj.methodName(); \n\ + default: \n\ + return obj.methodName.apply(obj, this); \n\ + } \n\ + }; \n\ + ".replace(/methodName/g, methodName))(ensureMethod); +}; + +var makeGetter = function (propertyName) { + return new Function("obj", " \n\ + 'use strict'; \n\ + return obj.propertyName; \n\ + ".replace("propertyName", propertyName)); +}; + +var getCompiled = function(name, compiler, cache) { + var ret = cache[name]; + if (typeof ret !== "function") { + if (!isIdentifier(name)) { + return null; + } + ret = compiler(name); + cache[name] = ret; + cache[" size"]++; + if (cache[" size"] > 512) { + var keys = Object.keys(cache); + for (var i = 0; i < 256; ++i) delete cache[keys[i]]; + cache[" size"] = keys.length - 256; + } + } + return ret; +}; + +getMethodCaller = function(name) { + return getCompiled(name, makeMethodCaller, callerCache); +}; + +getGetter = function(name) { + return getCompiled(name, makeGetter, getterCache); +}; +} + +function ensureMethod(obj, methodName) { + var fn; + if (obj != null) fn = obj[methodName]; + if (typeof fn !== "function") { + var message = "Object " + util.classString(obj) + " has no method '" + + util.toString(methodName) + "'"; + throw new Promise.TypeError(message); + } + return fn; +} + +function caller(obj) { + var methodName = this.pop(); + var fn = ensureMethod(obj, methodName); + return fn.apply(obj, this); +} +Promise.prototype.call = function (methodName) { + var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];} + if (!true) { + if (canEvaluate) { + var maybeCaller = getMethodCaller(methodName); + if (maybeCaller !== null) { + return this._then( + maybeCaller, undefined, undefined, args, undefined); + } + } + } + args.push(methodName); + return this._then(caller, undefined, undefined, args, undefined); +}; + +function namedGetter(obj) { + return obj[this]; +} +function indexedGetter(obj) { + var index = +this; + if (index < 0) index = Math.max(0, index + obj.length); + return obj[index]; +} +Promise.prototype.get = function (propertyName) { + var isIndex = (typeof propertyName === "number"); + var getter; + if (!isIndex) { + if (canEvaluate) { + var maybeGetter = getGetter(propertyName); + getter = maybeGetter !== null ? maybeGetter : namedGetter; + } else { + getter = namedGetter; + } + } else { + getter = indexedGetter; + } + return this._then(getter, undefined, undefined, propertyName, undefined); +}; +}; + +},{"./util.js":38}],6:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise) { +var errors = _dereq_("./errors.js"); +var async = _dereq_("./async.js"); +var CancellationError = errors.CancellationError; + +Promise.prototype._cancel = function (reason) { + if (!this.isCancellable()) return this; + var parent; + var promiseToReject = this; + while ((parent = promiseToReject._cancellationParent) !== undefined && + parent.isCancellable()) { + promiseToReject = parent; + } + this._unsetCancellable(); + promiseToReject._target()._rejectCallback(reason, false, true); +}; + +Promise.prototype.cancel = function (reason) { + if (!this.isCancellable()) return this; + if (reason === undefined) reason = new CancellationError(); + async.invokeLater(this._cancel, this, reason); + return this; +}; + +Promise.prototype.cancellable = function () { + if (this._cancellable()) return this; + async.enableTrampoline(); + this._setCancellable(); + this._cancellationParent = undefined; + return this; +}; + +Promise.prototype.uncancellable = function () { + var ret = this.then(); + ret._unsetCancellable(); + return ret; +}; + +Promise.prototype.fork = function (didFulfill, didReject, didProgress) { + var ret = this._then(didFulfill, didReject, didProgress, + undefined, undefined); + + ret._setCancellable(); + ret._cancellationParent = undefined; + return ret; +}; +}; + +},{"./async.js":2,"./errors.js":13}],7:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function() { +var async = _dereq_("./async.js"); +var util = _dereq_("./util.js"); +var bluebirdFramePattern = + /[\\\/]bluebird[\\\/]js[\\\/](main|debug|zalgo|instrumented)/; +var stackFramePattern = null; +var formatStack = null; +var indentStackFrames = false; +var warn; + +function CapturedTrace(parent) { + this._parent = parent; + var length = this._length = 1 + (parent === undefined ? 0 : parent._length); + captureStackTrace(this, CapturedTrace); + if (length > 32) this.uncycle(); +} +util.inherits(CapturedTrace, Error); + +CapturedTrace.prototype.uncycle = function() { + var length = this._length; + if (length < 2) return; + var nodes = []; + var stackToIndex = {}; + + for (var i = 0, node = this; node !== undefined; ++i) { + nodes.push(node); + node = node._parent; + } + length = this._length = i; + for (var i = length - 1; i >= 0; --i) { + var stack = nodes[i].stack; + if (stackToIndex[stack] === undefined) { + stackToIndex[stack] = i; + } + } + for (var i = 0; i < length; ++i) { + var currentStack = nodes[i].stack; + var index = stackToIndex[currentStack]; + if (index !== undefined && index !== i) { + if (index > 0) { + nodes[index - 1]._parent = undefined; + nodes[index - 1]._length = 1; + } + nodes[i]._parent = undefined; + nodes[i]._length = 1; + var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; + + if (index < length - 1) { + cycleEdgeNode._parent = nodes[index + 1]; + cycleEdgeNode._parent.uncycle(); + cycleEdgeNode._length = + cycleEdgeNode._parent._length + 1; + } else { + cycleEdgeNode._parent = undefined; + cycleEdgeNode._length = 1; + } + var currentChildLength = cycleEdgeNode._length + 1; + for (var j = i - 2; j >= 0; --j) { + nodes[j]._length = currentChildLength; + currentChildLength++; + } + return; + } + } +}; + +CapturedTrace.prototype.parent = function() { + return this._parent; +}; + +CapturedTrace.prototype.hasParent = function() { + return this._parent !== undefined; +}; + +CapturedTrace.prototype.attachExtraTrace = function(error) { + if (error.__stackCleaned__) return; + this.uncycle(); + var parsed = CapturedTrace.parseStackAndMessage(error); + var message = parsed.message; + var stacks = [parsed.stack]; + + var trace = this; + while (trace !== undefined) { + stacks.push(cleanStack(trace.stack.split("\n"))); + trace = trace._parent; + } + removeCommonRoots(stacks); + removeDuplicateOrEmptyJumps(stacks); + util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)); + util.notEnumerableProp(error, "__stackCleaned__", true); +}; + +function reconstructStack(message, stacks) { + for (var i = 0; i < stacks.length - 1; ++i) { + stacks[i].push("From previous event:"); + stacks[i] = stacks[i].join("\n"); + } + if (i < stacks.length) { + stacks[i] = stacks[i].join("\n"); + } + return message + "\n" + stacks.join("\n"); +} + +function removeDuplicateOrEmptyJumps(stacks) { + for (var i = 0; i < stacks.length; ++i) { + if (stacks[i].length === 0 || + ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) { + stacks.splice(i, 1); + i--; + } + } +} + +function removeCommonRoots(stacks) { + var current = stacks[0]; + for (var i = 1; i < stacks.length; ++i) { + var prev = stacks[i]; + var currentLastIndex = current.length - 1; + var currentLastLine = current[currentLastIndex]; + var commonRootMeetPoint = -1; + + for (var j = prev.length - 1; j >= 0; --j) { + if (prev[j] === currentLastLine) { + commonRootMeetPoint = j; + break; + } + } + + for (var j = commonRootMeetPoint; j >= 0; --j) { + var line = prev[j]; + if (current[currentLastIndex] === line) { + current.pop(); + currentLastIndex--; + } else { + break; + } + } + current = prev; + } +} + +function cleanStack(stack) { + var ret = []; + for (var i = 0; i < stack.length; ++i) { + var line = stack[i]; + var isTraceLine = stackFramePattern.test(line) || + " (No stack trace)" === line; + var isInternalFrame = isTraceLine && shouldIgnore(line); + if (isTraceLine && !isInternalFrame) { + if (indentStackFrames && line.charAt(0) !== " ") { + line = " " + line; + } + ret.push(line); + } + } + return ret; +} + +function stackFramesAsArray(error) { + var stack = error.stack.replace(/\s+$/g, "").split("\n"); + for (var i = 0; i < stack.length; ++i) { + var line = stack[i]; + if (" (No stack trace)" === line || stackFramePattern.test(line)) { + break; + } + } + if (i > 0) { + stack = stack.slice(i); + } + return stack; +} + +CapturedTrace.parseStackAndMessage = function(error) { + var stack = error.stack; + var message = error.toString(); + stack = typeof stack === "string" && stack.length > 0 + ? stackFramesAsArray(error) : [" (No stack trace)"]; + return { + message: message, + stack: cleanStack(stack) + }; +}; + +CapturedTrace.formatAndLogError = function(error, title) { + if (typeof console !== "undefined") { + var message; + if (typeof error === "object" || typeof error === "function") { + var stack = error.stack; + message = title + formatStack(stack, error); + } else { + message = title + String(error); + } + if (typeof warn === "function") { + warn(message); + } else if (typeof console.log === "function" || + typeof console.log === "object") { + console.log(message); + } + } +}; + +CapturedTrace.unhandledRejection = function (reason) { + CapturedTrace.formatAndLogError(reason, "^--- With additional stack trace: "); +}; + +CapturedTrace.isSupported = function () { + return typeof captureStackTrace === "function"; +}; + +CapturedTrace.fireRejectionEvent = +function(name, localHandler, reason, promise) { + var localEventFired = false; + try { + if (typeof localHandler === "function") { + localEventFired = true; + if (name === "rejectionHandled") { + localHandler(promise); + } else { + localHandler(reason, promise); + } + } + } catch (e) { + async.throwLater(e); + } + + var globalEventFired = false; + try { + globalEventFired = fireGlobalEvent(name, reason, promise); + } catch (e) { + globalEventFired = true; + async.throwLater(e); + } + + var domEventFired = false; + if (fireDomEvent) { + try { + domEventFired = fireDomEvent(name.toLowerCase(), { + reason: reason, + promise: promise + }); + } catch (e) { + domEventFired = true; + async.throwLater(e); + } + } + + if (!globalEventFired && !localEventFired && !domEventFired && + name === "unhandledRejection") { + CapturedTrace.formatAndLogError(reason, "Unhandled rejection "); + } +}; + +function formatNonError(obj) { + var str; + if (typeof obj === "function") { + str = "[function " + + (obj.name || "anonymous") + + "]"; + } else { + str = obj.toString(); + var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; + if (ruselessToString.test(str)) { + try { + var newStr = JSON.stringify(obj); + str = newStr; + } + catch(e) { + + } + } + if (str.length === 0) { + str = "(empty array)"; + } + } + return ("(<" + snip(str) + ">, no stack trace)"); +} + +function snip(str) { + var maxChars = 41; + if (str.length < maxChars) { + return str; + } + return str.substr(0, maxChars - 3) + "..."; +} + +var shouldIgnore = function() { return false; }; +var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; +function parseLineInfo(line) { + var matches = line.match(parseLineInfoRegex); + if (matches) { + return { + fileName: matches[1], + line: parseInt(matches[2], 10) + }; + } +} +CapturedTrace.setBounds = function(firstLineError, lastLineError) { + if (!CapturedTrace.isSupported()) return; + var firstStackLines = firstLineError.stack.split("\n"); + var lastStackLines = lastLineError.stack.split("\n"); + var firstIndex = -1; + var lastIndex = -1; + var firstFileName; + var lastFileName; + for (var i = 0; i < firstStackLines.length; ++i) { + var result = parseLineInfo(firstStackLines[i]); + if (result) { + firstFileName = result.fileName; + firstIndex = result.line; + break; + } + } + for (var i = 0; i < lastStackLines.length; ++i) { + var result = parseLineInfo(lastStackLines[i]); + if (result) { + lastFileName = result.fileName; + lastIndex = result.line; + break; + } + } + if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || + firstFileName !== lastFileName || firstIndex >= lastIndex) { + return; + } + + shouldIgnore = function(line) { + if (bluebirdFramePattern.test(line)) return true; + var info = parseLineInfo(line); + if (info) { + if (info.fileName === firstFileName && + (firstIndex <= info.line && info.line <= lastIndex)) { + return true; + } + } + return false; + }; +}; + +var captureStackTrace = (function stackDetection() { + var v8stackFramePattern = /^\s*at\s*/; + var v8stackFormatter = function(stack, error) { + if (typeof stack === "string") return stack; + + if (error.name !== undefined && + error.message !== undefined) { + return error.toString(); + } + return formatNonError(error); + }; + + if (typeof Error.stackTraceLimit === "number" && + typeof Error.captureStackTrace === "function") { + Error.stackTraceLimit = Error.stackTraceLimit + 6; + stackFramePattern = v8stackFramePattern; + formatStack = v8stackFormatter; + var captureStackTrace = Error.captureStackTrace; + + shouldIgnore = function(line) { + return bluebirdFramePattern.test(line); + }; + return function(receiver, ignoreUntil) { + Error.stackTraceLimit = Error.stackTraceLimit + 6; + captureStackTrace(receiver, ignoreUntil); + Error.stackTraceLimit = Error.stackTraceLimit - 6; + }; + } + var err = new Error(); + + if (typeof err.stack === "string" && + err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) { + stackFramePattern = /@/; + formatStack = v8stackFormatter; + indentStackFrames = true; + return function captureStackTrace(o) { + o.stack = new Error().stack; + }; + } + + var hasStackAfterThrow; + try { throw new Error(); } + catch(e) { + hasStackAfterThrow = ("stack" in e); + } + if (!("stack" in err) && hasStackAfterThrow) { + stackFramePattern = v8stackFramePattern; + formatStack = v8stackFormatter; + return function captureStackTrace(o) { + Error.stackTraceLimit = Error.stackTraceLimit + 6; + try { throw new Error(); } + catch(e) { o.stack = e.stack; } + Error.stackTraceLimit = Error.stackTraceLimit - 6; + }; + } + + formatStack = function(stack, error) { + if (typeof stack === "string") return stack; + + if ((typeof error === "object" || + typeof error === "function") && + error.name !== undefined && + error.message !== undefined) { + return error.toString(); + } + return formatNonError(error); + }; + + return null; + +})([]); + +var fireDomEvent; +var fireGlobalEvent = (function() { + if (util.isNode) { + return function(name, reason, promise) { + if (name === "rejectionHandled") { + return process.emit(name, promise); + } else { + return process.emit(name, reason, promise); + } + }; + } else { + var customEventWorks = false; + var anyEventWorks = true; + try { + var ev = new self.CustomEvent("test"); + customEventWorks = ev instanceof CustomEvent; + } catch (e) {} + if (!customEventWorks) { + try { + var event = document.createEvent("CustomEvent"); + event.initCustomEvent("testingtheevent", false, true, {}); + self.dispatchEvent(event); + } catch (e) { + anyEventWorks = false; + } + } + if (anyEventWorks) { + fireDomEvent = function(type, detail) { + var event; + if (customEventWorks) { + event = new self.CustomEvent(type, { + detail: detail, + bubbles: false, + cancelable: true + }); + } else if (self.dispatchEvent) { + event = document.createEvent("CustomEvent"); + event.initCustomEvent(type, false, true, detail); + } + + return event ? !self.dispatchEvent(event) : false; + }; + } + + var toWindowMethodNameMap = {}; + toWindowMethodNameMap["unhandledRejection"] = ("on" + + "unhandledRejection").toLowerCase(); + toWindowMethodNameMap["rejectionHandled"] = ("on" + + "rejectionHandled").toLowerCase(); + + return function(name, reason, promise) { + var methodName = toWindowMethodNameMap[name]; + var method = self[methodName]; + if (!method) return false; + if (name === "rejectionHandled") { + method.call(self, promise); + } else { + method.call(self, reason, promise); + } + return true; + }; + } +})(); + +if (typeof console !== "undefined" && typeof console.warn !== "undefined") { + warn = function (message) { + console.warn(message); + }; + if (util.isNode && process.stderr.isTTY) { + warn = function(message) { + process.stderr.write("\u001b[31m" + message + "\u001b[39m\n"); + }; + } else if (!util.isNode && typeof (new Error().stack) === "string") { + warn = function(message) { + console.warn("%c" + message, "color: red"); + }; + } +} + +return CapturedTrace; +}; + +},{"./async.js":2,"./util.js":38}],8:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(NEXT_FILTER) { +var util = _dereq_("./util.js"); +var errors = _dereq_("./errors.js"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var keys = _dereq_("./es5.js").keys; +var TypeError = errors.TypeError; + +function CatchFilter(instances, callback, promise) { + this._instances = instances; + this._callback = callback; + this._promise = promise; +} + +function safePredicate(predicate, e) { + var safeObject = {}; + var retfilter = tryCatch(predicate).call(safeObject, e); + + if (retfilter === errorObj) return retfilter; + + var safeKeys = keys(safeObject); + if (safeKeys.length) { + errorObj.e = new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a See http://goo.gl/o84o68\u000a"); + return errorObj; + } + return retfilter; +} + +CatchFilter.prototype.doFilter = function (e) { + var cb = this._callback; + var promise = this._promise; + var boundTo = promise._boundTo; + for (var i = 0, len = this._instances.length; i < len; ++i) { + var item = this._instances[i]; + var itemIsErrorType = item === Error || + (item != null && item.prototype instanceof Error); + + if (itemIsErrorType && e instanceof item) { + var ret = tryCatch(cb).call(boundTo, e); + if (ret === errorObj) { + NEXT_FILTER.e = ret.e; + return NEXT_FILTER; + } + return ret; + } else if (typeof item === "function" && !itemIsErrorType) { + var shouldHandle = safePredicate(item, e); + if (shouldHandle === errorObj) { + e = errorObj.e; + break; + } else if (shouldHandle) { + var ret = tryCatch(cb).call(boundTo, e); + if (ret === errorObj) { + NEXT_FILTER.e = ret.e; + return NEXT_FILTER; + } + return ret; + } + } + } + NEXT_FILTER.e = e; + return NEXT_FILTER; +}; + +return CatchFilter; +}; + +},{"./errors.js":13,"./es5.js":14,"./util.js":38}],9:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, CapturedTrace, isDebugging) { +var contextStack = []; +function Context() { + this._trace = new CapturedTrace(peekContext()); +} +Context.prototype._pushContext = function () { + if (!isDebugging()) return; + if (this._trace !== undefined) { + contextStack.push(this._trace); + } +}; + +Context.prototype._popContext = function () { + if (!isDebugging()) return; + if (this._trace !== undefined) { + contextStack.pop(); + } +}; + +function createContext() { + if (isDebugging()) return new Context(); +} + +function peekContext() { + var lastIndex = contextStack.length - 1; + if (lastIndex >= 0) { + return contextStack[lastIndex]; + } + return undefined; +} + +Promise.prototype._peekContext = peekContext; +Promise.prototype._pushContext = Context.prototype._pushContext; +Promise.prototype._popContext = Context.prototype._popContext; + +return createContext; +}; + +},{}],10:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, CapturedTrace) { +var async = _dereq_("./async.js"); +var Warning = _dereq_("./errors.js").Warning; +var util = _dereq_("./util.js"); +var canAttachTrace = util.canAttachTrace; +var unhandledRejectionHandled; +var possiblyUnhandledRejection; +var debugging = false || (util.isNode && + (!!process.env["BLUEBIRD_DEBUG"] || + process.env["NODE_ENV"] === "development")); + +if (debugging) { + async.disableTrampolineIfNecessary(); +} + +Promise.prototype._ensurePossibleRejectionHandled = function () { + this._setRejectionIsUnhandled(); + async.invokeLater(this._notifyUnhandledRejection, this, undefined); +}; + +Promise.prototype._notifyUnhandledRejectionIsHandled = function () { + CapturedTrace.fireRejectionEvent("rejectionHandled", + unhandledRejectionHandled, undefined, this); +}; + +Promise.prototype._notifyUnhandledRejection = function () { + if (this._isRejectionUnhandled()) { + var reason = this._getCarriedStackTrace() || this._settledValue; + this._setUnhandledRejectionIsNotified(); + CapturedTrace.fireRejectionEvent("unhandledRejection", + possiblyUnhandledRejection, reason, this); + } +}; + +Promise.prototype._setUnhandledRejectionIsNotified = function () { + this._bitField = this._bitField | 524288; +}; + +Promise.prototype._unsetUnhandledRejectionIsNotified = function () { + this._bitField = this._bitField & (~524288); +}; + +Promise.prototype._isUnhandledRejectionNotified = function () { + return (this._bitField & 524288) > 0; +}; + +Promise.prototype._setRejectionIsUnhandled = function () { + this._bitField = this._bitField | 2097152; +}; + +Promise.prototype._unsetRejectionIsUnhandled = function () { + this._bitField = this._bitField & (~2097152); + if (this._isUnhandledRejectionNotified()) { + this._unsetUnhandledRejectionIsNotified(); + this._notifyUnhandledRejectionIsHandled(); + } +}; + +Promise.prototype._isRejectionUnhandled = function () { + return (this._bitField & 2097152) > 0; +}; + +Promise.prototype._setCarriedStackTrace = function (capturedTrace) { + this._bitField = this._bitField | 1048576; + this._fulfillmentHandler0 = capturedTrace; +}; + +Promise.prototype._isCarryingStackTrace = function () { + return (this._bitField & 1048576) > 0; +}; + +Promise.prototype._getCarriedStackTrace = function () { + return this._isCarryingStackTrace() + ? this._fulfillmentHandler0 + : undefined; +}; + +Promise.prototype._captureStackTrace = function () { + if (debugging) { + this._trace = new CapturedTrace(this._peekContext()); + } + return this; +}; + +Promise.prototype._attachExtraTrace = function (error, ignoreSelf) { + if (debugging && canAttachTrace(error)) { + var trace = this._trace; + if (trace !== undefined) { + if (ignoreSelf) trace = trace._parent; + } + if (trace !== undefined) { + trace.attachExtraTrace(error); + } else if (!error.__stackCleaned__) { + var parsed = CapturedTrace.parseStackAndMessage(error); + util.notEnumerableProp(error, "stack", + parsed.message + "\n" + parsed.stack.join("\n")); + util.notEnumerableProp(error, "__stackCleaned__", true); + } + } +}; + +Promise.prototype._warn = function(message) { + var warning = new Warning(message); + var ctx = this._peekContext(); + if (ctx) { + ctx.attachExtraTrace(warning); + } else { + var parsed = CapturedTrace.parseStackAndMessage(warning); + warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); + } + CapturedTrace.formatAndLogError(warning, ""); +}; + +Promise.onPossiblyUnhandledRejection = function (fn) { + possiblyUnhandledRejection = typeof fn === "function" ? fn : undefined; +}; + +Promise.onUnhandledRejectionHandled = function (fn) { + unhandledRejectionHandled = typeof fn === "function" ? fn : undefined; +}; + +Promise.longStackTraces = function () { + if (async.haveItemsQueued() && + debugging === false + ) { + throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/DT1qyG\u000a"); + } + debugging = CapturedTrace.isSupported(); + if (debugging) { + async.disableTrampolineIfNecessary(); + } +}; + +Promise.hasLongStackTraces = function () { + return debugging && CapturedTrace.isSupported(); +}; + +if (!CapturedTrace.isSupported()) { + Promise.longStackTraces = function(){}; + debugging = false; +} + +return function() { + return debugging; +}; +}; + +},{"./async.js":2,"./errors.js":13,"./util.js":38}],11:[function(_dereq_,module,exports){ +"use strict"; +var util = _dereq_("./util.js"); +var isPrimitive = util.isPrimitive; +var wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver; + +module.exports = function(Promise) { +var returner = function () { + return this; +}; +var thrower = function () { + throw this; +}; +var returnUndefined = function() {}; +var throwUndefined = function() { + throw undefined; +}; + +var wrapper = function (value, action) { + if (action === 1) { + return function () { + throw value; + }; + } else if (action === 2) { + return function () { + return value; + }; + } +}; + + +Promise.prototype["return"] = +Promise.prototype.thenReturn = function (value) { + if (value === undefined) return this.then(returnUndefined); + + if (wrapsPrimitiveReceiver && isPrimitive(value)) { + return this._then( + wrapper(value, 2), + undefined, + undefined, + undefined, + undefined + ); + } + return this._then(returner, undefined, undefined, value, undefined); +}; + +Promise.prototype["throw"] = +Promise.prototype.thenThrow = function (reason) { + if (reason === undefined) return this.then(throwUndefined); + + if (wrapsPrimitiveReceiver && isPrimitive(reason)) { + return this._then( + wrapper(reason, 1), + undefined, + undefined, + undefined, + undefined + ); + } + return this._then(thrower, undefined, undefined, reason, undefined); +}; +}; + +},{"./util.js":38}],12:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var PromiseReduce = Promise.reduce; + +Promise.prototype.each = function (fn) { + return PromiseReduce(this, fn, null, INTERNAL); +}; + +Promise.each = function (promises, fn) { + return PromiseReduce(promises, fn, null, INTERNAL); +}; +}; + +},{}],13:[function(_dereq_,module,exports){ +"use strict"; +var es5 = _dereq_("./es5.js"); +var Objectfreeze = es5.freeze; +var util = _dereq_("./util.js"); +var inherits = util.inherits; +var notEnumerableProp = util.notEnumerableProp; + +function subError(nameProperty, defaultMessage) { + function SubError(message) { + if (!(this instanceof SubError)) return new SubError(message); + notEnumerableProp(this, "message", + typeof message === "string" ? message : defaultMessage); + notEnumerableProp(this, "name", nameProperty); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + Error.call(this); + } + } + inherits(SubError, Error); + return SubError; +} + +var _TypeError, _RangeError; +var Warning = subError("Warning", "warning"); +var CancellationError = subError("CancellationError", "cancellation error"); +var TimeoutError = subError("TimeoutError", "timeout error"); +var AggregateError = subError("AggregateError", "aggregate error"); +try { + _TypeError = TypeError; + _RangeError = RangeError; +} catch(e) { + _TypeError = subError("TypeError", "type error"); + _RangeError = subError("RangeError", "range error"); +} + +var methods = ("join pop push shift unshift slice filter forEach some " + + "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" "); + +for (var i = 0; i < methods.length; ++i) { + if (typeof Array.prototype[methods[i]] === "function") { + AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; + } +} + +es5.defineProperty(AggregateError.prototype, "length", { + value: 0, + configurable: false, + writable: true, + enumerable: true +}); +AggregateError.prototype["isOperational"] = true; +var level = 0; +AggregateError.prototype.toString = function() { + var indent = Array(level * 4 + 1).join(" "); + var ret = "\n" + indent + "AggregateError of:" + "\n"; + level++; + indent = Array(level * 4 + 1).join(" "); + for (var i = 0; i < this.length; ++i) { + var str = this[i] === this ? "[Circular AggregateError]" : this[i] + ""; + var lines = str.split("\n"); + for (var j = 0; j < lines.length; ++j) { + lines[j] = indent + lines[j]; + } + str = lines.join("\n"); + ret += str + "\n"; + } + level--; + return ret; +}; + +function OperationalError(message) { + if (!(this instanceof OperationalError)) + return new OperationalError(message); + notEnumerableProp(this, "name", "OperationalError"); + notEnumerableProp(this, "message", message); + this.cause = message; + this["isOperational"] = true; + + if (message instanceof Error) { + notEnumerableProp(this, "message", message.message); + notEnumerableProp(this, "stack", message.stack); + } else if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + +} +inherits(OperationalError, Error); + +var errorTypes = Error["__BluebirdErrorTypes__"]; +if (!errorTypes) { + errorTypes = Objectfreeze({ + CancellationError: CancellationError, + TimeoutError: TimeoutError, + OperationalError: OperationalError, + RejectionError: OperationalError, + AggregateError: AggregateError + }); + notEnumerableProp(Error, "__BluebirdErrorTypes__", errorTypes); +} + +module.exports = { + Error: Error, + TypeError: _TypeError, + RangeError: _RangeError, + CancellationError: errorTypes.CancellationError, + OperationalError: errorTypes.OperationalError, + TimeoutError: errorTypes.TimeoutError, + AggregateError: errorTypes.AggregateError, + Warning: Warning +}; + +},{"./es5.js":14,"./util.js":38}],14:[function(_dereq_,module,exports){ +var isES5 = (function(){ + "use strict"; + return this === undefined; +})(); + +if (isES5) { + module.exports = { + freeze: Object.freeze, + defineProperty: Object.defineProperty, + getDescriptor: Object.getOwnPropertyDescriptor, + keys: Object.keys, + names: Object.getOwnPropertyNames, + getPrototypeOf: Object.getPrototypeOf, + isArray: Array.isArray, + isES5: isES5, + propertyIsWritable: function(obj, prop) { + var descriptor = Object.getOwnPropertyDescriptor(obj, prop); + return !!(!descriptor || descriptor.writable || descriptor.set); + } + }; +} else { + var has = {}.hasOwnProperty; + var str = {}.toString; + var proto = {}.constructor.prototype; + + var ObjectKeys = function (o) { + var ret = []; + for (var key in o) { + if (has.call(o, key)) { + ret.push(key); + } + } + return ret; + }; + + var ObjectGetDescriptor = function(o, key) { + return {value: o[key]}; + }; + + var ObjectDefineProperty = function (o, key, desc) { + o[key] = desc.value; + return o; + }; + + var ObjectFreeze = function (obj) { + return obj; + }; + + var ObjectGetPrototypeOf = function (obj) { + try { + return Object(obj).constructor.prototype; + } + catch (e) { + return proto; + } + }; + + var ArrayIsArray = function (obj) { + try { + return str.call(obj) === "[object Array]"; + } + catch(e) { + return false; + } + }; + + module.exports = { + isArray: ArrayIsArray, + keys: ObjectKeys, + names: ObjectKeys, + defineProperty: ObjectDefineProperty, + getDescriptor: ObjectGetDescriptor, + freeze: ObjectFreeze, + getPrototypeOf: ObjectGetPrototypeOf, + isES5: isES5, + propertyIsWritable: function() { + return true; + } + }; +} + +},{}],15:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var PromiseMap = Promise.map; + +Promise.prototype.filter = function (fn, options) { + return PromiseMap(this, fn, options, INTERNAL); +}; + +Promise.filter = function (promises, fn, options) { + return PromiseMap(promises, fn, options, INTERNAL); +}; +}; + +},{}],16:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, NEXT_FILTER, tryConvertToPromise) { +var util = _dereq_("./util.js"); +var wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver; +var isPrimitive = util.isPrimitive; +var thrower = util.thrower; + +function returnThis() { + return this; +} +function throwThis() { + throw this; +} +function return$(r) { + return function() { + return r; + }; +} +function throw$(r) { + return function() { + throw r; + }; +} +function promisedFinally(ret, reasonOrValue, isFulfilled) { + var then; + if (wrapsPrimitiveReceiver && isPrimitive(reasonOrValue)) { + then = isFulfilled ? return$(reasonOrValue) : throw$(reasonOrValue); + } else { + then = isFulfilled ? returnThis : throwThis; + } + return ret._then(then, thrower, undefined, reasonOrValue, undefined); +} + +function finallyHandler(reasonOrValue) { + var promise = this.promise; + var handler = this.handler; + + var ret = promise._isBound() + ? handler.call(promise._boundTo) + : handler(); + + if (ret !== undefined) { + var maybePromise = tryConvertToPromise(ret, promise); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + return promisedFinally(maybePromise, reasonOrValue, + promise.isFulfilled()); + } + } + + if (promise.isRejected()) { + NEXT_FILTER.e = reasonOrValue; + return NEXT_FILTER; + } else { + return reasonOrValue; + } +} + +function tapHandler(value) { + var promise = this.promise; + var handler = this.handler; + + var ret = promise._isBound() + ? handler.call(promise._boundTo, value) + : handler(value); + + if (ret !== undefined) { + var maybePromise = tryConvertToPromise(ret, promise); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + return promisedFinally(maybePromise, value, true); + } + } + return value; +} + +Promise.prototype._passThroughHandler = function (handler, isFinally) { + if (typeof handler !== "function") return this.then(); + + var promiseAndHandler = { + promise: this, + handler: handler + }; + + return this._then( + isFinally ? finallyHandler : tapHandler, + isFinally ? finallyHandler : undefined, undefined, + promiseAndHandler, undefined); +}; + +Promise.prototype.lastly = +Promise.prototype["finally"] = function (handler) { + return this._passThroughHandler(handler, true); +}; + +Promise.prototype.tap = function (handler) { + return this._passThroughHandler(handler, false); +}; +}; + +},{"./util.js":38}],17:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, + apiRejection, + INTERNAL, + tryConvertToPromise) { +var errors = _dereq_("./errors.js"); +var TypeError = errors.TypeError; +var util = _dereq_("./util.js"); +var errorObj = util.errorObj; +var tryCatch = util.tryCatch; +var yieldHandlers = []; + +function promiseFromYieldHandler(value, yieldHandlers, traceParent) { + for (var i = 0; i < yieldHandlers.length; ++i) { + traceParent._pushContext(); + var result = tryCatch(yieldHandlers[i])(value); + traceParent._popContext(); + if (result === errorObj) { + traceParent._pushContext(); + var ret = Promise.reject(errorObj.e); + traceParent._popContext(); + return ret; + } + var maybePromise = tryConvertToPromise(result, traceParent); + if (maybePromise instanceof Promise) return maybePromise; + } + return null; +} + +function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { + var promise = this._promise = new Promise(INTERNAL); + promise._captureStackTrace(); + this._stack = stack; + this._generatorFunction = generatorFunction; + this._receiver = receiver; + this._generator = undefined; + this._yieldHandlers = typeof yieldHandler === "function" + ? [yieldHandler].concat(yieldHandlers) + : yieldHandlers; +} + +PromiseSpawn.prototype.promise = function () { + return this._promise; +}; + +PromiseSpawn.prototype._run = function () { + this._generator = this._generatorFunction.call(this._receiver); + this._receiver = + this._generatorFunction = undefined; + this._next(undefined); +}; + +PromiseSpawn.prototype._continue = function (result) { + if (result === errorObj) { + return this._promise._rejectCallback(result.e, false, true); + } + + var value = result.value; + if (result.done === true) { + this._promise._resolveCallback(value); + } else { + var maybePromise = tryConvertToPromise(value, this._promise); + if (!(maybePromise instanceof Promise)) { + maybePromise = + promiseFromYieldHandler(maybePromise, + this._yieldHandlers, + this._promise); + if (maybePromise === null) { + this._throw( + new TypeError( + "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/4Y4pDk\u000a\u000a".replace("%s", value) + + "From coroutine:\u000a" + + this._stack.split("\n").slice(1, -7).join("\n") + ) + ); + return; + } + } + maybePromise._then( + this._next, + this._throw, + undefined, + this, + null + ); + } +}; + +PromiseSpawn.prototype._throw = function (reason) { + this._promise._attachExtraTrace(reason); + this._promise._pushContext(); + var result = tryCatch(this._generator["throw"]) + .call(this._generator, reason); + this._promise._popContext(); + this._continue(result); +}; + +PromiseSpawn.prototype._next = function (value) { + this._promise._pushContext(); + var result = tryCatch(this._generator.next).call(this._generator, value); + this._promise._popContext(); + this._continue(result); +}; + +Promise.coroutine = function (generatorFunction, options) { + if (typeof generatorFunction !== "function") { + throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/6Vqhm0\u000a"); + } + var yieldHandler = Object(options).yieldHandler; + var PromiseSpawn$ = PromiseSpawn; + var stack = new Error().stack; + return function () { + var generator = generatorFunction.apply(this, arguments); + var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler, + stack); + spawn._generator = generator; + spawn._next(undefined); + return spawn.promise(); + }; +}; + +Promise.coroutine.addYieldHandler = function(fn) { + if (typeof fn !== "function") throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); + yieldHandlers.push(fn); +}; + +Promise.spawn = function (generatorFunction) { + if (typeof generatorFunction !== "function") { + return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/6Vqhm0\u000a"); + } + var spawn = new PromiseSpawn(generatorFunction, this); + var ret = spawn.promise(); + spawn._run(Promise.spawn); + return ret; +}; +}; + +},{"./errors.js":13,"./util.js":38}],18:[function(_dereq_,module,exports){ +"use strict"; +module.exports = +function(Promise, PromiseArray, tryConvertToPromise, INTERNAL) { +var util = _dereq_("./util.js"); +var canEvaluate = util.canEvaluate; +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var reject; + +if (!true) { +if (canEvaluate) { + var thenCallback = function(i) { + return new Function("value", "holder", " \n\ + 'use strict'; \n\ + holder.pIndex = value; \n\ + holder.checkFulfillment(this); \n\ + ".replace(/Index/g, i)); + }; + + var caller = function(count) { + var values = []; + for (var i = 1; i <= count; ++i) values.push("holder.p" + i); + return new Function("holder", " \n\ + 'use strict'; \n\ + var callback = holder.fn; \n\ + return callback(values); \n\ + ".replace(/values/g, values.join(", "))); + }; + var thenCallbacks = []; + var callers = [undefined]; + for (var i = 1; i <= 5; ++i) { + thenCallbacks.push(thenCallback(i)); + callers.push(caller(i)); + } + + var Holder = function(total, fn) { + this.p1 = this.p2 = this.p3 = this.p4 = this.p5 = null; + this.fn = fn; + this.total = total; + this.now = 0; + }; + + Holder.prototype.callers = callers; + Holder.prototype.checkFulfillment = function(promise) { + var now = this.now; + now++; + var total = this.total; + if (now >= total) { + var handler = this.callers[total]; + promise._pushContext(); + var ret = tryCatch(handler)(this); + promise._popContext(); + if (ret === errorObj) { + promise._rejectCallback(ret.e, false, true); + } else { + promise._resolveCallback(ret); + } + } else { + this.now = now; + } + }; + + var reject = function (reason) { + this._reject(reason); + }; +} +} + +Promise.join = function () { + var last = arguments.length - 1; + var fn; + if (last > 0 && typeof arguments[last] === "function") { + fn = arguments[last]; + if (!true) { + if (last < 6 && canEvaluate) { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + var holder = new Holder(last, fn); + var callbacks = thenCallbacks; + for (var i = 0; i < last; ++i) { + var maybePromise = tryConvertToPromise(arguments[i], ret); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + if (maybePromise._isPending()) { + maybePromise._then(callbacks[i], reject, + undefined, ret, holder); + } else if (maybePromise._isFulfilled()) { + callbacks[i].call(ret, + maybePromise._value(), holder); + } else { + ret._reject(maybePromise._reason()); + } + } else { + callbacks[i].call(ret, maybePromise, holder); + } + } + return ret; + } + } + } + var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];} + if (fn) args.pop(); + var ret = new PromiseArray(args).promise(); + return fn !== undefined ? ret.spread(fn) : ret; +}; + +}; + +},{"./util.js":38}],19:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, + PromiseArray, + apiRejection, + tryConvertToPromise, + INTERNAL) { +var async = _dereq_("./async.js"); +var util = _dereq_("./util.js"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var PENDING = {}; +var EMPTY_ARRAY = []; + +function MappingPromiseArray(promises, fn, limit, _filter) { + this.constructor$(promises); + this._promise._captureStackTrace(); + this._callback = fn; + this._preservedValues = _filter === INTERNAL + ? new Array(this.length()) + : null; + this._limit = limit; + this._inFlight = 0; + this._queue = limit >= 1 ? [] : EMPTY_ARRAY; + async.invoke(init, this, undefined); +} +util.inherits(MappingPromiseArray, PromiseArray); +function init() {this._init$(undefined, -2);} + +MappingPromiseArray.prototype._init = function () {}; + +MappingPromiseArray.prototype._promiseFulfilled = function (value, index) { + var values = this._values; + var length = this.length(); + var preservedValues = this._preservedValues; + var limit = this._limit; + if (values[index] === PENDING) { + values[index] = value; + if (limit >= 1) { + this._inFlight--; + this._drainQueue(); + if (this._isResolved()) return; + } + } else { + if (limit >= 1 && this._inFlight >= limit) { + values[index] = value; + this._queue.push(index); + return; + } + if (preservedValues !== null) preservedValues[index] = value; + + var callback = this._callback; + var receiver = this._promise._boundTo; + this._promise._pushContext(); + var ret = tryCatch(callback).call(receiver, value, index, length); + this._promise._popContext(); + if (ret === errorObj) return this._reject(ret.e); + + var maybePromise = tryConvertToPromise(ret, this._promise); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + if (maybePromise._isPending()) { + if (limit >= 1) this._inFlight++; + values[index] = PENDING; + return maybePromise._proxyPromiseArray(this, index); + } else if (maybePromise._isFulfilled()) { + ret = maybePromise._value(); + } else { + return this._reject(maybePromise._reason()); + } + } + values[index] = ret; + } + var totalResolved = ++this._totalResolved; + if (totalResolved >= length) { + if (preservedValues !== null) { + this._filter(values, preservedValues); + } else { + this._resolve(values); + } + + } +}; + +MappingPromiseArray.prototype._drainQueue = function () { + var queue = this._queue; + var limit = this._limit; + var values = this._values; + while (queue.length > 0 && this._inFlight < limit) { + if (this._isResolved()) return; + var index = queue.pop(); + this._promiseFulfilled(values[index], index); + } +}; + +MappingPromiseArray.prototype._filter = function (booleans, values) { + var len = values.length; + var ret = new Array(len); + var j = 0; + for (var i = 0; i < len; ++i) { + if (booleans[i]) ret[j++] = values[i]; + } + ret.length = j; + this._resolve(ret); +}; + +MappingPromiseArray.prototype.preservedValues = function () { + return this._preservedValues; +}; + +function map(promises, fn, options, _filter) { + var limit = typeof options === "object" && options !== null + ? options.concurrency + : 0; + limit = typeof limit === "number" && + isFinite(limit) && limit >= 1 ? limit : 0; + return new MappingPromiseArray(promises, fn, limit, _filter); +} + +Promise.prototype.map = function (fn, options) { + if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); + + return map(this, fn, options, null).promise(); +}; + +Promise.map = function (promises, fn, options, _filter) { + if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); + return map(promises, fn, options, _filter).promise(); +}; + + +}; + +},{"./async.js":2,"./util.js":38}],20:[function(_dereq_,module,exports){ +"use strict"; +module.exports = +function(Promise, INTERNAL, tryConvertToPromise, apiRejection) { +var util = _dereq_("./util.js"); +var tryCatch = util.tryCatch; + +Promise.method = function (fn) { + if (typeof fn !== "function") { + throw new Promise.TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); + } + return function () { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._pushContext(); + var value = tryCatch(fn).apply(this, arguments); + ret._popContext(); + ret._resolveFromSyncValue(value); + return ret; + }; +}; + +Promise.attempt = Promise["try"] = function (fn, args, ctx) { + if (typeof fn !== "function") { + return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); + } + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._pushContext(); + var value = util.isArray(args) + ? tryCatch(fn).apply(ctx, args) + : tryCatch(fn).call(ctx, args); + ret._popContext(); + ret._resolveFromSyncValue(value); + return ret; +}; + +Promise.prototype._resolveFromSyncValue = function (value) { + if (value === util.errorObj) { + this._rejectCallback(value.e, false, true); + } else { + this._resolveCallback(value, true); + } +}; +}; + +},{"./util.js":38}],21:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise) { +var util = _dereq_("./util.js"); +var async = _dereq_("./async.js"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; + +function spreadAdapter(val, nodeback) { + var promise = this; + if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback); + var ret = tryCatch(nodeback).apply(promise._boundTo, [null].concat(val)); + if (ret === errorObj) { + async.throwLater(ret.e); + } +} + +function successAdapter(val, nodeback) { + var promise = this; + var receiver = promise._boundTo; + var ret = val === undefined + ? tryCatch(nodeback).call(receiver, null) + : tryCatch(nodeback).call(receiver, null, val); + if (ret === errorObj) { + async.throwLater(ret.e); + } +} +function errorAdapter(reason, nodeback) { + var promise = this; + if (!reason) { + var target = promise._target(); + var newReason = target._getCarriedStackTrace(); + newReason.cause = reason; + reason = newReason; + } + var ret = tryCatch(nodeback).call(promise._boundTo, reason); + if (ret === errorObj) { + async.throwLater(ret.e); + } +} + +Promise.prototype.asCallback = +Promise.prototype.nodeify = function (nodeback, options) { + if (typeof nodeback == "function") { + var adapter = successAdapter; + if (options !== undefined && Object(options).spread) { + adapter = spreadAdapter; + } + this._then( + adapter, + errorAdapter, + undefined, + this, + nodeback + ); + } + return this; +}; +}; + +},{"./async.js":2,"./util.js":38}],22:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, PromiseArray) { +var util = _dereq_("./util.js"); +var async = _dereq_("./async.js"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; + +Promise.prototype.progressed = function (handler) { + return this._then(undefined, undefined, handler, undefined, undefined); +}; + +Promise.prototype._progress = function (progressValue) { + if (this._isFollowingOrFulfilledOrRejected()) return; + this._target()._progressUnchecked(progressValue); + +}; + +Promise.prototype._progressHandlerAt = function (index) { + return index === 0 + ? this._progressHandler0 + : this[(index << 2) + index - 5 + 2]; +}; + +Promise.prototype._doProgressWith = function (progression) { + var progressValue = progression.value; + var handler = progression.handler; + var promise = progression.promise; + var receiver = progression.receiver; + + var ret = tryCatch(handler).call(receiver, progressValue); + if (ret === errorObj) { + if (ret.e != null && + ret.e.name !== "StopProgressPropagation") { + var trace = util.canAttachTrace(ret.e) + ? ret.e : new Error(util.toString(ret.e)); + promise._attachExtraTrace(trace); + promise._progress(ret.e); + } + } else if (ret instanceof Promise) { + ret._then(promise._progress, null, null, promise, undefined); + } else { + promise._progress(ret); + } +}; + + +Promise.prototype._progressUnchecked = function (progressValue) { + var len = this._length(); + var progress = this._progress; + for (var i = 0; i < len; i++) { + var handler = this._progressHandlerAt(i); + var promise = this._promiseAt(i); + if (!(promise instanceof Promise)) { + var receiver = this._receiverAt(i); + if (typeof handler === "function") { + handler.call(receiver, progressValue, promise); + } else if (receiver instanceof PromiseArray && + !receiver._isResolved()) { + receiver._promiseProgressed(progressValue, promise); + } + continue; + } + + if (typeof handler === "function") { + async.invoke(this._doProgressWith, this, { + handler: handler, + promise: promise, + receiver: this._receiverAt(i), + value: progressValue + }); + } else { + async.invoke(progress, promise, progressValue); + } + } +}; +}; + +},{"./async.js":2,"./util.js":38}],23:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function() { +var makeSelfResolutionError = function () { + return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/LhFpo0\u000a"); +}; +var reflect = function() { + return new Promise.PromiseInspection(this._target()); +}; +var apiRejection = function(msg) { + return Promise.reject(new TypeError(msg)); +}; +var util = _dereq_("./util.js"); +var async = _dereq_("./async.js"); +var errors = _dereq_("./errors.js"); +var TypeError = Promise.TypeError = errors.TypeError; +Promise.RangeError = errors.RangeError; +Promise.CancellationError = errors.CancellationError; +Promise.TimeoutError = errors.TimeoutError; +Promise.OperationalError = errors.OperationalError; +Promise.RejectionError = errors.OperationalError; +Promise.AggregateError = errors.AggregateError; +var INTERNAL = function(){}; +var APPLY = {}; +var NEXT_FILTER = {e: null}; +var tryConvertToPromise = _dereq_("./thenables.js")(Promise, INTERNAL); +var PromiseArray = + _dereq_("./promise_array.js")(Promise, INTERNAL, + tryConvertToPromise, apiRejection); +var CapturedTrace = _dereq_("./captured_trace.js")(); +var isDebugging = _dereq_("./debuggability.js")(Promise, CapturedTrace); + /*jshint unused:false*/ +var createContext = + _dereq_("./context.js")(Promise, CapturedTrace, isDebugging); +var CatchFilter = _dereq_("./catch_filter.js")(NEXT_FILTER); +var PromiseResolver = _dereq_("./promise_resolver.js"); +var nodebackForPromise = PromiseResolver._nodebackForPromise; +var errorObj = util.errorObj; +var tryCatch = util.tryCatch; +function Promise(resolver) { + if (typeof resolver !== "function") { + throw new TypeError("the promise constructor requires a resolver function\u000a\u000a See http://goo.gl/EC22Yn\u000a"); + } + if (this.constructor !== Promise) { + throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/KsIlge\u000a"); + } + this._bitField = 0; + this._fulfillmentHandler0 = undefined; + this._rejectionHandler0 = undefined; + this._progressHandler0 = undefined; + this._promise0 = undefined; + this._receiver0 = undefined; + this._settledValue = undefined; + if (resolver !== INTERNAL) this._resolveFromResolver(resolver); +} + +Promise.prototype.toString = function () { + return "[object Promise]"; +}; + +Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { + var len = arguments.length; + if (len > 1) { + var catchInstances = new Array(len - 1), + j = 0, i; + for (i = 0; i < len - 1; ++i) { + var item = arguments[i]; + if (typeof item === "function") { + catchInstances[j++] = item; + } else { + return Promise.reject( + new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a See http://goo.gl/o84o68\u000a")); + } + } + catchInstances.length = j; + fn = arguments[i]; + var catchFilter = new CatchFilter(catchInstances, fn, this); + return this._then(undefined, catchFilter.doFilter, undefined, + catchFilter, undefined); + } + return this._then(undefined, fn, undefined, undefined, undefined); +}; + +Promise.prototype.reflect = function () { + return this._then(reflect, reflect, undefined, this, undefined); +}; + +Promise.prototype.then = function (didFulfill, didReject, didProgress) { + if (isDebugging() && arguments.length > 0 && + typeof didFulfill !== "function" && + typeof didReject !== "function") { + var msg = ".then() only accepts functions but was passed: " + + util.classString(didFulfill); + if (arguments.length > 1) { + msg += ", " + util.classString(didReject); + } + this._warn(msg); + } + return this._then(didFulfill, didReject, didProgress, + undefined, undefined); +}; + +Promise.prototype.done = function (didFulfill, didReject, didProgress) { + var promise = this._then(didFulfill, didReject, didProgress, + undefined, undefined); + promise._setIsFinal(); +}; + +Promise.prototype.spread = function (didFulfill, didReject) { + return this.all()._then(didFulfill, didReject, undefined, APPLY, undefined); +}; + +Promise.prototype.isCancellable = function () { + return !this.isResolved() && + this._cancellable(); +}; + +Promise.prototype.toJSON = function () { + var ret = { + isFulfilled: false, + isRejected: false, + fulfillmentValue: undefined, + rejectionReason: undefined + }; + if (this.isFulfilled()) { + ret.fulfillmentValue = this.value(); + ret.isFulfilled = true; + } else if (this.isRejected()) { + ret.rejectionReason = this.reason(); + ret.isRejected = true; + } + return ret; +}; + +Promise.prototype.all = function () { + return new PromiseArray(this).promise(); +}; + +Promise.prototype.error = function (fn) { + return this.caught(util.originatesFromRejection, fn); +}; + +Promise.is = function (val) { + return val instanceof Promise; +}; + +Promise.fromNode = function(fn) { + var ret = new Promise(INTERNAL); + var result = tryCatch(fn)(nodebackForPromise(ret)); + if (result === errorObj) { + ret._rejectCallback(result.e, true, true); + } + return ret; +}; + +Promise.all = function (promises) { + return new PromiseArray(promises).promise(); +}; + +Promise.defer = Promise.pending = function () { + var promise = new Promise(INTERNAL); + return new PromiseResolver(promise); +}; + +Promise.cast = function (obj) { + var ret = tryConvertToPromise(obj); + if (!(ret instanceof Promise)) { + var val = ret; + ret = new Promise(INTERNAL); + ret._fulfillUnchecked(val); + } + return ret; +}; + +Promise.resolve = Promise.fulfilled = Promise.cast; + +Promise.reject = Promise.rejected = function (reason) { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._rejectCallback(reason, true); + return ret; +}; + +Promise.setScheduler = function(fn) { + if (typeof fn !== "function") throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); + var prev = async._schedule; + async._schedule = fn; + return prev; +}; + +Promise.prototype._then = function ( + didFulfill, + didReject, + didProgress, + receiver, + internalData +) { + var haveInternalData = internalData !== undefined; + var ret = haveInternalData ? internalData : new Promise(INTERNAL); + + if (!haveInternalData) { + ret._propagateFrom(this, 4 | 1); + ret._captureStackTrace(); + } + + var target = this._target(); + if (target !== this) { + if (receiver === undefined) receiver = this._boundTo; + if (!haveInternalData) ret._setIsMigrated(); + } + + var callbackIndex = + target._addCallbacks(didFulfill, didReject, didProgress, ret, receiver); + + if (target._isResolved() && !target._isSettlePromisesQueued()) { + async.invoke( + target._settlePromiseAtPostResolution, target, callbackIndex); + } + + return ret; +}; + +Promise.prototype._settlePromiseAtPostResolution = function (index) { + if (this._isRejectionUnhandled()) this._unsetRejectionIsUnhandled(); + this._settlePromiseAt(index); +}; + +Promise.prototype._length = function () { + return this._bitField & 131071; +}; + +Promise.prototype._isFollowingOrFulfilledOrRejected = function () { + return (this._bitField & 939524096) > 0; +}; + +Promise.prototype._isFollowing = function () { + return (this._bitField & 536870912) === 536870912; +}; + +Promise.prototype._setLength = function (len) { + this._bitField = (this._bitField & -131072) | + (len & 131071); +}; + +Promise.prototype._setFulfilled = function () { + this._bitField = this._bitField | 268435456; +}; + +Promise.prototype._setRejected = function () { + this._bitField = this._bitField | 134217728; +}; + +Promise.prototype._setFollowing = function () { + this._bitField = this._bitField | 536870912; +}; + +Promise.prototype._setIsFinal = function () { + this._bitField = this._bitField | 33554432; +}; + +Promise.prototype._isFinal = function () { + return (this._bitField & 33554432) > 0; +}; + +Promise.prototype._cancellable = function () { + return (this._bitField & 67108864) > 0; +}; + +Promise.prototype._setCancellable = function () { + this._bitField = this._bitField | 67108864; +}; + +Promise.prototype._unsetCancellable = function () { + this._bitField = this._bitField & (~67108864); +}; + +Promise.prototype._setIsMigrated = function () { + this._bitField = this._bitField | 4194304; +}; + +Promise.prototype._unsetIsMigrated = function () { + this._bitField = this._bitField & (~4194304); +}; + +Promise.prototype._isMigrated = function () { + return (this._bitField & 4194304) > 0; +}; + +Promise.prototype._receiverAt = function (index) { + var ret = index === 0 + ? this._receiver0 + : this[ + index * 5 - 5 + 4]; + if (ret === undefined && this._isBound()) { + return this._boundTo; + } + return ret; +}; + +Promise.prototype._promiseAt = function (index) { + return index === 0 + ? this._promise0 + : this[index * 5 - 5 + 3]; +}; + +Promise.prototype._fulfillmentHandlerAt = function (index) { + return index === 0 + ? this._fulfillmentHandler0 + : this[index * 5 - 5 + 0]; +}; + +Promise.prototype._rejectionHandlerAt = function (index) { + return index === 0 + ? this._rejectionHandler0 + : this[index * 5 - 5 + 1]; +}; + +Promise.prototype._migrateCallbacks = function (follower, index) { + var fulfill = follower._fulfillmentHandlerAt(index); + var reject = follower._rejectionHandlerAt(index); + var progress = follower._progressHandlerAt(index); + var promise = follower._promiseAt(index); + var receiver = follower._receiverAt(index); + if (promise instanceof Promise) promise._setIsMigrated(); + this._addCallbacks(fulfill, reject, progress, promise, receiver); +}; + +Promise.prototype._addCallbacks = function ( + fulfill, + reject, + progress, + promise, + receiver +) { + var index = this._length(); + + if (index >= 131071 - 5) { + index = 0; + this._setLength(0); + } + + if (index === 0) { + this._promise0 = promise; + if (receiver !== undefined) this._receiver0 = receiver; + if (typeof fulfill === "function" && !this._isCarryingStackTrace()) + this._fulfillmentHandler0 = fulfill; + if (typeof reject === "function") this._rejectionHandler0 = reject; + if (typeof progress === "function") this._progressHandler0 = progress; + } else { + var base = index * 5 - 5; + this[base + 3] = promise; + this[base + 4] = receiver; + if (typeof fulfill === "function") + this[base + 0] = fulfill; + if (typeof reject === "function") + this[base + 1] = reject; + if (typeof progress === "function") + this[base + 2] = progress; + } + this._setLength(index + 1); + return index; +}; + +Promise.prototype._setProxyHandlers = function (receiver, promiseSlotValue) { + var index = this._length(); + + if (index >= 131071 - 5) { + index = 0; + this._setLength(0); + } + if (index === 0) { + this._promise0 = promiseSlotValue; + this._receiver0 = receiver; + } else { + var base = index * 5 - 5; + this[base + 3] = promiseSlotValue; + this[base + 4] = receiver; + } + this._setLength(index + 1); +}; + +Promise.prototype._proxyPromiseArray = function (promiseArray, index) { + this._setProxyHandlers(promiseArray, index); +}; + +Promise.prototype._resolveCallback = function(value, shouldBind) { + if (this._isFollowingOrFulfilledOrRejected()) return; + if (value === this) + return this._rejectCallback(makeSelfResolutionError(), false, true); + var maybePromise = tryConvertToPromise(value, this); + if (!(maybePromise instanceof Promise)) return this._fulfill(value); + + var propagationFlags = 1 | (shouldBind ? 4 : 0); + this._propagateFrom(maybePromise, propagationFlags); + var promise = maybePromise._target(); + if (promise._isPending()) { + var len = this._length(); + for (var i = 0; i < len; ++i) { + promise._migrateCallbacks(this, i); + } + this._setFollowing(); + this._setLength(0); + this._setFollowee(promise); + } else if (promise._isFulfilled()) { + this._fulfillUnchecked(promise._value()); + } else { + this._rejectUnchecked(promise._reason(), + promise._getCarriedStackTrace()); + } +}; + +Promise.prototype._rejectCallback = +function(reason, synchronous, shouldNotMarkOriginatingFromRejection) { + if (!shouldNotMarkOriginatingFromRejection) { + util.markAsOriginatingFromRejection(reason); + } + var trace = util.ensureErrorObject(reason); + var hasStack = trace === reason; + this._attachExtraTrace(trace, synchronous ? hasStack : false); + this._reject(reason, hasStack ? undefined : trace); +}; + +Promise.prototype._resolveFromResolver = function (resolver) { + var promise = this; + this._captureStackTrace(); + this._pushContext(); + var synchronous = true; + var r = tryCatch(resolver)(function(value) { + if (promise === null) return; + promise._resolveCallback(value); + promise = null; + }, function (reason) { + if (promise === null) return; + promise._rejectCallback(reason, synchronous); + promise = null; + }); + synchronous = false; + this._popContext(); + + if (r !== undefined && r === errorObj && promise !== null) { + promise._rejectCallback(r.e, true, true); + promise = null; + } +}; + +Promise.prototype._settlePromiseFromHandler = function ( + handler, receiver, value, promise +) { + if (promise._isRejected()) return; + promise._pushContext(); + var x; + if (receiver === APPLY && !this._isRejected()) { + x = tryCatch(handler).apply(this._boundTo, value); + } else { + x = tryCatch(handler).call(receiver, value); + } + promise._popContext(); + + if (x === errorObj || x === promise || x === NEXT_FILTER) { + var err = x === promise ? makeSelfResolutionError() : x.e; + promise._rejectCallback(err, false, true); + } else { + promise._resolveCallback(x); + } +}; + +Promise.prototype._target = function() { + var ret = this; + while (ret._isFollowing()) ret = ret._followee(); + return ret; +}; + +Promise.prototype._followee = function() { + return this._rejectionHandler0; +}; + +Promise.prototype._setFollowee = function(promise) { + this._rejectionHandler0 = promise; +}; + +Promise.prototype._cleanValues = function () { + if (this._cancellable()) { + this._cancellationParent = undefined; + } +}; + +Promise.prototype._propagateFrom = function (parent, flags) { + if ((flags & 1) > 0 && parent._cancellable()) { + this._setCancellable(); + this._cancellationParent = parent; + } + if ((flags & 4) > 0 && parent._isBound()) { + this._setBoundTo(parent._boundTo); + } +}; + +Promise.prototype._fulfill = function (value) { + if (this._isFollowingOrFulfilledOrRejected()) return; + this._fulfillUnchecked(value); +}; + +Promise.prototype._reject = function (reason, carriedStackTrace) { + if (this._isFollowingOrFulfilledOrRejected()) return; + this._rejectUnchecked(reason, carriedStackTrace); +}; + +Promise.prototype._settlePromiseAt = function (index) { + var promise = this._promiseAt(index); + var isPromise = promise instanceof Promise; + + if (isPromise && promise._isMigrated()) { + promise._unsetIsMigrated(); + return async.invoke(this._settlePromiseAt, this, index); + } + var handler = this._isFulfilled() + ? this._fulfillmentHandlerAt(index) + : this._rejectionHandlerAt(index); + + var carriedStackTrace = + this._isCarryingStackTrace() ? this._getCarriedStackTrace() : undefined; + var value = this._settledValue; + var receiver = this._receiverAt(index); + + + this._clearCallbackDataAtIndex(index); + + if (typeof handler === "function") { + if (!isPromise) { + handler.call(receiver, value, promise); + } else { + this._settlePromiseFromHandler(handler, receiver, value, promise); + } + } else if (receiver instanceof PromiseArray) { + if (!receiver._isResolved()) { + if (this._isFulfilled()) { + receiver._promiseFulfilled(value, promise); + } + else { + receiver._promiseRejected(value, promise); + } + } + } else if (isPromise) { + if (this._isFulfilled()) { + promise._fulfill(value); + } else { + promise._reject(value, carriedStackTrace); + } + } + + if (index >= 4 && (index & 31) === 4) + async.invokeLater(this._setLength, this, 0); +}; + +Promise.prototype._clearCallbackDataAtIndex = function(index) { + if (index === 0) { + if (!this._isCarryingStackTrace()) { + this._fulfillmentHandler0 = undefined; + } + this._rejectionHandler0 = + this._progressHandler0 = + this._receiver0 = + this._promise0 = undefined; + } else { + var base = index * 5 - 5; + this[base + 3] = + this[base + 4] = + this[base + 0] = + this[base + 1] = + this[base + 2] = undefined; + } +}; + +Promise.prototype._isSettlePromisesQueued = function () { + return (this._bitField & + -1073741824) === -1073741824; +}; + +Promise.prototype._setSettlePromisesQueued = function () { + this._bitField = this._bitField | -1073741824; +}; + +Promise.prototype._unsetSettlePromisesQueued = function () { + this._bitField = this._bitField & (~-1073741824); +}; + +Promise.prototype._queueSettlePromises = function() { + async.settlePromises(this); + this._setSettlePromisesQueued(); +}; + +Promise.prototype._fulfillUnchecked = function (value) { + if (value === this) { + var err = makeSelfResolutionError(); + this._attachExtraTrace(err); + return this._rejectUnchecked(err, undefined); + } + this._setFulfilled(); + this._settledValue = value; + this._cleanValues(); + + if (this._length() > 0) { + this._queueSettlePromises(); + } +}; + +Promise.prototype._rejectUncheckedCheckError = function (reason) { + var trace = util.ensureErrorObject(reason); + this._rejectUnchecked(reason, trace === reason ? undefined : trace); +}; + +Promise.prototype._rejectUnchecked = function (reason, trace) { + if (reason === this) { + var err = makeSelfResolutionError(); + this._attachExtraTrace(err); + return this._rejectUnchecked(err); + } + this._setRejected(); + this._settledValue = reason; + this._cleanValues(); + + if (this._isFinal()) { + async.throwLater(function(e) { + if ("stack" in e) { + async.invokeFirst( + CapturedTrace.unhandledRejection, undefined, e); + } + throw e; + }, trace === undefined ? reason : trace); + return; + } + + if (trace !== undefined && trace !== reason) { + this._setCarriedStackTrace(trace); + } + + if (this._length() > 0) { + this._queueSettlePromises(); + } else { + this._ensurePossibleRejectionHandled(); + } +}; + +Promise.prototype._settlePromises = function () { + this._unsetSettlePromisesQueued(); + var len = this._length(); + for (var i = 0; i < len; i++) { + this._settlePromiseAt(i); + } +}; + +Promise._makeSelfResolutionError = makeSelfResolutionError; +_dereq_("./progress.js")(Promise, PromiseArray); +_dereq_("./method.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection); +_dereq_("./bind.js")(Promise, INTERNAL, tryConvertToPromise); +_dereq_("./finally.js")(Promise, NEXT_FILTER, tryConvertToPromise); +_dereq_("./direct_resolve.js")(Promise); +_dereq_("./synchronous_inspection.js")(Promise); +_dereq_("./join.js")(Promise, PromiseArray, tryConvertToPromise, INTERNAL); +Promise.Promise = Promise; +_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL); +_dereq_('./cancel.js')(Promise); +_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext); +_dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise); +_dereq_('./nodeify.js')(Promise); +_dereq_('./call_get.js')(Promise); +_dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection); +_dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection); +_dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL); +_dereq_('./settle.js')(Promise, PromiseArray); +_dereq_('./some.js')(Promise, PromiseArray, apiRejection); +_dereq_('./promisify.js')(Promise, INTERNAL); +_dereq_('./any.js')(Promise); +_dereq_('./each.js')(Promise, INTERNAL); +_dereq_('./timers.js')(Promise, INTERNAL); +_dereq_('./filter.js')(Promise, INTERNAL); + + util.toFastProperties(Promise); + util.toFastProperties(Promise.prototype); + function fillTypes(value) { + var p = new Promise(INTERNAL); + p._fulfillmentHandler0 = value; + p._rejectionHandler0 = value; + p._progressHandler0 = value; + p._promise0 = value; + p._receiver0 = value; + p._settledValue = value; + } + // Complete slack tracking, opt out of field-type tracking and + // stabilize map + fillTypes({a: 1}); + fillTypes({b: 2}); + fillTypes({c: 3}); + fillTypes(1); + fillTypes(function(){}); + fillTypes(undefined); + fillTypes(false); + fillTypes(new Promise(INTERNAL)); + CapturedTrace.setBounds(async.firstLineError, util.lastLineError); + return Promise; + +}; + +},{"./any.js":1,"./async.js":2,"./bind.js":3,"./call_get.js":5,"./cancel.js":6,"./captured_trace.js":7,"./catch_filter.js":8,"./context.js":9,"./debuggability.js":10,"./direct_resolve.js":11,"./each.js":12,"./errors.js":13,"./filter.js":15,"./finally.js":16,"./generators.js":17,"./join.js":18,"./map.js":19,"./method.js":20,"./nodeify.js":21,"./progress.js":22,"./promise_array.js":24,"./promise_resolver.js":25,"./promisify.js":26,"./props.js":27,"./race.js":29,"./reduce.js":30,"./settle.js":32,"./some.js":33,"./synchronous_inspection.js":34,"./thenables.js":35,"./timers.js":36,"./using.js":37,"./util.js":38}],24:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL, tryConvertToPromise, + apiRejection) { +var util = _dereq_("./util.js"); +var isArray = util.isArray; + +function toResolutionValue(val) { + switch(val) { + case -2: return []; + case -3: return {}; + } +} + +function PromiseArray(values) { + var promise = this._promise = new Promise(INTERNAL); + var parent; + if (values instanceof Promise) { + parent = values; + promise._propagateFrom(parent, 1 | 4); + } + this._values = values; + this._length = 0; + this._totalResolved = 0; + this._init(undefined, -2); +} +PromiseArray.prototype.length = function () { + return this._length; +}; + +PromiseArray.prototype.promise = function () { + return this._promise; +}; + +PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { + var values = tryConvertToPromise(this._values, this._promise); + if (values instanceof Promise) { + values = values._target(); + this._values = values; + if (values._isFulfilled()) { + values = values._value(); + if (!isArray(values)) { + var err = new Promise.TypeError("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a"); + this.__hardReject__(err); + return; + } + } else if (values._isPending()) { + values._then( + init, + this._reject, + undefined, + this, + resolveValueIfEmpty + ); + return; + } else { + this._reject(values._reason()); + return; + } + } else if (!isArray(values)) { + this._promise._reject(apiRejection("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a")._reason()); + return; + } + + if (values.length === 0) { + if (resolveValueIfEmpty === -5) { + this._resolveEmptyArray(); + } + else { + this._resolve(toResolutionValue(resolveValueIfEmpty)); + } + return; + } + var len = this.getActualLength(values.length); + this._length = len; + this._values = this.shouldCopyValues() ? new Array(len) : this._values; + var promise = this._promise; + for (var i = 0; i < len; ++i) { + var isResolved = this._isResolved(); + var maybePromise = tryConvertToPromise(values[i], promise); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + if (isResolved) { + maybePromise._unsetRejectionIsUnhandled(); + } else if (maybePromise._isPending()) { + maybePromise._proxyPromiseArray(this, i); + } else if (maybePromise._isFulfilled()) { + this._promiseFulfilled(maybePromise._value(), i); + } else { + this._promiseRejected(maybePromise._reason(), i); + } + } else if (!isResolved) { + this._promiseFulfilled(maybePromise, i); + } + } +}; + +PromiseArray.prototype._isResolved = function () { + return this._values === null; +}; + +PromiseArray.prototype._resolve = function (value) { + this._values = null; + this._promise._fulfill(value); +}; + +PromiseArray.prototype.__hardReject__ = +PromiseArray.prototype._reject = function (reason) { + this._values = null; + this._promise._rejectCallback(reason, false, true); +}; + +PromiseArray.prototype._promiseProgressed = function (progressValue, index) { + this._promise._progress({ + index: index, + value: progressValue + }); +}; + + +PromiseArray.prototype._promiseFulfilled = function (value, index) { + this._values[index] = value; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + this._resolve(this._values); + } +}; + +PromiseArray.prototype._promiseRejected = function (reason, index) { + this._totalResolved++; + this._reject(reason); +}; + +PromiseArray.prototype.shouldCopyValues = function () { + return true; +}; + +PromiseArray.prototype.getActualLength = function (len) { + return len; +}; + +return PromiseArray; +}; + +},{"./util.js":38}],25:[function(_dereq_,module,exports){ +"use strict"; +var util = _dereq_("./util.js"); +var maybeWrapAsError = util.maybeWrapAsError; +var errors = _dereq_("./errors.js"); +var TimeoutError = errors.TimeoutError; +var OperationalError = errors.OperationalError; +var haveGetters = util.haveGetters; +var es5 = _dereq_("./es5.js"); + +function isUntypedError(obj) { + return obj instanceof Error && + es5.getPrototypeOf(obj) === Error.prototype; +} + +var rErrorKey = /^(?:name|message|stack|cause)$/; +function wrapAsOperationalError(obj) { + var ret; + if (isUntypedError(obj)) { + ret = new OperationalError(obj); + ret.name = obj.name; + ret.message = obj.message; + ret.stack = obj.stack; + var keys = es5.keys(obj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (!rErrorKey.test(key)) { + ret[key] = obj[key]; + } + } + return ret; + } + util.markAsOriginatingFromRejection(obj); + return obj; +} + +function nodebackForPromise(promise) { + return function(err, value) { + if (promise === null) return; + + if (err) { + var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); + promise._attachExtraTrace(wrapped); + promise._reject(wrapped); + } else if (arguments.length > 2) { + var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];} + promise._fulfill(args); + } else { + promise._fulfill(value); + } + + promise = null; + }; +} + + +var PromiseResolver; +if (!haveGetters) { + PromiseResolver = function (promise) { + this.promise = promise; + this.asCallback = nodebackForPromise(promise); + this.callback = this.asCallback; + }; +} +else { + PromiseResolver = function (promise) { + this.promise = promise; + }; +} +if (haveGetters) { + var prop = { + get: function() { + return nodebackForPromise(this.promise); + } + }; + es5.defineProperty(PromiseResolver.prototype, "asCallback", prop); + es5.defineProperty(PromiseResolver.prototype, "callback", prop); +} + +PromiseResolver._nodebackForPromise = nodebackForPromise; + +PromiseResolver.prototype.toString = function () { + return "[object PromiseResolver]"; +}; + +PromiseResolver.prototype.resolve = +PromiseResolver.prototype.fulfill = function (value) { + if (!(this instanceof PromiseResolver)) { + throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); + } + this.promise._resolveCallback(value); +}; + +PromiseResolver.prototype.reject = function (reason) { + if (!(this instanceof PromiseResolver)) { + throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); + } + this.promise._rejectCallback(reason); +}; + +PromiseResolver.prototype.progress = function (value) { + if (!(this instanceof PromiseResolver)) { + throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); + } + this.promise._progress(value); +}; + +PromiseResolver.prototype.cancel = function (err) { + this.promise.cancel(err); +}; + +PromiseResolver.prototype.timeout = function () { + this.reject(new TimeoutError("timeout")); +}; + +PromiseResolver.prototype.isResolved = function () { + return this.promise.isResolved(); +}; + +PromiseResolver.prototype.toJSON = function () { + return this.promise.toJSON(); +}; + +module.exports = PromiseResolver; + +},{"./errors.js":13,"./es5.js":14,"./util.js":38}],26:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var THIS = {}; +var util = _dereq_("./util.js"); +var nodebackForPromise = _dereq_("./promise_resolver.js") + ._nodebackForPromise; +var withAppended = util.withAppended; +var maybeWrapAsError = util.maybeWrapAsError; +var canEvaluate = util.canEvaluate; +var TypeError = _dereq_("./errors").TypeError; +var defaultSuffix = "Async"; +var defaultPromisified = {__isPromisified__: true}; +var noCopyPropsPattern = + /^(?:length|name|arguments|caller|callee|prototype|__isPromisified__)$/; +var defaultFilter = function(name, func) { + return util.isIdentifier(name) && + name.charAt(0) !== "_" && + !util.isClass(func); +}; + +function propsFilter(key) { + return !noCopyPropsPattern.test(key); +} + +function isPromisified(fn) { + try { + return fn.__isPromisified__ === true; + } + catch (e) { + return false; + } +} + +function hasPromisified(obj, key, suffix) { + var val = util.getDataPropertyOrDefault(obj, key + suffix, + defaultPromisified); + return val ? isPromisified(val) : false; +} +function checkValid(ret, suffix, suffixRegexp) { + for (var i = 0; i < ret.length; i += 2) { + var key = ret[i]; + if (suffixRegexp.test(key)) { + var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""); + for (var j = 0; j < ret.length; j += 2) { + if (ret[j] === keyWithoutAsyncSuffix) { + throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/iWrZbw\u000a" + .replace("%s", suffix)); + } + } + } + } +} + +function promisifiableMethods(obj, suffix, suffixRegexp, filter) { + var keys = util.inheritedDataKeys(obj); + var ret = []; + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var value = obj[key]; + var passesDefaultFilter = filter === defaultFilter + ? true : defaultFilter(key, value, obj); + if (typeof value === "function" && + !isPromisified(value) && + !hasPromisified(obj, key, suffix) && + filter(key, value, obj, passesDefaultFilter)) { + ret.push(key, value); + } + } + checkValid(ret, suffix, suffixRegexp); + return ret; +} + +var escapeIdentRegex = function(str) { + return str.replace(/([$])/, "\\$"); +}; + +var makeNodePromisifiedEval; +if (!true) { +var switchCaseArgumentOrder = function(likelyArgumentCount) { + var ret = [likelyArgumentCount]; + var min = Math.max(0, likelyArgumentCount - 1 - 3); + for(var i = likelyArgumentCount - 1; i >= min; --i) { + ret.push(i); + } + for(var i = likelyArgumentCount + 1; i <= 3; ++i) { + ret.push(i); + } + return ret; +}; + +var argumentSequence = function(argumentCount) { + return util.filledRange(argumentCount, "_arg", ""); +}; + +var parameterDeclaration = function(parameterCount) { + return util.filledRange( + Math.max(parameterCount, 3), "_arg", ""); +}; + +var parameterCount = function(fn) { + if (typeof fn.length === "number") { + return Math.max(Math.min(fn.length, 1023 + 1), 0); + } + return 0; +}; + +makeNodePromisifiedEval = +function(callback, receiver, originalName, fn) { + var newParameterCount = Math.max(0, parameterCount(fn) - 1); + var argumentOrder = switchCaseArgumentOrder(newParameterCount); + var shouldProxyThis = typeof callback === "string" || receiver === THIS; + + function generateCallForArgumentCount(count) { + var args = argumentSequence(count).join(", "); + var comma = count > 0 ? ", " : ""; + var ret; + if (shouldProxyThis) { + ret = "ret = callback.call(this, {{args}}, nodeback); break;\n"; + } else { + ret = receiver === undefined + ? "ret = callback({{args}}, nodeback); break;\n" + : "ret = callback.call(receiver, {{args}}, nodeback); break;\n"; + } + return ret.replace("{{args}}", args).replace(", ", comma); + } + + function generateArgumentSwitchCase() { + var ret = ""; + for (var i = 0; i < argumentOrder.length; ++i) { + ret += "case " + argumentOrder[i] +":" + + generateCallForArgumentCount(argumentOrder[i]); + } + + ret += " \n\ + default: \n\ + var args = new Array(len + 1); \n\ + var i = 0; \n\ + for (var i = 0; i < len; ++i) { \n\ + args[i] = arguments[i]; \n\ + } \n\ + args[i] = nodeback; \n\ + [CodeForCall] \n\ + break; \n\ + ".replace("[CodeForCall]", (shouldProxyThis + ? "ret = callback.apply(this, args);\n" + : "ret = callback.apply(receiver, args);\n")); + return ret; + } + + var getFunctionCode = typeof callback === "string" + ? ("this != null ? this['"+callback+"'] : fn") + : "fn"; + + return new Function("Promise", + "fn", + "receiver", + "withAppended", + "maybeWrapAsError", + "nodebackForPromise", + "tryCatch", + "errorObj", + "INTERNAL","'use strict'; \n\ + var ret = function (Parameters) { \n\ + 'use strict'; \n\ + var len = arguments.length; \n\ + var promise = new Promise(INTERNAL); \n\ + promise._captureStackTrace(); \n\ + var nodeback = nodebackForPromise(promise); \n\ + var ret; \n\ + var callback = tryCatch([GetFunctionCode]); \n\ + switch(len) { \n\ + [CodeForSwitchCase] \n\ + } \n\ + if (ret === errorObj) { \n\ + promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\ + } \n\ + return promise; \n\ + }; \n\ + ret.__isPromisified__ = true; \n\ + return ret; \n\ + " + .replace("Parameters", parameterDeclaration(newParameterCount)) + .replace("[CodeForSwitchCase]", generateArgumentSwitchCase()) + .replace("[GetFunctionCode]", getFunctionCode))( + Promise, + fn, + receiver, + withAppended, + maybeWrapAsError, + nodebackForPromise, + util.tryCatch, + util.errorObj, + INTERNAL + ); +}; +} + +function makeNodePromisifiedClosure(callback, receiver, _, fn) { + var defaultThis = (function() {return this;})(); + var method = callback; + if (typeof method === "string") { + callback = fn; + } + function promisified() { + var _receiver = receiver; + if (receiver === THIS) _receiver = this; + var promise = new Promise(INTERNAL); + promise._captureStackTrace(); + var cb = typeof method === "string" && this !== defaultThis + ? this[method] : callback; + var fn = nodebackForPromise(promise); + try { + cb.apply(_receiver, withAppended(arguments, fn)); + } catch(e) { + promise._rejectCallback(maybeWrapAsError(e), true, true); + } + return promise; + } + promisified.__isPromisified__ = true; + return promisified; +} + +var makeNodePromisified = canEvaluate + ? makeNodePromisifiedEval + : makeNodePromisifiedClosure; + +function promisifyAll(obj, suffix, filter, promisifier) { + var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"); + var methods = + promisifiableMethods(obj, suffix, suffixRegexp, filter); + + for (var i = 0, len = methods.length; i < len; i+= 2) { + var key = methods[i]; + var fn = methods[i+1]; + var promisifiedKey = key + suffix; + obj[promisifiedKey] = promisifier === makeNodePromisified + ? makeNodePromisified(key, THIS, key, fn, suffix) + : promisifier(fn, function() { + return makeNodePromisified(key, THIS, key, fn, suffix); + }); + } + util.toFastProperties(obj); + return obj; +} + +function promisify(callback, receiver) { + return makeNodePromisified(callback, receiver, undefined, callback); +} + +Promise.promisify = function (fn, receiver) { + if (typeof fn !== "function") { + throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); + } + if (isPromisified(fn)) { + return fn; + } + var ret = promisify(fn, arguments.length < 2 ? THIS : receiver); + util.copyDescriptors(fn, ret, propsFilter); + return ret; +}; + +Promise.promisifyAll = function (target, options) { + if (typeof target !== "function" && typeof target !== "object") { + throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/9ITlV0\u000a"); + } + options = Object(options); + var suffix = options.suffix; + if (typeof suffix !== "string") suffix = defaultSuffix; + var filter = options.filter; + if (typeof filter !== "function") filter = defaultFilter; + var promisifier = options.promisifier; + if (typeof promisifier !== "function") promisifier = makeNodePromisified; + + if (!util.isIdentifier(suffix)) { + throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/8FZo5V\u000a"); + } + + var keys = util.inheritedDataKeys(target); + for (var i = 0; i < keys.length; ++i) { + var value = target[keys[i]]; + if (keys[i] !== "constructor" && + util.isClass(value)) { + promisifyAll(value.prototype, suffix, filter, promisifier); + promisifyAll(value, suffix, filter, promisifier); + } + } + + return promisifyAll(target, suffix, filter, promisifier); +}; +}; + + +},{"./errors":13,"./promise_resolver.js":25,"./util.js":38}],27:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function( + Promise, PromiseArray, tryConvertToPromise, apiRejection) { +var util = _dereq_("./util.js"); +var isObject = util.isObject; +var es5 = _dereq_("./es5.js"); + +function PropertiesPromiseArray(obj) { + var keys = es5.keys(obj); + var len = keys.length; + var values = new Array(len * 2); + for (var i = 0; i < len; ++i) { + var key = keys[i]; + values[i] = obj[key]; + values[i + len] = key; + } + this.constructor$(values); +} +util.inherits(PropertiesPromiseArray, PromiseArray); + +PropertiesPromiseArray.prototype._init = function () { + this._init$(undefined, -3) ; +}; + +PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) { + this._values[index] = value; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + var val = {}; + var keyOffset = this.length(); + for (var i = 0, len = this.length(); i < len; ++i) { + val[this._values[i + keyOffset]] = this._values[i]; + } + this._resolve(val); + } +}; + +PropertiesPromiseArray.prototype._promiseProgressed = function (value, index) { + this._promise._progress({ + key: this._values[index + this.length()], + value: value + }); +}; + +PropertiesPromiseArray.prototype.shouldCopyValues = function () { + return false; +}; + +PropertiesPromiseArray.prototype.getActualLength = function (len) { + return len >> 1; +}; + +function props(promises) { + var ret; + var castValue = tryConvertToPromise(promises); + + if (!isObject(castValue)) { + return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/OsFKC8\u000a"); + } else if (castValue instanceof Promise) { + ret = castValue._then( + Promise.props, undefined, undefined, undefined, undefined); + } else { + ret = new PropertiesPromiseArray(castValue).promise(); + } + + if (castValue instanceof Promise) { + ret._propagateFrom(castValue, 4); + } + return ret; +} + +Promise.prototype.props = function () { + return props(this); +}; + +Promise.props = function (promises) { + return props(promises); +}; +}; + +},{"./es5.js":14,"./util.js":38}],28:[function(_dereq_,module,exports){ +"use strict"; +function arrayMove(src, srcIndex, dst, dstIndex, len) { + for (var j = 0; j < len; ++j) { + dst[j + dstIndex] = src[j + srcIndex]; + src[j + srcIndex] = void 0; + } +} + +function Queue(capacity) { + this._capacity = capacity; + this._length = 0; + this._front = 0; +} + +Queue.prototype._willBeOverCapacity = function (size) { + return this._capacity < size; +}; + +Queue.prototype._pushOne = function (arg) { + var length = this.length(); + this._checkCapacity(length + 1); + var i = (this._front + length) & (this._capacity - 1); + this[i] = arg; + this._length = length + 1; +}; + +Queue.prototype._unshiftOne = function(value) { + var capacity = this._capacity; + this._checkCapacity(this.length() + 1); + var front = this._front; + var i = (((( front - 1 ) & + ( capacity - 1) ) ^ capacity ) - capacity ); + this[i] = value; + this._front = i; + this._length = this.length() + 1; +}; + +Queue.prototype.unshift = function(fn, receiver, arg) { + this._unshiftOne(arg); + this._unshiftOne(receiver); + this._unshiftOne(fn); +}; + +Queue.prototype.push = function (fn, receiver, arg) { + var length = this.length() + 3; + if (this._willBeOverCapacity(length)) { + this._pushOne(fn); + this._pushOne(receiver); + this._pushOne(arg); + return; + } + var j = this._front + length - 3; + this._checkCapacity(length); + var wrapMask = this._capacity - 1; + this[(j + 0) & wrapMask] = fn; + this[(j + 1) & wrapMask] = receiver; + this[(j + 2) & wrapMask] = arg; + this._length = length; +}; + +Queue.prototype.shift = function () { + var front = this._front, + ret = this[front]; + + this[front] = undefined; + this._front = (front + 1) & (this._capacity - 1); + this._length--; + return ret; +}; + +Queue.prototype.length = function () { + return this._length; +}; + +Queue.prototype._checkCapacity = function (size) { + if (this._capacity < size) { + this._resizeTo(this._capacity << 1); + } +}; + +Queue.prototype._resizeTo = function (capacity) { + var oldCapacity = this._capacity; + this._capacity = capacity; + var front = this._front; + var length = this._length; + var moveItemsCount = (front + length) & (oldCapacity - 1); + arrayMove(this, 0, this, oldCapacity, moveItemsCount); +}; + +module.exports = Queue; + +},{}],29:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function( + Promise, INTERNAL, tryConvertToPromise, apiRejection) { +var isArray = _dereq_("./util.js").isArray; + +var raceLater = function (promise) { + return promise.then(function(array) { + return race(array, promise); + }); +}; + +function race(promises, parent) { + var maybePromise = tryConvertToPromise(promises); + + if (maybePromise instanceof Promise) { + return raceLater(maybePromise); + } else if (!isArray(promises)) { + return apiRejection("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a"); + } + + var ret = new Promise(INTERNAL); + if (parent !== undefined) { + ret._propagateFrom(parent, 4 | 1); + } + var fulfill = ret._fulfill; + var reject = ret._reject; + for (var i = 0, len = promises.length; i < len; ++i) { + var val = promises[i]; + + if (val === undefined && !(i in promises)) { + continue; + } + + Promise.cast(val)._then(fulfill, reject, undefined, ret, null); + } + return ret; +} + +Promise.race = function (promises) { + return race(promises, undefined); +}; + +Promise.prototype.race = function () { + return race(this, undefined); +}; + +}; + +},{"./util.js":38}],30:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, + PromiseArray, + apiRejection, + tryConvertToPromise, + INTERNAL) { +var async = _dereq_("./async.js"); +var util = _dereq_("./util.js"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +function ReductionPromiseArray(promises, fn, accum, _each) { + this.constructor$(promises); + this._promise._captureStackTrace(); + this._preservedValues = _each === INTERNAL ? [] : null; + this._zerothIsAccum = (accum === undefined); + this._gotAccum = false; + this._reducingIndex = (this._zerothIsAccum ? 1 : 0); + this._valuesPhase = undefined; + var maybePromise = tryConvertToPromise(accum, this._promise); + var rejected = false; + var isPromise = maybePromise instanceof Promise; + if (isPromise) { + maybePromise = maybePromise._target(); + if (maybePromise._isPending()) { + maybePromise._proxyPromiseArray(this, -1); + } else if (maybePromise._isFulfilled()) { + accum = maybePromise._value(); + this._gotAccum = true; + } else { + this._reject(maybePromise._reason()); + rejected = true; + } + } + if (!(isPromise || this._zerothIsAccum)) this._gotAccum = true; + this._callback = fn; + this._accum = accum; + if (!rejected) async.invoke(init, this, undefined); +} +function init() { + this._init$(undefined, -5); +} +util.inherits(ReductionPromiseArray, PromiseArray); + +ReductionPromiseArray.prototype._init = function () {}; + +ReductionPromiseArray.prototype._resolveEmptyArray = function () { + if (this._gotAccum || this._zerothIsAccum) { + this._resolve(this._preservedValues !== null + ? [] : this._accum); + } +}; + +ReductionPromiseArray.prototype._promiseFulfilled = function (value, index) { + var values = this._values; + values[index] = value; + var length = this.length(); + var preservedValues = this._preservedValues; + var isEach = preservedValues !== null; + var gotAccum = this._gotAccum; + var valuesPhase = this._valuesPhase; + var valuesPhaseIndex; + if (!valuesPhase) { + valuesPhase = this._valuesPhase = new Array(length); + for (valuesPhaseIndex=0; valuesPhaseIndex= this._length) { + this._resolve(this._values); + } +}; + +SettledPromiseArray.prototype._promiseFulfilled = function (value, index) { + var ret = new PromiseInspection(); + ret._bitField = 268435456; + ret._settledValue = value; + this._promiseResolved(index, ret); +}; +SettledPromiseArray.prototype._promiseRejected = function (reason, index) { + var ret = new PromiseInspection(); + ret._bitField = 134217728; + ret._settledValue = reason; + this._promiseResolved(index, ret); +}; + +Promise.settle = function (promises) { + return new SettledPromiseArray(promises).promise(); +}; + +Promise.prototype.settle = function () { + return new SettledPromiseArray(this).promise(); +}; +}; + +},{"./util.js":38}],33:[function(_dereq_,module,exports){ +"use strict"; +module.exports = +function(Promise, PromiseArray, apiRejection) { +var util = _dereq_("./util.js"); +var RangeError = _dereq_("./errors.js").RangeError; +var AggregateError = _dereq_("./errors.js").AggregateError; +var isArray = util.isArray; + + +function SomePromiseArray(values) { + this.constructor$(values); + this._howMany = 0; + this._unwrap = false; + this._initialized = false; +} +util.inherits(SomePromiseArray, PromiseArray); + +SomePromiseArray.prototype._init = function () { + if (!this._initialized) { + return; + } + if (this._howMany === 0) { + this._resolve([]); + return; + } + this._init$(undefined, -5); + var isArrayResolved = isArray(this._values); + if (!this._isResolved() && + isArrayResolved && + this._howMany > this._canPossiblyFulfill()) { + this._reject(this._getRangeError(this.length())); + } +}; + +SomePromiseArray.prototype.init = function () { + this._initialized = true; + this._init(); +}; + +SomePromiseArray.prototype.setUnwrap = function () { + this._unwrap = true; +}; + +SomePromiseArray.prototype.howMany = function () { + return this._howMany; +}; + +SomePromiseArray.prototype.setHowMany = function (count) { + this._howMany = count; +}; + +SomePromiseArray.prototype._promiseFulfilled = function (value) { + this._addFulfilled(value); + if (this._fulfilled() === this.howMany()) { + this._values.length = this.howMany(); + if (this.howMany() === 1 && this._unwrap) { + this._resolve(this._values[0]); + } else { + this._resolve(this._values); + } + } + +}; +SomePromiseArray.prototype._promiseRejected = function (reason) { + this._addRejected(reason); + if (this.howMany() > this._canPossiblyFulfill()) { + var e = new AggregateError(); + for (var i = this.length(); i < this._values.length; ++i) { + e.push(this._values[i]); + } + this._reject(e); + } +}; + +SomePromiseArray.prototype._fulfilled = function () { + return this._totalResolved; +}; + +SomePromiseArray.prototype._rejected = function () { + return this._values.length - this.length(); +}; + +SomePromiseArray.prototype._addRejected = function (reason) { + this._values.push(reason); +}; + +SomePromiseArray.prototype._addFulfilled = function (value) { + this._values[this._totalResolved++] = value; +}; + +SomePromiseArray.prototype._canPossiblyFulfill = function () { + return this.length() - this._rejected(); +}; + +SomePromiseArray.prototype._getRangeError = function (count) { + var message = "Input array must contain at least " + + this._howMany + " items but contains only " + count + " items"; + return new RangeError(message); +}; + +SomePromiseArray.prototype._resolveEmptyArray = function () { + this._reject(this._getRangeError(0)); +}; + +function some(promises, howMany) { + if ((howMany | 0) !== howMany || howMany < 0) { + return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/1wAmHx\u000a"); + } + var ret = new SomePromiseArray(promises); + var promise = ret.promise(); + ret.setHowMany(howMany); + ret.init(); + return promise; +} + +Promise.some = function (promises, howMany) { + return some(promises, howMany); +}; + +Promise.prototype.some = function (howMany) { + return some(this, howMany); +}; + +Promise._SomePromiseArray = SomePromiseArray; +}; + +},{"./errors.js":13,"./util.js":38}],34:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise) { +function PromiseInspection(promise) { + if (promise !== undefined) { + promise = promise._target(); + this._bitField = promise._bitField; + this._settledValue = promise._settledValue; + } + else { + this._bitField = 0; + this._settledValue = undefined; + } +} + +PromiseInspection.prototype.value = function () { + if (!this.isFulfilled()) { + throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/hc1DLj\u000a"); + } + return this._settledValue; +}; + +PromiseInspection.prototype.error = +PromiseInspection.prototype.reason = function () { + if (!this.isRejected()) { + throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/hPuiwB\u000a"); + } + return this._settledValue; +}; + +PromiseInspection.prototype.isFulfilled = +Promise.prototype._isFulfilled = function () { + return (this._bitField & 268435456) > 0; +}; + +PromiseInspection.prototype.isRejected = +Promise.prototype._isRejected = function () { + return (this._bitField & 134217728) > 0; +}; + +PromiseInspection.prototype.isPending = +Promise.prototype._isPending = function () { + return (this._bitField & 402653184) === 0; +}; + +PromiseInspection.prototype.isResolved = +Promise.prototype._isResolved = function () { + return (this._bitField & 402653184) > 0; +}; + +Promise.prototype.isPending = function() { + return this._target()._isPending(); +}; + +Promise.prototype.isRejected = function() { + return this._target()._isRejected(); +}; + +Promise.prototype.isFulfilled = function() { + return this._target()._isFulfilled(); +}; + +Promise.prototype.isResolved = function() { + return this._target()._isResolved(); +}; + +Promise.prototype._value = function() { + return this._settledValue; +}; + +Promise.prototype._reason = function() { + this._unsetRejectionIsUnhandled(); + return this._settledValue; +}; + +Promise.prototype.value = function() { + var target = this._target(); + if (!target.isFulfilled()) { + throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/hc1DLj\u000a"); + } + return target._settledValue; +}; + +Promise.prototype.reason = function() { + var target = this._target(); + if (!target.isRejected()) { + throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/hPuiwB\u000a"); + } + target._unsetRejectionIsUnhandled(); + return target._settledValue; +}; + + +Promise.PromiseInspection = PromiseInspection; +}; + +},{}],35:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var util = _dereq_("./util.js"); +var errorObj = util.errorObj; +var isObject = util.isObject; + +function tryConvertToPromise(obj, context) { + if (isObject(obj)) { + if (obj instanceof Promise) { + return obj; + } + else if (isAnyBluebirdPromise(obj)) { + var ret = new Promise(INTERNAL); + obj._then( + ret._fulfillUnchecked, + ret._rejectUncheckedCheckError, + ret._progressUnchecked, + ret, + null + ); + return ret; + } + var then = util.tryCatch(getThen)(obj); + if (then === errorObj) { + if (context) context._pushContext(); + var ret = Promise.reject(then.e); + if (context) context._popContext(); + return ret; + } else if (typeof then === "function") { + return doThenable(obj, then, context); + } + } + return obj; +} + +function getThen(obj) { + return obj.then; +} + +var hasProp = {}.hasOwnProperty; +function isAnyBluebirdPromise(obj) { + return hasProp.call(obj, "_promise0"); +} + +function doThenable(x, then, context) { + var promise = new Promise(INTERNAL); + var ret = promise; + if (context) context._pushContext(); + promise._captureStackTrace(); + if (context) context._popContext(); + var synchronous = true; + var result = util.tryCatch(then).call(x, + resolveFromThenable, + rejectFromThenable, + progressFromThenable); + synchronous = false; + if (promise && result === errorObj) { + promise._rejectCallback(result.e, true, true); + promise = null; + } + + function resolveFromThenable(value) { + if (!promise) return; + if (x === value) { + promise._rejectCallback( + Promise._makeSelfResolutionError(), false, true); + } else { + promise._resolveCallback(value); + } + promise = null; + } + + function rejectFromThenable(reason) { + if (!promise) return; + promise._rejectCallback(reason, synchronous, true); + promise = null; + } + + function progressFromThenable(value) { + if (!promise) return; + if (typeof promise._progress === "function") { + promise._progress(value); + } + } + return ret; +} + +return tryConvertToPromise; +}; + +},{"./util.js":38}],36:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var util = _dereq_("./util.js"); +var TimeoutError = Promise.TimeoutError; + +var afterTimeout = function (promise, message) { + if (!promise.isPending()) return; + if (typeof message !== "string") { + message = "operation timed out"; + } + var err = new TimeoutError(message); + util.markAsOriginatingFromRejection(err); + promise._attachExtraTrace(err); + promise._cancel(err); +}; + +var afterValue = function(value) { return delay(+this).thenReturn(value); }; +var delay = Promise.delay = function (value, ms) { + if (ms === undefined) { + ms = value; + value = undefined; + var ret = new Promise(INTERNAL); + setTimeout(function() { ret._fulfill(); }, ms); + return ret; + } + ms = +ms; + return Promise.resolve(value)._then(afterValue, null, null, ms, undefined); +}; + +Promise.prototype.delay = function (ms) { + return delay(this, ms); +}; + +function successClear(value) { + var handle = this; + if (handle instanceof Number) handle = +handle; + clearTimeout(handle); + return value; +} + +function failureClear(reason) { + var handle = this; + if (handle instanceof Number) handle = +handle; + clearTimeout(handle); + throw reason; +} + +Promise.prototype.timeout = function (ms, message) { + ms = +ms; + var ret = this.then().cancellable(); + ret._cancellationParent = this; + var handle = setTimeout(function timeoutTimeout() { + afterTimeout(ret, message); + }, ms); + return ret._then(successClear, failureClear, undefined, handle, undefined); +}; + +}; + +},{"./util.js":38}],37:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function (Promise, apiRejection, tryConvertToPromise, + createContext) { + var TypeError = _dereq_("./errors.js").TypeError; + var inherits = _dereq_("./util.js").inherits; + var PromiseInspection = Promise.PromiseInspection; + + function inspectionMapper(inspections) { + var len = inspections.length; + for (var i = 0; i < len; ++i) { + var inspection = inspections[i]; + if (inspection.isRejected()) { + return Promise.reject(inspection.error()); + } + inspections[i] = inspection._settledValue; + } + return inspections; + } + + function thrower(e) { + setTimeout(function(){throw e;}, 0); + } + + function castPreservingDisposable(thenable) { + var maybePromise = tryConvertToPromise(thenable); + if (maybePromise !== thenable && + typeof thenable._isDisposable === "function" && + typeof thenable._getDisposer === "function" && + thenable._isDisposable()) { + maybePromise._setDisposable(thenable._getDisposer()); + } + return maybePromise; + } + function dispose(resources, inspection) { + var i = 0; + var len = resources.length; + var ret = Promise.defer(); + function iterator() { + if (i >= len) return ret.resolve(); + var maybePromise = castPreservingDisposable(resources[i++]); + if (maybePromise instanceof Promise && + maybePromise._isDisposable()) { + try { + maybePromise = tryConvertToPromise( + maybePromise._getDisposer().tryDispose(inspection), + resources.promise); + } catch (e) { + return thrower(e); + } + if (maybePromise instanceof Promise) { + return maybePromise._then(iterator, thrower, + null, null, null); + } + } + iterator(); + } + iterator(); + return ret.promise; + } + + function disposerSuccess(value) { + var inspection = new PromiseInspection(); + inspection._settledValue = value; + inspection._bitField = 268435456; + return dispose(this, inspection).thenReturn(value); + } + + function disposerFail(reason) { + var inspection = new PromiseInspection(); + inspection._settledValue = reason; + inspection._bitField = 134217728; + return dispose(this, inspection).thenThrow(reason); + } + + function Disposer(data, promise, context) { + this._data = data; + this._promise = promise; + this._context = context; + } + + Disposer.prototype.data = function () { + return this._data; + }; + + Disposer.prototype.promise = function () { + return this._promise; + }; + + Disposer.prototype.resource = function () { + if (this.promise().isFulfilled()) { + return this.promise().value(); + } + return null; + }; + + Disposer.prototype.tryDispose = function(inspection) { + var resource = this.resource(); + var context = this._context; + if (context !== undefined) context._pushContext(); + var ret = resource !== null + ? this.doDispose(resource, inspection) : null; + if (context !== undefined) context._popContext(); + this._promise._unsetDisposable(); + this._data = null; + return ret; + }; + + Disposer.isDisposer = function (d) { + return (d != null && + typeof d.resource === "function" && + typeof d.tryDispose === "function"); + }; + + function FunctionDisposer(fn, promise, context) { + this.constructor$(fn, promise, context); + } + inherits(FunctionDisposer, Disposer); + + FunctionDisposer.prototype.doDispose = function (resource, inspection) { + var fn = this.data(); + return fn.call(resource, resource, inspection); + }; + + function maybeUnwrapDisposer(value) { + if (Disposer.isDisposer(value)) { + this.resources[this.index]._setDisposable(value); + return value.promise(); + } + return value; + } + + Promise.using = function () { + var len = arguments.length; + if (len < 2) return apiRejection( + "you must pass at least 2 arguments to Promise.using"); + var fn = arguments[len - 1]; + if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); + len--; + var resources = new Array(len); + for (var i = 0; i < len; ++i) { + var resource = arguments[i]; + if (Disposer.isDisposer(resource)) { + var disposer = resource; + resource = resource.promise(); + resource._setDisposable(disposer); + } else { + var maybePromise = tryConvertToPromise(resource); + if (maybePromise instanceof Promise) { + resource = + maybePromise._then(maybeUnwrapDisposer, null, null, { + resources: resources, + index: i + }, undefined); + } + } + resources[i] = resource; + } + + var promise = Promise.settle(resources) + .then(inspectionMapper) + .then(function(vals) { + promise._pushContext(); + var ret; + try { + ret = fn.apply(undefined, vals); + } finally { + promise._popContext(); + } + return ret; + }) + ._then( + disposerSuccess, disposerFail, undefined, resources, undefined); + resources.promise = promise; + return promise; + }; + + Promise.prototype._setDisposable = function (disposer) { + this._bitField = this._bitField | 262144; + this._disposer = disposer; + }; + + Promise.prototype._isDisposable = function () { + return (this._bitField & 262144) > 0; + }; + + Promise.prototype._getDisposer = function () { + return this._disposer; + }; + + Promise.prototype._unsetDisposable = function () { + this._bitField = this._bitField & (~262144); + this._disposer = undefined; + }; + + Promise.prototype.disposer = function (fn) { + if (typeof fn === "function") { + return new FunctionDisposer(fn, this, createContext()); + } + throw new TypeError(); + }; + +}; + +},{"./errors.js":13,"./util.js":38}],38:[function(_dereq_,module,exports){ +"use strict"; +var es5 = _dereq_("./es5.js"); +var canEvaluate = typeof navigator == "undefined"; +var haveGetters = (function(){ + try { + var o = {}; + es5.defineProperty(o, "f", { + get: function () { + return 3; + } + }); + return o.f === 3; + } + catch (e) { + return false; + } + +})(); + +var errorObj = {e: {}}; +var tryCatchTarget; +function tryCatcher() { + try { + return tryCatchTarget.apply(this, arguments); + } catch (e) { + errorObj.e = e; + return errorObj; + } +} +function tryCatch(fn) { + tryCatchTarget = fn; + return tryCatcher; +} + +var inherits = function(Child, Parent) { + var hasProp = {}.hasOwnProperty; + + function T() { + this.constructor = Child; + this.constructor$ = Parent; + for (var propertyName in Parent.prototype) { + if (hasProp.call(Parent.prototype, propertyName) && + propertyName.charAt(propertyName.length-1) !== "$" + ) { + this[propertyName + "$"] = Parent.prototype[propertyName]; + } + } + } + T.prototype = Parent.prototype; + Child.prototype = new T(); + return Child.prototype; +}; + + +function isPrimitive(val) { + return val == null || val === true || val === false || + typeof val === "string" || typeof val === "number"; + +} + +function isObject(value) { + return !isPrimitive(value); +} + +function maybeWrapAsError(maybeError) { + if (!isPrimitive(maybeError)) return maybeError; + + return new Error(safeToString(maybeError)); +} + +function withAppended(target, appendee) { + var len = target.length; + var ret = new Array(len + 1); + var i; + for (i = 0; i < len; ++i) { + ret[i] = target[i]; + } + ret[i] = appendee; + return ret; +} + +function getDataPropertyOrDefault(obj, key, defaultValue) { + if (es5.isES5) { + var desc = Object.getOwnPropertyDescriptor(obj, key); + if (desc != null) { + return desc.get == null && desc.set == null + ? desc.value + : defaultValue; + } + } else { + return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined; + } +} + +function notEnumerableProp(obj, name, value) { + if (isPrimitive(obj)) return obj; + var descriptor = { + value: value, + configurable: true, + enumerable: false, + writable: true + }; + es5.defineProperty(obj, name, descriptor); + return obj; +} + + +var wrapsPrimitiveReceiver = (function() { + return this !== "string"; +}).call("string"); + +function thrower(r) { + throw r; +} + +var inheritedDataKeys = (function() { + if (es5.isES5) { + var oProto = Object.prototype; + var getKeys = Object.getOwnPropertyNames; + return function(obj) { + var ret = []; + var visitedKeys = Object.create(null); + while (obj != null && obj !== oProto) { + var keys; + try { + keys = getKeys(obj); + } catch (e) { + return ret; + } + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (visitedKeys[key]) continue; + visitedKeys[key] = true; + var desc = Object.getOwnPropertyDescriptor(obj, key); + if (desc != null && desc.get == null && desc.set == null) { + ret.push(key); + } + } + obj = es5.getPrototypeOf(obj); + } + return ret; + }; + } else { + return function(obj) { + var ret = []; + /*jshint forin:false */ + for (var key in obj) { + ret.push(key); + } + return ret; + }; + } + +})(); + +function isClass(fn) { + try { + if (typeof fn === "function") { + var keys = es5.names(fn.prototype); + if (es5.isES5) return keys.length > 1; + return keys.length > 0 && + !(keys.length === 1 && keys[0] === "constructor"); + } + return false; + } catch (e) { + return false; + } +} + +function toFastProperties(obj) { + /*jshint -W027,-W055,-W031*/ + function f() {} + f.prototype = obj; + var l = 8; + while (l--) new f(); + return obj; + eval(obj); +} + +var rident = /^[a-z$_][a-z$_0-9]*$/i; +function isIdentifier(str) { + return rident.test(str); +} + +function filledRange(count, prefix, suffix) { + var ret = new Array(count); + for(var i = 0; i < count; ++i) { + ret[i] = prefix + i + suffix; + } + return ret; +} + +function safeToString(obj) { + try { + return obj + ""; + } catch (e) { + return "[no string representation]"; + } +} + +function markAsOriginatingFromRejection(e) { + try { + notEnumerableProp(e, "isOperational", true); + } + catch(ignore) {} +} + +function originatesFromRejection(e) { + if (e == null) return false; + return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) || + e["isOperational"] === true); +} + +function canAttachTrace(obj) { + return obj instanceof Error && es5.propertyIsWritable(obj, "stack"); +} + +var ensureErrorObject = (function() { + if (!("stack" in new Error())) { + return function(value) { + if (canAttachTrace(value)) return value; + try {throw new Error(safeToString(value));} + catch(err) {return err;} + }; + } else { + return function(value) { + if (canAttachTrace(value)) return value; + return new Error(safeToString(value)); + }; + } +})(); + +function classString(obj) { + return {}.toString.call(obj); +} + +function copyDescriptors(from, to, filter) { + var keys = es5.names(from); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (filter(key)) { + es5.defineProperty(to, key, es5.getDescriptor(from, key)); + } + } +} + +var ret = { + isClass: isClass, + isIdentifier: isIdentifier, + inheritedDataKeys: inheritedDataKeys, + getDataPropertyOrDefault: getDataPropertyOrDefault, + thrower: thrower, + isArray: es5.isArray, + haveGetters: haveGetters, + notEnumerableProp: notEnumerableProp, + isPrimitive: isPrimitive, + isObject: isObject, + canEvaluate: canEvaluate, + errorObj: errorObj, + tryCatch: tryCatch, + inherits: inherits, + withAppended: withAppended, + maybeWrapAsError: maybeWrapAsError, + wrapsPrimitiveReceiver: wrapsPrimitiveReceiver, + toFastProperties: toFastProperties, + filledRange: filledRange, + toString: safeToString, + canAttachTrace: canAttachTrace, + ensureErrorObject: ensureErrorObject, + originatesFromRejection: originatesFromRejection, + markAsOriginatingFromRejection: markAsOriginatingFromRejection, + classString: classString, + copyDescriptors: copyDescriptors, + hasDevTools: typeof chrome !== "undefined" && chrome && + typeof chrome.loadTimes === "function", + isNode: typeof process !== "undefined" && + classString(process).toLowerCase() === "[object process]" +}; +ret.isRecentNode = ret.isNode && (function() { + var version = process.versions.node.split(".").map(Number); + return (version[0] === 0 && version[1] > 10) || (version[0] > 0); +})(); +try {throw new Error(); } catch (e) {ret.lastLineError = e;} +module.exports = ret; + +},{"./es5.js":14}],39:[function(_dereq_,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +function EventEmitter() { + this._events = this._events || {}; + this._maxListeners = this._maxListeners || undefined; +} +module.exports = EventEmitter; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +EventEmitter.defaultMaxListeners = 10; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function(n) { + if (!isNumber(n) || n < 0 || isNaN(n)) + throw TypeError('n must be a positive number'); + this._maxListeners = n; + return this; +}; + +EventEmitter.prototype.emit = function(type) { + var er, handler, len, args, i, listeners; + + if (!this._events) + this._events = {}; + + // If there is no 'error' event listener then throw. + if (type === 'error') { + if (!this._events.error || + (isObject(this._events.error) && !this._events.error.length)) { + er = arguments[1]; + if (er instanceof Error) { + throw er; // Unhandled 'error' event + } + throw TypeError('Uncaught, unspecified "error" event.'); + } + } + + handler = this._events[type]; + + if (isUndefined(handler)) + return false; + + if (isFunction(handler)) { + switch (arguments.length) { + // fast cases + case 1: + handler.call(this); + break; + case 2: + handler.call(this, arguments[1]); + break; + case 3: + handler.call(this, arguments[1], arguments[2]); + break; + // slower + default: + len = arguments.length; + args = new Array(len - 1); + for (i = 1; i < len; i++) + args[i - 1] = arguments[i]; + handler.apply(this, args); + } + } else if (isObject(handler)) { + len = arguments.length; + args = new Array(len - 1); + for (i = 1; i < len; i++) + args[i - 1] = arguments[i]; + + listeners = handler.slice(); + len = listeners.length; + for (i = 0; i < len; i++) + listeners[i].apply(this, args); + } + + return true; +}; + +EventEmitter.prototype.addListener = function(type, listener) { + var m; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + if (!this._events) + this._events = {}; + + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (this._events.newListener) + this.emit('newListener', type, + isFunction(listener.listener) ? + listener.listener : listener); + + if (!this._events[type]) + // Optimize the case of one listener. Don't need the extra array object. + this._events[type] = listener; + else if (isObject(this._events[type])) + // If we've already got an array, just append. + this._events[type].push(listener); + else + // Adding the second element, need to change to array. + this._events[type] = [this._events[type], listener]; + + // Check for listener leak + if (isObject(this._events[type]) && !this._events[type].warned) { + var m; + if (!isUndefined(this._maxListeners)) { + m = this._maxListeners; + } else { + m = EventEmitter.defaultMaxListeners; + } + + if (m && m > 0 && this._events[type].length > m) { + this._events[type].warned = true; + console.error('(node) warning: possible EventEmitter memory ' + + 'leak detected. %d listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.', + this._events[type].length); + if (typeof console.trace === 'function') { + // not supported in IE 10 + console.trace(); + } + } + } + + return this; +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.once = function(type, listener) { + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + var fired = false; + + function g() { + this.removeListener(type, g); + + if (!fired) { + fired = true; + listener.apply(this, arguments); + } + } + + g.listener = listener; + this.on(type, g); + + return this; +}; + +// emits a 'removeListener' event iff the listener was removed +EventEmitter.prototype.removeListener = function(type, listener) { + var list, position, length, i; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + if (!this._events || !this._events[type]) + return this; + + list = this._events[type]; + length = list.length; + position = -1; + + if (list === listener || + (isFunction(list.listener) && list.listener === listener)) { + delete this._events[type]; + if (this._events.removeListener) + this.emit('removeListener', type, listener); + + } else if (isObject(list)) { + for (i = length; i-- > 0;) { + if (list[i] === listener || + (list[i].listener && list[i].listener === listener)) { + position = i; + break; + } + } + + if (position < 0) + return this; + + if (list.length === 1) { + list.length = 0; + delete this._events[type]; + } else { + list.splice(position, 1); + } + + if (this._events.removeListener) + this.emit('removeListener', type, listener); + } + + return this; +}; + +EventEmitter.prototype.removeAllListeners = function(type) { + var key, listeners; + + if (!this._events) + return this; + + // not listening for removeListener, no need to emit + if (!this._events.removeListener) { + if (arguments.length === 0) + this._events = {}; + else if (this._events[type]) + delete this._events[type]; + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + for (key in this._events) { + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = {}; + return this; + } + + listeners = this._events[type]; + + if (isFunction(listeners)) { + this.removeListener(type, listeners); + } else { + // LIFO order + while (listeners.length) + this.removeListener(type, listeners[listeners.length - 1]); + } + delete this._events[type]; + + return this; +}; + +EventEmitter.prototype.listeners = function(type) { + var ret; + if (!this._events || !this._events[type]) + ret = []; + else if (isFunction(this._events[type])) + ret = [this._events[type]]; + else + ret = this._events[type].slice(); + return ret; +}; + +EventEmitter.listenerCount = function(emitter, type) { + var ret; + if (!emitter._events || !emitter._events[type]) + ret = 0; + else if (isFunction(emitter._events[type])) + ret = 1; + else + ret = emitter._events[type].length; + return ret; +}; + +function isFunction(arg) { + return typeof arg === 'function'; +} + +function isNumber(arg) { + return typeof arg === 'number'; +} + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} + +function isUndefined(arg) { + return arg === void 0; +} + +},{}]},{},[4])(4) +}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; } \ No newline at end of file diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/browser/bluebird.min.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/browser/bluebird.min.js new file mode 100644 index 00000000000..bc182ffdd64 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/browser/bluebird.min.js @@ -0,0 +1,31 @@ +/* @preserve + * The MIT License (MIT) + * + * Copyright (c) 2014 Petka Antonov + * + * 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. + * + */ +/** + * bluebird build version 2.9.27 + * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, cancel, using, filter, any, each, timers +*/ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Promise=t()}}(function(){var t,e,r;return function n(t,e,r){function i(s,a){if(!e[s]){if(!t[s]){var u="function"==typeof _dereq_&&_dereq_;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=e[s]={exports:{}};t[s][0].call(l.exports,function(e){var r=t[s][1][e];return i(r?r:e)},l,l.exports,n,t,e,r)}return e[s].exports}for(var o="function"==typeof _dereq_&&_dereq_,s=0;s0},r.prototype.throwLater=function(t,e){1===arguments.length&&(e=t,t=function(){throw e});var r=this._getDomain();if(void 0!==r&&(t=r.bind(t)),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(n){throw new Error("No async scheduler available\n\n See http://goo.gl/m3OTXk\n")}},r.prototype._getDomain=function(){};l.hasDevTools?(r.prototype.invokeLater=function(t,e,r){this._trampolineEnabled?n.call(this,t,e,r):setTimeout(function(){t.call(e,r)},100)},r.prototype.invoke=function(t,e,r){this._trampolineEnabled?i.call(this,t,e,r):setTimeout(function(){t.call(e,r)},0)},r.prototype.settlePromises=function(t){this._trampolineEnabled?o.call(this,t):setTimeout(function(){t._settlePromises()},0)}):(r.prototype.invokeLater=n,r.prototype.invoke=i,r.prototype.settlePromises=o),r.prototype.invokeFirst=function(t,e,r){var n=this._getDomain();void 0!==n&&(t=n.bind(t)),this._normalQueue.unshift(t,e,r),this._queueTick()},r.prototype._drainQueue=function(t){for(;t.length()>0;){var e=t.shift();if("function"==typeof e){var r=t.shift(),n=t.shift();e.call(r,n)}else e._settlePromises()}},r.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._drainQueue(this._lateQueue)},r.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},r.prototype._reset=function(){this._isTickUsed=!1},e.exports=new r,e.exports.firstLineError=s},{"./queue.js":28,"./schedule.js":31,"./util.js":38,events:39}],3:[function(t,e){"use strict";e.exports=function(t,e,r){var n=function(t,e){this._reject(e)},i=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(n,n,null,this,t)},o=function(t,e){this._setBoundTo(t),this._isPending()&&this._resolveCallback(e.target)},s=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(n){var a=r(n),u=new t(e);u._propagateFrom(this,1);var c=this._target();if(a instanceof t){var l={promiseRejectionQueued:!1,promise:u,target:c,bindingPromise:a};c._then(e,i,u._progress,u,l),a._then(o,s,u._progress,u,l)}else u._setBoundTo(n),u._resolveCallback(c);return u},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=131072|this._bitField,this._boundTo=t):this._bitField=-131073&this._bitField},t.prototype._isBound=function(){return 131072===(131072&this._bitField)},t.bind=function(n,i){var o=r(n),s=new t(e);return o instanceof t?o._then(function(t){s._setBoundTo(t),s._resolveCallback(i)},s._reject,s._progress,s,null):(s._setBoundTo(n),s._resolveCallback(i)),s}}},{}],4:[function(t,e){"use strict";function r(){try{Promise===i&&(Promise=n)}catch(t){}return i}var n;"undefined"!=typeof Promise&&(n=Promise);var i=t("./promise.js")();i.noConflict=r,e.exports=i},{"./promise.js":23}],5:[function(t,e){"use strict";var r=Object.create;if(r){var n=r(null),i=r(null);n[" size"]=i[" size"]=0}e.exports=function(e){function r(t,r){var n;if(null!=t&&(n=t[r]),"function"!=typeof n){var i="Object "+a.classString(t)+" has no method '"+a.toString(r)+"'";throw new e.TypeError(i)}return n}function n(t){var e=this.pop(),n=r(t,e);return n.apply(t,this)}function i(t){return t[this]}function o(t){var e=+this;return 0>e&&(e=Math.max(0,e+t.length)),t[e]}{var s,a=t("./util.js"),u=a.canEvaluate;a.isIdentifier}e.prototype.call=function(t){for(var e=arguments.length,r=new Array(e-1),i=1;e>i;++i)r[i-1]=arguments[i];return r.push(t),this._then(n,void 0,void 0,r,void 0)},e.prototype.get=function(t){var e,r="number"==typeof t;if(r)e=o;else if(u){var n=s(t);e=null!==n?n:i}else e=i;return this._then(e,void 0,void 0,t,void 0)}}},{"./util.js":38}],6:[function(t,e){"use strict";e.exports=function(e){var r=t("./errors.js"),n=t("./async.js"),i=r.CancellationError;e.prototype._cancel=function(t){if(!this.isCancellable())return this;for(var e,r=this;void 0!==(e=r._cancellationParent)&&e.isCancellable();)r=e;this._unsetCancellable(),r._target()._rejectCallback(t,!1,!0)},e.prototype.cancel=function(t){return this.isCancellable()?(void 0===t&&(t=new i),n.invokeLater(this._cancel,this,t),this):this},e.prototype.cancellable=function(){return this._cancellable()?this:(n.enableTrampoline(),this._setCancellable(),this._cancellationParent=void 0,this)},e.prototype.uncancellable=function(){var t=this.then();return t._unsetCancellable(),t},e.prototype.fork=function(t,e,r){var n=this._then(t,e,r,void 0,void 0);return n._setCancellable(),n._cancellationParent=void 0,n}}},{"./async.js":2,"./errors.js":13}],7:[function(t,e){"use strict";e.exports=function(){function e(t){this._parent=t;var r=this._length=1+(void 0===t?0:t._length);j(this,e),r>32&&this.uncycle()}function r(t,e){for(var r=0;r=0;--a)if(n[a]===o){s=a;break}for(var a=s;a>=0;--a){var u=n[a];if(e[i]!==u)break;e.pop(),i--}e=n}}function o(t){for(var e=[],r=0;r0&&(e=e.slice(r)),e}function a(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t.toString();var r=/\[object [a-zA-Z0-9$_]+\]/;if(r.test(e))try{var n=JSON.stringify(t);e=n}catch(i){}0===e.length&&(e="(empty array)")}return"(<"+u(e)+">, no stack trace)"}function u(t){var e=41;return t.lengtht)){for(var e=[],r={},n=0,i=this;void 0!==i;++n)e.push(i),i=i._parent;t=this._length=n;for(var n=t-1;n>=0;--n){var o=e[n].stack;void 0===r[o]&&(r[o]=n)}for(var n=0;t>n;++n){var s=e[n].stack,a=r[s];if(void 0!==a&&a!==n){a>0&&(e[a-1]._parent=void 0,e[a-1]._length=1),e[n]._parent=void 0,e[n]._length=1;var u=n>0?e[n-1]:this;t-1>a?(u._parent=e[a+1],u._parent.uncycle(),u._length=u._parent._length+1):(u._parent=void 0,u._length=1);for(var c=u._length+1,l=n-2;l>=0;--l)e[l]._length=c,c++;return}}}},e.prototype.parent=function(){return this._parent},e.prototype.hasParent=function(){return void 0!==this._parent},e.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var s=e.parseStackAndMessage(t),a=s.message,u=[s.stack],c=this;void 0!==c;)u.push(o(c.stack.split("\n"))),c=c._parent;i(u),n(u),p.notEnumerableProp(t,"stack",r(a,u)),p.notEnumerableProp(t,"__stackCleaned__",!0)}},e.parseStackAndMessage=function(t){var e=t.stack,r=t.toString();return e="string"==typeof e&&e.length>0?s(t):[" (No stack trace)"],{message:r,stack:o(e)}},e.formatAndLogError=function(t,e){if("undefined"!=typeof console){var r;if("object"==typeof t||"function"==typeof t){var n=t.stack;r=e+d(n,t)}else r=e+String(t);"function"==typeof l?l(r):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}},e.unhandledRejection=function(t){e.formatAndLogError(t,"^--- With additional stack trace: ")},e.isSupported=function(){return"function"==typeof j},e.fireRejectionEvent=function(t,r,n,i){var o=!1;try{"function"==typeof r&&(o=!0,"rejectionHandled"===t?r(i):r(n,i))}catch(s){h.throwLater(s)}var a=!1;try{a=b(t,n,i)}catch(s){a=!0,h.throwLater(s)}var u=!1;if(m)try{u=m(t.toLowerCase(),{reason:n,promise:i})}catch(s){u=!0,h.throwLater(s)}a||o||u||"unhandledRejection"!==t||e.formatAndLogError(n,"Unhandled rejection ")};var y=function(){return!1},g=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;e.setBounds=function(t,r){if(e.isSupported()){for(var n,i,o=t.stack.split("\n"),s=r.stack.split("\n"),a=-1,u=-1,l=0;la||0>u||!n||!i||n!==i||a>=u||(y=function(t){if(f.test(t))return!0;var e=c(t);return e&&e.fileName===n&&a<=e.line&&e.line<=u?!0:!1})}};var m,j=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():a(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit=Error.stackTraceLimit+6,_=t,d=e;var r=Error.captureStackTrace;return y=function(t){return f.test(t)},function(t,e){Error.stackTraceLimit=Error.stackTraceLimit+6,r(t,e),Error.stackTraceLimit=Error.stackTraceLimit-6}}var n=new Error;if("string"==typeof n.stack&&n.stack.split("\n")[0].indexOf("stackDetection@")>=0)return _=/@/,d=e,v=!0,function(t){t.stack=(new Error).stack};var i;try{throw new Error}catch(o){i="stack"in o}return"stack"in n||!i?(d=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?a(e):e.toString()},null):(_=t,d=e,function(t){Error.stackTraceLimit=Error.stackTraceLimit+6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit=Error.stackTraceLimit-6})}([]),b=function(){if(p.isNode)return function(t,e,r){return"rejectionHandled"===t?process.emit(t,r):process.emit(t,e,r)};var t=!1,e=!0;try{var r=new self.CustomEvent("test");t=r instanceof CustomEvent}catch(n){}if(!t)try{var i=document.createEvent("CustomEvent");i.initCustomEvent("testingtheevent",!1,!0,{}),self.dispatchEvent(i)}catch(n){e=!1}e&&(m=function(e,r){var n;return t?n=new self.CustomEvent(e,{detail:r,bubbles:!1,cancelable:!0}):self.dispatchEvent&&(n=document.createEvent("CustomEvent"),n.initCustomEvent(e,!1,!0,r)),n?!self.dispatchEvent(n):!1});var o={};return o.unhandledRejection="onunhandledRejection".toLowerCase(),o.rejectionHandled="onrejectionHandled".toLowerCase(),function(t,e,r){var n=o[t],i=self[n];return i?("rejectionHandled"===t?i.call(self,r):i.call(self,e,r),!0):!1}}();return"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(l=function(t){console.warn(t)},p.isNode&&process.stderr.isTTY?l=function(t){process.stderr.write(""+t+"\n")}:p.isNode||"string"!=typeof(new Error).stack||(l=function(t){console.warn("%c"+t,"color: red")})),e}},{"./async.js":2,"./util.js":38}],8:[function(t,e){"use strict";e.exports=function(e){function r(t,e,r){this._instances=t,this._callback=e,this._promise=r}function n(t,e){var r={},n=s(t).call(r,e);if(n===a)return n;var i=u(r);return i.length?(a.e=new c("Catch filter must inherit from Error or be a simple predicate function\n\n See http://goo.gl/o84o68\n"),a):n}var i=t("./util.js"),o=t("./errors.js"),s=i.tryCatch,a=i.errorObj,u=t("./es5.js").keys,c=o.TypeError;return r.prototype.doFilter=function(t){for(var r=this._callback,i=this._promise,o=i._boundTo,u=0,c=this._instances.length;c>u;++u){var l=this._instances[u],h=l===Error||null!=l&&l.prototype instanceof Error;if(h&&t instanceof l){var p=s(r).call(o,t);return p===a?(e.e=p.e,e):p}if("function"==typeof l&&!h){var f=n(l,t);if(f===a){t=a.e;break}if(f){var p=s(r).call(o,t);return p===a?(e.e=p.e,e):p}}}return e.e=t,e},r}},{"./errors.js":13,"./es5.js":14,"./util.js":38}],9:[function(t,e){"use strict";e.exports=function(t,e,r){function n(){this._trace=new e(o())}function i(){return r()?new n:void 0}function o(){var t=s.length-1;return t>=0?s[t]:void 0}var s=[];return n.prototype._pushContext=function(){r()&&void 0!==this._trace&&s.push(this._trace)},n.prototype._popContext=function(){r()&&void 0!==this._trace&&s.pop()},t.prototype._peekContext=o,t.prototype._pushContext=n.prototype._pushContext,t.prototype._popContext=n.prototype._popContext,i}},{}],10:[function(t,e){"use strict";e.exports=function(e,r){var n,i,o=t("./async.js"),s=t("./errors.js").Warning,a=t("./util.js"),u=a.canAttachTrace,c=!1||a.isNode&&(!!process.env.BLUEBIRD_DEBUG||"development"===process.env.NODE_ENV);return c&&o.disableTrampolineIfNecessary(),e.prototype._ensurePossibleRejectionHandled=function(){this._setRejectionIsUnhandled(),o.invokeLater(this._notifyUnhandledRejection,this,void 0)},e.prototype._notifyUnhandledRejectionIsHandled=function(){r.fireRejectionEvent("rejectionHandled",n,void 0,this)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._getCarriedStackTrace()||this._settledValue;this._setUnhandledRejectionIsNotified(),r.fireRejectionEvent("unhandledRejection",i,t,this)}},e.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=524288|this._bitField},e.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-524289&this._bitField},e.prototype._isUnhandledRejectionNotified=function(){return(524288&this._bitField)>0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=2097152|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-2097153&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(2097152&this._bitField)>0},e.prototype._setCarriedStackTrace=function(t){this._bitField=1048576|this._bitField,this._fulfillmentHandler0=t},e.prototype._isCarryingStackTrace=function(){return(1048576&this._bitField)>0},e.prototype._getCarriedStackTrace=function(){return this._isCarryingStackTrace()?this._fulfillmentHandler0:void 0},e.prototype._captureStackTrace=function(){return c&&(this._trace=new r(this._peekContext())),this},e.prototype._attachExtraTrace=function(t,e){if(c&&u(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var i=r.parseStackAndMessage(t);a.notEnumerableProp(t,"stack",i.message+"\n"+i.stack.join("\n")),a.notEnumerableProp(t,"__stackCleaned__",!0)}}},e.prototype._warn=function(t){var e=new s(t),n=this._peekContext();if(n)n.attachExtraTrace(e);else{var i=r.parseStackAndMessage(e);e.stack=i.message+"\n"+i.stack.join("\n")}r.formatAndLogError(e,"")},e.onPossiblyUnhandledRejection=function(t){i="function"==typeof t?t:void 0},e.onUnhandledRejectionHandled=function(t){n="function"==typeof t?t:void 0},e.longStackTraces=function(){if(o.haveItemsQueued()&&c===!1)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/DT1qyG\n");c=r.isSupported(),c&&o.disableTrampolineIfNecessary()},e.hasLongStackTraces=function(){return c&&r.isSupported()},r.isSupported()||(e.longStackTraces=function(){},c=!1),function(){return c}}},{"./async.js":2,"./errors.js":13,"./util.js":38}],11:[function(t,e){"use strict";var r=t("./util.js"),n=r.isPrimitive,i=r.wrapsPrimitiveReceiver;e.exports=function(t){var e=function(){return this},r=function(){throw this},o=function(){},s=function(){throw void 0},a=function(t,e){return 1===e?function(){throw t}:2===e?function(){return t}:void 0};t.prototype["return"]=t.prototype.thenReturn=function(t){return void 0===t?this.then(o):i&&n(t)?this._then(a(t,2),void 0,void 0,void 0,void 0):this._then(e,void 0,void 0,t,void 0)},t.prototype["throw"]=t.prototype.thenThrow=function(t){return void 0===t?this.then(s):i&&n(t)?this._then(a(t,1),void 0,void 0,void 0,void 0):this._then(r,void 0,void 0,t,void 0)}}},{"./util.js":38}],12:[function(t,e){"use strict";e.exports=function(t,e){var r=t.reduce;t.prototype.each=function(t){return r(this,t,null,e)},t.each=function(t,n){return r(t,n,null,e)}}},{}],13:[function(t,e){"use strict";function r(t,e){function r(n){return this instanceof r?(l(this,"message","string"==typeof n?n:e),l(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new r(n)}return c(r,Error),r}function n(t){return this instanceof n?(l(this,"name","OperationalError"),l(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(l(this,"message",t.message),l(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new n(t)}var i,o,s=t("./es5.js"),a=s.freeze,u=t("./util.js"),c=u.inherits,l=u.notEnumerableProp,h=r("Warning","warning"),p=r("CancellationError","cancellation error"),f=r("TimeoutError","timeout error"),_=r("AggregateError","aggregate error");try{i=TypeError,o=RangeError}catch(d){i=r("TypeError","type error"),o=r("RangeError","range error")}for(var v="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),y=0;y0&&"function"==typeof arguments[e]){t=arguments[e];var n}for(var i=arguments.length,o=new Array(i),s=0;i>s;++s)o[s]=arguments[s];t&&o.pop();var n=new r(o).promise();return void 0!==t?n.spread(t):n}}},{"./util.js":38}],19:[function(t,e){"use strict";e.exports=function(e,r,n,i,o){function s(t,e,r,n){this.constructor$(t),this._promise._captureStackTrace(),this._callback=e,this._preservedValues=n===o?new Array(this.length()):null,this._limit=r,this._inFlight=0,this._queue=r>=1?[]:_,c.invoke(a,this,void 0)}function a(){this._init$(void 0,-2)}function u(t,e,r,n){var i="object"==typeof r&&null!==r?r.concurrency:0;return i="number"==typeof i&&isFinite(i)&&i>=1?i:0,new s(t,e,i,n)}var c=t("./async.js"),l=t("./util.js"),h=l.tryCatch,p=l.errorObj,f={},_=[];l.inherits(s,r),s.prototype._init=function(){},s.prototype._promiseFulfilled=function(t,r){var n=this._values,o=this.length(),s=this._preservedValues,a=this._limit;if(n[r]===f){if(n[r]=t,a>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return}else{if(a>=1&&this._inFlight>=a)return n[r]=t,void this._queue.push(r);null!==s&&(s[r]=t);var u=this._callback,c=this._promise._boundTo;this._promise._pushContext();var l=h(u).call(c,t,r,o);if(this._promise._popContext(),l===p)return this._reject(l.e);var _=i(l,this._promise);if(_ instanceof e){if(_=_._target(),_._isPending())return a>=1&&this._inFlight++,n[r]=f,_._proxyPromiseArray(this,r);if(!_._isFulfilled())return this._reject(_._reason());l=_._value()}n[r]=l}var d=++this._totalResolved;d>=o&&(null!==s?this._filter(n,s):this._resolve(n))},s.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,r=this._values;t.length>0&&this._inFlighto;++o)t[o]&&(n[i++]=e[o]);n.length=i,this._resolve(n)},s.prototype.preservedValues=function(){return this._preservedValues},e.prototype.map=function(t,e){return"function"!=typeof t?n("fn must be a function\n\n See http://goo.gl/916lJJ\n"):u(this,t,e,null).promise()},e.map=function(t,e,r,i){return"function"!=typeof e?n("fn must be a function\n\n See http://goo.gl/916lJJ\n"):u(t,e,r,i).promise()}}},{"./async.js":2,"./util.js":38}],20:[function(t,e){"use strict";e.exports=function(e,r,n,i){var o=t("./util.js"),s=o.tryCatch;e.method=function(t){if("function"!=typeof t)throw new e.TypeError("fn must be a function\n\n See http://goo.gl/916lJJ\n");return function(){var n=new e(r);n._captureStackTrace(),n._pushContext();var i=s(t).apply(this,arguments);return n._popContext(),n._resolveFromSyncValue(i),n}},e.attempt=e["try"]=function(t,n,a){if("function"!=typeof t)return i("fn must be a function\n\n See http://goo.gl/916lJJ\n");var u=new e(r);u._captureStackTrace(),u._pushContext();var c=o.isArray(n)?s(t).apply(a,n):s(t).call(a,n);return u._popContext(),u._resolveFromSyncValue(c),u},e.prototype._resolveFromSyncValue=function(t){t===o.errorObj?this._rejectCallback(t.e,!1,!0):this._resolveCallback(t,!0)}}},{"./util.js":38}],21:[function(t,e){"use strict";e.exports=function(e){function r(t,e){var r=this;if(!o.isArray(t))return n.call(r,t,e);var i=a(e).apply(r._boundTo,[null].concat(t));i===u&&s.throwLater(i.e)}function n(t,e){var r=this,n=r._boundTo,i=void 0===t?a(e).call(n,null):a(e).call(n,null,t);i===u&&s.throwLater(i.e)}function i(t,e){var r=this;if(!t){var n=r._target(),i=n._getCarriedStackTrace();i.cause=t,t=i}var o=a(e).call(r._boundTo,t);o===u&&s.throwLater(o.e)}var o=t("./util.js"),s=t("./async.js"),a=o.tryCatch,u=o.errorObj;e.prototype.asCallback=e.prototype.nodeify=function(t,e){if("function"==typeof t){var o=n;void 0!==e&&Object(e).spread&&(o=r),this._then(o,i,void 0,this,t)}return this}}},{"./async.js":2,"./util.js":38}],22:[function(t,e){"use strict";e.exports=function(e,r){var n=t("./util.js"),i=t("./async.js"),o=n.tryCatch,s=n.errorObj;e.prototype.progressed=function(t){return this._then(void 0,void 0,t,void 0,void 0)},e.prototype._progress=function(t){this._isFollowingOrFulfilledOrRejected()||this._target()._progressUnchecked(t)},e.prototype._progressHandlerAt=function(t){return 0===t?this._progressHandler0:this[(t<<2)+t-5+2]},e.prototype._doProgressWith=function(t){var r=t.value,i=t.handler,a=t.promise,u=t.receiver,c=o(i).call(u,r);if(c===s){if(null!=c.e&&"StopProgressPropagation"!==c.e.name){var l=n.canAttachTrace(c.e)?c.e:new Error(n.toString(c.e));a._attachExtraTrace(l),a._progress(c.e)}}else c instanceof e?c._then(a._progress,null,null,a,void 0):a._progress(c)},e.prototype._progressUnchecked=function(t){for(var n=this._length(),o=this._progress,s=0;n>s;s++){var a=this._progressHandlerAt(s),u=this._promiseAt(s);if(u instanceof e)"function"==typeof a?i.invoke(this._doProgressWith,this,{handler:a,promise:u,receiver:this._receiverAt(s),value:t}):i.invoke(o,u,t);else{var c=this._receiverAt(s);"function"==typeof a?a.call(c,t,u):c instanceof r&&!c._isResolved()&&c._promiseProgressed(t,u)}}}}},{"./async.js":2,"./util.js":38}],23:[function(t,e){"use strict";e.exports=function(){function e(t){if("function"!=typeof t)throw new c("the promise constructor requires a resolver function\n\n See http://goo.gl/EC22Yn\n");if(this.constructor!==e)throw new c("the promise constructor cannot be invoked directly\n\n See http://goo.gl/KsIlge\n");this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._progressHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._settledValue=void 0,t!==l&&this._resolveFromResolver(t)}function r(t){var r=new e(l);r._fulfillmentHandler0=t,r._rejectionHandler0=t,r._progressHandler0=t,r._promise0=t,r._receiver0=t,r._settledValue=t}var n=function(){return new c("circular promise resolution chain\n\n See http://goo.gl/LhFpo0\n")},i=function(){return new e.PromiseInspection(this._target())},o=function(t){return e.reject(new c(t))},s=t("./util.js"),a=t("./async.js"),u=t("./errors.js"),c=e.TypeError=u.TypeError;e.RangeError=u.RangeError,e.CancellationError=u.CancellationError,e.TimeoutError=u.TimeoutError,e.OperationalError=u.OperationalError,e.RejectionError=u.OperationalError,e.AggregateError=u.AggregateError;var l=function(){},h={},p={e:null},f=t("./thenables.js")(e,l),_=t("./promise_array.js")(e,l,f,o),d=t("./captured_trace.js")(),v=t("./debuggability.js")(e,d),y=t("./context.js")(e,d,v),g=t("./catch_filter.js")(p),m=t("./promise_resolver.js"),j=m._nodebackForPromise,b=s.errorObj,w=s.tryCatch;return e.prototype.toString=function(){return"[object Promise]"},e.prototype.caught=e.prototype["catch"]=function(t){var r=arguments.length;if(r>1){var n,i=new Array(r-1),o=0;for(n=0;r-1>n;++n){var s=arguments[n];if("function"!=typeof s)return e.reject(new c("Catch filter must inherit from Error or be a simple predicate function\n\n See http://goo.gl/o84o68\n"));i[o++]=s}i.length=o,t=arguments[n];var a=new g(i,t,this);return this._then(void 0,a.doFilter,void 0,a,void 0)}return this._then(void 0,t,void 0,void 0,void 0)},e.prototype.reflect=function(){return this._then(i,i,void 0,this,void 0)},e.prototype.then=function(t,e,r){if(v()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+s.classString(t);arguments.length>1&&(n+=", "+s.classString(e)),this._warn(n)}return this._then(t,e,r,void 0,void 0)},e.prototype.done=function(t,e,r){var n=this._then(t,e,r,void 0,void 0);n._setIsFinal()},e.prototype.spread=function(t,e){return this.all()._then(t,e,void 0,h,void 0)},e.prototype.isCancellable=function(){return!this.isResolved()&&this._cancellable() +},e.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},e.prototype.all=function(){return new _(this).promise()},e.prototype.error=function(t){return this.caught(s.originatesFromRejection,t)},e.is=function(t){return t instanceof e},e.fromNode=function(t){var r=new e(l),n=w(t)(j(r));return n===b&&r._rejectCallback(n.e,!0,!0),r},e.all=function(t){return new _(t).promise()},e.defer=e.pending=function(){var t=new e(l);return new m(t)},e.cast=function(t){var r=f(t);if(!(r instanceof e)){var n=r;r=new e(l),r._fulfillUnchecked(n)}return r},e.resolve=e.fulfilled=e.cast,e.reject=e.rejected=function(t){var r=new e(l);return r._captureStackTrace(),r._rejectCallback(t,!0),r},e.setScheduler=function(t){if("function"!=typeof t)throw new c("fn must be a function\n\n See http://goo.gl/916lJJ\n");var e=a._schedule;return a._schedule=t,e},e.prototype._then=function(t,r,n,i,o){var s=void 0!==o,u=s?o:new e(l);s||(u._propagateFrom(this,5),u._captureStackTrace());var c=this._target();c!==this&&(void 0===i&&(i=this._boundTo),s||u._setIsMigrated());var h=c._addCallbacks(t,r,n,u,i);return c._isResolved()&&!c._isSettlePromisesQueued()&&a.invoke(c._settlePromiseAtPostResolution,c,h),u},e.prototype._settlePromiseAtPostResolution=function(t){this._isRejectionUnhandled()&&this._unsetRejectionIsUnhandled(),this._settlePromiseAt(t)},e.prototype._length=function(){return 131071&this._bitField},e.prototype._isFollowingOrFulfilledOrRejected=function(){return(939524096&this._bitField)>0},e.prototype._isFollowing=function(){return 536870912===(536870912&this._bitField)},e.prototype._setLength=function(t){this._bitField=-131072&this._bitField|131071&t},e.prototype._setFulfilled=function(){this._bitField=268435456|this._bitField},e.prototype._setRejected=function(){this._bitField=134217728|this._bitField},e.prototype._setFollowing=function(){this._bitField=536870912|this._bitField},e.prototype._setIsFinal=function(){this._bitField=33554432|this._bitField},e.prototype._isFinal=function(){return(33554432&this._bitField)>0},e.prototype._cancellable=function(){return(67108864&this._bitField)>0},e.prototype._setCancellable=function(){this._bitField=67108864|this._bitField},e.prototype._unsetCancellable=function(){this._bitField=-67108865&this._bitField},e.prototype._setIsMigrated=function(){this._bitField=4194304|this._bitField},e.prototype._unsetIsMigrated=function(){this._bitField=-4194305&this._bitField},e.prototype._isMigrated=function(){return(4194304&this._bitField)>0},e.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[5*t-5+4];return void 0===e&&this._isBound()?this._boundTo:e},e.prototype._promiseAt=function(t){return 0===t?this._promise0:this[5*t-5+3]},e.prototype._fulfillmentHandlerAt=function(t){return 0===t?this._fulfillmentHandler0:this[5*t-5+0]},e.prototype._rejectionHandlerAt=function(t){return 0===t?this._rejectionHandler0:this[5*t-5+1]},e.prototype._migrateCallbacks=function(t,r){var n=t._fulfillmentHandlerAt(r),i=t._rejectionHandlerAt(r),o=t._progressHandlerAt(r),s=t._promiseAt(r),a=t._receiverAt(r);s instanceof e&&s._setIsMigrated(),this._addCallbacks(n,i,o,s,a)},e.prototype._addCallbacks=function(t,e,r,n,i){var o=this._length();if(o>=131066&&(o=0,this._setLength(0)),0===o)this._promise0=n,void 0!==i&&(this._receiver0=i),"function"!=typeof t||this._isCarryingStackTrace()||(this._fulfillmentHandler0=t),"function"==typeof e&&(this._rejectionHandler0=e),"function"==typeof r&&(this._progressHandler0=r);else{var s=5*o-5;this[s+3]=n,this[s+4]=i,"function"==typeof t&&(this[s+0]=t),"function"==typeof e&&(this[s+1]=e),"function"==typeof r&&(this[s+2]=r)}return this._setLength(o+1),o},e.prototype._setProxyHandlers=function(t,e){var r=this._length();if(r>=131066&&(r=0,this._setLength(0)),0===r)this._promise0=e,this._receiver0=t;else{var n=5*r-5;this[n+3]=e,this[n+4]=t}this._setLength(r+1)},e.prototype._proxyPromiseArray=function(t,e){this._setProxyHandlers(t,e)},e.prototype._resolveCallback=function(t,r){if(!this._isFollowingOrFulfilledOrRejected()){if(t===this)return this._rejectCallback(n(),!1,!0);var i=f(t,this);if(!(i instanceof e))return this._fulfill(t);var o=1|(r?4:0);this._propagateFrom(i,o);var s=i._target();if(s._isPending()){for(var a=this._length(),u=0;a>u;++u)s._migrateCallbacks(this,u);this._setFollowing(),this._setLength(0),this._setFollowee(s)}else s._isFulfilled()?this._fulfillUnchecked(s._value()):this._rejectUnchecked(s._reason(),s._getCarriedStackTrace())}},e.prototype._rejectCallback=function(t,e,r){r||s.markAsOriginatingFromRejection(t);var n=s.ensureErrorObject(t),i=n===t;this._attachExtraTrace(n,e?i:!1),this._reject(t,i?void 0:n)},e.prototype._resolveFromResolver=function(t){var e=this;this._captureStackTrace(),this._pushContext();var r=!0,n=w(t)(function(t){null!==e&&(e._resolveCallback(t),e=null)},function(t){null!==e&&(e._rejectCallback(t,r),e=null)});r=!1,this._popContext(),void 0!==n&&n===b&&null!==e&&(e._rejectCallback(n.e,!0,!0),e=null)},e.prototype._settlePromiseFromHandler=function(t,e,r,i){if(!i._isRejected()){i._pushContext();var o;if(o=e!==h||this._isRejected()?w(t).call(e,r):w(t).apply(this._boundTo,r),i._popContext(),o===b||o===i||o===p){var s=o===i?n():o.e;i._rejectCallback(s,!1,!0)}else i._resolveCallback(o)}},e.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},e.prototype._followee=function(){return this._rejectionHandler0},e.prototype._setFollowee=function(t){this._rejectionHandler0=t},e.prototype._cleanValues=function(){this._cancellable()&&(this._cancellationParent=void 0)},e.prototype._propagateFrom=function(t,e){(1&e)>0&&t._cancellable()&&(this._setCancellable(),this._cancellationParent=t),(4&e)>0&&t._isBound()&&this._setBoundTo(t._boundTo)},e.prototype._fulfill=function(t){this._isFollowingOrFulfilledOrRejected()||this._fulfillUnchecked(t)},e.prototype._reject=function(t,e){this._isFollowingOrFulfilledOrRejected()||this._rejectUnchecked(t,e)},e.prototype._settlePromiseAt=function(t){var r=this._promiseAt(t),n=r instanceof e;if(n&&r._isMigrated())return r._unsetIsMigrated(),a.invoke(this._settlePromiseAt,this,t);var i=this._isFulfilled()?this._fulfillmentHandlerAt(t):this._rejectionHandlerAt(t),o=this._isCarryingStackTrace()?this._getCarriedStackTrace():void 0,s=this._settledValue,u=this._receiverAt(t);this._clearCallbackDataAtIndex(t),"function"==typeof i?n?this._settlePromiseFromHandler(i,u,s,r):i.call(u,s,r):u instanceof _?u._isResolved()||(this._isFulfilled()?u._promiseFulfilled(s,r):u._promiseRejected(s,r)):n&&(this._isFulfilled()?r._fulfill(s):r._reject(s,o)),t>=4&&4===(31&t)&&a.invokeLater(this._setLength,this,0)},e.prototype._clearCallbackDataAtIndex=function(t){if(0===t)this._isCarryingStackTrace()||(this._fulfillmentHandler0=void 0),this._rejectionHandler0=this._progressHandler0=this._receiver0=this._promise0=void 0;else{var e=5*t-5;this[e+3]=this[e+4]=this[e+0]=this[e+1]=this[e+2]=void 0}},e.prototype._isSettlePromisesQueued=function(){return-1073741824===(-1073741824&this._bitField)},e.prototype._setSettlePromisesQueued=function(){this._bitField=-1073741824|this._bitField},e.prototype._unsetSettlePromisesQueued=function(){this._bitField=1073741823&this._bitField},e.prototype._queueSettlePromises=function(){a.settlePromises(this),this._setSettlePromisesQueued()},e.prototype._fulfillUnchecked=function(t){if(t===this){var e=n();return this._attachExtraTrace(e),this._rejectUnchecked(e,void 0)}this._setFulfilled(),this._settledValue=t,this._cleanValues(),this._length()>0&&this._queueSettlePromises()},e.prototype._rejectUncheckedCheckError=function(t){var e=s.ensureErrorObject(t);this._rejectUnchecked(t,e===t?void 0:e)},e.prototype._rejectUnchecked=function(t,e){if(t===this){var r=n();return this._attachExtraTrace(r),this._rejectUnchecked(r)}return this._setRejected(),this._settledValue=t,this._cleanValues(),this._isFinal()?void a.throwLater(function(t){throw"stack"in t&&a.invokeFirst(d.unhandledRejection,void 0,t),t},void 0===e?t:e):(void 0!==e&&e!==t&&this._setCarriedStackTrace(e),void(this._length()>0?this._queueSettlePromises():this._ensurePossibleRejectionHandled()))},e.prototype._settlePromises=function(){this._unsetSettlePromisesQueued();for(var t=this._length(),e=0;t>e;e++)this._settlePromiseAt(e)},e._makeSelfResolutionError=n,t("./progress.js")(e,_),t("./method.js")(e,l,f,o),t("./bind.js")(e,l,f),t("./finally.js")(e,p,f),t("./direct_resolve.js")(e),t("./synchronous_inspection.js")(e),t("./join.js")(e,_,f,l),e.Promise=e,t("./map.js")(e,_,o,f,l),t("./cancel.js")(e),t("./using.js")(e,o,f,y),t("./generators.js")(e,o,l,f),t("./nodeify.js")(e),t("./call_get.js")(e),t("./props.js")(e,_,f,o),t("./race.js")(e,l,f,o),t("./reduce.js")(e,_,o,f,l),t("./settle.js")(e,_),t("./some.js")(e,_,o),t("./promisify.js")(e,l),t("./any.js")(e),t("./each.js")(e,l),t("./timers.js")(e,l),t("./filter.js")(e,l),s.toFastProperties(e),s.toFastProperties(e.prototype),r({a:1}),r({b:2}),r({c:3}),r(1),r(function(){}),r(void 0),r(!1),r(new e(l)),d.setBounds(a.firstLineError,s.lastLineError),e}},{"./any.js":1,"./async.js":2,"./bind.js":3,"./call_get.js":5,"./cancel.js":6,"./captured_trace.js":7,"./catch_filter.js":8,"./context.js":9,"./debuggability.js":10,"./direct_resolve.js":11,"./each.js":12,"./errors.js":13,"./filter.js":15,"./finally.js":16,"./generators.js":17,"./join.js":18,"./map.js":19,"./method.js":20,"./nodeify.js":21,"./progress.js":22,"./promise_array.js":24,"./promise_resolver.js":25,"./promisify.js":26,"./props.js":27,"./race.js":29,"./reduce.js":30,"./settle.js":32,"./some.js":33,"./synchronous_inspection.js":34,"./thenables.js":35,"./timers.js":36,"./using.js":37,"./util.js":38}],24:[function(t,e){"use strict";e.exports=function(e,r,n,i){function o(t){switch(t){case-2:return[];case-3:return{}}}function s(t){var n,i=this._promise=new e(r);t instanceof e&&(n=t,i._propagateFrom(n,5)),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var a=t("./util.js"),u=a.isArray;return s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function c(t,r){var s=n(this._values,this._promise);if(s instanceof e){if(s=s._target(),this._values=s,!s._isFulfilled())return s._isPending()?void s._then(c,this._reject,void 0,this,r):void this._reject(s._reason());if(s=s._value(),!u(s)){var a=new e.TypeError("expecting an array, a promise or a thenable\n\n See http://goo.gl/s8MMhc\n");return void this.__hardReject__(a)}}else if(!u(s))return void this._promise._reject(i("expecting an array, a promise or a thenable\n\n See http://goo.gl/s8MMhc\n")._reason());if(0===s.length)return void(-5===r?this._resolveEmptyArray():this._resolve(o(r)));var l=this.getActualLength(s.length);this._length=l,this._values=this.shouldCopyValues()?new Array(l):this._values;for(var h=this._promise,p=0;l>p;++p){var f=this._isResolved(),_=n(s[p],h);_ instanceof e?(_=_._target(),f?_._unsetRejectionIsUnhandled():_._isPending()?_._proxyPromiseArray(this,p):_._isFulfilled()?this._promiseFulfilled(_._value(),p):this._promiseRejected(_._reason(),p)):f||this._promiseFulfilled(_,p)}},s.prototype._isResolved=function(){return null===this._values},s.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},s.prototype.__hardReject__=s.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1,!0)},s.prototype._promiseProgressed=function(t,e){this._promise._progress({index:e,value:t})},s.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var r=++this._totalResolved;r>=this._length&&this._resolve(this._values)},s.prototype._promiseRejected=function(t){this._totalResolved++,this._reject(t)},s.prototype.shouldCopyValues=function(){return!0},s.prototype.getActualLength=function(t){return t},s}},{"./util.js":38}],25:[function(t,e){"use strict";function r(t){return t instanceof Error&&p.getPrototypeOf(t)===Error.prototype}function n(t){var e;if(r(t)){e=new l(t),e.name=t.name,e.message=t.message,e.stack=t.stack;for(var n=p.keys(t),i=0;i2){for(var o=arguments.length,s=new Array(o-1),u=1;o>u;++u)s[u-1]=arguments[u];t._fulfill(s)}else t._fulfill(r);t=null}}}var o,s=t("./util.js"),a=s.maybeWrapAsError,u=t("./errors.js"),c=u.TimeoutError,l=u.OperationalError,h=s.haveGetters,p=t("./es5.js"),f=/^(?:name|message|stack|cause)$/;if(o=h?function(t){this.promise=t}:function(t){this.promise=t,this.asCallback=i(t),this.callback=this.asCallback},h){var _={get:function(){return i(this.promise)}};p.defineProperty(o.prototype,"asCallback",_),p.defineProperty(o.prototype,"callback",_)}o._nodebackForPromise=i,o.prototype.toString=function(){return"[object PromiseResolver]"},o.prototype.resolve=o.prototype.fulfill=function(t){if(!(this instanceof o))throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n");this.promise._resolveCallback(t)},o.prototype.reject=function(t){if(!(this instanceof o))throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n");this.promise._rejectCallback(t)},o.prototype.progress=function(t){if(!(this instanceof o))throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n");this.promise._progress(t)},o.prototype.cancel=function(t){this.promise.cancel(t)},o.prototype.timeout=function(){this.reject(new c("timeout"))},o.prototype.isResolved=function(){return this.promise.isResolved()},o.prototype.toJSON=function(){return this.promise.toJSON()},e.exports=o},{"./errors.js":13,"./es5.js":14,"./util.js":38}],26:[function(t,e){"use strict";e.exports=function(e,r){function n(t){return!b.test(t)}function i(t){try{return t.__isPromisified__===!0}catch(e){return!1}}function o(t,e,r){var n=f.getDataPropertyOrDefault(t,e+r,j);return n?i(n):!1}function s(t,e,r){for(var n=0;ns;s+=2){var c=o[s],l=o[s+1],h=c+e;t[h]=n===E?E(c,p,c,l,e):n(l,function(){return E(c,p,c,l,e)})}return f.toFastProperties(t),t}function l(t,e){return E(t,e,void 0,t)}var h,p={},f=t("./util.js"),_=t("./promise_resolver.js")._nodebackForPromise,d=f.withAppended,v=f.maybeWrapAsError,y=f.canEvaluate,g=t("./errors").TypeError,m="Async",j={__isPromisified__:!0},b=/^(?:length|name|arguments|caller|callee|prototype|__isPromisified__)$/,w=function(t,e){return f.isIdentifier(t)&&"_"!==t.charAt(0)&&!f.isClass(e)},k=function(t){return t.replace(/([$])/,"\\$")},E=y?h:u;e.promisify=function(t,e){if("function"!=typeof t)throw new g("fn must be a function\n\n See http://goo.gl/916lJJ\n");if(i(t))return t;var r=l(t,arguments.length<2?p:e);return f.copyDescriptors(t,r,n),r},e.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new g("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/9ITlV0\n");e=Object(e);var r=e.suffix;"string"!=typeof r&&(r=m);var n=e.filter;"function"!=typeof n&&(n=w);var i=e.promisifier;if("function"!=typeof i&&(i=E),!f.isIdentifier(r))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/8FZo5V\n");for(var o=f.inheritedDataKeys(t),s=0;si;++i){var o=e[i];n[i]=t[o],n[i+r]=o}this.constructor$(n)}function s(t){var r,s=n(t);return u(s)?(r=s instanceof e?s._then(e.props,void 0,void 0,void 0,void 0):new o(s).promise(),s instanceof e&&r._propagateFrom(s,4),r):i("cannot await properties of a non-object\n\n See http://goo.gl/OsFKC8\n")}var a=t("./util.js"),u=a.isObject,c=t("./es5.js");a.inherits(o,r),o.prototype._init=function(){this._init$(void 0,-3)},o.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var r=++this._totalResolved;if(r>=this._length){for(var n={},i=this.length(),o=0,s=this.length();s>o;++o)n[this._values[o+i]]=this._values[o];this._resolve(n)}},o.prototype._promiseProgressed=function(t,e){this._promise._progress({key:this._values[e+this.length()],value:t})},o.prototype.shouldCopyValues=function(){return!1},o.prototype.getActualLength=function(t){return t>>1},e.prototype.props=function(){return s(this)},e.props=function(t){return s(t)}}},{"./es5.js":14,"./util.js":38}],28:[function(t,e){"use strict";function r(t,e,r,n,i){for(var o=0;i>o;++o)r[o+n]=t[o+e],t[o+e]=void 0}function n(t){this._capacity=t,this._length=0,this._front=0}n.prototype._willBeOverCapacity=function(t){return this._capacityp;++p){var _=t[p];(void 0!==_||p in t)&&e.cast(_)._then(l,h,void 0,c,null)}return c}var s=t("./util.js").isArray,a=function(t){return t.then(function(e){return o(e,t)})};e.race=function(t){return o(t,void 0)},e.prototype.race=function(){return o(this,void 0)}}},{"./util.js":38}],30:[function(t,e){"use strict";e.exports=function(e,r,n,i,o){function s(t,r,n,s){this.constructor$(t),this._promise._captureStackTrace(),this._preservedValues=s===o?[]:null,this._zerothIsAccum=void 0===n,this._gotAccum=!1,this._reducingIndex=this._zerothIsAccum?1:0,this._valuesPhase=void 0;var u=i(n,this._promise),l=!1,h=u instanceof e;h&&(u=u._target(),u._isPending()?u._proxyPromiseArray(this,-1):u._isFulfilled()?(n=u._value(),this._gotAccum=!0):(this._reject(u._reason()),l=!0)),h||this._zerothIsAccum||(this._gotAccum=!0),this._callback=r,this._accum=n,l||c.invoke(a,this,void 0)}function a(){this._init$(void 0,-5)}function u(t,e,r,i){if("function"!=typeof e)return n("fn must be a function\n\n See http://goo.gl/916lJJ\n");var o=new s(t,e,r,i);return o.promise()}var c=t("./async.js"),l=t("./util.js"),h=l.tryCatch,p=l.errorObj;l.inherits(s,r),s.prototype._init=function(){},s.prototype._resolveEmptyArray=function(){(this._gotAccum||this._zerothIsAccum)&&this._resolve(null!==this._preservedValues?[]:this._accum)},s.prototype._promiseFulfilled=function(t,r){var n=this._values;n[r]=t;var o,s=this.length(),a=this._preservedValues,u=null!==a,c=this._gotAccum,l=this._valuesPhase;if(!l)for(l=this._valuesPhase=new Array(s),o=0;s>o;++o)l[o]=0;if(o=l[r],0===r&&this._zerothIsAccum?(this._accum=t,this._gotAccum=c=!0,l[r]=0===o?1:2):-1===r?(this._accum=t,this._gotAccum=c=!0):0===o?l[r]=1:(l[r]=2,this._accum=t),c){for(var f,_=this._callback,d=this._promise._boundTo,v=this._reducingIndex;s>v;++v)if(o=l[v],2!==o){if(1!==o)return;if(t=n[v],this._promise._pushContext(),u?(a.push(t),f=h(_).call(d,t,v,s)):f=h(_).call(d,this._accum,t,v,s),this._promise._popContext(),f===p)return this._reject(f.e);var y=i(f,this._promise);if(y instanceof e){if(y=y._target(),y._isPending())return l[v]=4,y._proxyPromiseArray(this,v);if(!y._isFulfilled())return this._reject(y._reason());f=y._value()}this._reducingIndex=v+1,this._accum=f}else this._reducingIndex=v+1;this._resolve(u?a:this._accum)}},e.prototype.reduce=function(t,e){return u(this,t,e,null)},e.reduce=function(t,e,r,n){return u(t,e,r,n)}}},{"./async.js":2,"./util.js":38}],31:[function(t,e){"use strict";var r,n=t("./util"),i=function(){throw new Error("No async scheduler available\n\n See http://goo.gl/m3OTXk\n")};if(n.isNode&&"undefined"==typeof MutationObserver){var o=global.setImmediate,s=process.nextTick;r=n.isRecentNode?function(t){o.call(global,t)}:function(t){s.call(process,t)}}else"undefined"!=typeof MutationObserver?(r=function(t){var e=document.createElement("div"),r=new MutationObserver(t);return r.observe(e,{attributes:!0}),function(){e.classList.toggle("foo")}},r.isStatic=!0):r="undefined"!=typeof setImmediate?function(t){setImmediate(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:i;e.exports=r},{"./util":38}],32:[function(t,e){"use strict";e.exports=function(e,r){function n(t){this.constructor$(t)}var i=e.PromiseInspection,o=t("./util.js");o.inherits(n,r),n.prototype._promiseResolved=function(t,e){this._values[t]=e;var r=++this._totalResolved;r>=this._length&&this._resolve(this._values)},n.prototype._promiseFulfilled=function(t,e){var r=new i;r._bitField=268435456,r._settledValue=t,this._promiseResolved(e,r)},n.prototype._promiseRejected=function(t,e){var r=new i;r._bitField=134217728,r._settledValue=t,this._promiseResolved(e,r)},e.settle=function(t){return new n(t).promise()},e.prototype.settle=function(){return new n(this).promise()}}},{"./util.js":38}],33:[function(t,e){"use strict";e.exports=function(e,r,n){function i(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function o(t,e){if((0|e)!==e||0>e)return n("expecting a positive integer\n\n See http://goo.gl/1wAmHx\n");var r=new i(t),o=r.promise();return r.setHowMany(e),r.init(),o}var s=t("./util.js"),a=t("./errors.js").RangeError,u=t("./errors.js").AggregateError,c=s.isArray;s.inherits(i,r),i.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var t=c(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},i.prototype.init=function(){this._initialized=!0,this._init()},i.prototype.setUnwrap=function(){this._unwrap=!0},i.prototype.howMany=function(){return this._howMany},i.prototype.setHowMany=function(t){this._howMany=t},i.prototype._promiseFulfilled=function(t){this._addFulfilled(t),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),this._resolve(1===this.howMany()&&this._unwrap?this._values[0]:this._values))},i.prototype._promiseRejected=function(t){if(this._addRejected(t),this.howMany()>this._canPossiblyFulfill()){for(var e=new u,r=this.length();r0},e.prototype.isRejected=t.prototype._isRejected=function(){return(134217728&this._bitField)>0},e.prototype.isPending=t.prototype._isPending=function(){return 0===(402653184&this._bitField)},e.prototype.isResolved=t.prototype._isResolved=function(){return(402653184&this._bitField)>0},t.prototype.isPending=function(){return this._target()._isPending()},t.prototype.isRejected=function(){return this._target()._isRejected()},t.prototype.isFulfilled=function(){return this._target()._isFulfilled()},t.prototype.isResolved=function(){return this._target()._isResolved()},t.prototype._value=function(){return this._settledValue},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue},t.prototype.value=function(){var t=this._target();if(!t.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/hc1DLj\n");return t._settledValue},t.prototype.reason=function(){var t=this._target();if(!t.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/hPuiwB\n");return t._unsetRejectionIsUnhandled(),t._settledValue},t.PromiseInspection=e}},{}],35:[function(t,e){"use strict";e.exports=function(e,r){function n(t,n){if(c(t)){if(t instanceof e)return t;if(o(t)){var l=new e(r);return t._then(l._fulfillUnchecked,l._rejectUncheckedCheckError,l._progressUnchecked,l,null),l}var h=a.tryCatch(i)(t);if(h===u){n&&n._pushContext();var l=e.reject(h.e);return n&&n._popContext(),l}if("function"==typeof h)return s(t,h,n)}return t}function i(t){return t.then}function o(t){return l.call(t,"_promise0")}function s(t,n,i){function o(r){l&&(t===r?l._rejectCallback(e._makeSelfResolutionError(),!1,!0):l._resolveCallback(r),l=null)}function s(t){l&&(l._rejectCallback(t,p,!0),l=null)}function c(t){l&&"function"==typeof l._progress&&l._progress(t)}var l=new e(r),h=l;i&&i._pushContext(),l._captureStackTrace(),i&&i._popContext();var p=!0,f=a.tryCatch(n).call(t,o,s,c);return p=!1,l&&f===u&&(l._rejectCallback(f.e,!0,!0),l=null),h}var a=t("./util.js"),u=a.errorObj,c=a.isObject,l={}.hasOwnProperty;return n}},{"./util.js":38}],36:[function(t,e){"use strict";e.exports=function(e,r){function n(t){var e=this;return e instanceof Number&&(e=+e),clearTimeout(e),t}function i(t){var e=this;throw e instanceof Number&&(e=+e),clearTimeout(e),t}var o=t("./util.js"),s=e.TimeoutError,a=function(t,e){if(t.isPending()){"string"!=typeof e&&(e="operation timed out");var r=new s(e);o.markAsOriginatingFromRejection(r),t._attachExtraTrace(r),t._cancel(r)}},u=function(t){return c(+this).thenReturn(t)},c=e.delay=function(t,n){if(void 0===n){n=t,t=void 0;var i=new e(r);return setTimeout(function(){i._fulfill()},n),i}return n=+n,e.resolve(t)._then(u,null,null,n,void 0)};e.prototype.delay=function(t){return c(this,t)},e.prototype.timeout=function(t,e){t=+t;var r=this.then().cancellable();r._cancellationParent=this;var o=setTimeout(function(){a(r,e)},t);return r._then(n,i,void 0,o,void 0)}}},{"./util.js":38}],37:[function(t,e){"use strict";e.exports=function(e,r,n,i){function o(t){for(var r=t.length,n=0;r>n;++n){var i=t[n];if(i.isRejected())return e.reject(i.error());t[n]=i._settledValue}return t}function s(t){setTimeout(function(){throw t},0)}function a(t){var e=n(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}function u(t,r){function i(){if(o>=u)return c.resolve();var l=a(t[o++]);if(l instanceof e&&l._isDisposable()){try{l=n(l._getDisposer().tryDispose(r),t.promise)}catch(h){return s(h)}if(l instanceof e)return l._then(i,s,null,null,null)}i()}var o=0,u=t.length,c=e.defer();return i(),c.promise}function c(t){var e=new v;return e._settledValue=t,e._bitField=268435456,u(this,e).thenReturn(t)}function l(t){var e=new v;return e._settledValue=t,e._bitField=134217728,u(this,e).thenThrow(t)}function h(t,e,r){this._data=t,this._promise=e,this._context=r}function p(t,e,r){this.constructor$(t,e,r)}function f(t){return h.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}var _=t("./errors.js").TypeError,d=t("./util.js").inherits,v=e.PromiseInspection;h.prototype.data=function(){return this._data},h.prototype.promise=function(){return this._promise},h.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():null},h.prototype.tryDispose=function(t){var e=this.resource(),r=this._context;void 0!==r&&r._pushContext();var n=null!==e?this.doDispose(e,t):null;return void 0!==r&&r._popContext(),this._promise._unsetDisposable(),this._data=null,n},h.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},d(p,h),p.prototype.doDispose=function(t,e){var r=this.data();return r.call(t,t,e)},e.using=function(){var t=arguments.length;if(2>t)return r("you must pass at least 2 arguments to Promise.using");var i=arguments[t-1];if("function"!=typeof i)return r("fn must be a function\n\n See http://goo.gl/916lJJ\n");t--;for(var s=new Array(t),a=0;t>a;++a){var u=arguments[a];if(h.isDisposer(u)){var p=u;u=u.promise(),u._setDisposable(p)}else{var _=n(u);_ instanceof e&&(u=_._then(f,null,null,{resources:s,index:a},void 0))}s[a]=u}var d=e.settle(s).then(o).then(function(t){d._pushContext();var e;try{e=i.apply(void 0,t)}finally{d._popContext()}return e})._then(c,l,void 0,s,void 0);return s.promise=d,d},e.prototype._setDisposable=function(t){this._bitField=262144|this._bitField,this._disposer=t},e.prototype._isDisposable=function(){return(262144&this._bitField)>0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-262145&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new p(t,this,i());throw new _}}},{"./errors.js":13,"./util.js":38}],38:[function(t,e,r){"use strict";function n(){try{return C.apply(this,arguments)}catch(t){return F.e=t,F +}}function i(t){return C=t,n}function o(t){return null==t||t===!0||t===!1||"string"==typeof t||"number"==typeof t}function s(t){return!o(t)}function a(t){return o(t)?new Error(v(t)):t}function u(t,e){var r,n=t.length,i=new Array(n+1);for(r=0;n>r;++r)i[r]=t[r];return i[r]=e,i}function c(t,e,r){if(!w.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var n=Object.getOwnPropertyDescriptor(t,e);return null!=n?null==n.get&&null==n.set?n.value:r:void 0}function l(t,e,r){if(o(t))return t;var n={value:r,configurable:!0,enumerable:!1,writable:!0};return w.defineProperty(t,e,n),t}function h(t){throw t}function p(t){try{if("function"==typeof t){var e=w.names(t.prototype);return w.isES5?e.length>1:e.length>0&&!(1===e.length&&"constructor"===e[0])}return!1}catch(r){return!1}}function f(t){function e(){}e.prototype=t;for(var r=8;r--;)new e;return t}function _(t){return R.test(t)}function d(t,e,r){for(var n=new Array(t),i=0;t>i;++i)n[i]=e+i+r;return n}function v(t){try{return t+""}catch(e){return"[no string representation]"}}function y(t){try{l(t,"isOperational",!0)}catch(e){}}function g(t){return null==t?!1:t instanceof Error.__BluebirdErrorTypes__.OperationalError||t.isOperational===!0}function m(t){return t instanceof Error&&w.propertyIsWritable(t,"stack")}function j(t){return{}.toString.call(t)}function b(t,e,r){for(var n=w.names(t),i=0;i10||t[0]>0}();try{throw new Error}catch(O){S.lastLineError=O}e.exports=S},{"./es5.js":14}],39:[function(t,e){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(t){return"function"==typeof t}function i(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!i(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,r,i,a,u,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[t],s(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:for(i=arguments.length,a=new Array(i-1),u=1;i>u;u++)a[u-1]=arguments[u];r.apply(this,a)}else if(o(r)){for(i=arguments.length,a=new Array(i-1),u=1;i>u;u++)a[u-1]=arguments[u];for(c=r.slice(),i=c.length,u=0;i>u;u++)c[u].apply(this,a)}return!0},r.prototype.addListener=function(t,e){var i;if(!n(e))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,n(e.listener)?e.listener:e),this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,o(this._events[t])&&!this._events[t].warned){var i;i=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[t].length>i&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())}return this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function r(){this.removeListener(t,r),i||(i=!0,e.apply(this,arguments))}if(!n(e))throw TypeError("listener must be a function");var i=!1;return r.listener=e,this.on(t,r),this},r.prototype.removeListener=function(t,e){var r,i,s,a;if(!n(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],s=r.length,i=-1,r===e||n(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(a=s;a-->0;)if(r[a]===e||r[a].listener&&r[a].listener===e){i=a;break}if(0>i)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],n(r))this.removeListener(t,r);else for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.listenerCount=function(t,e){var r;return r=t._events&&t._events[e]?n(t._events[e])?1:t._events[e].length:0}},{}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise); \ No newline at end of file diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/any.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/any.js new file mode 100644 index 00000000000..05a6228ef9c --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/any.js @@ -0,0 +1,21 @@ +"use strict"; +module.exports = function(Promise) { +var SomePromiseArray = Promise._SomePromiseArray; +function any(promises) { + var ret = new SomePromiseArray(promises); + var promise = ret.promise(); + ret.setHowMany(1); + ret.setUnwrap(); + ret.init(); + return promise; +} + +Promise.any = function (promises) { + return any(promises); +}; + +Promise.prototype.any = function () { + return any(this); +}; + +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/assert.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/assert.js new file mode 100644 index 00000000000..a98955c475e --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/assert.js @@ -0,0 +1,55 @@ +"use strict"; +module.exports = (function(){ +var AssertionError = (function() { + function AssertionError(a) { + this.constructor$(a); + this.message = a; + this.name = "AssertionError"; + } + AssertionError.prototype = new Error(); + AssertionError.prototype.constructor = AssertionError; + AssertionError.prototype.constructor$ = Error; + return AssertionError; +})(); + +function getParams(args) { + var params = []; + for (var i = 0; i < args.length; ++i) params.push("arg" + i); + return params; +} + +function nativeAssert(callName, args, expect) { + try { + var params = getParams(args); + var constructorArgs = params; + constructorArgs.push("return " + + callName + "("+ params.join(",") + ");"); + var fn = Function.apply(null, constructorArgs); + return fn.apply(null, args); + } catch (e) { + if (!(e instanceof SyntaxError)) { + throw e; + } else { + return expect; + } + } +} + +return function assert(boolExpr, message) { + if (boolExpr === true) return; + + if (typeof boolExpr === "string" && + boolExpr.charAt(0) === "%") { + var nativeCallName = boolExpr; + var $_len = arguments.length;var args = new Array($_len - 2); for(var $_i = 2; $_i < $_len; ++$_i) {args[$_i - 2] = arguments[$_i];} + if (nativeAssert(nativeCallName, args, message) === message) return; + message = (nativeCallName + " !== " + message); + } + + var ret = new AssertionError(message); + if (Error.captureStackTrace) { + Error.captureStackTrace(ret, assert); + } + throw ret; +}; +})(); diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/async.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/async.js new file mode 100644 index 00000000000..3b5f828ce9e --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/async.js @@ -0,0 +1,204 @@ +"use strict"; +var firstLineError; +try {throw new Error(); } catch (e) {firstLineError = e;} +var schedule = require("./schedule.js"); +var Queue = require("./queue.js"); +var util = require("./util.js"); + +function Async() { + this._isTickUsed = false; + this._lateQueue = new Queue(16); + this._normalQueue = new Queue(16); + this._trampolineEnabled = true; + var self = this; + this.drainQueues = function () { + self._drainQueues(); + }; + this._schedule = + schedule.isStatic ? schedule(this.drainQueues) : schedule; +} + +Async.prototype.disableTrampolineIfNecessary = function() { + if (util.hasDevTools) { + this._trampolineEnabled = false; + } +}; + +Async.prototype.enableTrampoline = function() { + if (!this._trampolineEnabled) { + this._trampolineEnabled = true; + this._schedule = function(fn) { + setTimeout(fn, 0); + }; + } +}; + +Async.prototype.haveItemsQueued = function () { + return this._normalQueue.length() > 0; +}; + +Async.prototype.throwLater = function(fn, arg) { + if (arguments.length === 1) { + arg = fn; + fn = function () { throw arg; }; + } + var domain = this._getDomain(); + if (domain !== undefined) fn = domain.bind(fn); + if (typeof setTimeout !== "undefined") { + setTimeout(function() { + fn(arg); + }, 0); + } else try { + this._schedule(function() { + fn(arg); + }); + } catch (e) { + throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/m3OTXk\u000a"); + } +}; + +Async.prototype._getDomain = function() {}; + +if (!false) { +if (util.isNode) { + var EventsModule = require("events"); + + var domainGetter = function() { + var domain = process.domain; + if (domain === null) return undefined; + return domain; + }; + + if (EventsModule.usingDomains) { + Async.prototype._getDomain = domainGetter; + } else { + var descriptor = + Object.getOwnPropertyDescriptor(EventsModule, "usingDomains"); + + if (descriptor) { + if (!descriptor.configurable) { + process.on("domainsActivated", function() { + Async.prototype._getDomain = domainGetter; + }); + } else { + var usingDomains = false; + Object.defineProperty(EventsModule, "usingDomains", { + configurable: false, + enumerable: true, + get: function() { + return usingDomains; + }, + set: function(value) { + if (usingDomains || !value) return; + usingDomains = true; + Async.prototype._getDomain = domainGetter; + util.toFastProperties(process); + process.emit("domainsActivated"); + } + }); + } + } + } +} +} + +function AsyncInvokeLater(fn, receiver, arg) { + var domain = this._getDomain(); + if (domain !== undefined) fn = domain.bind(fn); + this._lateQueue.push(fn, receiver, arg); + this._queueTick(); +} + +function AsyncInvoke(fn, receiver, arg) { + var domain = this._getDomain(); + if (domain !== undefined) fn = domain.bind(fn); + this._normalQueue.push(fn, receiver, arg); + this._queueTick(); +} + +function AsyncSettlePromises(promise) { + var domain = this._getDomain(); + if (domain !== undefined) { + var fn = domain.bind(promise._settlePromises); + this._normalQueue.push(fn, promise, undefined); + } else { + this._normalQueue._pushOne(promise); + } + this._queueTick(); +} + +if (!util.hasDevTools) { + Async.prototype.invokeLater = AsyncInvokeLater; + Async.prototype.invoke = AsyncInvoke; + Async.prototype.settlePromises = AsyncSettlePromises; +} else { + Async.prototype.invokeLater = function (fn, receiver, arg) { + if (this._trampolineEnabled) { + AsyncInvokeLater.call(this, fn, receiver, arg); + } else { + setTimeout(function() { + fn.call(receiver, arg); + }, 100); + } + }; + + Async.prototype.invoke = function (fn, receiver, arg) { + if (this._trampolineEnabled) { + AsyncInvoke.call(this, fn, receiver, arg); + } else { + setTimeout(function() { + fn.call(receiver, arg); + }, 0); + } + }; + + Async.prototype.settlePromises = function(promise) { + if (this._trampolineEnabled) { + AsyncSettlePromises.call(this, promise); + } else { + setTimeout(function() { + promise._settlePromises(); + }, 0); + } + }; +} + +Async.prototype.invokeFirst = function (fn, receiver, arg) { + var domain = this._getDomain(); + if (domain !== undefined) fn = domain.bind(fn); + this._normalQueue.unshift(fn, receiver, arg); + this._queueTick(); +}; + +Async.prototype._drainQueue = function(queue) { + while (queue.length() > 0) { + var fn = queue.shift(); + if (typeof fn !== "function") { + fn._settlePromises(); + continue; + } + var receiver = queue.shift(); + var arg = queue.shift(); + fn.call(receiver, arg); + } +}; + +Async.prototype._drainQueues = function () { + this._drainQueue(this._normalQueue); + this._reset(); + this._drainQueue(this._lateQueue); +}; + +Async.prototype._queueTick = function () { + if (!this._isTickUsed) { + this._isTickUsed = true; + this._schedule(this.drainQueues); + } +}; + +Async.prototype._reset = function () { + this._isTickUsed = false; +}; + +module.exports = new Async(); +module.exports.firstLineError = firstLineError; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/bind.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/bind.js new file mode 100644 index 00000000000..d6f6da2576e --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/bind.js @@ -0,0 +1,73 @@ +"use strict"; +module.exports = function(Promise, INTERNAL, tryConvertToPromise) { +var rejectThis = function(_, e) { + this._reject(e); +}; + +var targetRejected = function(e, context) { + context.promiseRejectionQueued = true; + context.bindingPromise._then(rejectThis, rejectThis, null, this, e); +}; + +var bindingResolved = function(thisArg, context) { + this._setBoundTo(thisArg); + if (this._isPending()) { + this._resolveCallback(context.target); + } +}; + +var bindingRejected = function(e, context) { + if (!context.promiseRejectionQueued) this._reject(e); +}; + +Promise.prototype.bind = function (thisArg) { + var maybePromise = tryConvertToPromise(thisArg); + var ret = new Promise(INTERNAL); + ret._propagateFrom(this, 1); + var target = this._target(); + if (maybePromise instanceof Promise) { + var context = { + promiseRejectionQueued: false, + promise: ret, + target: target, + bindingPromise: maybePromise + }; + target._then(INTERNAL, targetRejected, ret._progress, ret, context); + maybePromise._then( + bindingResolved, bindingRejected, ret._progress, ret, context); + } else { + ret._setBoundTo(thisArg); + ret._resolveCallback(target); + } + return ret; +}; + +Promise.prototype._setBoundTo = function (obj) { + if (obj !== undefined) { + this._bitField = this._bitField | 131072; + this._boundTo = obj; + } else { + this._bitField = this._bitField & (~131072); + } +}; + +Promise.prototype._isBound = function () { + return (this._bitField & 131072) === 131072; +}; + +Promise.bind = function (thisArg, value) { + var maybePromise = tryConvertToPromise(thisArg); + var ret = new Promise(INTERNAL); + + if (maybePromise instanceof Promise) { + maybePromise._then(function(thisArg) { + ret._setBoundTo(thisArg); + ret._resolveCallback(value); + }, ret._reject, ret._progress, ret, null); + } else { + ret._setBoundTo(thisArg); + ret._resolveCallback(value); + } + return ret; +}; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/bluebird.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/bluebird.js new file mode 100644 index 00000000000..ed6226e7ea3 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/bluebird.js @@ -0,0 +1,11 @@ +"use strict"; +var old; +if (typeof Promise !== "undefined") old = Promise; +function noConflict() { + try { if (Promise === bluebird) Promise = old; } + catch (e) {} + return bluebird; +} +var bluebird = require("./promise.js")(); +bluebird.noConflict = noConflict; +module.exports = bluebird; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/call_get.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/call_get.js new file mode 100644 index 00000000000..62c166d5c08 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/call_get.js @@ -0,0 +1,123 @@ +"use strict"; +var cr = Object.create; +if (cr) { + var callerCache = cr(null); + var getterCache = cr(null); + callerCache[" size"] = getterCache[" size"] = 0; +} + +module.exports = function(Promise) { +var util = require("./util.js"); +var canEvaluate = util.canEvaluate; +var isIdentifier = util.isIdentifier; + +var getMethodCaller; +var getGetter; +if (!false) { +var makeMethodCaller = function (methodName) { + return new Function("ensureMethod", " \n\ + return function(obj) { \n\ + 'use strict' \n\ + var len = this.length; \n\ + ensureMethod(obj, 'methodName'); \n\ + switch(len) { \n\ + case 1: return obj.methodName(this[0]); \n\ + case 2: return obj.methodName(this[0], this[1]); \n\ + case 3: return obj.methodName(this[0], this[1], this[2]); \n\ + case 0: return obj.methodName(); \n\ + default: \n\ + return obj.methodName.apply(obj, this); \n\ + } \n\ + }; \n\ + ".replace(/methodName/g, methodName))(ensureMethod); +}; + +var makeGetter = function (propertyName) { + return new Function("obj", " \n\ + 'use strict'; \n\ + return obj.propertyName; \n\ + ".replace("propertyName", propertyName)); +}; + +var getCompiled = function(name, compiler, cache) { + var ret = cache[name]; + if (typeof ret !== "function") { + if (!isIdentifier(name)) { + return null; + } + ret = compiler(name); + cache[name] = ret; + cache[" size"]++; + if (cache[" size"] > 512) { + var keys = Object.keys(cache); + for (var i = 0; i < 256; ++i) delete cache[keys[i]]; + cache[" size"] = keys.length - 256; + } + } + return ret; +}; + +getMethodCaller = function(name) { + return getCompiled(name, makeMethodCaller, callerCache); +}; + +getGetter = function(name) { + return getCompiled(name, makeGetter, getterCache); +}; +} + +function ensureMethod(obj, methodName) { + var fn; + if (obj != null) fn = obj[methodName]; + if (typeof fn !== "function") { + var message = "Object " + util.classString(obj) + " has no method '" + + util.toString(methodName) + "'"; + throw new Promise.TypeError(message); + } + return fn; +} + +function caller(obj) { + var methodName = this.pop(); + var fn = ensureMethod(obj, methodName); + return fn.apply(obj, this); +} +Promise.prototype.call = function (methodName) { + var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];} + if (!false) { + if (canEvaluate) { + var maybeCaller = getMethodCaller(methodName); + if (maybeCaller !== null) { + return this._then( + maybeCaller, undefined, undefined, args, undefined); + } + } + } + args.push(methodName); + return this._then(caller, undefined, undefined, args, undefined); +}; + +function namedGetter(obj) { + return obj[this]; +} +function indexedGetter(obj) { + var index = +this; + if (index < 0) index = Math.max(0, index + obj.length); + return obj[index]; +} +Promise.prototype.get = function (propertyName) { + var isIndex = (typeof propertyName === "number"); + var getter; + if (!isIndex) { + if (canEvaluate) { + var maybeGetter = getGetter(propertyName); + getter = maybeGetter !== null ? maybeGetter : namedGetter; + } else { + getter = namedGetter; + } + } else { + getter = indexedGetter; + } + return this._then(getter, undefined, undefined, propertyName, undefined); +}; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/cancel.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/cancel.js new file mode 100644 index 00000000000..9eb40b6fb14 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/cancel.js @@ -0,0 +1,48 @@ +"use strict"; +module.exports = function(Promise) { +var errors = require("./errors.js"); +var async = require("./async.js"); +var CancellationError = errors.CancellationError; + +Promise.prototype._cancel = function (reason) { + if (!this.isCancellable()) return this; + var parent; + var promiseToReject = this; + while ((parent = promiseToReject._cancellationParent) !== undefined && + parent.isCancellable()) { + promiseToReject = parent; + } + this._unsetCancellable(); + promiseToReject._target()._rejectCallback(reason, false, true); +}; + +Promise.prototype.cancel = function (reason) { + if (!this.isCancellable()) return this; + if (reason === undefined) reason = new CancellationError(); + async.invokeLater(this._cancel, this, reason); + return this; +}; + +Promise.prototype.cancellable = function () { + if (this._cancellable()) return this; + async.enableTrampoline(); + this._setCancellable(); + this._cancellationParent = undefined; + return this; +}; + +Promise.prototype.uncancellable = function () { + var ret = this.then(); + ret._unsetCancellable(); + return ret; +}; + +Promise.prototype.fork = function (didFulfill, didReject, didProgress) { + var ret = this._then(didFulfill, didReject, didProgress, + undefined, undefined); + + ret._setCancellable(); + ret._cancellationParent = undefined; + return ret; +}; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/captured_trace.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/captured_trace.js new file mode 100644 index 00000000000..6fda9e80c85 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/captured_trace.js @@ -0,0 +1,492 @@ +"use strict"; +module.exports = function() { +var async = require("./async.js"); +var util = require("./util.js"); +var bluebirdFramePattern = + /[\\\/]bluebird[\\\/]js[\\\/](main|debug|zalgo|instrumented)/; +var stackFramePattern = null; +var formatStack = null; +var indentStackFrames = false; +var warn; + +function CapturedTrace(parent) { + this._parent = parent; + var length = this._length = 1 + (parent === undefined ? 0 : parent._length); + captureStackTrace(this, CapturedTrace); + if (length > 32) this.uncycle(); +} +util.inherits(CapturedTrace, Error); + +CapturedTrace.prototype.uncycle = function() { + var length = this._length; + if (length < 2) return; + var nodes = []; + var stackToIndex = {}; + + for (var i = 0, node = this; node !== undefined; ++i) { + nodes.push(node); + node = node._parent; + } + length = this._length = i; + for (var i = length - 1; i >= 0; --i) { + var stack = nodes[i].stack; + if (stackToIndex[stack] === undefined) { + stackToIndex[stack] = i; + } + } + for (var i = 0; i < length; ++i) { + var currentStack = nodes[i].stack; + var index = stackToIndex[currentStack]; + if (index !== undefined && index !== i) { + if (index > 0) { + nodes[index - 1]._parent = undefined; + nodes[index - 1]._length = 1; + } + nodes[i]._parent = undefined; + nodes[i]._length = 1; + var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; + + if (index < length - 1) { + cycleEdgeNode._parent = nodes[index + 1]; + cycleEdgeNode._parent.uncycle(); + cycleEdgeNode._length = + cycleEdgeNode._parent._length + 1; + } else { + cycleEdgeNode._parent = undefined; + cycleEdgeNode._length = 1; + } + var currentChildLength = cycleEdgeNode._length + 1; + for (var j = i - 2; j >= 0; --j) { + nodes[j]._length = currentChildLength; + currentChildLength++; + } + return; + } + } +}; + +CapturedTrace.prototype.parent = function() { + return this._parent; +}; + +CapturedTrace.prototype.hasParent = function() { + return this._parent !== undefined; +}; + +CapturedTrace.prototype.attachExtraTrace = function(error) { + if (error.__stackCleaned__) return; + this.uncycle(); + var parsed = CapturedTrace.parseStackAndMessage(error); + var message = parsed.message; + var stacks = [parsed.stack]; + + var trace = this; + while (trace !== undefined) { + stacks.push(cleanStack(trace.stack.split("\n"))); + trace = trace._parent; + } + removeCommonRoots(stacks); + removeDuplicateOrEmptyJumps(stacks); + util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)); + util.notEnumerableProp(error, "__stackCleaned__", true); +}; + +function reconstructStack(message, stacks) { + for (var i = 0; i < stacks.length - 1; ++i) { + stacks[i].push("From previous event:"); + stacks[i] = stacks[i].join("\n"); + } + if (i < stacks.length) { + stacks[i] = stacks[i].join("\n"); + } + return message + "\n" + stacks.join("\n"); +} + +function removeDuplicateOrEmptyJumps(stacks) { + for (var i = 0; i < stacks.length; ++i) { + if (stacks[i].length === 0 || + ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) { + stacks.splice(i, 1); + i--; + } + } +} + +function removeCommonRoots(stacks) { + var current = stacks[0]; + for (var i = 1; i < stacks.length; ++i) { + var prev = stacks[i]; + var currentLastIndex = current.length - 1; + var currentLastLine = current[currentLastIndex]; + var commonRootMeetPoint = -1; + + for (var j = prev.length - 1; j >= 0; --j) { + if (prev[j] === currentLastLine) { + commonRootMeetPoint = j; + break; + } + } + + for (var j = commonRootMeetPoint; j >= 0; --j) { + var line = prev[j]; + if (current[currentLastIndex] === line) { + current.pop(); + currentLastIndex--; + } else { + break; + } + } + current = prev; + } +} + +function cleanStack(stack) { + var ret = []; + for (var i = 0; i < stack.length; ++i) { + var line = stack[i]; + var isTraceLine = stackFramePattern.test(line) || + " (No stack trace)" === line; + var isInternalFrame = isTraceLine && shouldIgnore(line); + if (isTraceLine && !isInternalFrame) { + if (indentStackFrames && line.charAt(0) !== " ") { + line = " " + line; + } + ret.push(line); + } + } + return ret; +} + +function stackFramesAsArray(error) { + var stack = error.stack.replace(/\s+$/g, "").split("\n"); + for (var i = 0; i < stack.length; ++i) { + var line = stack[i]; + if (" (No stack trace)" === line || stackFramePattern.test(line)) { + break; + } + } + if (i > 0) { + stack = stack.slice(i); + } + return stack; +} + +CapturedTrace.parseStackAndMessage = function(error) { + var stack = error.stack; + var message = error.toString(); + stack = typeof stack === "string" && stack.length > 0 + ? stackFramesAsArray(error) : [" (No stack trace)"]; + return { + message: message, + stack: cleanStack(stack) + }; +}; + +CapturedTrace.formatAndLogError = function(error, title) { + if (typeof console !== "undefined") { + var message; + if (typeof error === "object" || typeof error === "function") { + var stack = error.stack; + message = title + formatStack(stack, error); + } else { + message = title + String(error); + } + if (typeof warn === "function") { + warn(message); + } else if (typeof console.log === "function" || + typeof console.log === "object") { + console.log(message); + } + } +}; + +CapturedTrace.unhandledRejection = function (reason) { + CapturedTrace.formatAndLogError(reason, "^--- With additional stack trace: "); +}; + +CapturedTrace.isSupported = function () { + return typeof captureStackTrace === "function"; +}; + +CapturedTrace.fireRejectionEvent = +function(name, localHandler, reason, promise) { + var localEventFired = false; + try { + if (typeof localHandler === "function") { + localEventFired = true; + if (name === "rejectionHandled") { + localHandler(promise); + } else { + localHandler(reason, promise); + } + } + } catch (e) { + async.throwLater(e); + } + + var globalEventFired = false; + try { + globalEventFired = fireGlobalEvent(name, reason, promise); + } catch (e) { + globalEventFired = true; + async.throwLater(e); + } + + var domEventFired = false; + if (fireDomEvent) { + try { + domEventFired = fireDomEvent(name.toLowerCase(), { + reason: reason, + promise: promise + }); + } catch (e) { + domEventFired = true; + async.throwLater(e); + } + } + + if (!globalEventFired && !localEventFired && !domEventFired && + name === "unhandledRejection") { + CapturedTrace.formatAndLogError(reason, "Unhandled rejection "); + } +}; + +function formatNonError(obj) { + var str; + if (typeof obj === "function") { + str = "[function " + + (obj.name || "anonymous") + + "]"; + } else { + str = obj.toString(); + var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; + if (ruselessToString.test(str)) { + try { + var newStr = JSON.stringify(obj); + str = newStr; + } + catch(e) { + + } + } + if (str.length === 0) { + str = "(empty array)"; + } + } + return ("(<" + snip(str) + ">, no stack trace)"); +} + +function snip(str) { + var maxChars = 41; + if (str.length < maxChars) { + return str; + } + return str.substr(0, maxChars - 3) + "..."; +} + +var shouldIgnore = function() { return false; }; +var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; +function parseLineInfo(line) { + var matches = line.match(parseLineInfoRegex); + if (matches) { + return { + fileName: matches[1], + line: parseInt(matches[2], 10) + }; + } +} +CapturedTrace.setBounds = function(firstLineError, lastLineError) { + if (!CapturedTrace.isSupported()) return; + var firstStackLines = firstLineError.stack.split("\n"); + var lastStackLines = lastLineError.stack.split("\n"); + var firstIndex = -1; + var lastIndex = -1; + var firstFileName; + var lastFileName; + for (var i = 0; i < firstStackLines.length; ++i) { + var result = parseLineInfo(firstStackLines[i]); + if (result) { + firstFileName = result.fileName; + firstIndex = result.line; + break; + } + } + for (var i = 0; i < lastStackLines.length; ++i) { + var result = parseLineInfo(lastStackLines[i]); + if (result) { + lastFileName = result.fileName; + lastIndex = result.line; + break; + } + } + if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || + firstFileName !== lastFileName || firstIndex >= lastIndex) { + return; + } + + shouldIgnore = function(line) { + if (bluebirdFramePattern.test(line)) return true; + var info = parseLineInfo(line); + if (info) { + if (info.fileName === firstFileName && + (firstIndex <= info.line && info.line <= lastIndex)) { + return true; + } + } + return false; + }; +}; + +var captureStackTrace = (function stackDetection() { + var v8stackFramePattern = /^\s*at\s*/; + var v8stackFormatter = function(stack, error) { + if (typeof stack === "string") return stack; + + if (error.name !== undefined && + error.message !== undefined) { + return error.toString(); + } + return formatNonError(error); + }; + + if (typeof Error.stackTraceLimit === "number" && + typeof Error.captureStackTrace === "function") { + Error.stackTraceLimit = Error.stackTraceLimit + 6; + stackFramePattern = v8stackFramePattern; + formatStack = v8stackFormatter; + var captureStackTrace = Error.captureStackTrace; + + shouldIgnore = function(line) { + return bluebirdFramePattern.test(line); + }; + return function(receiver, ignoreUntil) { + Error.stackTraceLimit = Error.stackTraceLimit + 6; + captureStackTrace(receiver, ignoreUntil); + Error.stackTraceLimit = Error.stackTraceLimit - 6; + }; + } + var err = new Error(); + + if (typeof err.stack === "string" && + err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) { + stackFramePattern = /@/; + formatStack = v8stackFormatter; + indentStackFrames = true; + return function captureStackTrace(o) { + o.stack = new Error().stack; + }; + } + + var hasStackAfterThrow; + try { throw new Error(); } + catch(e) { + hasStackAfterThrow = ("stack" in e); + } + if (!("stack" in err) && hasStackAfterThrow) { + stackFramePattern = v8stackFramePattern; + formatStack = v8stackFormatter; + return function captureStackTrace(o) { + Error.stackTraceLimit = Error.stackTraceLimit + 6; + try { throw new Error(); } + catch(e) { o.stack = e.stack; } + Error.stackTraceLimit = Error.stackTraceLimit - 6; + }; + } + + formatStack = function(stack, error) { + if (typeof stack === "string") return stack; + + if ((typeof error === "object" || + typeof error === "function") && + error.name !== undefined && + error.message !== undefined) { + return error.toString(); + } + return formatNonError(error); + }; + + return null; + +})([]); + +var fireDomEvent; +var fireGlobalEvent = (function() { + if (util.isNode) { + return function(name, reason, promise) { + if (name === "rejectionHandled") { + return process.emit(name, promise); + } else { + return process.emit(name, reason, promise); + } + }; + } else { + var customEventWorks = false; + var anyEventWorks = true; + try { + var ev = new self.CustomEvent("test"); + customEventWorks = ev instanceof CustomEvent; + } catch (e) {} + if (!customEventWorks) { + try { + var event = document.createEvent("CustomEvent"); + event.initCustomEvent("testingtheevent", false, true, {}); + self.dispatchEvent(event); + } catch (e) { + anyEventWorks = false; + } + } + if (anyEventWorks) { + fireDomEvent = function(type, detail) { + var event; + if (customEventWorks) { + event = new self.CustomEvent(type, { + detail: detail, + bubbles: false, + cancelable: true + }); + } else if (self.dispatchEvent) { + event = document.createEvent("CustomEvent"); + event.initCustomEvent(type, false, true, detail); + } + + return event ? !self.dispatchEvent(event) : false; + }; + } + + var toWindowMethodNameMap = {}; + toWindowMethodNameMap["unhandledRejection"] = ("on" + + "unhandledRejection").toLowerCase(); + toWindowMethodNameMap["rejectionHandled"] = ("on" + + "rejectionHandled").toLowerCase(); + + return function(name, reason, promise) { + var methodName = toWindowMethodNameMap[name]; + var method = self[methodName]; + if (!method) return false; + if (name === "rejectionHandled") { + method.call(self, promise); + } else { + method.call(self, reason, promise); + } + return true; + }; + } +})(); + +if (typeof console !== "undefined" && typeof console.warn !== "undefined") { + warn = function (message) { + console.warn(message); + }; + if (util.isNode && process.stderr.isTTY) { + warn = function(message) { + process.stderr.write("\u001b[31m" + message + "\u001b[39m\n"); + }; + } else if (!util.isNode && typeof (new Error().stack) === "string") { + warn = function(message) { + console.warn("%c" + message, "color: red"); + }; + } +} + +return CapturedTrace; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/catch_filter.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/catch_filter.js new file mode 100644 index 00000000000..040f057202e --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/catch_filter.js @@ -0,0 +1,66 @@ +"use strict"; +module.exports = function(NEXT_FILTER) { +var util = require("./util.js"); +var errors = require("./errors.js"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var keys = require("./es5.js").keys; +var TypeError = errors.TypeError; + +function CatchFilter(instances, callback, promise) { + this._instances = instances; + this._callback = callback; + this._promise = promise; +} + +function safePredicate(predicate, e) { + var safeObject = {}; + var retfilter = tryCatch(predicate).call(safeObject, e); + + if (retfilter === errorObj) return retfilter; + + var safeKeys = keys(safeObject); + if (safeKeys.length) { + errorObj.e = new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a See http://goo.gl/o84o68\u000a"); + return errorObj; + } + return retfilter; +} + +CatchFilter.prototype.doFilter = function (e) { + var cb = this._callback; + var promise = this._promise; + var boundTo = promise._boundTo; + for (var i = 0, len = this._instances.length; i < len; ++i) { + var item = this._instances[i]; + var itemIsErrorType = item === Error || + (item != null && item.prototype instanceof Error); + + if (itemIsErrorType && e instanceof item) { + var ret = tryCatch(cb).call(boundTo, e); + if (ret === errorObj) { + NEXT_FILTER.e = ret.e; + return NEXT_FILTER; + } + return ret; + } else if (typeof item === "function" && !itemIsErrorType) { + var shouldHandle = safePredicate(item, e); + if (shouldHandle === errorObj) { + e = errorObj.e; + break; + } else if (shouldHandle) { + var ret = tryCatch(cb).call(boundTo, e); + if (ret === errorObj) { + NEXT_FILTER.e = ret.e; + return NEXT_FILTER; + } + return ret; + } + } + } + NEXT_FILTER.e = e; + return NEXT_FILTER; +}; + +return CatchFilter; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/context.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/context.js new file mode 100644 index 00000000000..ccd7702b7e9 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/context.js @@ -0,0 +1,38 @@ +"use strict"; +module.exports = function(Promise, CapturedTrace, isDebugging) { +var contextStack = []; +function Context() { + this._trace = new CapturedTrace(peekContext()); +} +Context.prototype._pushContext = function () { + if (!isDebugging()) return; + if (this._trace !== undefined) { + contextStack.push(this._trace); + } +}; + +Context.prototype._popContext = function () { + if (!isDebugging()) return; + if (this._trace !== undefined) { + contextStack.pop(); + } +}; + +function createContext() { + if (isDebugging()) return new Context(); +} + +function peekContext() { + var lastIndex = contextStack.length - 1; + if (lastIndex >= 0) { + return contextStack[lastIndex]; + } + return undefined; +} + +Promise.prototype._peekContext = peekContext; +Promise.prototype._pushContext = Context.prototype._pushContext; +Promise.prototype._popContext = Context.prototype._popContext; + +return createContext; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/debuggability.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/debuggability.js new file mode 100644 index 00000000000..5ac176705f2 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/debuggability.js @@ -0,0 +1,147 @@ +"use strict"; +module.exports = function(Promise, CapturedTrace) { +var async = require("./async.js"); +var Warning = require("./errors.js").Warning; +var util = require("./util.js"); +var canAttachTrace = util.canAttachTrace; +var unhandledRejectionHandled; +var possiblyUnhandledRejection; +var debugging = false || (util.isNode && + (!!process.env["BLUEBIRD_DEBUG"] || + process.env["NODE_ENV"] === "development")); + +if (debugging) { + async.disableTrampolineIfNecessary(); +} + +Promise.prototype._ensurePossibleRejectionHandled = function () { + this._setRejectionIsUnhandled(); + async.invokeLater(this._notifyUnhandledRejection, this, undefined); +}; + +Promise.prototype._notifyUnhandledRejectionIsHandled = function () { + CapturedTrace.fireRejectionEvent("rejectionHandled", + unhandledRejectionHandled, undefined, this); +}; + +Promise.prototype._notifyUnhandledRejection = function () { + if (this._isRejectionUnhandled()) { + var reason = this._getCarriedStackTrace() || this._settledValue; + this._setUnhandledRejectionIsNotified(); + CapturedTrace.fireRejectionEvent("unhandledRejection", + possiblyUnhandledRejection, reason, this); + } +}; + +Promise.prototype._setUnhandledRejectionIsNotified = function () { + this._bitField = this._bitField | 524288; +}; + +Promise.prototype._unsetUnhandledRejectionIsNotified = function () { + this._bitField = this._bitField & (~524288); +}; + +Promise.prototype._isUnhandledRejectionNotified = function () { + return (this._bitField & 524288) > 0; +}; + +Promise.prototype._setRejectionIsUnhandled = function () { + this._bitField = this._bitField | 2097152; +}; + +Promise.prototype._unsetRejectionIsUnhandled = function () { + this._bitField = this._bitField & (~2097152); + if (this._isUnhandledRejectionNotified()) { + this._unsetUnhandledRejectionIsNotified(); + this._notifyUnhandledRejectionIsHandled(); + } +}; + +Promise.prototype._isRejectionUnhandled = function () { + return (this._bitField & 2097152) > 0; +}; + +Promise.prototype._setCarriedStackTrace = function (capturedTrace) { + this._bitField = this._bitField | 1048576; + this._fulfillmentHandler0 = capturedTrace; +}; + +Promise.prototype._isCarryingStackTrace = function () { + return (this._bitField & 1048576) > 0; +}; + +Promise.prototype._getCarriedStackTrace = function () { + return this._isCarryingStackTrace() + ? this._fulfillmentHandler0 + : undefined; +}; + +Promise.prototype._captureStackTrace = function () { + if (debugging) { + this._trace = new CapturedTrace(this._peekContext()); + } + return this; +}; + +Promise.prototype._attachExtraTrace = function (error, ignoreSelf) { + if (debugging && canAttachTrace(error)) { + var trace = this._trace; + if (trace !== undefined) { + if (ignoreSelf) trace = trace._parent; + } + if (trace !== undefined) { + trace.attachExtraTrace(error); + } else if (!error.__stackCleaned__) { + var parsed = CapturedTrace.parseStackAndMessage(error); + util.notEnumerableProp(error, "stack", + parsed.message + "\n" + parsed.stack.join("\n")); + util.notEnumerableProp(error, "__stackCleaned__", true); + } + } +}; + +Promise.prototype._warn = function(message) { + var warning = new Warning(message); + var ctx = this._peekContext(); + if (ctx) { + ctx.attachExtraTrace(warning); + } else { + var parsed = CapturedTrace.parseStackAndMessage(warning); + warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); + } + CapturedTrace.formatAndLogError(warning, ""); +}; + +Promise.onPossiblyUnhandledRejection = function (fn) { + possiblyUnhandledRejection = typeof fn === "function" ? fn : undefined; +}; + +Promise.onUnhandledRejectionHandled = function (fn) { + unhandledRejectionHandled = typeof fn === "function" ? fn : undefined; +}; + +Promise.longStackTraces = function () { + if (async.haveItemsQueued() && + debugging === false + ) { + throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/DT1qyG\u000a"); + } + debugging = CapturedTrace.isSupported(); + if (debugging) { + async.disableTrampolineIfNecessary(); + } +}; + +Promise.hasLongStackTraces = function () { + return debugging && CapturedTrace.isSupported(); +}; + +if (!CapturedTrace.isSupported()) { + Promise.longStackTraces = function(){}; + debugging = false; +} + +return function() { + return debugging; +}; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/direct_resolve.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/direct_resolve.js new file mode 100644 index 00000000000..47a9ce9dc65 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/direct_resolve.js @@ -0,0 +1,62 @@ +"use strict"; +var util = require("./util.js"); +var isPrimitive = util.isPrimitive; +var wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver; + +module.exports = function(Promise) { +var returner = function () { + return this; +}; +var thrower = function () { + throw this; +}; +var returnUndefined = function() {}; +var throwUndefined = function() { + throw undefined; +}; + +var wrapper = function (value, action) { + if (action === 1) { + return function () { + throw value; + }; + } else if (action === 2) { + return function () { + return value; + }; + } +}; + + +Promise.prototype["return"] = +Promise.prototype.thenReturn = function (value) { + if (value === undefined) return this.then(returnUndefined); + + if (wrapsPrimitiveReceiver && isPrimitive(value)) { + return this._then( + wrapper(value, 2), + undefined, + undefined, + undefined, + undefined + ); + } + return this._then(returner, undefined, undefined, value, undefined); +}; + +Promise.prototype["throw"] = +Promise.prototype.thenThrow = function (reason) { + if (reason === undefined) return this.then(throwUndefined); + + if (wrapsPrimitiveReceiver && isPrimitive(reason)) { + return this._then( + wrapper(reason, 1), + undefined, + undefined, + undefined, + undefined + ); + } + return this._then(thrower, undefined, undefined, reason, undefined); +}; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/each.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/each.js new file mode 100644 index 00000000000..a37e22c058b --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/each.js @@ -0,0 +1,12 @@ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var PromiseReduce = Promise.reduce; + +Promise.prototype.each = function (fn) { + return PromiseReduce(this, fn, null, INTERNAL); +}; + +Promise.each = function (promises, fn) { + return PromiseReduce(promises, fn, null, INTERNAL); +}; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/errors.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/errors.js new file mode 100644 index 00000000000..c334bb1c83f --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/errors.js @@ -0,0 +1,111 @@ +"use strict"; +var es5 = require("./es5.js"); +var Objectfreeze = es5.freeze; +var util = require("./util.js"); +var inherits = util.inherits; +var notEnumerableProp = util.notEnumerableProp; + +function subError(nameProperty, defaultMessage) { + function SubError(message) { + if (!(this instanceof SubError)) return new SubError(message); + notEnumerableProp(this, "message", + typeof message === "string" ? message : defaultMessage); + notEnumerableProp(this, "name", nameProperty); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + Error.call(this); + } + } + inherits(SubError, Error); + return SubError; +} + +var _TypeError, _RangeError; +var Warning = subError("Warning", "warning"); +var CancellationError = subError("CancellationError", "cancellation error"); +var TimeoutError = subError("TimeoutError", "timeout error"); +var AggregateError = subError("AggregateError", "aggregate error"); +try { + _TypeError = TypeError; + _RangeError = RangeError; +} catch(e) { + _TypeError = subError("TypeError", "type error"); + _RangeError = subError("RangeError", "range error"); +} + +var methods = ("join pop push shift unshift slice filter forEach some " + + "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" "); + +for (var i = 0; i < methods.length; ++i) { + if (typeof Array.prototype[methods[i]] === "function") { + AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; + } +} + +es5.defineProperty(AggregateError.prototype, "length", { + value: 0, + configurable: false, + writable: true, + enumerable: true +}); +AggregateError.prototype["isOperational"] = true; +var level = 0; +AggregateError.prototype.toString = function() { + var indent = Array(level * 4 + 1).join(" "); + var ret = "\n" + indent + "AggregateError of:" + "\n"; + level++; + indent = Array(level * 4 + 1).join(" "); + for (var i = 0; i < this.length; ++i) { + var str = this[i] === this ? "[Circular AggregateError]" : this[i] + ""; + var lines = str.split("\n"); + for (var j = 0; j < lines.length; ++j) { + lines[j] = indent + lines[j]; + } + str = lines.join("\n"); + ret += str + "\n"; + } + level--; + return ret; +}; + +function OperationalError(message) { + if (!(this instanceof OperationalError)) + return new OperationalError(message); + notEnumerableProp(this, "name", "OperationalError"); + notEnumerableProp(this, "message", message); + this.cause = message; + this["isOperational"] = true; + + if (message instanceof Error) { + notEnumerableProp(this, "message", message.message); + notEnumerableProp(this, "stack", message.stack); + } else if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + +} +inherits(OperationalError, Error); + +var errorTypes = Error["__BluebirdErrorTypes__"]; +if (!errorTypes) { + errorTypes = Objectfreeze({ + CancellationError: CancellationError, + TimeoutError: TimeoutError, + OperationalError: OperationalError, + RejectionError: OperationalError, + AggregateError: AggregateError + }); + notEnumerableProp(Error, "__BluebirdErrorTypes__", errorTypes); +} + +module.exports = { + Error: Error, + TypeError: _TypeError, + RangeError: _RangeError, + CancellationError: errorTypes.CancellationError, + OperationalError: errorTypes.OperationalError, + TimeoutError: errorTypes.TimeoutError, + AggregateError: errorTypes.AggregateError, + Warning: Warning +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/es5.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/es5.js new file mode 100644 index 00000000000..ea41d5a5669 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/es5.js @@ -0,0 +1,80 @@ +var isES5 = (function(){ + "use strict"; + return this === undefined; +})(); + +if (isES5) { + module.exports = { + freeze: Object.freeze, + defineProperty: Object.defineProperty, + getDescriptor: Object.getOwnPropertyDescriptor, + keys: Object.keys, + names: Object.getOwnPropertyNames, + getPrototypeOf: Object.getPrototypeOf, + isArray: Array.isArray, + isES5: isES5, + propertyIsWritable: function(obj, prop) { + var descriptor = Object.getOwnPropertyDescriptor(obj, prop); + return !!(!descriptor || descriptor.writable || descriptor.set); + } + }; +} else { + var has = {}.hasOwnProperty; + var str = {}.toString; + var proto = {}.constructor.prototype; + + var ObjectKeys = function (o) { + var ret = []; + for (var key in o) { + if (has.call(o, key)) { + ret.push(key); + } + } + return ret; + }; + + var ObjectGetDescriptor = function(o, key) { + return {value: o[key]}; + }; + + var ObjectDefineProperty = function (o, key, desc) { + o[key] = desc.value; + return o; + }; + + var ObjectFreeze = function (obj) { + return obj; + }; + + var ObjectGetPrototypeOf = function (obj) { + try { + return Object(obj).constructor.prototype; + } + catch (e) { + return proto; + } + }; + + var ArrayIsArray = function (obj) { + try { + return str.call(obj) === "[object Array]"; + } + catch(e) { + return false; + } + }; + + module.exports = { + isArray: ArrayIsArray, + keys: ObjectKeys, + names: ObjectKeys, + defineProperty: ObjectDefineProperty, + getDescriptor: ObjectGetDescriptor, + freeze: ObjectFreeze, + getPrototypeOf: ObjectGetPrototypeOf, + isES5: isES5, + propertyIsWritable: function() { + return true; + } + }; +} diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/filter.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/filter.js new file mode 100644 index 00000000000..ed57bf01592 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/filter.js @@ -0,0 +1,12 @@ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var PromiseMap = Promise.map; + +Promise.prototype.filter = function (fn, options) { + return PromiseMap(this, fn, options, INTERNAL); +}; + +Promise.filter = function (promises, fn, options) { + return PromiseMap(promises, fn, options, INTERNAL); +}; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/finally.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/finally.js new file mode 100644 index 00000000000..ed84a2a1f89 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/finally.js @@ -0,0 +1,99 @@ +"use strict"; +module.exports = function(Promise, NEXT_FILTER, tryConvertToPromise) { +var util = require("./util.js"); +var wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver; +var isPrimitive = util.isPrimitive; +var thrower = util.thrower; + +function returnThis() { + return this; +} +function throwThis() { + throw this; +} +function return$(r) { + return function() { + return r; + }; +} +function throw$(r) { + return function() { + throw r; + }; +} +function promisedFinally(ret, reasonOrValue, isFulfilled) { + var then; + if (wrapsPrimitiveReceiver && isPrimitive(reasonOrValue)) { + then = isFulfilled ? return$(reasonOrValue) : throw$(reasonOrValue); + } else { + then = isFulfilled ? returnThis : throwThis; + } + return ret._then(then, thrower, undefined, reasonOrValue, undefined); +} + +function finallyHandler(reasonOrValue) { + var promise = this.promise; + var handler = this.handler; + + var ret = promise._isBound() + ? handler.call(promise._boundTo) + : handler(); + + if (ret !== undefined) { + var maybePromise = tryConvertToPromise(ret, promise); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + return promisedFinally(maybePromise, reasonOrValue, + promise.isFulfilled()); + } + } + + if (promise.isRejected()) { + NEXT_FILTER.e = reasonOrValue; + return NEXT_FILTER; + } else { + return reasonOrValue; + } +} + +function tapHandler(value) { + var promise = this.promise; + var handler = this.handler; + + var ret = promise._isBound() + ? handler.call(promise._boundTo, value) + : handler(value); + + if (ret !== undefined) { + var maybePromise = tryConvertToPromise(ret, promise); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + return promisedFinally(maybePromise, value, true); + } + } + return value; +} + +Promise.prototype._passThroughHandler = function (handler, isFinally) { + if (typeof handler !== "function") return this.then(); + + var promiseAndHandler = { + promise: this, + handler: handler + }; + + return this._then( + isFinally ? finallyHandler : tapHandler, + isFinally ? finallyHandler : undefined, undefined, + promiseAndHandler, undefined); +}; + +Promise.prototype.lastly = +Promise.prototype["finally"] = function (handler) { + return this._passThroughHandler(handler, true); +}; + +Promise.prototype.tap = function (handler) { + return this._passThroughHandler(handler, false); +}; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/generators.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/generators.js new file mode 100644 index 00000000000..4c0568d21f9 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/generators.js @@ -0,0 +1,136 @@ +"use strict"; +module.exports = function(Promise, + apiRejection, + INTERNAL, + tryConvertToPromise) { +var errors = require("./errors.js"); +var TypeError = errors.TypeError; +var util = require("./util.js"); +var errorObj = util.errorObj; +var tryCatch = util.tryCatch; +var yieldHandlers = []; + +function promiseFromYieldHandler(value, yieldHandlers, traceParent) { + for (var i = 0; i < yieldHandlers.length; ++i) { + traceParent._pushContext(); + var result = tryCatch(yieldHandlers[i])(value); + traceParent._popContext(); + if (result === errorObj) { + traceParent._pushContext(); + var ret = Promise.reject(errorObj.e); + traceParent._popContext(); + return ret; + } + var maybePromise = tryConvertToPromise(result, traceParent); + if (maybePromise instanceof Promise) return maybePromise; + } + return null; +} + +function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { + var promise = this._promise = new Promise(INTERNAL); + promise._captureStackTrace(); + this._stack = stack; + this._generatorFunction = generatorFunction; + this._receiver = receiver; + this._generator = undefined; + this._yieldHandlers = typeof yieldHandler === "function" + ? [yieldHandler].concat(yieldHandlers) + : yieldHandlers; +} + +PromiseSpawn.prototype.promise = function () { + return this._promise; +}; + +PromiseSpawn.prototype._run = function () { + this._generator = this._generatorFunction.call(this._receiver); + this._receiver = + this._generatorFunction = undefined; + this._next(undefined); +}; + +PromiseSpawn.prototype._continue = function (result) { + if (result === errorObj) { + return this._promise._rejectCallback(result.e, false, true); + } + + var value = result.value; + if (result.done === true) { + this._promise._resolveCallback(value); + } else { + var maybePromise = tryConvertToPromise(value, this._promise); + if (!(maybePromise instanceof Promise)) { + maybePromise = + promiseFromYieldHandler(maybePromise, + this._yieldHandlers, + this._promise); + if (maybePromise === null) { + this._throw( + new TypeError( + "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/4Y4pDk\u000a\u000a".replace("%s", value) + + "From coroutine:\u000a" + + this._stack.split("\n").slice(1, -7).join("\n") + ) + ); + return; + } + } + maybePromise._then( + this._next, + this._throw, + undefined, + this, + null + ); + } +}; + +PromiseSpawn.prototype._throw = function (reason) { + this._promise._attachExtraTrace(reason); + this._promise._pushContext(); + var result = tryCatch(this._generator["throw"]) + .call(this._generator, reason); + this._promise._popContext(); + this._continue(result); +}; + +PromiseSpawn.prototype._next = function (value) { + this._promise._pushContext(); + var result = tryCatch(this._generator.next).call(this._generator, value); + this._promise._popContext(); + this._continue(result); +}; + +Promise.coroutine = function (generatorFunction, options) { + if (typeof generatorFunction !== "function") { + throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/6Vqhm0\u000a"); + } + var yieldHandler = Object(options).yieldHandler; + var PromiseSpawn$ = PromiseSpawn; + var stack = new Error().stack; + return function () { + var generator = generatorFunction.apply(this, arguments); + var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler, + stack); + spawn._generator = generator; + spawn._next(undefined); + return spawn.promise(); + }; +}; + +Promise.coroutine.addYieldHandler = function(fn) { + if (typeof fn !== "function") throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); + yieldHandlers.push(fn); +}; + +Promise.spawn = function (generatorFunction) { + if (typeof generatorFunction !== "function") { + return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/6Vqhm0\u000a"); + } + var spawn = new PromiseSpawn(generatorFunction, this); + var ret = spawn.promise(); + spawn._run(Promise.spawn); + return ret; +}; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/join.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/join.js new file mode 100644 index 00000000000..cf33eb1d073 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/join.js @@ -0,0 +1,107 @@ +"use strict"; +module.exports = +function(Promise, PromiseArray, tryConvertToPromise, INTERNAL) { +var util = require("./util.js"); +var canEvaluate = util.canEvaluate; +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var reject; + +if (!false) { +if (canEvaluate) { + var thenCallback = function(i) { + return new Function("value", "holder", " \n\ + 'use strict'; \n\ + holder.pIndex = value; \n\ + holder.checkFulfillment(this); \n\ + ".replace(/Index/g, i)); + }; + + var caller = function(count) { + var values = []; + for (var i = 1; i <= count; ++i) values.push("holder.p" + i); + return new Function("holder", " \n\ + 'use strict'; \n\ + var callback = holder.fn; \n\ + return callback(values); \n\ + ".replace(/values/g, values.join(", "))); + }; + var thenCallbacks = []; + var callers = [undefined]; + for (var i = 1; i <= 5; ++i) { + thenCallbacks.push(thenCallback(i)); + callers.push(caller(i)); + } + + var Holder = function(total, fn) { + this.p1 = this.p2 = this.p3 = this.p4 = this.p5 = null; + this.fn = fn; + this.total = total; + this.now = 0; + }; + + Holder.prototype.callers = callers; + Holder.prototype.checkFulfillment = function(promise) { + var now = this.now; + now++; + var total = this.total; + if (now >= total) { + var handler = this.callers[total]; + promise._pushContext(); + var ret = tryCatch(handler)(this); + promise._popContext(); + if (ret === errorObj) { + promise._rejectCallback(ret.e, false, true); + } else { + promise._resolveCallback(ret); + } + } else { + this.now = now; + } + }; + + var reject = function (reason) { + this._reject(reason); + }; +} +} + +Promise.join = function () { + var last = arguments.length - 1; + var fn; + if (last > 0 && typeof arguments[last] === "function") { + fn = arguments[last]; + if (!false) { + if (last < 6 && canEvaluate) { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + var holder = new Holder(last, fn); + var callbacks = thenCallbacks; + for (var i = 0; i < last; ++i) { + var maybePromise = tryConvertToPromise(arguments[i], ret); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + if (maybePromise._isPending()) { + maybePromise._then(callbacks[i], reject, + undefined, ret, holder); + } else if (maybePromise._isFulfilled()) { + callbacks[i].call(ret, + maybePromise._value(), holder); + } else { + ret._reject(maybePromise._reason()); + } + } else { + callbacks[i].call(ret, maybePromise, holder); + } + } + return ret; + } + } + } + var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];} + if (fn) args.pop(); + var ret = new PromiseArray(args).promise(); + return fn !== undefined ? ret.spread(fn) : ret; +}; + +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/map.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/map.js new file mode 100644 index 00000000000..66a5b179cf3 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/map.js @@ -0,0 +1,131 @@ +"use strict"; +module.exports = function(Promise, + PromiseArray, + apiRejection, + tryConvertToPromise, + INTERNAL) { +var async = require("./async.js"); +var util = require("./util.js"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var PENDING = {}; +var EMPTY_ARRAY = []; + +function MappingPromiseArray(promises, fn, limit, _filter) { + this.constructor$(promises); + this._promise._captureStackTrace(); + this._callback = fn; + this._preservedValues = _filter === INTERNAL + ? new Array(this.length()) + : null; + this._limit = limit; + this._inFlight = 0; + this._queue = limit >= 1 ? [] : EMPTY_ARRAY; + async.invoke(init, this, undefined); +} +util.inherits(MappingPromiseArray, PromiseArray); +function init() {this._init$(undefined, -2);} + +MappingPromiseArray.prototype._init = function () {}; + +MappingPromiseArray.prototype._promiseFulfilled = function (value, index) { + var values = this._values; + var length = this.length(); + var preservedValues = this._preservedValues; + var limit = this._limit; + if (values[index] === PENDING) { + values[index] = value; + if (limit >= 1) { + this._inFlight--; + this._drainQueue(); + if (this._isResolved()) return; + } + } else { + if (limit >= 1 && this._inFlight >= limit) { + values[index] = value; + this._queue.push(index); + return; + } + if (preservedValues !== null) preservedValues[index] = value; + + var callback = this._callback; + var receiver = this._promise._boundTo; + this._promise._pushContext(); + var ret = tryCatch(callback).call(receiver, value, index, length); + this._promise._popContext(); + if (ret === errorObj) return this._reject(ret.e); + + var maybePromise = tryConvertToPromise(ret, this._promise); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + if (maybePromise._isPending()) { + if (limit >= 1) this._inFlight++; + values[index] = PENDING; + return maybePromise._proxyPromiseArray(this, index); + } else if (maybePromise._isFulfilled()) { + ret = maybePromise._value(); + } else { + return this._reject(maybePromise._reason()); + } + } + values[index] = ret; + } + var totalResolved = ++this._totalResolved; + if (totalResolved >= length) { + if (preservedValues !== null) { + this._filter(values, preservedValues); + } else { + this._resolve(values); + } + + } +}; + +MappingPromiseArray.prototype._drainQueue = function () { + var queue = this._queue; + var limit = this._limit; + var values = this._values; + while (queue.length > 0 && this._inFlight < limit) { + if (this._isResolved()) return; + var index = queue.pop(); + this._promiseFulfilled(values[index], index); + } +}; + +MappingPromiseArray.prototype._filter = function (booleans, values) { + var len = values.length; + var ret = new Array(len); + var j = 0; + for (var i = 0; i < len; ++i) { + if (booleans[i]) ret[j++] = values[i]; + } + ret.length = j; + this._resolve(ret); +}; + +MappingPromiseArray.prototype.preservedValues = function () { + return this._preservedValues; +}; + +function map(promises, fn, options, _filter) { + var limit = typeof options === "object" && options !== null + ? options.concurrency + : 0; + limit = typeof limit === "number" && + isFinite(limit) && limit >= 1 ? limit : 0; + return new MappingPromiseArray(promises, fn, limit, _filter); +} + +Promise.prototype.map = function (fn, options) { + if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); + + return map(this, fn, options, null).promise(); +}; + +Promise.map = function (promises, fn, options, _filter) { + if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); + return map(promises, fn, options, _filter).promise(); +}; + + +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/method.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/method.js new file mode 100644 index 00000000000..3d3eeb17c83 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/method.js @@ -0,0 +1,44 @@ +"use strict"; +module.exports = +function(Promise, INTERNAL, tryConvertToPromise, apiRejection) { +var util = require("./util.js"); +var tryCatch = util.tryCatch; + +Promise.method = function (fn) { + if (typeof fn !== "function") { + throw new Promise.TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); + } + return function () { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._pushContext(); + var value = tryCatch(fn).apply(this, arguments); + ret._popContext(); + ret._resolveFromSyncValue(value); + return ret; + }; +}; + +Promise.attempt = Promise["try"] = function (fn, args, ctx) { + if (typeof fn !== "function") { + return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); + } + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._pushContext(); + var value = util.isArray(args) + ? tryCatch(fn).apply(ctx, args) + : tryCatch(fn).call(ctx, args); + ret._popContext(); + ret._resolveFromSyncValue(value); + return ret; +}; + +Promise.prototype._resolveFromSyncValue = function (value) { + if (value === util.errorObj) { + this._rejectCallback(value.e, false, true); + } else { + this._resolveCallback(value, true); + } +}; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/nodeify.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/nodeify.js new file mode 100644 index 00000000000..f305b936bf0 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/nodeify.js @@ -0,0 +1,58 @@ +"use strict"; +module.exports = function(Promise) { +var util = require("./util.js"); +var async = require("./async.js"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; + +function spreadAdapter(val, nodeback) { + var promise = this; + if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback); + var ret = tryCatch(nodeback).apply(promise._boundTo, [null].concat(val)); + if (ret === errorObj) { + async.throwLater(ret.e); + } +} + +function successAdapter(val, nodeback) { + var promise = this; + var receiver = promise._boundTo; + var ret = val === undefined + ? tryCatch(nodeback).call(receiver, null) + : tryCatch(nodeback).call(receiver, null, val); + if (ret === errorObj) { + async.throwLater(ret.e); + } +} +function errorAdapter(reason, nodeback) { + var promise = this; + if (!reason) { + var target = promise._target(); + var newReason = target._getCarriedStackTrace(); + newReason.cause = reason; + reason = newReason; + } + var ret = tryCatch(nodeback).call(promise._boundTo, reason); + if (ret === errorObj) { + async.throwLater(ret.e); + } +} + +Promise.prototype.asCallback = +Promise.prototype.nodeify = function (nodeback, options) { + if (typeof nodeback == "function") { + var adapter = successAdapter; + if (options !== undefined && Object(options).spread) { + adapter = spreadAdapter; + } + this._then( + adapter, + errorAdapter, + undefined, + this, + nodeback + ); + } + return this; +}; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/progress.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/progress.js new file mode 100644 index 00000000000..2e3e95e564b --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/progress.js @@ -0,0 +1,76 @@ +"use strict"; +module.exports = function(Promise, PromiseArray) { +var util = require("./util.js"); +var async = require("./async.js"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; + +Promise.prototype.progressed = function (handler) { + return this._then(undefined, undefined, handler, undefined, undefined); +}; + +Promise.prototype._progress = function (progressValue) { + if (this._isFollowingOrFulfilledOrRejected()) return; + this._target()._progressUnchecked(progressValue); + +}; + +Promise.prototype._progressHandlerAt = function (index) { + return index === 0 + ? this._progressHandler0 + : this[(index << 2) + index - 5 + 2]; +}; + +Promise.prototype._doProgressWith = function (progression) { + var progressValue = progression.value; + var handler = progression.handler; + var promise = progression.promise; + var receiver = progression.receiver; + + var ret = tryCatch(handler).call(receiver, progressValue); + if (ret === errorObj) { + if (ret.e != null && + ret.e.name !== "StopProgressPropagation") { + var trace = util.canAttachTrace(ret.e) + ? ret.e : new Error(util.toString(ret.e)); + promise._attachExtraTrace(trace); + promise._progress(ret.e); + } + } else if (ret instanceof Promise) { + ret._then(promise._progress, null, null, promise, undefined); + } else { + promise._progress(ret); + } +}; + + +Promise.prototype._progressUnchecked = function (progressValue) { + var len = this._length(); + var progress = this._progress; + for (var i = 0; i < len; i++) { + var handler = this._progressHandlerAt(i); + var promise = this._promiseAt(i); + if (!(promise instanceof Promise)) { + var receiver = this._receiverAt(i); + if (typeof handler === "function") { + handler.call(receiver, progressValue, promise); + } else if (receiver instanceof PromiseArray && + !receiver._isResolved()) { + receiver._promiseProgressed(progressValue, promise); + } + continue; + } + + if (typeof handler === "function") { + async.invoke(this._doProgressWith, this, { + handler: handler, + promise: promise, + receiver: this._receiverAt(i), + value: progressValue + }); + } else { + async.invoke(progress, promise, progressValue); + } + } +}; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/promise.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/promise.js new file mode 100644 index 00000000000..f80d247b140 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/promise.js @@ -0,0 +1,700 @@ +"use strict"; +module.exports = function() { +var makeSelfResolutionError = function () { + return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/LhFpo0\u000a"); +}; +var reflect = function() { + return new Promise.PromiseInspection(this._target()); +}; +var apiRejection = function(msg) { + return Promise.reject(new TypeError(msg)); +}; +var util = require("./util.js"); +var async = require("./async.js"); +var errors = require("./errors.js"); +var TypeError = Promise.TypeError = errors.TypeError; +Promise.RangeError = errors.RangeError; +Promise.CancellationError = errors.CancellationError; +Promise.TimeoutError = errors.TimeoutError; +Promise.OperationalError = errors.OperationalError; +Promise.RejectionError = errors.OperationalError; +Promise.AggregateError = errors.AggregateError; +var INTERNAL = function(){}; +var APPLY = {}; +var NEXT_FILTER = {e: null}; +var tryConvertToPromise = require("./thenables.js")(Promise, INTERNAL); +var PromiseArray = + require("./promise_array.js")(Promise, INTERNAL, + tryConvertToPromise, apiRejection); +var CapturedTrace = require("./captured_trace.js")(); +var isDebugging = require("./debuggability.js")(Promise, CapturedTrace); + /*jshint unused:false*/ +var createContext = + require("./context.js")(Promise, CapturedTrace, isDebugging); +var CatchFilter = require("./catch_filter.js")(NEXT_FILTER); +var PromiseResolver = require("./promise_resolver.js"); +var nodebackForPromise = PromiseResolver._nodebackForPromise; +var errorObj = util.errorObj; +var tryCatch = util.tryCatch; +function Promise(resolver) { + if (typeof resolver !== "function") { + throw new TypeError("the promise constructor requires a resolver function\u000a\u000a See http://goo.gl/EC22Yn\u000a"); + } + if (this.constructor !== Promise) { + throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/KsIlge\u000a"); + } + this._bitField = 0; + this._fulfillmentHandler0 = undefined; + this._rejectionHandler0 = undefined; + this._progressHandler0 = undefined; + this._promise0 = undefined; + this._receiver0 = undefined; + this._settledValue = undefined; + if (resolver !== INTERNAL) this._resolveFromResolver(resolver); +} + +Promise.prototype.toString = function () { + return "[object Promise]"; +}; + +Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { + var len = arguments.length; + if (len > 1) { + var catchInstances = new Array(len - 1), + j = 0, i; + for (i = 0; i < len - 1; ++i) { + var item = arguments[i]; + if (typeof item === "function") { + catchInstances[j++] = item; + } else { + return Promise.reject( + new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a See http://goo.gl/o84o68\u000a")); + } + } + catchInstances.length = j; + fn = arguments[i]; + var catchFilter = new CatchFilter(catchInstances, fn, this); + return this._then(undefined, catchFilter.doFilter, undefined, + catchFilter, undefined); + } + return this._then(undefined, fn, undefined, undefined, undefined); +}; + +Promise.prototype.reflect = function () { + return this._then(reflect, reflect, undefined, this, undefined); +}; + +Promise.prototype.then = function (didFulfill, didReject, didProgress) { + if (isDebugging() && arguments.length > 0 && + typeof didFulfill !== "function" && + typeof didReject !== "function") { + var msg = ".then() only accepts functions but was passed: " + + util.classString(didFulfill); + if (arguments.length > 1) { + msg += ", " + util.classString(didReject); + } + this._warn(msg); + } + return this._then(didFulfill, didReject, didProgress, + undefined, undefined); +}; + +Promise.prototype.done = function (didFulfill, didReject, didProgress) { + var promise = this._then(didFulfill, didReject, didProgress, + undefined, undefined); + promise._setIsFinal(); +}; + +Promise.prototype.spread = function (didFulfill, didReject) { + return this.all()._then(didFulfill, didReject, undefined, APPLY, undefined); +}; + +Promise.prototype.isCancellable = function () { + return !this.isResolved() && + this._cancellable(); +}; + +Promise.prototype.toJSON = function () { + var ret = { + isFulfilled: false, + isRejected: false, + fulfillmentValue: undefined, + rejectionReason: undefined + }; + if (this.isFulfilled()) { + ret.fulfillmentValue = this.value(); + ret.isFulfilled = true; + } else if (this.isRejected()) { + ret.rejectionReason = this.reason(); + ret.isRejected = true; + } + return ret; +}; + +Promise.prototype.all = function () { + return new PromiseArray(this).promise(); +}; + +Promise.prototype.error = function (fn) { + return this.caught(util.originatesFromRejection, fn); +}; + +Promise.is = function (val) { + return val instanceof Promise; +}; + +Promise.fromNode = function(fn) { + var ret = new Promise(INTERNAL); + var result = tryCatch(fn)(nodebackForPromise(ret)); + if (result === errorObj) { + ret._rejectCallback(result.e, true, true); + } + return ret; +}; + +Promise.all = function (promises) { + return new PromiseArray(promises).promise(); +}; + +Promise.defer = Promise.pending = function () { + var promise = new Promise(INTERNAL); + return new PromiseResolver(promise); +}; + +Promise.cast = function (obj) { + var ret = tryConvertToPromise(obj); + if (!(ret instanceof Promise)) { + var val = ret; + ret = new Promise(INTERNAL); + ret._fulfillUnchecked(val); + } + return ret; +}; + +Promise.resolve = Promise.fulfilled = Promise.cast; + +Promise.reject = Promise.rejected = function (reason) { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._rejectCallback(reason, true); + return ret; +}; + +Promise.setScheduler = function(fn) { + if (typeof fn !== "function") throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); + var prev = async._schedule; + async._schedule = fn; + return prev; +}; + +Promise.prototype._then = function ( + didFulfill, + didReject, + didProgress, + receiver, + internalData +) { + var haveInternalData = internalData !== undefined; + var ret = haveInternalData ? internalData : new Promise(INTERNAL); + + if (!haveInternalData) { + ret._propagateFrom(this, 4 | 1); + ret._captureStackTrace(); + } + + var target = this._target(); + if (target !== this) { + if (receiver === undefined) receiver = this._boundTo; + if (!haveInternalData) ret._setIsMigrated(); + } + + var callbackIndex = + target._addCallbacks(didFulfill, didReject, didProgress, ret, receiver); + + if (target._isResolved() && !target._isSettlePromisesQueued()) { + async.invoke( + target._settlePromiseAtPostResolution, target, callbackIndex); + } + + return ret; +}; + +Promise.prototype._settlePromiseAtPostResolution = function (index) { + if (this._isRejectionUnhandled()) this._unsetRejectionIsUnhandled(); + this._settlePromiseAt(index); +}; + +Promise.prototype._length = function () { + return this._bitField & 131071; +}; + +Promise.prototype._isFollowingOrFulfilledOrRejected = function () { + return (this._bitField & 939524096) > 0; +}; + +Promise.prototype._isFollowing = function () { + return (this._bitField & 536870912) === 536870912; +}; + +Promise.prototype._setLength = function (len) { + this._bitField = (this._bitField & -131072) | + (len & 131071); +}; + +Promise.prototype._setFulfilled = function () { + this._bitField = this._bitField | 268435456; +}; + +Promise.prototype._setRejected = function () { + this._bitField = this._bitField | 134217728; +}; + +Promise.prototype._setFollowing = function () { + this._bitField = this._bitField | 536870912; +}; + +Promise.prototype._setIsFinal = function () { + this._bitField = this._bitField | 33554432; +}; + +Promise.prototype._isFinal = function () { + return (this._bitField & 33554432) > 0; +}; + +Promise.prototype._cancellable = function () { + return (this._bitField & 67108864) > 0; +}; + +Promise.prototype._setCancellable = function () { + this._bitField = this._bitField | 67108864; +}; + +Promise.prototype._unsetCancellable = function () { + this._bitField = this._bitField & (~67108864); +}; + +Promise.prototype._setIsMigrated = function () { + this._bitField = this._bitField | 4194304; +}; + +Promise.prototype._unsetIsMigrated = function () { + this._bitField = this._bitField & (~4194304); +}; + +Promise.prototype._isMigrated = function () { + return (this._bitField & 4194304) > 0; +}; + +Promise.prototype._receiverAt = function (index) { + var ret = index === 0 + ? this._receiver0 + : this[ + index * 5 - 5 + 4]; + if (ret === undefined && this._isBound()) { + return this._boundTo; + } + return ret; +}; + +Promise.prototype._promiseAt = function (index) { + return index === 0 + ? this._promise0 + : this[index * 5 - 5 + 3]; +}; + +Promise.prototype._fulfillmentHandlerAt = function (index) { + return index === 0 + ? this._fulfillmentHandler0 + : this[index * 5 - 5 + 0]; +}; + +Promise.prototype._rejectionHandlerAt = function (index) { + return index === 0 + ? this._rejectionHandler0 + : this[index * 5 - 5 + 1]; +}; + +Promise.prototype._migrateCallbacks = function (follower, index) { + var fulfill = follower._fulfillmentHandlerAt(index); + var reject = follower._rejectionHandlerAt(index); + var progress = follower._progressHandlerAt(index); + var promise = follower._promiseAt(index); + var receiver = follower._receiverAt(index); + if (promise instanceof Promise) promise._setIsMigrated(); + this._addCallbacks(fulfill, reject, progress, promise, receiver); +}; + +Promise.prototype._addCallbacks = function ( + fulfill, + reject, + progress, + promise, + receiver +) { + var index = this._length(); + + if (index >= 131071 - 5) { + index = 0; + this._setLength(0); + } + + if (index === 0) { + this._promise0 = promise; + if (receiver !== undefined) this._receiver0 = receiver; + if (typeof fulfill === "function" && !this._isCarryingStackTrace()) + this._fulfillmentHandler0 = fulfill; + if (typeof reject === "function") this._rejectionHandler0 = reject; + if (typeof progress === "function") this._progressHandler0 = progress; + } else { + var base = index * 5 - 5; + this[base + 3] = promise; + this[base + 4] = receiver; + if (typeof fulfill === "function") + this[base + 0] = fulfill; + if (typeof reject === "function") + this[base + 1] = reject; + if (typeof progress === "function") + this[base + 2] = progress; + } + this._setLength(index + 1); + return index; +}; + +Promise.prototype._setProxyHandlers = function (receiver, promiseSlotValue) { + var index = this._length(); + + if (index >= 131071 - 5) { + index = 0; + this._setLength(0); + } + if (index === 0) { + this._promise0 = promiseSlotValue; + this._receiver0 = receiver; + } else { + var base = index * 5 - 5; + this[base + 3] = promiseSlotValue; + this[base + 4] = receiver; + } + this._setLength(index + 1); +}; + +Promise.prototype._proxyPromiseArray = function (promiseArray, index) { + this._setProxyHandlers(promiseArray, index); +}; + +Promise.prototype._resolveCallback = function(value, shouldBind) { + if (this._isFollowingOrFulfilledOrRejected()) return; + if (value === this) + return this._rejectCallback(makeSelfResolutionError(), false, true); + var maybePromise = tryConvertToPromise(value, this); + if (!(maybePromise instanceof Promise)) return this._fulfill(value); + + var propagationFlags = 1 | (shouldBind ? 4 : 0); + this._propagateFrom(maybePromise, propagationFlags); + var promise = maybePromise._target(); + if (promise._isPending()) { + var len = this._length(); + for (var i = 0; i < len; ++i) { + promise._migrateCallbacks(this, i); + } + this._setFollowing(); + this._setLength(0); + this._setFollowee(promise); + } else if (promise._isFulfilled()) { + this._fulfillUnchecked(promise._value()); + } else { + this._rejectUnchecked(promise._reason(), + promise._getCarriedStackTrace()); + } +}; + +Promise.prototype._rejectCallback = +function(reason, synchronous, shouldNotMarkOriginatingFromRejection) { + if (!shouldNotMarkOriginatingFromRejection) { + util.markAsOriginatingFromRejection(reason); + } + var trace = util.ensureErrorObject(reason); + var hasStack = trace === reason; + this._attachExtraTrace(trace, synchronous ? hasStack : false); + this._reject(reason, hasStack ? undefined : trace); +}; + +Promise.prototype._resolveFromResolver = function (resolver) { + var promise = this; + this._captureStackTrace(); + this._pushContext(); + var synchronous = true; + var r = tryCatch(resolver)(function(value) { + if (promise === null) return; + promise._resolveCallback(value); + promise = null; + }, function (reason) { + if (promise === null) return; + promise._rejectCallback(reason, synchronous); + promise = null; + }); + synchronous = false; + this._popContext(); + + if (r !== undefined && r === errorObj && promise !== null) { + promise._rejectCallback(r.e, true, true); + promise = null; + } +}; + +Promise.prototype._settlePromiseFromHandler = function ( + handler, receiver, value, promise +) { + if (promise._isRejected()) return; + promise._pushContext(); + var x; + if (receiver === APPLY && !this._isRejected()) { + x = tryCatch(handler).apply(this._boundTo, value); + } else { + x = tryCatch(handler).call(receiver, value); + } + promise._popContext(); + + if (x === errorObj || x === promise || x === NEXT_FILTER) { + var err = x === promise ? makeSelfResolutionError() : x.e; + promise._rejectCallback(err, false, true); + } else { + promise._resolveCallback(x); + } +}; + +Promise.prototype._target = function() { + var ret = this; + while (ret._isFollowing()) ret = ret._followee(); + return ret; +}; + +Promise.prototype._followee = function() { + return this._rejectionHandler0; +}; + +Promise.prototype._setFollowee = function(promise) { + this._rejectionHandler0 = promise; +}; + +Promise.prototype._cleanValues = function () { + if (this._cancellable()) { + this._cancellationParent = undefined; + } +}; + +Promise.prototype._propagateFrom = function (parent, flags) { + if ((flags & 1) > 0 && parent._cancellable()) { + this._setCancellable(); + this._cancellationParent = parent; + } + if ((flags & 4) > 0 && parent._isBound()) { + this._setBoundTo(parent._boundTo); + } +}; + +Promise.prototype._fulfill = function (value) { + if (this._isFollowingOrFulfilledOrRejected()) return; + this._fulfillUnchecked(value); +}; + +Promise.prototype._reject = function (reason, carriedStackTrace) { + if (this._isFollowingOrFulfilledOrRejected()) return; + this._rejectUnchecked(reason, carriedStackTrace); +}; + +Promise.prototype._settlePromiseAt = function (index) { + var promise = this._promiseAt(index); + var isPromise = promise instanceof Promise; + + if (isPromise && promise._isMigrated()) { + promise._unsetIsMigrated(); + return async.invoke(this._settlePromiseAt, this, index); + } + var handler = this._isFulfilled() + ? this._fulfillmentHandlerAt(index) + : this._rejectionHandlerAt(index); + + var carriedStackTrace = + this._isCarryingStackTrace() ? this._getCarriedStackTrace() : undefined; + var value = this._settledValue; + var receiver = this._receiverAt(index); + + + this._clearCallbackDataAtIndex(index); + + if (typeof handler === "function") { + if (!isPromise) { + handler.call(receiver, value, promise); + } else { + this._settlePromiseFromHandler(handler, receiver, value, promise); + } + } else if (receiver instanceof PromiseArray) { + if (!receiver._isResolved()) { + if (this._isFulfilled()) { + receiver._promiseFulfilled(value, promise); + } + else { + receiver._promiseRejected(value, promise); + } + } + } else if (isPromise) { + if (this._isFulfilled()) { + promise._fulfill(value); + } else { + promise._reject(value, carriedStackTrace); + } + } + + if (index >= 4 && (index & 31) === 4) + async.invokeLater(this._setLength, this, 0); +}; + +Promise.prototype._clearCallbackDataAtIndex = function(index) { + if (index === 0) { + if (!this._isCarryingStackTrace()) { + this._fulfillmentHandler0 = undefined; + } + this._rejectionHandler0 = + this._progressHandler0 = + this._receiver0 = + this._promise0 = undefined; + } else { + var base = index * 5 - 5; + this[base + 3] = + this[base + 4] = + this[base + 0] = + this[base + 1] = + this[base + 2] = undefined; + } +}; + +Promise.prototype._isSettlePromisesQueued = function () { + return (this._bitField & + -1073741824) === -1073741824; +}; + +Promise.prototype._setSettlePromisesQueued = function () { + this._bitField = this._bitField | -1073741824; +}; + +Promise.prototype._unsetSettlePromisesQueued = function () { + this._bitField = this._bitField & (~-1073741824); +}; + +Promise.prototype._queueSettlePromises = function() { + async.settlePromises(this); + this._setSettlePromisesQueued(); +}; + +Promise.prototype._fulfillUnchecked = function (value) { + if (value === this) { + var err = makeSelfResolutionError(); + this._attachExtraTrace(err); + return this._rejectUnchecked(err, undefined); + } + this._setFulfilled(); + this._settledValue = value; + this._cleanValues(); + + if (this._length() > 0) { + this._queueSettlePromises(); + } +}; + +Promise.prototype._rejectUncheckedCheckError = function (reason) { + var trace = util.ensureErrorObject(reason); + this._rejectUnchecked(reason, trace === reason ? undefined : trace); +}; + +Promise.prototype._rejectUnchecked = function (reason, trace) { + if (reason === this) { + var err = makeSelfResolutionError(); + this._attachExtraTrace(err); + return this._rejectUnchecked(err); + } + this._setRejected(); + this._settledValue = reason; + this._cleanValues(); + + if (this._isFinal()) { + async.throwLater(function(e) { + if ("stack" in e) { + async.invokeFirst( + CapturedTrace.unhandledRejection, undefined, e); + } + throw e; + }, trace === undefined ? reason : trace); + return; + } + + if (trace !== undefined && trace !== reason) { + this._setCarriedStackTrace(trace); + } + + if (this._length() > 0) { + this._queueSettlePromises(); + } else { + this._ensurePossibleRejectionHandled(); + } +}; + +Promise.prototype._settlePromises = function () { + this._unsetSettlePromisesQueued(); + var len = this._length(); + for (var i = 0; i < len; i++) { + this._settlePromiseAt(i); + } +}; + +Promise._makeSelfResolutionError = makeSelfResolutionError; +require("./progress.js")(Promise, PromiseArray); +require("./method.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection); +require("./bind.js")(Promise, INTERNAL, tryConvertToPromise); +require("./finally.js")(Promise, NEXT_FILTER, tryConvertToPromise); +require("./direct_resolve.js")(Promise); +require("./synchronous_inspection.js")(Promise); +require("./join.js")(Promise, PromiseArray, tryConvertToPromise, INTERNAL); +Promise.Promise = Promise; +require('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL); +require('./cancel.js')(Promise); +require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext); +require('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise); +require('./nodeify.js')(Promise); +require('./call_get.js')(Promise); +require('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection); +require('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection); +require('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL); +require('./settle.js')(Promise, PromiseArray); +require('./some.js')(Promise, PromiseArray, apiRejection); +require('./promisify.js')(Promise, INTERNAL); +require('./any.js')(Promise); +require('./each.js')(Promise, INTERNAL); +require('./timers.js')(Promise, INTERNAL); +require('./filter.js')(Promise, INTERNAL); + + util.toFastProperties(Promise); + util.toFastProperties(Promise.prototype); + function fillTypes(value) { + var p = new Promise(INTERNAL); + p._fulfillmentHandler0 = value; + p._rejectionHandler0 = value; + p._progressHandler0 = value; + p._promise0 = value; + p._receiver0 = value; + p._settledValue = value; + } + // Complete slack tracking, opt out of field-type tracking and + // stabilize map + fillTypes({a: 1}); + fillTypes({b: 2}); + fillTypes({c: 3}); + fillTypes(1); + fillTypes(function(){}); + fillTypes(undefined); + fillTypes(false); + fillTypes(new Promise(INTERNAL)); + CapturedTrace.setBounds(async.firstLineError, util.lastLineError); + return Promise; + +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/promise_array.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/promise_array.js new file mode 100644 index 00000000000..6dac86640a9 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/promise_array.js @@ -0,0 +1,142 @@ +"use strict"; +module.exports = function(Promise, INTERNAL, tryConvertToPromise, + apiRejection) { +var util = require("./util.js"); +var isArray = util.isArray; + +function toResolutionValue(val) { + switch(val) { + case -2: return []; + case -3: return {}; + } +} + +function PromiseArray(values) { + var promise = this._promise = new Promise(INTERNAL); + var parent; + if (values instanceof Promise) { + parent = values; + promise._propagateFrom(parent, 1 | 4); + } + this._values = values; + this._length = 0; + this._totalResolved = 0; + this._init(undefined, -2); +} +PromiseArray.prototype.length = function () { + return this._length; +}; + +PromiseArray.prototype.promise = function () { + return this._promise; +}; + +PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { + var values = tryConvertToPromise(this._values, this._promise); + if (values instanceof Promise) { + values = values._target(); + this._values = values; + if (values._isFulfilled()) { + values = values._value(); + if (!isArray(values)) { + var err = new Promise.TypeError("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a"); + this.__hardReject__(err); + return; + } + } else if (values._isPending()) { + values._then( + init, + this._reject, + undefined, + this, + resolveValueIfEmpty + ); + return; + } else { + this._reject(values._reason()); + return; + } + } else if (!isArray(values)) { + this._promise._reject(apiRejection("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a")._reason()); + return; + } + + if (values.length === 0) { + if (resolveValueIfEmpty === -5) { + this._resolveEmptyArray(); + } + else { + this._resolve(toResolutionValue(resolveValueIfEmpty)); + } + return; + } + var len = this.getActualLength(values.length); + this._length = len; + this._values = this.shouldCopyValues() ? new Array(len) : this._values; + var promise = this._promise; + for (var i = 0; i < len; ++i) { + var isResolved = this._isResolved(); + var maybePromise = tryConvertToPromise(values[i], promise); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + if (isResolved) { + maybePromise._unsetRejectionIsUnhandled(); + } else if (maybePromise._isPending()) { + maybePromise._proxyPromiseArray(this, i); + } else if (maybePromise._isFulfilled()) { + this._promiseFulfilled(maybePromise._value(), i); + } else { + this._promiseRejected(maybePromise._reason(), i); + } + } else if (!isResolved) { + this._promiseFulfilled(maybePromise, i); + } + } +}; + +PromiseArray.prototype._isResolved = function () { + return this._values === null; +}; + +PromiseArray.prototype._resolve = function (value) { + this._values = null; + this._promise._fulfill(value); +}; + +PromiseArray.prototype.__hardReject__ = +PromiseArray.prototype._reject = function (reason) { + this._values = null; + this._promise._rejectCallback(reason, false, true); +}; + +PromiseArray.prototype._promiseProgressed = function (progressValue, index) { + this._promise._progress({ + index: index, + value: progressValue + }); +}; + + +PromiseArray.prototype._promiseFulfilled = function (value, index) { + this._values[index] = value; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + this._resolve(this._values); + } +}; + +PromiseArray.prototype._promiseRejected = function (reason, index) { + this._totalResolved++; + this._reject(reason); +}; + +PromiseArray.prototype.shouldCopyValues = function () { + return true; +}; + +PromiseArray.prototype.getActualLength = function (len) { + return len; +}; + +return PromiseArray; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/promise_resolver.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/promise_resolver.js new file mode 100644 index 00000000000..b180a328037 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/promise_resolver.js @@ -0,0 +1,123 @@ +"use strict"; +var util = require("./util.js"); +var maybeWrapAsError = util.maybeWrapAsError; +var errors = require("./errors.js"); +var TimeoutError = errors.TimeoutError; +var OperationalError = errors.OperationalError; +var haveGetters = util.haveGetters; +var es5 = require("./es5.js"); + +function isUntypedError(obj) { + return obj instanceof Error && + es5.getPrototypeOf(obj) === Error.prototype; +} + +var rErrorKey = /^(?:name|message|stack|cause)$/; +function wrapAsOperationalError(obj) { + var ret; + if (isUntypedError(obj)) { + ret = new OperationalError(obj); + ret.name = obj.name; + ret.message = obj.message; + ret.stack = obj.stack; + var keys = es5.keys(obj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (!rErrorKey.test(key)) { + ret[key] = obj[key]; + } + } + return ret; + } + util.markAsOriginatingFromRejection(obj); + return obj; +} + +function nodebackForPromise(promise) { + return function(err, value) { + if (promise === null) return; + + if (err) { + var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); + promise._attachExtraTrace(wrapped); + promise._reject(wrapped); + } else if (arguments.length > 2) { + var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];} + promise._fulfill(args); + } else { + promise._fulfill(value); + } + + promise = null; + }; +} + + +var PromiseResolver; +if (!haveGetters) { + PromiseResolver = function (promise) { + this.promise = promise; + this.asCallback = nodebackForPromise(promise); + this.callback = this.asCallback; + }; +} +else { + PromiseResolver = function (promise) { + this.promise = promise; + }; +} +if (haveGetters) { + var prop = { + get: function() { + return nodebackForPromise(this.promise); + } + }; + es5.defineProperty(PromiseResolver.prototype, "asCallback", prop); + es5.defineProperty(PromiseResolver.prototype, "callback", prop); +} + +PromiseResolver._nodebackForPromise = nodebackForPromise; + +PromiseResolver.prototype.toString = function () { + return "[object PromiseResolver]"; +}; + +PromiseResolver.prototype.resolve = +PromiseResolver.prototype.fulfill = function (value) { + if (!(this instanceof PromiseResolver)) { + throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); + } + this.promise._resolveCallback(value); +}; + +PromiseResolver.prototype.reject = function (reason) { + if (!(this instanceof PromiseResolver)) { + throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); + } + this.promise._rejectCallback(reason); +}; + +PromiseResolver.prototype.progress = function (value) { + if (!(this instanceof PromiseResolver)) { + throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); + } + this.promise._progress(value); +}; + +PromiseResolver.prototype.cancel = function (err) { + this.promise.cancel(err); +}; + +PromiseResolver.prototype.timeout = function () { + this.reject(new TimeoutError("timeout")); +}; + +PromiseResolver.prototype.isResolved = function () { + return this.promise.isResolved(); +}; + +PromiseResolver.prototype.toJSON = function () { + return this.promise.toJSON(); +}; + +module.exports = PromiseResolver; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/promisify.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/promisify.js new file mode 100644 index 00000000000..035534459bb --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/promisify.js @@ -0,0 +1,291 @@ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var THIS = {}; +var util = require("./util.js"); +var nodebackForPromise = require("./promise_resolver.js") + ._nodebackForPromise; +var withAppended = util.withAppended; +var maybeWrapAsError = util.maybeWrapAsError; +var canEvaluate = util.canEvaluate; +var TypeError = require("./errors").TypeError; +var defaultSuffix = "Async"; +var defaultPromisified = {__isPromisified__: true}; +var noCopyPropsPattern = + /^(?:length|name|arguments|caller|callee|prototype|__isPromisified__)$/; +var defaultFilter = function(name, func) { + return util.isIdentifier(name) && + name.charAt(0) !== "_" && + !util.isClass(func); +}; + +function propsFilter(key) { + return !noCopyPropsPattern.test(key); +} + +function isPromisified(fn) { + try { + return fn.__isPromisified__ === true; + } + catch (e) { + return false; + } +} + +function hasPromisified(obj, key, suffix) { + var val = util.getDataPropertyOrDefault(obj, key + suffix, + defaultPromisified); + return val ? isPromisified(val) : false; +} +function checkValid(ret, suffix, suffixRegexp) { + for (var i = 0; i < ret.length; i += 2) { + var key = ret[i]; + if (suffixRegexp.test(key)) { + var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""); + for (var j = 0; j < ret.length; j += 2) { + if (ret[j] === keyWithoutAsyncSuffix) { + throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/iWrZbw\u000a" + .replace("%s", suffix)); + } + } + } + } +} + +function promisifiableMethods(obj, suffix, suffixRegexp, filter) { + var keys = util.inheritedDataKeys(obj); + var ret = []; + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var value = obj[key]; + var passesDefaultFilter = filter === defaultFilter + ? true : defaultFilter(key, value, obj); + if (typeof value === "function" && + !isPromisified(value) && + !hasPromisified(obj, key, suffix) && + filter(key, value, obj, passesDefaultFilter)) { + ret.push(key, value); + } + } + checkValid(ret, suffix, suffixRegexp); + return ret; +} + +var escapeIdentRegex = function(str) { + return str.replace(/([$])/, "\\$"); +}; + +var makeNodePromisifiedEval; +if (!false) { +var switchCaseArgumentOrder = function(likelyArgumentCount) { + var ret = [likelyArgumentCount]; + var min = Math.max(0, likelyArgumentCount - 1 - 3); + for(var i = likelyArgumentCount - 1; i >= min; --i) { + ret.push(i); + } + for(var i = likelyArgumentCount + 1; i <= 3; ++i) { + ret.push(i); + } + return ret; +}; + +var argumentSequence = function(argumentCount) { + return util.filledRange(argumentCount, "_arg", ""); +}; + +var parameterDeclaration = function(parameterCount) { + return util.filledRange( + Math.max(parameterCount, 3), "_arg", ""); +}; + +var parameterCount = function(fn) { + if (typeof fn.length === "number") { + return Math.max(Math.min(fn.length, 1023 + 1), 0); + } + return 0; +}; + +makeNodePromisifiedEval = +function(callback, receiver, originalName, fn) { + var newParameterCount = Math.max(0, parameterCount(fn) - 1); + var argumentOrder = switchCaseArgumentOrder(newParameterCount); + var shouldProxyThis = typeof callback === "string" || receiver === THIS; + + function generateCallForArgumentCount(count) { + var args = argumentSequence(count).join(", "); + var comma = count > 0 ? ", " : ""; + var ret; + if (shouldProxyThis) { + ret = "ret = callback.call(this, {{args}}, nodeback); break;\n"; + } else { + ret = receiver === undefined + ? "ret = callback({{args}}, nodeback); break;\n" + : "ret = callback.call(receiver, {{args}}, nodeback); break;\n"; + } + return ret.replace("{{args}}", args).replace(", ", comma); + } + + function generateArgumentSwitchCase() { + var ret = ""; + for (var i = 0; i < argumentOrder.length; ++i) { + ret += "case " + argumentOrder[i] +":" + + generateCallForArgumentCount(argumentOrder[i]); + } + + ret += " \n\ + default: \n\ + var args = new Array(len + 1); \n\ + var i = 0; \n\ + for (var i = 0; i < len; ++i) { \n\ + args[i] = arguments[i]; \n\ + } \n\ + args[i] = nodeback; \n\ + [CodeForCall] \n\ + break; \n\ + ".replace("[CodeForCall]", (shouldProxyThis + ? "ret = callback.apply(this, args);\n" + : "ret = callback.apply(receiver, args);\n")); + return ret; + } + + var getFunctionCode = typeof callback === "string" + ? ("this != null ? this['"+callback+"'] : fn") + : "fn"; + + return new Function("Promise", + "fn", + "receiver", + "withAppended", + "maybeWrapAsError", + "nodebackForPromise", + "tryCatch", + "errorObj", + "INTERNAL","'use strict'; \n\ + var ret = function (Parameters) { \n\ + 'use strict'; \n\ + var len = arguments.length; \n\ + var promise = new Promise(INTERNAL); \n\ + promise._captureStackTrace(); \n\ + var nodeback = nodebackForPromise(promise); \n\ + var ret; \n\ + var callback = tryCatch([GetFunctionCode]); \n\ + switch(len) { \n\ + [CodeForSwitchCase] \n\ + } \n\ + if (ret === errorObj) { \n\ + promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\ + } \n\ + return promise; \n\ + }; \n\ + ret.__isPromisified__ = true; \n\ + return ret; \n\ + " + .replace("Parameters", parameterDeclaration(newParameterCount)) + .replace("[CodeForSwitchCase]", generateArgumentSwitchCase()) + .replace("[GetFunctionCode]", getFunctionCode))( + Promise, + fn, + receiver, + withAppended, + maybeWrapAsError, + nodebackForPromise, + util.tryCatch, + util.errorObj, + INTERNAL + ); +}; +} + +function makeNodePromisifiedClosure(callback, receiver, _, fn) { + var defaultThis = (function() {return this;})(); + var method = callback; + if (typeof method === "string") { + callback = fn; + } + function promisified() { + var _receiver = receiver; + if (receiver === THIS) _receiver = this; + var promise = new Promise(INTERNAL); + promise._captureStackTrace(); + var cb = typeof method === "string" && this !== defaultThis + ? this[method] : callback; + var fn = nodebackForPromise(promise); + try { + cb.apply(_receiver, withAppended(arguments, fn)); + } catch(e) { + promise._rejectCallback(maybeWrapAsError(e), true, true); + } + return promise; + } + promisified.__isPromisified__ = true; + return promisified; +} + +var makeNodePromisified = canEvaluate + ? makeNodePromisifiedEval + : makeNodePromisifiedClosure; + +function promisifyAll(obj, suffix, filter, promisifier) { + var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"); + var methods = + promisifiableMethods(obj, suffix, suffixRegexp, filter); + + for (var i = 0, len = methods.length; i < len; i+= 2) { + var key = methods[i]; + var fn = methods[i+1]; + var promisifiedKey = key + suffix; + obj[promisifiedKey] = promisifier === makeNodePromisified + ? makeNodePromisified(key, THIS, key, fn, suffix) + : promisifier(fn, function() { + return makeNodePromisified(key, THIS, key, fn, suffix); + }); + } + util.toFastProperties(obj); + return obj; +} + +function promisify(callback, receiver) { + return makeNodePromisified(callback, receiver, undefined, callback); +} + +Promise.promisify = function (fn, receiver) { + if (typeof fn !== "function") { + throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); + } + if (isPromisified(fn)) { + return fn; + } + var ret = promisify(fn, arguments.length < 2 ? THIS : receiver); + util.copyDescriptors(fn, ret, propsFilter); + return ret; +}; + +Promise.promisifyAll = function (target, options) { + if (typeof target !== "function" && typeof target !== "object") { + throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/9ITlV0\u000a"); + } + options = Object(options); + var suffix = options.suffix; + if (typeof suffix !== "string") suffix = defaultSuffix; + var filter = options.filter; + if (typeof filter !== "function") filter = defaultFilter; + var promisifier = options.promisifier; + if (typeof promisifier !== "function") promisifier = makeNodePromisified; + + if (!util.isIdentifier(suffix)) { + throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/8FZo5V\u000a"); + } + + var keys = util.inheritedDataKeys(target); + for (var i = 0; i < keys.length; ++i) { + var value = target[keys[i]]; + if (keys[i] !== "constructor" && + util.isClass(value)) { + promisifyAll(value.prototype, suffix, filter, promisifier); + promisifyAll(value, suffix, filter, promisifier); + } + } + + return promisifyAll(target, suffix, filter, promisifier); +}; +}; + diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/props.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/props.js new file mode 100644 index 00000000000..d6f9e64b074 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/props.js @@ -0,0 +1,79 @@ +"use strict"; +module.exports = function( + Promise, PromiseArray, tryConvertToPromise, apiRejection) { +var util = require("./util.js"); +var isObject = util.isObject; +var es5 = require("./es5.js"); + +function PropertiesPromiseArray(obj) { + var keys = es5.keys(obj); + var len = keys.length; + var values = new Array(len * 2); + for (var i = 0; i < len; ++i) { + var key = keys[i]; + values[i] = obj[key]; + values[i + len] = key; + } + this.constructor$(values); +} +util.inherits(PropertiesPromiseArray, PromiseArray); + +PropertiesPromiseArray.prototype._init = function () { + this._init$(undefined, -3) ; +}; + +PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) { + this._values[index] = value; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + var val = {}; + var keyOffset = this.length(); + for (var i = 0, len = this.length(); i < len; ++i) { + val[this._values[i + keyOffset]] = this._values[i]; + } + this._resolve(val); + } +}; + +PropertiesPromiseArray.prototype._promiseProgressed = function (value, index) { + this._promise._progress({ + key: this._values[index + this.length()], + value: value + }); +}; + +PropertiesPromiseArray.prototype.shouldCopyValues = function () { + return false; +}; + +PropertiesPromiseArray.prototype.getActualLength = function (len) { + return len >> 1; +}; + +function props(promises) { + var ret; + var castValue = tryConvertToPromise(promises); + + if (!isObject(castValue)) { + return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/OsFKC8\u000a"); + } else if (castValue instanceof Promise) { + ret = castValue._then( + Promise.props, undefined, undefined, undefined, undefined); + } else { + ret = new PropertiesPromiseArray(castValue).promise(); + } + + if (castValue instanceof Promise) { + ret._propagateFrom(castValue, 4); + } + return ret; +} + +Promise.prototype.props = function () { + return props(this); +}; + +Promise.props = function (promises) { + return props(promises); +}; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/queue.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/queue.js new file mode 100644 index 00000000000..84d57d5f62d --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/queue.js @@ -0,0 +1,90 @@ +"use strict"; +function arrayMove(src, srcIndex, dst, dstIndex, len) { + for (var j = 0; j < len; ++j) { + dst[j + dstIndex] = src[j + srcIndex]; + src[j + srcIndex] = void 0; + } +} + +function Queue(capacity) { + this._capacity = capacity; + this._length = 0; + this._front = 0; +} + +Queue.prototype._willBeOverCapacity = function (size) { + return this._capacity < size; +}; + +Queue.prototype._pushOne = function (arg) { + var length = this.length(); + this._checkCapacity(length + 1); + var i = (this._front + length) & (this._capacity - 1); + this[i] = arg; + this._length = length + 1; +}; + +Queue.prototype._unshiftOne = function(value) { + var capacity = this._capacity; + this._checkCapacity(this.length() + 1); + var front = this._front; + var i = (((( front - 1 ) & + ( capacity - 1) ) ^ capacity ) - capacity ); + this[i] = value; + this._front = i; + this._length = this.length() + 1; +}; + +Queue.prototype.unshift = function(fn, receiver, arg) { + this._unshiftOne(arg); + this._unshiftOne(receiver); + this._unshiftOne(fn); +}; + +Queue.prototype.push = function (fn, receiver, arg) { + var length = this.length() + 3; + if (this._willBeOverCapacity(length)) { + this._pushOne(fn); + this._pushOne(receiver); + this._pushOne(arg); + return; + } + var j = this._front + length - 3; + this._checkCapacity(length); + var wrapMask = this._capacity - 1; + this[(j + 0) & wrapMask] = fn; + this[(j + 1) & wrapMask] = receiver; + this[(j + 2) & wrapMask] = arg; + this._length = length; +}; + +Queue.prototype.shift = function () { + var front = this._front, + ret = this[front]; + + this[front] = undefined; + this._front = (front + 1) & (this._capacity - 1); + this._length--; + return ret; +}; + +Queue.prototype.length = function () { + return this._length; +}; + +Queue.prototype._checkCapacity = function (size) { + if (this._capacity < size) { + this._resizeTo(this._capacity << 1); + } +}; + +Queue.prototype._resizeTo = function (capacity) { + var oldCapacity = this._capacity; + this._capacity = capacity; + var front = this._front; + var length = this._length; + var moveItemsCount = (front + length) & (oldCapacity - 1); + arrayMove(this, 0, this, oldCapacity, moveItemsCount); +}; + +module.exports = Queue; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/race.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/race.js new file mode 100644 index 00000000000..30e7bb094ea --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/race.js @@ -0,0 +1,47 @@ +"use strict"; +module.exports = function( + Promise, INTERNAL, tryConvertToPromise, apiRejection) { +var isArray = require("./util.js").isArray; + +var raceLater = function (promise) { + return promise.then(function(array) { + return race(array, promise); + }); +}; + +function race(promises, parent) { + var maybePromise = tryConvertToPromise(promises); + + if (maybePromise instanceof Promise) { + return raceLater(maybePromise); + } else if (!isArray(promises)) { + return apiRejection("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a"); + } + + var ret = new Promise(INTERNAL); + if (parent !== undefined) { + ret._propagateFrom(parent, 4 | 1); + } + var fulfill = ret._fulfill; + var reject = ret._reject; + for (var i = 0, len = promises.length; i < len; ++i) { + var val = promises[i]; + + if (val === undefined && !(i in promises)) { + continue; + } + + Promise.cast(val)._then(fulfill, reject, undefined, ret, null); + } + return ret; +} + +Promise.race = function (promises) { + return race(promises, undefined); +}; + +Promise.prototype.race = function () { + return race(this, undefined); +}; + +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/reduce.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/reduce.js new file mode 100644 index 00000000000..319222012b3 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/reduce.js @@ -0,0 +1,146 @@ +"use strict"; +module.exports = function(Promise, + PromiseArray, + apiRejection, + tryConvertToPromise, + INTERNAL) { +var async = require("./async.js"); +var util = require("./util.js"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +function ReductionPromiseArray(promises, fn, accum, _each) { + this.constructor$(promises); + this._promise._captureStackTrace(); + this._preservedValues = _each === INTERNAL ? [] : null; + this._zerothIsAccum = (accum === undefined); + this._gotAccum = false; + this._reducingIndex = (this._zerothIsAccum ? 1 : 0); + this._valuesPhase = undefined; + var maybePromise = tryConvertToPromise(accum, this._promise); + var rejected = false; + var isPromise = maybePromise instanceof Promise; + if (isPromise) { + maybePromise = maybePromise._target(); + if (maybePromise._isPending()) { + maybePromise._proxyPromiseArray(this, -1); + } else if (maybePromise._isFulfilled()) { + accum = maybePromise._value(); + this._gotAccum = true; + } else { + this._reject(maybePromise._reason()); + rejected = true; + } + } + if (!(isPromise || this._zerothIsAccum)) this._gotAccum = true; + this._callback = fn; + this._accum = accum; + if (!rejected) async.invoke(init, this, undefined); +} +function init() { + this._init$(undefined, -5); +} +util.inherits(ReductionPromiseArray, PromiseArray); + +ReductionPromiseArray.prototype._init = function () {}; + +ReductionPromiseArray.prototype._resolveEmptyArray = function () { + if (this._gotAccum || this._zerothIsAccum) { + this._resolve(this._preservedValues !== null + ? [] : this._accum); + } +}; + +ReductionPromiseArray.prototype._promiseFulfilled = function (value, index) { + var values = this._values; + values[index] = value; + var length = this.length(); + var preservedValues = this._preservedValues; + var isEach = preservedValues !== null; + var gotAccum = this._gotAccum; + var valuesPhase = this._valuesPhase; + var valuesPhaseIndex; + if (!valuesPhase) { + valuesPhase = this._valuesPhase = new Array(length); + for (valuesPhaseIndex=0; valuesPhaseIndex= this._length) { + this._resolve(this._values); + } +}; + +SettledPromiseArray.prototype._promiseFulfilled = function (value, index) { + var ret = new PromiseInspection(); + ret._bitField = 268435456; + ret._settledValue = value; + this._promiseResolved(index, ret); +}; +SettledPromiseArray.prototype._promiseRejected = function (reason, index) { + var ret = new PromiseInspection(); + ret._bitField = 134217728; + ret._settledValue = reason; + this._promiseResolved(index, ret); +}; + +Promise.settle = function (promises) { + return new SettledPromiseArray(promises).promise(); +}; + +Promise.prototype.settle = function () { + return new SettledPromiseArray(this).promise(); +}; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/some.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/some.js new file mode 100644 index 00000000000..f3968cf1fad --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/some.js @@ -0,0 +1,125 @@ +"use strict"; +module.exports = +function(Promise, PromiseArray, apiRejection) { +var util = require("./util.js"); +var RangeError = require("./errors.js").RangeError; +var AggregateError = require("./errors.js").AggregateError; +var isArray = util.isArray; + + +function SomePromiseArray(values) { + this.constructor$(values); + this._howMany = 0; + this._unwrap = false; + this._initialized = false; +} +util.inherits(SomePromiseArray, PromiseArray); + +SomePromiseArray.prototype._init = function () { + if (!this._initialized) { + return; + } + if (this._howMany === 0) { + this._resolve([]); + return; + } + this._init$(undefined, -5); + var isArrayResolved = isArray(this._values); + if (!this._isResolved() && + isArrayResolved && + this._howMany > this._canPossiblyFulfill()) { + this._reject(this._getRangeError(this.length())); + } +}; + +SomePromiseArray.prototype.init = function () { + this._initialized = true; + this._init(); +}; + +SomePromiseArray.prototype.setUnwrap = function () { + this._unwrap = true; +}; + +SomePromiseArray.prototype.howMany = function () { + return this._howMany; +}; + +SomePromiseArray.prototype.setHowMany = function (count) { + this._howMany = count; +}; + +SomePromiseArray.prototype._promiseFulfilled = function (value) { + this._addFulfilled(value); + if (this._fulfilled() === this.howMany()) { + this._values.length = this.howMany(); + if (this.howMany() === 1 && this._unwrap) { + this._resolve(this._values[0]); + } else { + this._resolve(this._values); + } + } + +}; +SomePromiseArray.prototype._promiseRejected = function (reason) { + this._addRejected(reason); + if (this.howMany() > this._canPossiblyFulfill()) { + var e = new AggregateError(); + for (var i = this.length(); i < this._values.length; ++i) { + e.push(this._values[i]); + } + this._reject(e); + } +}; + +SomePromiseArray.prototype._fulfilled = function () { + return this._totalResolved; +}; + +SomePromiseArray.prototype._rejected = function () { + return this._values.length - this.length(); +}; + +SomePromiseArray.prototype._addRejected = function (reason) { + this._values.push(reason); +}; + +SomePromiseArray.prototype._addFulfilled = function (value) { + this._values[this._totalResolved++] = value; +}; + +SomePromiseArray.prototype._canPossiblyFulfill = function () { + return this.length() - this._rejected(); +}; + +SomePromiseArray.prototype._getRangeError = function (count) { + var message = "Input array must contain at least " + + this._howMany + " items but contains only " + count + " items"; + return new RangeError(message); +}; + +SomePromiseArray.prototype._resolveEmptyArray = function () { + this._reject(this._getRangeError(0)); +}; + +function some(promises, howMany) { + if ((howMany | 0) !== howMany || howMany < 0) { + return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/1wAmHx\u000a"); + } + var ret = new SomePromiseArray(promises); + var promise = ret.promise(); + ret.setHowMany(howMany); + ret.init(); + return promise; +} + +Promise.some = function (promises, howMany) { + return some(promises, howMany); +}; + +Promise.prototype.some = function (howMany) { + return some(this, howMany); +}; + +Promise._SomePromiseArray = SomePromiseArray; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/synchronous_inspection.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/synchronous_inspection.js new file mode 100644 index 00000000000..7aac1496d5f --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/synchronous_inspection.js @@ -0,0 +1,94 @@ +"use strict"; +module.exports = function(Promise) { +function PromiseInspection(promise) { + if (promise !== undefined) { + promise = promise._target(); + this._bitField = promise._bitField; + this._settledValue = promise._settledValue; + } + else { + this._bitField = 0; + this._settledValue = undefined; + } +} + +PromiseInspection.prototype.value = function () { + if (!this.isFulfilled()) { + throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/hc1DLj\u000a"); + } + return this._settledValue; +}; + +PromiseInspection.prototype.error = +PromiseInspection.prototype.reason = function () { + if (!this.isRejected()) { + throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/hPuiwB\u000a"); + } + return this._settledValue; +}; + +PromiseInspection.prototype.isFulfilled = +Promise.prototype._isFulfilled = function () { + return (this._bitField & 268435456) > 0; +}; + +PromiseInspection.prototype.isRejected = +Promise.prototype._isRejected = function () { + return (this._bitField & 134217728) > 0; +}; + +PromiseInspection.prototype.isPending = +Promise.prototype._isPending = function () { + return (this._bitField & 402653184) === 0; +}; + +PromiseInspection.prototype.isResolved = +Promise.prototype._isResolved = function () { + return (this._bitField & 402653184) > 0; +}; + +Promise.prototype.isPending = function() { + return this._target()._isPending(); +}; + +Promise.prototype.isRejected = function() { + return this._target()._isRejected(); +}; + +Promise.prototype.isFulfilled = function() { + return this._target()._isFulfilled(); +}; + +Promise.prototype.isResolved = function() { + return this._target()._isResolved(); +}; + +Promise.prototype._value = function() { + return this._settledValue; +}; + +Promise.prototype._reason = function() { + this._unsetRejectionIsUnhandled(); + return this._settledValue; +}; + +Promise.prototype.value = function() { + var target = this._target(); + if (!target.isFulfilled()) { + throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/hc1DLj\u000a"); + } + return target._settledValue; +}; + +Promise.prototype.reason = function() { + var target = this._target(); + if (!target.isRejected()) { + throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/hPuiwB\u000a"); + } + target._unsetRejectionIsUnhandled(); + return target._settledValue; +}; + + +Promise.PromiseInspection = PromiseInspection; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/thenables.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/thenables.js new file mode 100644 index 00000000000..c858f86ab5d --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/thenables.js @@ -0,0 +1,89 @@ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var util = require("./util.js"); +var errorObj = util.errorObj; +var isObject = util.isObject; + +function tryConvertToPromise(obj, context) { + if (isObject(obj)) { + if (obj instanceof Promise) { + return obj; + } + else if (isAnyBluebirdPromise(obj)) { + var ret = new Promise(INTERNAL); + obj._then( + ret._fulfillUnchecked, + ret._rejectUncheckedCheckError, + ret._progressUnchecked, + ret, + null + ); + return ret; + } + var then = util.tryCatch(getThen)(obj); + if (then === errorObj) { + if (context) context._pushContext(); + var ret = Promise.reject(then.e); + if (context) context._popContext(); + return ret; + } else if (typeof then === "function") { + return doThenable(obj, then, context); + } + } + return obj; +} + +function getThen(obj) { + return obj.then; +} + +var hasProp = {}.hasOwnProperty; +function isAnyBluebirdPromise(obj) { + return hasProp.call(obj, "_promise0"); +} + +function doThenable(x, then, context) { + var promise = new Promise(INTERNAL); + var ret = promise; + if (context) context._pushContext(); + promise._captureStackTrace(); + if (context) context._popContext(); + var synchronous = true; + var result = util.tryCatch(then).call(x, + resolveFromThenable, + rejectFromThenable, + progressFromThenable); + synchronous = false; + if (promise && result === errorObj) { + promise._rejectCallback(result.e, true, true); + promise = null; + } + + function resolveFromThenable(value) { + if (!promise) return; + if (x === value) { + promise._rejectCallback( + Promise._makeSelfResolutionError(), false, true); + } else { + promise._resolveCallback(value); + } + promise = null; + } + + function rejectFromThenable(reason) { + if (!promise) return; + promise._rejectCallback(reason, synchronous, true); + promise = null; + } + + function progressFromThenable(value) { + if (!promise) return; + if (typeof promise._progress === "function") { + promise._progress(value); + } + } + return ret; +} + +return tryConvertToPromise; +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/timers.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/timers.js new file mode 100644 index 00000000000..ecf1b57658a --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/timers.js @@ -0,0 +1,58 @@ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var util = require("./util.js"); +var TimeoutError = Promise.TimeoutError; + +var afterTimeout = function (promise, message) { + if (!promise.isPending()) return; + if (typeof message !== "string") { + message = "operation timed out"; + } + var err = new TimeoutError(message); + util.markAsOriginatingFromRejection(err); + promise._attachExtraTrace(err); + promise._cancel(err); +}; + +var afterValue = function(value) { return delay(+this).thenReturn(value); }; +var delay = Promise.delay = function (value, ms) { + if (ms === undefined) { + ms = value; + value = undefined; + var ret = new Promise(INTERNAL); + setTimeout(function() { ret._fulfill(); }, ms); + return ret; + } + ms = +ms; + return Promise.resolve(value)._then(afterValue, null, null, ms, undefined); +}; + +Promise.prototype.delay = function (ms) { + return delay(this, ms); +}; + +function successClear(value) { + var handle = this; + if (handle instanceof Number) handle = +handle; + clearTimeout(handle); + return value; +} + +function failureClear(reason) { + var handle = this; + if (handle instanceof Number) handle = +handle; + clearTimeout(handle); + throw reason; +} + +Promise.prototype.timeout = function (ms, message) { + ms = +ms; + var ret = this.then().cancellable(); + ret._cancellationParent = this; + var handle = setTimeout(function timeoutTimeout() { + afterTimeout(ret, message); + }, ms); + return ret._then(successClear, failureClear, undefined, handle, undefined); +}; + +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/using.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/using.js new file mode 100644 index 00000000000..40387117b69 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/using.js @@ -0,0 +1,202 @@ +"use strict"; +module.exports = function (Promise, apiRejection, tryConvertToPromise, + createContext) { + var TypeError = require("./errors.js").TypeError; + var inherits = require("./util.js").inherits; + var PromiseInspection = Promise.PromiseInspection; + + function inspectionMapper(inspections) { + var len = inspections.length; + for (var i = 0; i < len; ++i) { + var inspection = inspections[i]; + if (inspection.isRejected()) { + return Promise.reject(inspection.error()); + } + inspections[i] = inspection._settledValue; + } + return inspections; + } + + function thrower(e) { + setTimeout(function(){throw e;}, 0); + } + + function castPreservingDisposable(thenable) { + var maybePromise = tryConvertToPromise(thenable); + if (maybePromise !== thenable && + typeof thenable._isDisposable === "function" && + typeof thenable._getDisposer === "function" && + thenable._isDisposable()) { + maybePromise._setDisposable(thenable._getDisposer()); + } + return maybePromise; + } + function dispose(resources, inspection) { + var i = 0; + var len = resources.length; + var ret = Promise.defer(); + function iterator() { + if (i >= len) return ret.resolve(); + var maybePromise = castPreservingDisposable(resources[i++]); + if (maybePromise instanceof Promise && + maybePromise._isDisposable()) { + try { + maybePromise = tryConvertToPromise( + maybePromise._getDisposer().tryDispose(inspection), + resources.promise); + } catch (e) { + return thrower(e); + } + if (maybePromise instanceof Promise) { + return maybePromise._then(iterator, thrower, + null, null, null); + } + } + iterator(); + } + iterator(); + return ret.promise; + } + + function disposerSuccess(value) { + var inspection = new PromiseInspection(); + inspection._settledValue = value; + inspection._bitField = 268435456; + return dispose(this, inspection).thenReturn(value); + } + + function disposerFail(reason) { + var inspection = new PromiseInspection(); + inspection._settledValue = reason; + inspection._bitField = 134217728; + return dispose(this, inspection).thenThrow(reason); + } + + function Disposer(data, promise, context) { + this._data = data; + this._promise = promise; + this._context = context; + } + + Disposer.prototype.data = function () { + return this._data; + }; + + Disposer.prototype.promise = function () { + return this._promise; + }; + + Disposer.prototype.resource = function () { + if (this.promise().isFulfilled()) { + return this.promise().value(); + } + return null; + }; + + Disposer.prototype.tryDispose = function(inspection) { + var resource = this.resource(); + var context = this._context; + if (context !== undefined) context._pushContext(); + var ret = resource !== null + ? this.doDispose(resource, inspection) : null; + if (context !== undefined) context._popContext(); + this._promise._unsetDisposable(); + this._data = null; + return ret; + }; + + Disposer.isDisposer = function (d) { + return (d != null && + typeof d.resource === "function" && + typeof d.tryDispose === "function"); + }; + + function FunctionDisposer(fn, promise, context) { + this.constructor$(fn, promise, context); + } + inherits(FunctionDisposer, Disposer); + + FunctionDisposer.prototype.doDispose = function (resource, inspection) { + var fn = this.data(); + return fn.call(resource, resource, inspection); + }; + + function maybeUnwrapDisposer(value) { + if (Disposer.isDisposer(value)) { + this.resources[this.index]._setDisposable(value); + return value.promise(); + } + return value; + } + + Promise.using = function () { + var len = arguments.length; + if (len < 2) return apiRejection( + "you must pass at least 2 arguments to Promise.using"); + var fn = arguments[len - 1]; + if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); + len--; + var resources = new Array(len); + for (var i = 0; i < len; ++i) { + var resource = arguments[i]; + if (Disposer.isDisposer(resource)) { + var disposer = resource; + resource = resource.promise(); + resource._setDisposable(disposer); + } else { + var maybePromise = tryConvertToPromise(resource); + if (maybePromise instanceof Promise) { + resource = + maybePromise._then(maybeUnwrapDisposer, null, null, { + resources: resources, + index: i + }, undefined); + } + } + resources[i] = resource; + } + + var promise = Promise.settle(resources) + .then(inspectionMapper) + .then(function(vals) { + promise._pushContext(); + var ret; + try { + ret = fn.apply(undefined, vals); + } finally { + promise._popContext(); + } + return ret; + }) + ._then( + disposerSuccess, disposerFail, undefined, resources, undefined); + resources.promise = promise; + return promise; + }; + + Promise.prototype._setDisposable = function (disposer) { + this._bitField = this._bitField | 262144; + this._disposer = disposer; + }; + + Promise.prototype._isDisposable = function () { + return (this._bitField & 262144) > 0; + }; + + Promise.prototype._getDisposer = function () { + return this._disposer; + }; + + Promise.prototype._unsetDisposable = function () { + this._bitField = this._bitField & (~262144); + this._disposer = undefined; + }; + + Promise.prototype.disposer = function (fn) { + if (typeof fn === "function") { + return new FunctionDisposer(fn, this, createContext()); + } + throw new TypeError(); + }; + +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/util.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/util.js new file mode 100644 index 00000000000..ab67f8759de --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/main/util.js @@ -0,0 +1,284 @@ +"use strict"; +var es5 = require("./es5.js"); +var canEvaluate = typeof navigator == "undefined"; +var haveGetters = (function(){ + try { + var o = {}; + es5.defineProperty(o, "f", { + get: function () { + return 3; + } + }); + return o.f === 3; + } + catch (e) { + return false; + } + +})(); + +var errorObj = {e: {}}; +var tryCatchTarget; +function tryCatcher() { + try { + return tryCatchTarget.apply(this, arguments); + } catch (e) { + errorObj.e = e; + return errorObj; + } +} +function tryCatch(fn) { + tryCatchTarget = fn; + return tryCatcher; +} + +var inherits = function(Child, Parent) { + var hasProp = {}.hasOwnProperty; + + function T() { + this.constructor = Child; + this.constructor$ = Parent; + for (var propertyName in Parent.prototype) { + if (hasProp.call(Parent.prototype, propertyName) && + propertyName.charAt(propertyName.length-1) !== "$" + ) { + this[propertyName + "$"] = Parent.prototype[propertyName]; + } + } + } + T.prototype = Parent.prototype; + Child.prototype = new T(); + return Child.prototype; +}; + + +function isPrimitive(val) { + return val == null || val === true || val === false || + typeof val === "string" || typeof val === "number"; + +} + +function isObject(value) { + return !isPrimitive(value); +} + +function maybeWrapAsError(maybeError) { + if (!isPrimitive(maybeError)) return maybeError; + + return new Error(safeToString(maybeError)); +} + +function withAppended(target, appendee) { + var len = target.length; + var ret = new Array(len + 1); + var i; + for (i = 0; i < len; ++i) { + ret[i] = target[i]; + } + ret[i] = appendee; + return ret; +} + +function getDataPropertyOrDefault(obj, key, defaultValue) { + if (es5.isES5) { + var desc = Object.getOwnPropertyDescriptor(obj, key); + if (desc != null) { + return desc.get == null && desc.set == null + ? desc.value + : defaultValue; + } + } else { + return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined; + } +} + +function notEnumerableProp(obj, name, value) { + if (isPrimitive(obj)) return obj; + var descriptor = { + value: value, + configurable: true, + enumerable: false, + writable: true + }; + es5.defineProperty(obj, name, descriptor); + return obj; +} + + +var wrapsPrimitiveReceiver = (function() { + return this !== "string"; +}).call("string"); + +function thrower(r) { + throw r; +} + +var inheritedDataKeys = (function() { + if (es5.isES5) { + var oProto = Object.prototype; + var getKeys = Object.getOwnPropertyNames; + return function(obj) { + var ret = []; + var visitedKeys = Object.create(null); + while (obj != null && obj !== oProto) { + var keys; + try { + keys = getKeys(obj); + } catch (e) { + return ret; + } + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (visitedKeys[key]) continue; + visitedKeys[key] = true; + var desc = Object.getOwnPropertyDescriptor(obj, key); + if (desc != null && desc.get == null && desc.set == null) { + ret.push(key); + } + } + obj = es5.getPrototypeOf(obj); + } + return ret; + }; + } else { + return function(obj) { + var ret = []; + /*jshint forin:false */ + for (var key in obj) { + ret.push(key); + } + return ret; + }; + } + +})(); + +function isClass(fn) { + try { + if (typeof fn === "function") { + var keys = es5.names(fn.prototype); + if (es5.isES5) return keys.length > 1; + return keys.length > 0 && + !(keys.length === 1 && keys[0] === "constructor"); + } + return false; + } catch (e) { + return false; + } +} + +function toFastProperties(obj) { + /*jshint -W027,-W055,-W031*/ + function f() {} + f.prototype = obj; + var l = 8; + while (l--) new f(); + return obj; + eval(obj); +} + +var rident = /^[a-z$_][a-z$_0-9]*$/i; +function isIdentifier(str) { + return rident.test(str); +} + +function filledRange(count, prefix, suffix) { + var ret = new Array(count); + for(var i = 0; i < count; ++i) { + ret[i] = prefix + i + suffix; + } + return ret; +} + +function safeToString(obj) { + try { + return obj + ""; + } catch (e) { + return "[no string representation]"; + } +} + +function markAsOriginatingFromRejection(e) { + try { + notEnumerableProp(e, "isOperational", true); + } + catch(ignore) {} +} + +function originatesFromRejection(e) { + if (e == null) return false; + return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) || + e["isOperational"] === true); +} + +function canAttachTrace(obj) { + return obj instanceof Error && es5.propertyIsWritable(obj, "stack"); +} + +var ensureErrorObject = (function() { + if (!("stack" in new Error())) { + return function(value) { + if (canAttachTrace(value)) return value; + try {throw new Error(safeToString(value));} + catch(err) {return err;} + }; + } else { + return function(value) { + if (canAttachTrace(value)) return value; + return new Error(safeToString(value)); + }; + } +})(); + +function classString(obj) { + return {}.toString.call(obj); +} + +function copyDescriptors(from, to, filter) { + var keys = es5.names(from); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (filter(key)) { + es5.defineProperty(to, key, es5.getDescriptor(from, key)); + } + } +} + +var ret = { + isClass: isClass, + isIdentifier: isIdentifier, + inheritedDataKeys: inheritedDataKeys, + getDataPropertyOrDefault: getDataPropertyOrDefault, + thrower: thrower, + isArray: es5.isArray, + haveGetters: haveGetters, + notEnumerableProp: notEnumerableProp, + isPrimitive: isPrimitive, + isObject: isObject, + canEvaluate: canEvaluate, + errorObj: errorObj, + tryCatch: tryCatch, + inherits: inherits, + withAppended: withAppended, + maybeWrapAsError: maybeWrapAsError, + wrapsPrimitiveReceiver: wrapsPrimitiveReceiver, + toFastProperties: toFastProperties, + filledRange: filledRange, + toString: safeToString, + canAttachTrace: canAttachTrace, + ensureErrorObject: ensureErrorObject, + originatesFromRejection: originatesFromRejection, + markAsOriginatingFromRejection: markAsOriginatingFromRejection, + classString: classString, + copyDescriptors: copyDescriptors, + hasDevTools: typeof chrome !== "undefined" && chrome && + typeof chrome.loadTimes === "function", + isNode: typeof process !== "undefined" && + classString(process).toLowerCase() === "[object process]" +}; +ret.isRecentNode = ret.isNode && (function() { + var version = process.versions.node.split(".").map(Number); + return (version[0] === 0 && version[1] > 10) || (version[0] > 0); +})(); +try {throw new Error(); } catch (e) {ret.lastLineError = e;} +module.exports = ret; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/package.json b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/package.json new file mode 100644 index 00000000000..2bb86a9a1fa --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/bluebird/package.json @@ -0,0 +1,98 @@ +{ + "name": "bluebird", + "description": "Full featured Promises/A+ implementation with exceptionally good performance", + "version": "2.9.27", + "keywords": [ + "promise", + "performance", + "promises", + "promises-a", + "promises-aplus", + "async", + "await", + "deferred", + "deferreds", + "future", + "flow control", + "dsl", + "fluent interface" + ], + "scripts": { + "lint": "node scripts/jshint.js", + "test": "node tools/test.js", + "istanbul": "istanbul", + "prepublish": "node tools/build.js --no-debug --main --zalgo --browser --minify" + }, + "homepage": "https://github.com/petkaantonov/bluebird", + "repository": { + "type": "git", + "url": "git://github.com/petkaantonov/bluebird.git" + }, + "bugs": { + "url": "http://github.com/petkaantonov/bluebird/issues" + }, + "license": "MIT", + "author": { + "name": "Petka Antonov", + "email": "petka_antonov@hotmail.com", + "url": "http://github.com/petkaantonov/" + }, + "devDependencies": { + "acorn": "~0.6.0", + "baconjs": "^0.7.43", + "bluebird": "^2.9.2", + "body-parser": "^1.10.2", + "browserify": "^8.1.1", + "cli-table": "~0.3.1", + "co": "^4.2.0", + "cross-spawn": "^0.2.3", + "glob": "^4.3.2", + "grunt-saucelabs": "~8.4.1", + "highland": "^2.3.0", + "istanbul": "^0.3.5", + "jshint": "^2.6.0", + "jshint-stylish": "~0.2.0", + "mkdirp": "~0.5.0", + "mocha": "~2.1", + "open": "~0.0.5", + "optimist": "~0.6.1", + "rimraf": "~2.2.6", + "rx": "^2.3.25", + "serve-static": "^1.7.1", + "sinon": "~1.7.3", + "uglify-js": "~2.4.16", + "kefir": "^2.4.1" + }, + "main": "./js/main/bluebird.js", + "browser": "./js/browser/bluebird.js", + "files": [ + "js/browser", + "js/main", + "js/zalgo", + "LICENSE", + "zalgo.js" + ], + "gitHead": "634af0e27ff4faab62c6c5bfd105527abcf8b06e", + "_id": "bluebird@2.9.27", + "_shasum": "8eab7da1e866998f9f71c209b9875f9949a7adca", + "_from": "bluebird@>=2.9.26 <3.0.0", + "_npmVersion": "2.7.1", + "_nodeVersion": "1.6.2", + "_npmUser": { + "name": "esailija", + "email": "petka_antonov@hotmail.com" + }, + "maintainers": [ + { + "name": "esailija", + "email": "petka_antonov@hotmail.com" + } + ], + "dist": { + "shasum": "8eab7da1e866998f9f71c209b9875f9949a7adca", + "tarball": "http://registry.npmjs.org/bluebird/-/bluebird-2.9.27.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.9.27.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/index.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/index.js new file mode 100644 index 00000000000..4138a64dd91 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/index.js @@ -0,0 +1,100 @@ +'use strict'; +var escapeStringRegexp = require('escape-string-regexp'); +var ansiStyles = require('ansi-styles'); +var stripAnsi = require('strip-ansi'); +var hasAnsi = require('has-ansi'); +var supportsColor = require('supports-color'); +var defineProps = Object.defineProperties; + +function Chalk(options) { + // detect mode if not set manually + this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled; +} + +// use bright blue on Windows as the normal blue color is illegible +if (process.platform === 'win32') { + ansiStyles.blue.open = '\u001b[94m'; +} + +function build(_styles) { + var builder = function builder() { + return applyStyle.apply(builder, arguments); + }; + builder._styles = _styles; + builder.enabled = this.enabled; + // __proto__ is used because we must return a function, but there is + // no way to create a function with a different prototype. + builder.__proto__ = proto; + return builder; +} + +var styles = (function () { + var ret = {}; + + Object.keys(ansiStyles).forEach(function (key) { + ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); + + ret[key] = { + get: function () { + return build.call(this, this._styles.concat(key)); + } + }; + }); + + return ret; +})(); + +var proto = defineProps(function chalk() {}, styles); + +function applyStyle() { + // support varags, but simply cast to string in case there's only one arg + var args = arguments; + var argsLen = args.length; + var str = argsLen !== 0 && String(arguments[0]); + if (argsLen > 1) { + // don't slice `arguments`, it prevents v8 optimizations + for (var a = 1; a < argsLen; a++) { + str += ' ' + args[a]; + } + } + + if (!this.enabled || !str) { + return str; + } + + /*jshint validthis: true */ + var nestedStyles = this._styles; + + var i = nestedStyles.length; + while (i--) { + var code = ansiStyles[nestedStyles[i]]; + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + str = code.open + str.replace(code.closeRe, code.open) + code.close; + } + + return str; +} + +function init() { + var ret = {}; + + Object.keys(styles).forEach(function (name) { + ret[name] = { + get: function () { + return build.call(this, [name]); + } + }; + }); + + return ret; +} + +defineProps(Chalk.prototype, init()); + +module.exports = new Chalk(); +module.exports.styles = ansiStyles; +module.exports.hasColor = hasAnsi; +module.exports.stripColor = stripAnsi; +module.exports.supportsColor = supportsColor; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/license b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/license new file mode 100644 index 00000000000..654d0bfe943 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.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/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/ansi-styles/index.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/ansi-styles/index.js new file mode 100644 index 00000000000..caf9e119ebf --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/ansi-styles/index.js @@ -0,0 +1,56 @@ +'use strict'; + +var styles = module.exports = { + modifiers: { + reset: [0, 0], + bold: [1, 22], // 21 isn't widely supported and 22 does the same thing + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + colors: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39] + }, + bgColors: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49] + } +}; + +// fix humans +styles.colors.grey = styles.colors.gray; + +Object.keys(styles).forEach(function (groupName) { + var group = styles[groupName]; + + Object.keys(group).forEach(function (styleName) { + var style = group[styleName]; + + styles[styleName] = group[styleName] = { + open: '\u001b[' + style[0] + 'm', + close: '\u001b[' + style[1] + 'm' + }; + }); + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); +}); diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/ansi-styles/license b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/ansi-styles/license new file mode 100644 index 00000000000..654d0bfe943 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/ansi-styles/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.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/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/ansi-styles/package.json b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/ansi-styles/package.json new file mode 100644 index 00000000000..3ae71e3ab08 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/ansi-styles/package.json @@ -0,0 +1,71 @@ +{ + "name": "ansi-styles", + "version": "2.0.1", + "description": "ANSI escape codes for styling strings in the terminal", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/ansi-styles.git" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + { + "name": "Joshua Appelman", + "email": "jappelman@xebia.com", + "url": "http://jbnicolai.com" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "devDependencies": { + "mocha": "*" + }, + "readme": "# ansi-styles [![Build Status](https://travis-ci.org/sindresorhus/ansi-styles.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-styles)\n\n> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal\n\nYou probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings.\n\n![](screenshot.png)\n\n\n## Install\n\n```sh\n$ npm install --save ansi-styles\n```\n\n\n## Usage\n\n```js\nvar ansi = require('ansi-styles');\n\nconsole.log(ansi.green.open + 'Hello world!' + ansi.green.close);\n```\n\n\n## API\n\nEach style has an `open` and `close` property.\n\n\n## Styles\n\n### Modifiers\n\n- `reset`\n- `bold`\n- `dim`\n- `italic` *(not widely supported)*\n- `underline`\n- `inverse`\n- `hidden`\n- `strikethrough` *(not widely supported)*\n\n### Colors\n\n- `black`\n- `red`\n- `green`\n- `yellow`\n- `blue`\n- `magenta`\n- `cyan`\n- `white`\n- `gray`\n\n### Background colors\n\n- `bgBlack`\n- `bgRed`\n- `bgGreen`\n- `bgYellow`\n- `bgBlue`\n- `bgMagenta`\n- `bgCyan`\n- `bgWhite`\n\n\n## Advanced usage\n\nBy default you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.\n\n- `ansi.modifiers`\n- `ansi.colors`\n- `ansi.bgColors`\n\n\n###### Example\n\n```js\nconsole.log(ansi.colors.green.open);\n```\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n", + "readmeFilename": "readme.md", + "bugs": { + "url": "https://github.com/sindresorhus/ansi-styles/issues" + }, + "homepage": "https://github.com/sindresorhus/ansi-styles#readme", + "_id": "ansi-styles@2.0.1", + "_shasum": "b033f57f93e2d28adeb8bc11138fa13da0fd20a3", + "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.0.1.tgz", + "_from": "ansi-styles@>=2.0.1 <3.0.0" +} diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/ansi-styles/readme.md b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/ansi-styles/readme.md new file mode 100644 index 00000000000..89ec6a7c1ed --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/ansi-styles/readme.md @@ -0,0 +1,86 @@ +# ansi-styles [![Build Status](https://travis-ci.org/sindresorhus/ansi-styles.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-styles) + +> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal + +You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings. + +![](screenshot.png) + + +## Install + +```sh +$ npm install --save ansi-styles +``` + + +## Usage + +```js +var ansi = require('ansi-styles'); + +console.log(ansi.green.open + 'Hello world!' + ansi.green.close); +``` + + +## API + +Each style has an `open` and `close` property. + + +## Styles + +### Modifiers + +- `reset` +- `bold` +- `dim` +- `italic` *(not widely supported)* +- `underline` +- `inverse` +- `hidden` +- `strikethrough` *(not widely supported)* + +### Colors + +- `black` +- `red` +- `green` +- `yellow` +- `blue` +- `magenta` +- `cyan` +- `white` +- `gray` + +### Background colors + +- `bgBlack` +- `bgRed` +- `bgGreen` +- `bgYellow` +- `bgBlue` +- `bgMagenta` +- `bgCyan` +- `bgWhite` + + +## Advanced usage + +By default you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. + +- `ansi.modifiers` +- `ansi.colors` +- `ansi.bgColors` + + +###### Example + +```js +console.log(ansi.colors.green.open); +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/index.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/index.js new file mode 100644 index 00000000000..ac6572cabec --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/index.js @@ -0,0 +1,11 @@ +'use strict'; + +var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; + +module.exports = function (str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } + + return str.replace(matchOperatorsRe, '\\$&'); +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/license b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/license new file mode 100644 index 00000000000..654d0bfe943 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.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/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/package.json b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/package.json new file mode 100644 index 00000000000..b2bafb26a04 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/package.json @@ -0,0 +1,61 @@ +{ + "name": "escape-string-regexp", + "version": "1.0.3", + "description": "Escape RegExp special characters", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/escape-string-regexp.git" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + { + "name": "Joshua Appelman", + "email": "jappelman@xebia.com", + "url": "http://jbnicolai.com" + } + ], + "engines": { + "node": ">=0.8.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "regex", + "regexp", + "re", + "regular", + "expression", + "escape", + "string", + "str", + "special", + "characters" + ], + "devDependencies": { + "mocha": "*" + }, + "readme": "# escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp)\n\n> Escape RegExp special characters\n\n\n## Install\n\n```sh\n$ npm install --save escape-string-regexp\n```\n\n\n## Usage\n\n```js\nvar escapeStringRegexp = require('escape-string-regexp');\n\nvar escapedString = escapeStringRegexp('how much $ for a unicorn?');\n//=> how much \\$ for a unicorn\\?\n\nnew RegExp(escapedString);\n```\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n", + "readmeFilename": "readme.md", + "bugs": { + "url": "https://github.com/sindresorhus/escape-string-regexp/issues" + }, + "homepage": "https://github.com/sindresorhus/escape-string-regexp#readme", + "_id": "escape-string-regexp@1.0.3", + "_shasum": "9e2d8b25bc2555c3336723750e03f099c2735bb5", + "_resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz", + "_from": "escape-string-regexp@>=1.0.2 <2.0.0" +} diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/readme.md b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/readme.md new file mode 100644 index 00000000000..808a963a862 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/readme.md @@ -0,0 +1,27 @@ +# escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp) + +> Escape RegExp special characters + + +## Install + +```sh +$ npm install --save escape-string-regexp +``` + + +## Usage + +```js +var escapeStringRegexp = require('escape-string-regexp'); + +var escapedString = escapeStringRegexp('how much $ for a unicorn?'); +//=> how much \$ for a unicorn\? + +new RegExp(escapedString); +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/cli.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/cli.js new file mode 100755 index 00000000000..0386a824236 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/cli.js @@ -0,0 +1,45 @@ +#!/usr/bin/env node +'use strict'; +var stdin = require('get-stdin'); +var pkg = require('./package.json'); +var hasAnsi = require('./'); +var argv = process.argv.slice(2); +var input = argv[0]; + +function help() { + console.log([ + '', + ' ' + pkg.description, + '', + ' Usage', + ' has-ansi ', + ' echo | has-ansi', + '', + ' Exits with code 0 if input has ANSI escape codes and 1 if not' + ].join('\n')); +} + +function init(data) { + process.exit(hasAnsi(data) ? 0 : 1); +} + +if (argv.indexOf('--help') !== -1) { + help(); + return; +} + +if (argv.indexOf('--version') !== -1) { + console.log(pkg.version); + return; +} + +if (process.stdin.isTTY) { + if (!input) { + help(); + return; + } + + init(input); +} else { + stdin(init); +} diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/index.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/index.js new file mode 100644 index 00000000000..98fae067673 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/index.js @@ -0,0 +1,4 @@ +'use strict'; +var ansiRegex = require('ansi-regex'); +var re = new RegExp(ansiRegex().source); // remove the `g` flag +module.exports = re.test.bind(re); diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/license b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/license new file mode 100644 index 00000000000..654d0bfe943 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.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/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/index.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/index.js new file mode 100644 index 00000000000..0f1aeb3df4e --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/index.js @@ -0,0 +1,49 @@ +'use strict'; + +module.exports = function (cb) { + var stdin = process.stdin; + var ret = ''; + + if (stdin.isTTY) { + setImmediate(cb, ''); + return; + } + + stdin.setEncoding('utf8'); + + stdin.on('readable', function () { + var chunk; + + while (chunk = stdin.read()) { + ret += chunk; + } + }); + + stdin.on('end', function () { + cb(ret); + }); +}; + +module.exports.buffer = function (cb) { + var stdin = process.stdin; + var ret = []; + var len = 0; + + if (stdin.isTTY) { + setImmediate(cb, new Buffer('')); + return; + } + + stdin.on('readable', function () { + var chunk; + + while (chunk = stdin.read()) { + ret.push(chunk); + len += chunk.length; + } + }); + + stdin.on('end', function () { + cb(Buffer.concat(ret, len)); + }); +}; diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/package.json b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/package.json new file mode 100644 index 00000000000..0075a22136f --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/package.json @@ -0,0 +1,48 @@ +{ + "name": "get-stdin", + "version": "4.0.1", + "description": "Easier stdin", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/get-stdin.git" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "node test.js && node test-buffer.js && echo unicorns | node test-real.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "std", + "stdin", + "stdio", + "concat", + "buffer", + "stream", + "process", + "stream" + ], + "devDependencies": { + "ava": "0.0.4", + "buffer-equal": "0.0.1" + }, + "readme": "# get-stdin [![Build Status](https://travis-ci.org/sindresorhus/get-stdin.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stdin)\n\n> Easier stdin\n\n\n## Install\n\n```sh\n$ npm install --save get-stdin\n```\n\n\n## Usage\n\n```js\n// example.js\nvar stdin = require('get-stdin');\n\nstdin(function (data) {\n\tconsole.log(data);\n\t//=> unicorns\n});\n```\n\n```sh\n$ echo unicorns | node example.js\nunicorns\n```\n\n\n## API\n\n### stdin(callback)\n\nGet `stdin` as a string.\n\n### stdin.buffer(callback)\n\nGet `stdin` as a buffer.\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n", + "readmeFilename": "readme.md", + "bugs": { + "url": "https://github.com/sindresorhus/get-stdin/issues" + }, + "homepage": "https://github.com/sindresorhus/get-stdin#readme", + "_id": "get-stdin@4.0.1", + "_shasum": "b968c6b0a04384324902e8bf1a5df32579a450fe", + "_resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "_from": "get-stdin@>=4.0.1 <5.0.0" +} diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/readme.md b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/readme.md new file mode 100644 index 00000000000..bc1d32a8ad5 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/readme.md @@ -0,0 +1,44 @@ +# get-stdin [![Build Status](https://travis-ci.org/sindresorhus/get-stdin.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stdin) + +> Easier stdin + + +## Install + +```sh +$ npm install --save get-stdin +``` + + +## Usage + +```js +// example.js +var stdin = require('get-stdin'); + +stdin(function (data) { + console.log(data); + //=> unicorns +}); +``` + +```sh +$ echo unicorns | node example.js +unicorns +``` + + +## API + +### stdin(callback) + +Get `stdin` as a string. + +### stdin.buffer(callback) + +Get `stdin` as a buffer. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/package.json b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/package.json new file mode 100644 index 00000000000..11bcab99880 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/package.json @@ -0,0 +1,83 @@ +{ + "name": "has-ansi", + "version": "1.0.3", + "description": "Check if a string has ANSI escape codes", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/has-ansi.git" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + { + "name": "Joshua Appelman", + "email": "jappelman@xebia.com", + "url": "http://jbnicolai.com" + } + ], + "bin": { + "has-ansi": "cli.js" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js", + "cli.js" + ], + "keywords": [ + "cli", + "bin", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern", + "has" + ], + "dependencies": { + "ansi-regex": "^1.1.0", + "get-stdin": "^4.0.1" + }, + "devDependencies": { + "mocha": "*" + }, + "readme": "# has-ansi [![Build Status](https://travis-ci.org/sindresorhus/has-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/has-ansi)\n\n> Check if a string has [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)\n\n\n## Install\n\n```sh\n$ npm install --save has-ansi\n```\n\n\n## Usage\n\n```js\nvar hasAnsi = require('has-ansi');\n\nhasAnsi('\\u001b[4mcake\\u001b[0m');\n//=> true\n\nhasAnsi('cake');\n//=> false\n```\n\n\n## CLI\n\n```sh\n$ npm install --global has-ansi\n```\n\n```\n$ has-ansi --help\n\n Usage\n has-ansi \n echo | has-ansi\n\n Exits with code 0 if input has ANSI escape codes and 1 if not\n```\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n", + "readmeFilename": "readme.md", + "bugs": { + "url": "https://github.com/sindresorhus/has-ansi/issues" + }, + "homepage": "https://github.com/sindresorhus/has-ansi#readme", + "_id": "has-ansi@1.0.3", + "_shasum": "c0b5b1615d9e382b0ff67169d967b425e48ca538", + "_resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-1.0.3.tgz", + "_from": "has-ansi@>=1.0.3 <2.0.0" +} diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/readme.md b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/readme.md new file mode 100644 index 00000000000..0fa149a82a1 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/readme.md @@ -0,0 +1,45 @@ +# has-ansi [![Build Status](https://travis-ci.org/sindresorhus/has-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/has-ansi) + +> Check if a string has [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +```sh +$ npm install --save has-ansi +``` + + +## Usage + +```js +var hasAnsi = require('has-ansi'); + +hasAnsi('\u001b[4mcake\u001b[0m'); +//=> true + +hasAnsi('cake'); +//=> false +``` + + +## CLI + +```sh +$ npm install --global has-ansi +``` + +``` +$ has-ansi --help + + Usage + has-ansi + echo | has-ansi + + Exits with code 0 if input has ANSI escape codes and 1 if not +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/cli.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/cli.js new file mode 100755 index 00000000000..e746987666d --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/cli.js @@ -0,0 +1,29 @@ +#!/usr/bin/env node +'use strict'; +var pkg = require('./package.json'); +var supportsColor = require('./'); +var argv = process.argv.slice(2); + +function help() { + console.log([ + '', + ' ' + pkg.description, + '', + ' Usage', + ' supports-color', + '', + ' Exits with code 0 if color is supported and 1 if not' + ].join('\n')); +} + +if (argv.indexOf('--help') !== -1) { + help(); + return; +} + +if (argv.indexOf('--version') !== -1) { + console.log(pkg.version); + return; +} + +process.exit(supportsColor ? 0 : 1); diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/index.js b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/index.js new file mode 100644 index 00000000000..a17196485d7 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/index.js @@ -0,0 +1,43 @@ +'use strict'; +var argv = process.argv; + +module.exports = (function () { + if ('FORCE_COLOR' in process.env) { + return true; + } + + if (argv.indexOf('--no-color') !== -1 || + argv.indexOf('--no-colors') !== -1 || + argv.indexOf('--color=false') !== -1) { + return false; + } + + if (argv.indexOf('--color') !== -1 || + argv.indexOf('--colors') !== -1 || + argv.indexOf('--color=true') !== -1 || + argv.indexOf('--color=always') !== -1) { + return true; + } + + if (process.stdout && !process.stdout.isTTY) { + return false; + } + + if (process.platform === 'win32') { + return true; + } + + if ('COLORTERM' in process.env) { + return true; + } + + if (process.env.TERM === 'dumb') { + return false; + } + + if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) { + return true; + } + + return false; +})(); diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/license b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/license new file mode 100644 index 00000000000..654d0bfe943 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.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/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/package.json b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/package.json new file mode 100644 index 00000000000..ca9b2c42ece --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/package.json @@ -0,0 +1,76 @@ +{ + "name": "supports-color", + "version": "1.3.1", + "description": "Detect whether a terminal supports color", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/supports-color.git" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "maintainers": [ + { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + { + "name": "Joshua Appelman", + "email": "jappelman@xebia.com", + "url": "jbnicolai.com" + } + ], + "bin": { + "supports-color": "cli.js" + }, + "engines": { + "node": ">=0.8.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js", + "cli.js" + ], + "keywords": [ + "cli", + "bin", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "ansi", + "styles", + "tty", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "support", + "supports", + "capability", + "detect" + ], + "devDependencies": { + "mocha": "*", + "require-uncached": "^1.0.2" + }, + "readme": "# supports-color [![Build Status](https://travis-ci.org/sindresorhus/supports-color.svg?branch=master)](https://travis-ci.org/sindresorhus/supports-color)\n\n> Detect whether a terminal supports color\n\n\n## Install\n\n```\n$ npm install --save supports-color\n```\n\n\n## Usage\n\n```js\nvar supportsColor = require('supports-color');\n\nif (supportsColor) {\n\tconsole.log('Terminal supports color');\n}\n```\n\nIt obeys the `--color` and `--no-color` CLI flags.\n\nFor situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`.\n\n\n## CLI\n\n```\n$ npm install --global supports-color\n```\n\n```\n$ supports-color --help\n\n Usage\n supports-color\n\n Exits with code 0 if color is supported and 1 if not\n```\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n", + "readmeFilename": "readme.md", + "bugs": { + "url": "https://github.com/sindresorhus/supports-color/issues" + }, + "homepage": "https://github.com/sindresorhus/supports-color#readme", + "_id": "supports-color@1.3.1", + "_shasum": "15758df09d8ff3b4acc307539fabe27095e1042d", + "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", + "_from": "supports-color@>=1.3.0 <2.0.0" +} diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/readme.md b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/readme.md new file mode 100644 index 00000000000..fe6016f9d09 --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/readme.md @@ -0,0 +1,46 @@ +# supports-color [![Build Status](https://travis-ci.org/sindresorhus/supports-color.svg?branch=master)](https://travis-ci.org/sindresorhus/supports-color) + +> Detect whether a terminal supports color + + +## Install + +``` +$ npm install --save supports-color +``` + + +## Usage + +```js +var supportsColor = require('supports-color'); + +if (supportsColor) { + console.log('Terminal supports color'); +} +``` + +It obeys the `--color` and `--no-color` CLI flags. + +For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`. + + +## CLI + +``` +$ npm install --global supports-color +``` + +``` +$ supports-color --help + + Usage + supports-color + + Exits with code 0 if color is supported and 1 if not +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/package.json b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/package.json new file mode 100644 index 00000000000..ce07ec6e48b --- /dev/null +++ b/deps/npm/node_modules/request/node_modules/har-validator/node_modules/chalk/package.json @@ -0,0 +1,74 @@ +{ + "name": "chalk", + "version": "1.0.0", + "description": "Terminal string styling done right. Much color.", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/chalk.git" + }, + "maintainers": [ + { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + { + "name": "Joshua Appelman", + "email": "jappelman@xebia.com", + "url": "http://jbnicolai.com" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha", + "bench": "matcha benchmark.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "ansi", + "styles", + "tty", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-styles": "^2.0.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^1.0.3", + "strip-ansi": "^2.0.1", + "supports-color": "^1.3.0" + }, + "devDependencies": { + "matcha": "^0.6.0", + "mocha": "*" + }, + "readme": "

                              \n\t
                              \n\t\"chalk\"\n\t
                              \n\t
                              \n

                              \n\n> Terminal string styling done right\n\n[![Build Status](https://travis-ci.org/sindresorhus/chalk.svg?branch=master)](https://travis-ci.org/sindresorhus/chalk) [![](http://img.shields.io/badge/unicorn-approved-ff69b4.svg?style=flat)](https://www.youtube.com/watch?v=Sm368W0OsHo)\n\n[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68). Although there are other ones, they either do too much or not enough.\n\n**Chalk is a clean and focused alternative.**\n\n![screenshot](https://github.com/sindresorhus/ansi-styles/raw/master/screenshot.png)\n\n\n## Why\n\n- Highly performant\n- Doesn't extend `String.prototype`\n- Expressive API\n- Ability to nest styles\n- Clean and focused\n- Auto-detects color support\n- Actively maintained\n- [Used by ~3000 modules](https://www.npmjs.com/browse/depended/chalk)\n\n\n## Install\n\n```\n$ npm install --save chalk\n```\n\n\n## Usage\n\nChalk comes with an easy to use composable API where you just chain and nest the styles you want.\n\n```js\nvar chalk = require('chalk');\n\n// style a string\nchalk.blue('Hello world!');\n\n// combine styled and normal strings\nchalk.blue('Hello') + 'World' + chalk.red('!');\n\n// compose multiple styles using the chainable API\nchalk.blue.bgRed.bold('Hello world!');\n\n// pass in multiple arguments\nchalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz');\n\n// nest styles\nchalk.red('Hello', chalk.underline.bgBlue('world') + '!');\n\n// nest styles of the same type even (color, underline, background)\nchalk.green(\n\t'I am a green line ' +\n\tchalk.blue.underline.bold('with a blue substring') +\n\t' that becomes green again!'\n);\n```\n\nEasily define your own themes.\n\n```js\nvar chalk = require('chalk');\nvar error = chalk.bold.red;\nconsole.log(error('Error!'));\n```\n\nTake advantage of console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data).\n\n```js\nvar name = 'Sindre';\nconsole.log(chalk.green('Hello %s'), name);\n//=> Hello Sindre\n```\n\n\n## API\n\n### chalk.`