Your SlideShare is downloading. ×
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Narwhal and the Adventures of CommonJS

2,031

Published on

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,031
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Narwhal and the Adventures of CommonJS Clinton R. Nixon
  • 2. CommonJSpromises  to  be  a  standard  environment  that   will  let  JavaScript  code  use  the  same  APIs   with  different  interpreters
  • 3. Why?JavaScript  is  simple  and  widely-­‐known.To  succeed,  server-­‐side  JavaScript  must  avoid  the  fate  of  Lisp.
  • 4. CommonJS standardsModulesPackagesSystemBinaryFilesystemUnit  Testing
  • 5. CommonJS implementationsNarwhal  (Rhino,  v8,  JSC)Flusspferd  (Spidermonkey/C++)node.js  (v8;  not  many  standards  or  proposals  implemented)v8cgi  (v8)GPSEE  (Spidermonkey/C)RingoJS  (Rhino;  was  Helma  NG)Perservere  (Rhino)SproutCore  (in-­‐browser)
  • 6. Narwhalone  of  the  most  mature  CommonJS  implementations
  • 7. NarwhalA  CommonJS  platform  or  implementationArguably  the  most  mature  implementationRuns  on  several  interpretersRhino  has  the  most  complete  implementationJavaScriptCore  works  well  on  MacsEasy  to  add  new  engines  if  youre  a  language  implementation  hacker
  • 8. Why?You  can  use  it  todayRhino  makes  it  easy  to  build  off  Java  librariesLots  of  activity,  and  other  implementations  are  working  to  be  compatible  with  itBut  still  needs  lots  of  work
  • 9. Narwhal packages package.jsonBased  on  the  CommonJS   local.json bin/package  standard lib/tusk  is  a  package  manager    foo.js src/sea  is  an  environment  manager jars/ packages/Every  project  is  a  package engines/ tests/    foo.tests.js
  • 10. package.json{        "name":  "jake",        "author":  "Francisco  Tolmasky  <francisco@280north.com>",        "contributors":  [                "Tom  Robinson  (http://tlrobinson.net/)  <tom@280north.com>"        ],        "description":  "A  build  system  for  CommonJS,  lifted  from  Rake",        "keywords":  [                "build",                "jake",                "rake",                "make"        ],        "version":  "0.2.1"}
  • 11. ModulesEach  JS  file  under  lib/  is  a  moduleModules  are  executed  within  a  functionArguments  are  require,  exports,  and  moduleModules  return  exportsCore  concept  of  CommonJS
  • 12. Module & package demonstration
  • 13. Testing demonstration
  • 14. Package management
  • 15. sources.json{    "version":  2,    "includes":  ["http://github.com/280north/narwhal/raw/master/catalog-­‐2.json"],    "sources":  {        "dice":  {            "type":  "github",            "user":  "crnixon",            "name":  "narwhal-­‐dice"        },        "caffeine":  {            "type":  "github",            "user":  "crnixon",            "name":  "narwhal-­‐caffeine"        }    }}
  • 16. Important packagesjackjakejsdocsejsnitrobogart
  • 17. Real apps I wrote
  • 18. Questions and discussionhttp://narwhaljs.org/Email  me  at  Clinton  R.  Nixon  <crnixon@gmail.com>http://pinboard.in/u:crnixon/t:talk:narwhal/

×