Narwhal and the Adventures of CommonJS Clinton R. Nixon
CommonJSpromises  to  be  a  standard  environment  that   will  let  JavaScript  code  use  the  same  APIs   ...
Why?JavaScript  is  simple  and  widely-­‐known.To  succeed,  server-­‐side  JavaScript  must  avoid  the  fate  of  Lisp.
CommonJS standardsModulesPackagesSystemBinaryFilesystemUnit  Testing
CommonJS implementationsNarwhal  (Rhino,  v8,  JSC)Flusspferd  (Spidermonkey/C++)node.js  (v8;  not  many  standards  or  ...
Narwhalone  of  the  most  mature  CommonJS  implementations
NarwhalA  CommonJS  platform  or  implementationArguably  the  most  mature  implementationRuns  on  several  interpreters...
Why?You  can  use  it  todayRhino  makes  it  easy  to  build  off  Java  librariesLots  of  activity,  and  other  impleme...
Narwhal packages package.jsonBased  on  the  CommonJS   local.json ...
package.json{        "name":  "jake",        "author":  "Francisco  Tolmasky  <francisco@280north.com>",        "contribut...
ModulesEach  JS  file  under  lib/  is  a  moduleModules  are  executed  within  a  functionArguments  are  require,  expor...
Module & package demonstration
Testing demonstration
Package management
sources.json{    "version":  2,    "includes":  ["http://github.com/280north/narwhal/raw/master/catalog-­‐2.json"],    "so...
Important packagesjackjakejsdocsejsnitrobogart
Real apps I wrote
Questions and discussionhttp://narwhaljs.org/Email  me  at  Clinton  R.  Nixon  <crnixon@gmail.com>http://pinboard.in/u:cr...
Narwhal and the Adventures of CommonJS
Narwhal and the Adventures of CommonJS
of 20

Narwhal and the Adventures of CommonJS

Published on: Mar 3, 2016
Published in: Technology      
Source: www.slideshare.net


Transcripts - Narwhal and the Adventures of CommonJS

  • 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/

Related Documents