SlideShare una empresa de Scribd logo
1 de 81
CommonJS via     BETA
PINF JavaScript Loader
  github.com/pinf/loader-js (MIT Licensed)



              Introduction

  Boston JavaScript - October 14, 2011
             by Christoph Dorn

       Copyright (c) 2011 Christoph Dorn <christoph@christophdorn.com>
      License: Creative Commons Attribution-NonCommercial-ShareAlike 3.0
            Various names and trademarks copyright respective parties.
About Christoph
About Christoph
• 15+ years experience (web apps & business)
About Christoph
• 15+ years experience (web apps & business)
• Self taught developer
About Christoph
• 15+ years experience (web apps & business)
• Self taught developer
• Independent
About Christoph
• 15+ years experience (web apps & business)
• Self taught developer
• Independent
• Playing with and integrating toolchains for years
About Christoph
•   15+ years experience (web apps & business)
•   Self taught developer
•   Independent
•   Playing with and integrating toolchains for years
•   Firebug Working Group (3 years)
About Christoph
•   15+ years experience (web apps & business)
•   Self taught developer
•   Independent
•   Playing with and integrating toolchains for years
•   Firebug Working Group (3 years)
    • Extensions
About Christoph
•   15+ years experience (web apps & business)
•   Self taught developer
•   Independent
•   Playing with and integrating toolchains for years
•   Firebug Working Group (3 years)
    • Extensions
• CommonJS List (2 years)
About Christoph
•   15+ years experience (web apps & business)
•   Self taught developer
•   Independent
•   Playing with and integrating toolchains for years
•   Firebug Working Group (3 years)
    • Extensions
• CommonJS List (2 years)
  • Packages & dependency management
About Christoph
•   15+ years experience (web apps & business)
•   Self taught developer
•   Independent
•   Playing with and integrating toolchains for years
•   Firebug Working Group (3 years)
    • Extensions
• CommonJS List (2 years)
  • Packages & dependency management

Focus: Toolchain Design & Efficient Workflows
What drives me?
What drives me?
   I believe a major factor constraining software evolution is
the lack of refactorability as a core design goal of toolchains.
What drives me?
   I believe a major factor constraining software evolution is
the lack of refactorability as a core design goal of toolchains.

 If we can easily change our software in every way we can
     focus on figuring out what actually works the best!
What drives me?
   I believe a major factor constraining software evolution is
the lack of refactorability as a core design goal of toolchains.

 If we can easily change our software in every way we can
     focus on figuring out what actually works the best!

    Building a JavaScript based Toolchain Platform!
What drives me?
   I believe a major factor constraining software evolution is
the lack of refactorability as a core design goal of toolchains.

 If we can easily change our software in every way we can
     focus on figuring out what actually works the best!

    Building a JavaScript based Toolchain Platform!
                  github.com/pinf (MIT Licensed)
What drives me?
   I believe a major factor constraining software evolution is
the lack of refactorability as a core design goal of toolchains.

 If we can easily change our software in every way we can
     focus on figuring out what actually works the best!

     Building a JavaScript based Toolchain Platform!
                    github.com/pinf (MIT Licensed)


JavaScript: Very expressive and easy to refactor; everyone will know it
What drives me?
   I believe a major factor constraining software evolution is
the lack of refactorability as a core design goal of toolchains.

 If we can easily change our software in every way we can
     focus on figuring out what actually works the best!

     Building a JavaScript based Toolchain Platform!
                    github.com/pinf (MIT Licensed)


JavaScript: Very expressive and easy to refactor; everyone will know it

CommonJS: Developers seeking to build a JavaScript Ecosystem
 which allows for:
What drives me?
   I believe a major factor constraining software evolution is
the lack of refactorability as a core design goal of toolchains.

 If we can easily change our software in every way we can
     focus on figuring out what actually works the best!

     Building a JavaScript based Toolchain Platform!
                    github.com/pinf (MIT Licensed)


JavaScript: Very expressive and easy to refactor; everyone will know it

CommonJS: Developers seeking to build a JavaScript Ecosystem
 which allows for:
  • Code-sharing, interoperable libraries and portable applications
What drives me?
   I believe a major factor constraining software evolution is
the lack of refactorability as a core design goal of toolchains.

 If we can easily change our software in every way we can
     focus on figuring out what actually works the best!

     Building a JavaScript based Toolchain Platform!
                    github.com/pinf (MIT Licensed)


JavaScript: Very expressive and easy to refactor; everyone will know it

CommonJS: Developers seeking to build a JavaScript Ecosystem
 which allows for:
  • Code-sharing, interoperable libraries and portable applications
  • Transferring the power of JavaScript to various parts of a system
What drives me?
   I believe a major factor constraining software evolution is
the lack of refactorability as a core design goal of toolchains.

 If we can easily change our software in every way we can
     focus on figuring out what actually works the best!

     Building a JavaScript based Toolchain Platform!
                    github.com/pinf (MIT Licensed)


JavaScript: Very expressive and easy to refactor; everyone will know it

CommonJS: Developers seeking to build a JavaScript Ecosystem
 which allows for:
  • Code-sharing, interoperable libraries and portable applications
  • Transferring the power of JavaScript to various parts of a system
  • Seamless refactoring and re-composition of programs
What funds my work?
What funds my work?
CommonJS Ecosystem Goals
CommonJS Ecosystem Goals
• Consistent low-level APIs across platforms
CommonJS Ecosystem Goals
• Consistent low-level APIs across platforms
• Interoperable libraries
CommonJS Ecosystem Goals
• Consistent low-level APIs across platforms
• Interoperable libraries
• Securable module sandboxes
CommonJS Ecosystem Goals
•   Consistent low-level APIs across platforms
•   Interoperable libraries
•   Securable module sandboxes
•   Portable applications
CommonJS Ecosystem Goals
•   Consistent low-level APIs across platforms
•   Interoperable libraries
•   Securable module sandboxes
•   Portable applications
•   Arbitrary & re-configurable program composition
CommonJS Ecosystem Goals
•   Consistent low-level APIs across platforms
•   Interoperable libraries
•   Securable module sandboxes
•   Portable applications
•   Arbitrary & re-configurable program composition
•   Non-conflicting namespaces
CommonJS Ecosystem Goals
•   Consistent low-level APIs across platforms
•   Interoperable libraries
•   Securable module sandboxes
•   Portable applications
•   Arbitrary & re-configurable program composition
•   Non-conflicting namespaces
•   Publish code to URIs
CommonJS Ecosystem Goals
•   Consistent low-level APIs across platforms
•   Interoperable libraries
•   Securable module sandboxes
•   Portable applications
•   Arbitrary & re-configurable program composition
•   Non-conflicting namespaces
•   Publish code to URIs
•   Depend on code from URIs
CommonJS Ecosystem Goals
•   Consistent low-level APIs across platforms
•   Interoperable libraries
•   Securable module sandboxes
•   Portable applications
•   Arbitrary & re-configurable program composition
•   Non-conflicting namespaces
•   Publish code to URIs
•   Depend on code from URIs
•   Distributed package registry and repository
CommonJS Ecosystem Goals
•   Consistent low-level APIs across platforms
•   Interoperable libraries
•   Securable module sandboxes
•   Portable applications
•   Arbitrary & re-configurable program composition
•   Non-conflicting namespaces
•   Publish code to URIs
•   Depend on code from URIs
•   Distributed package registry and repository
•   Consistent tooling interface
Separate Concerns
Separate Concerns
To achieve our goals I believe we MUST:
Separate Concerns
To achieve our goals I believe we MUST:
 • Clearly separate concerns
Separate Concerns
To achieve our goals I believe we MUST:
 • Clearly separate concerns
   • Logically (within runtime by using different API methods vs overloading)
Separate Concerns
To achieve our goals I believe we MUST:
 • Clearly separate concerns
   • Logically (within runtime by using different API methods vs overloading)
   • Physically (between runtimes and parties)
Separate Concerns
To achieve our goals I believe we MUST:
 • Clearly separate concerns
   • Logically (within runtime by using different API methods vs overloading)
   • Physically (between runtimes and parties)
 • Link everything by URIs (globally unique namespace)
Separate Concerns
To achieve our goals I believe we MUST:
 • Clearly separate concerns
   • Logically (within runtime by using different API methods vs overloading)
   • Physically (between runtimes and parties)
 • Link everything by URIs (globally unique namespace)
 • Layer control to introduce possibilities of indirection
Separate Concerns
To achieve our goals I believe we MUST:
  • Clearly separate concerns
    • Logically (within runtime by using different API methods vs overloading)
    • Physically (between runtimes and parties)
  • Link everything by URIs (globally unique namespace)
  • Layer control to introduce possibilities of indirection
We are talking about layered re-configurability of a program from
 the outside in at any point of the program’s pre-run lifecycle.
Separate Concerns
To achieve our goals I believe we MUST:
  • Clearly separate concerns
    • Logically (within runtime by using different API methods vs overloading)
    • Physically (between runtimes and parties)
  • Link everything by URIs (globally unique namespace)
  • Layer control to introduce possibilities of indirection
We are talking about layered re-configurability of a program from
 the outside in at any point of the program’s pre-run lifecycle.

It must be:
Separate Concerns
To achieve our goals I believe we MUST:
  • Clearly separate concerns
    • Logically (within runtime by using different API methods vs overloading)
    • Physically (between runtimes and parties)
  • Link everything by URIs (globally unique namespace)
  • Layer control to introduce possibilities of indirection
We are talking about layered re-configurability of a program from
 the outside in at any point of the program’s pre-run lifecycle.

It must be:
   • Easy to learn and understand
Separate Concerns
To achieve our goals I believe we MUST:
  • Clearly separate concerns
    • Logically (within runtime by using different API methods vs overloading)
    • Physically (between runtimes and parties)
  • Link everything by URIs (globally unique namespace)
  • Layer control to introduce possibilities of indirection
We are talking about layered re-configurability of a program from
 the outside in at any point of the program’s pre-run lifecycle.

It must be:
   • Easy to learn and understand
   • Restrict only where absolutely necessary
Separate Concerns
To achieve our goals I believe we MUST:
  • Clearly separate concerns
    • Logically (within runtime by using different API methods vs overloading)
    • Physically (between runtimes and parties)
  • Link everything by URIs (globally unique namespace)
  • Layer control to introduce possibilities of indirection
We are talking about layered re-configurability of a program from
 the outside in at any point of the program’s pre-run lifecycle.

It must be:
   • Easy to learn and understand
   • Restrict only where absolutely necessary
   • Lightweight and easily implemented
Separate Concerns
To achieve our goals I believe we MUST:
  • Clearly separate concerns
    • Logically (within runtime by using different API methods vs overloading)
    • Physically (between runtimes and parties)
  • Link everything by URIs (globally unique namespace)
  • Layer control to introduce possibilities of indirection
We are talking about layered re-configurability of a program from
 the outside in at any point of the program’s pre-run lifecycle.

It must be:
   • Easy to learn and understand
   • Restrict only where absolutely necessary
   • Lightweight and easily implemented
A/The Solution
A/The Solution
CommonJS/Modules/2.0 (draft)
A/The Solution
CommonJS/Modules/2.0 (draft)
 • function (require, exports, module) {} - Factory
A/The Solution
CommonJS/Modules/2.0 (draft)
 • function (require, exports, module) {} - Factory
 • require(“./<id>”); - Static linking (rel_id)
A/The Solution
CommonJS/Modules/2.0 (draft)
 • function (require, exports, module) {} - Factory
 • require(“./<id>”); - Static linking (rel_id)
 • module.load($rel_id, function callback() {}); - Dynamic linking
A/The Solution
CommonJS/Modules/2.0 (draft)
 •   function (require, exports, module) {} - Factory
 •   require(“./<id>”); - Static linking (rel_id)
 •   module.load($rel_id, function callback() {}); - Dynamic linking
 •   module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource())
A/The Solution
CommonJS/Modules/2.0 (draft)
 •   function (require, exports, module) {} - Factory
 •   require(“./<id>”); - Static linking (rel_id)
 •   module.load($rel_id, function callback() {}); - Dynamic linking
 •   module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource())
 •   module.declare([“<dep_rel_id>”], factory); - Strict ASYNC
A/The Solution
CommonJS/Modules/2.0 (draft)
 •   function (require, exports, module) {} - Factory
 •   require(“./<id>”); - Static linking (rel_id)
 •   module.load($rel_id, function callback() {}); - Dynamic linking
 •   module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource())
 •   module.declare([“<dep_rel_id>”], factory); - Strict ASYNC
 •   require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport
A/The Solution
CommonJS/Modules/2.0 (draft)
 •   function (require, exports, module) {} - Factory
 •   require(“./<id>”); - Static linking (rel_id)
 •   module.load($rel_id, function callback() {}); - Dynamic linking
 •   module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource())
 •   module.declare([“<dep_rel_id>”], factory); - Strict ASYNC
 •   require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport

CommonJS/Package/Mappings/C (proposal; amendment required)
A/The Solution
CommonJS/Modules/2.0 (draft)
 •   function (require, exports, module) {} - Factory
 •   require(“./<id>”); - Static linking (rel_id)
 •   module.load($rel_id, function callback() {}); - Dynamic linking
 •   module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource())
 •   module.declare([“<dep_rel_id>”], factory); - Strict ASYNC
 •   require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport

CommonJS/Package/Mappings/C (proposal; amendment required)
 • {“archive”:”<url>”}, {“location”:”<path>”}, ... - Locators
A/The Solution
CommonJS/Modules/2.0 (draft)
 •   function (require, exports, module) {} - Factory
 •   require(“./<id>”); - Static linking (rel_id)
 •   module.load($rel_id, function callback() {}); - Dynamic linking
 •   module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource())
 •   module.declare([“<dep_rel_id>”], factory); - Strict ASYNC
 •   require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport

CommonJS/Package/Mappings/C (proposal; amendment required)
 • {“archive”:”<url>”}, {“location”:”<path>”}, ... - Locators
 • package.json ~ {“mappings”: {“<alias>”:<locator>}} - Pkg. Descriptor
A/The Solution
CommonJS/Modules/2.0 (draft)
 •   function (require, exports, module) {} - Factory
 •   require(“./<id>”); - Static linking (rel_id)
 •   module.load($rel_id, function callback() {}); - Dynamic linking
 •   module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource())
 •   module.declare([“<dep_rel_id>”], factory); - Strict ASYNC
 •   require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport

CommonJS/Package/Mappings/C (proposal; amendment required)
 • {“archive”:”<url>”}, {“location”:”<path>”}, ... - Locators
 • package.json ~ {“mappings”: {“<alias>”:<locator>}} - Pkg. Descriptor
 • require(“<alias>/<id>”); - Static linking (alias_id)
A/The Solution
CommonJS/Modules/2.0 (draft)
 •   function (require, exports, module) {} - Factory
 •   require(“./<id>”); - Static linking (rel_id)
 •   module.load($rel_id, function callback() {}); - Dynamic linking
 •   module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource())
 •   module.declare([“<dep_rel_id>”], factory); - Strict ASYNC
 •   require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport

CommonJS/Package/Mappings/C (proposal; amendment required)
 •   {“archive”:”<url>”}, {“location”:”<path>”}, ... - Locators
 •   package.json ~ {“mappings”: {“<alias>”:<locator>}} - Pkg. Descriptor
 •   require(“<alias>/<id>”); - Static linking (alias_id)
 •   module.load($alias_id, function callback() {}); - Dynamic linking
A/The Solution
CommonJS/Modules/2.0 (draft)
 •   function (require, exports, module) {} - Factory
 •   require(“./<id>”); - Static linking (rel_id)
 •   module.load($rel_id, function callback() {}); - Dynamic linking
 •   module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource())
 •   module.declare([“<dep_rel_id>”], factory); - Strict ASYNC
 •   require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport

CommonJS/Package/Mappings/C (proposal; amendment required)
 •   {“archive”:”<url>”}, {“location”:”<path>”}, ... - Locators
 •   package.json ~ {“mappings”: {“<alias>”:<locator>}} - Pkg. Descriptor
 •   require(“<alias>/<id>”); - Static linking (alias_id)
 •   module.load($alias_id, function callback() {}); - Dynamic linking
 •   module.declare([“<dep_alias_id>”], factory); - Strict ASYNC
A/The Solution
CommonJS/Modules/2.0 (draft)
 •   function (require, exports, module) {} - Factory
 •   require(“./<id>”); - Static linking (rel_id)
 •   module.load($rel_id, function callback() {}); - Dynamic linking
 •   module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource())
 •   module.declare([“<dep_rel_id>”], factory); - Strict ASYNC
 •   require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport

CommonJS/Package/Mappings/C (proposal; amendment required)
 •   {“archive”:”<url>”}, {“location”:”<path>”}, ... - Locators
 •   package.json ~ {“mappings”: {“<alias>”:<locator>}} - Pkg. Descriptor
 •   require(“<alias>/<id>”); - Static linking (alias_id)
 •   module.load($alias_id, function callback() {}); - Dynamic linking
 •   module.declare([“<dep_alias_id>”], factory); - Strict ASYNC
 •   require.memoize(“<can_id>”, [“<dep_alias_id>”], factory); - Transport
A/The Solution
CommonJS/Modules/2.0 (draft)
 •   function (require, exports, module) {} - Factory
 •   require(“./<id>”); - Static linking (rel_id)
 •   module.load($rel_id, function callback() {}); - Dynamic linking
 •   module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource())
 •   module.declare([“<dep_rel_id>”], factory); - Strict ASYNC
 •   require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport

CommonJS/Package/Mappings/C (proposal; amendment required)
 •   {“archive”:”<url>”}, {“location”:”<path>”}, ... - Locators
 •   package.json ~ {“mappings”: {“<alias>”:<locator>}} - Pkg. Descriptor
 •   require(“<alias>/<id>”); - Static linking (alias_id)
 •   module.load($alias_id, function callback() {}); - Dynamic linking
 •   module.declare([“<dep_alias_id>”], factory); - Strict ASYNC
 •   require.memoize(“<can_id>”, [“<dep_alias_id>”], factory); - Transport
 •   /<packages>/<uri_no_protocol>/<revision>@/<lib>/<id> - Canonical ID
Logically separate concerns
                               Plain
                              Module



                               Lazy
                              ASYNC



                               Strict
                              ASYNC
Physical layers of indirection
PINF JS Loader Overview
PINF JS Loader Overview
• Loads multiple module source formats:
PINF JS Loader Overview
• Loads multiple module source formats:
 • Asynchronous Module Definition (AMD)
PINF JS Loader Overview
• Loads multiple module source formats:
 • Asynchronous Module Definition (AMD)
 • CommonJS Modules 1.1
PINF JS Loader Overview
• Loads multiple module source formats:
 • Asynchronous Module Definition (AMD)
 • CommonJS Modules 1.1
 • CommonJS Modules 2.0 (draft)
PINF JS Loader Overview
• Loads multiple module source formats:
 •   Asynchronous Module Definition (AMD)
 •   CommonJS Modules 1.1
 •   CommonJS Modules 2.0 (draft)
 •   Plain JavaScript files
PINF JS Loader Overview
• Loads multiple module source formats:
 •   Asynchronous Module Definition (AMD)
 •   CommonJS Modules 1.1
 •   CommonJS Modules 2.0 (draft)
 •   Plain JavaScript files

• Dynamically downloads and resolves dependencies via
 CommonJS Package Mappings & Dependencies
PINF JS Loader Overview
• Loads multiple module source formats:
 •   Asynchronous Module Definition (AMD)
 •   CommonJS Modules 1.1
 •   CommonJS Modules 2.0 (draft)
 •   Plain JavaScript files

• Dynamically downloads and resolves dependencies via
 CommonJS Package Mappings & Dependencies
• Runs an identical CommonJS package on many platforms
 for development and production:
PINF JS Loader Overview
• Loads multiple module source formats:
 •   Asynchronous Module Definition (AMD)
 •   CommonJS Modules 1.1
 •   CommonJS Modules 2.0 (draft)
 •   Plain JavaScript files

• Dynamically downloads and resolves dependencies via
 CommonJS Package Mappings & Dependencies
• Runs an identical CommonJS package on many platforms
 for development and production:
 • Browser, NodeJS, V8CGI, GPSEE, RingoJS, Narwhal,
     Jetpack, Titanium, AdobeAir (platform and API support varies)
PINF JS Loader Overview
• Loads multiple module source formats:
 •   Asynchronous Module Definition (AMD)
 •   CommonJS Modules 1.1
 •   CommonJS Modules 2.0 (draft)
 •   Plain JavaScript files

• Dynamically downloads and resolves dependencies via
 CommonJS Package Mappings & Dependencies
• Runs an identical CommonJS package on many platforms
 for development and production:
 • Browser, NodeJS, V8CGI, GPSEE, RingoJS, Narwhal,
     Jetpack, Titanium, AdobeAir (platform and API support varies)

• Can load CommonJS programs and export static bundle
 (inlined modules) based programs for running in Browser via
 BravoJS (multiple platforms and loaders coming soon)
Where does the loader typically sit?
Architecture & process of the loader
Architecture & process of the loader
Dependency trees afforded by the loader
Demo Time!


  github.com/cadorn/ace-extjs


github.com/pinf/test-programs-js
Thank you!


Slides and links will be made available at:

github.com/pinf/loader-js/wiki

Más contenido relacionado

La actualidad más candente

The next generation of google APIs (Ade Oshineye)
The next generation of google APIs (Ade Oshineye)The next generation of google APIs (Ade Oshineye)
The next generation of google APIs (Ade Oshineye)
Ontico
 

La actualidad más candente (20)

Working effectively with OpenShift
Working effectively with OpenShiftWorking effectively with OpenShift
Working effectively with OpenShift
 
Introduction to web development
Introduction to web developmentIntroduction to web development
Introduction to web development
 
Publishing API documentation -- Presentation
Publishing API documentation -- PresentationPublishing API documentation -- Presentation
Publishing API documentation -- Presentation
 
CI/CD: Lessons from LinkedIn and Mockito
CI/CD: Lessons from LinkedIn and MockitoCI/CD: Lessons from LinkedIn and Mockito
CI/CD: Lessons from LinkedIn and Mockito
 
Nexus Pro Customer Survey Findings
Nexus Pro Customer Survey FindingsNexus Pro Customer Survey Findings
Nexus Pro Customer Survey Findings
 
Migrating to Angular 4 for Spring Developers
Migrating to Angular 4 for Spring Developers Migrating to Angular 4 for Spring Developers
Migrating to Angular 4 for Spring Developers
 
Engineering at bbc kl hpsd
Engineering at bbc kl   hpsdEngineering at bbc kl   hpsd
Engineering at bbc kl hpsd
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
 
API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015
 
The next generation of google APIs (Ade Oshineye)
The next generation of google APIs (Ade Oshineye)The next generation of google APIs (Ade Oshineye)
The next generation of google APIs (Ade Oshineye)
 
API Workshop: Deep dive into code samples
API Workshop: Deep dive into code samplesAPI Workshop: Deep dive into code samples
API Workshop: Deep dive into code samples
 
API Description Languages: Which Is The Right One For Me?
 API Description Languages: Which Is The Right One For Me?  API Description Languages: Which Is The Right One For Me?
API Description Languages: Which Is The Right One For Me?
 
Continuous Integration with Maven for Android apps
Continuous Integration with Maven for Android appsContinuous Integration with Maven for Android apps
Continuous Integration with Maven for Android apps
 
The Ring programming language version 1.8 book - Part 6 of 202
The Ring programming language version 1.8 book - Part 6 of 202The Ring programming language version 1.8 book - Part 6 of 202
The Ring programming language version 1.8 book - Part 6 of 202
 
Salesforce: CI,CD & CT
Salesforce: CI,CD & CTSalesforce: CI,CD & CT
Salesforce: CI,CD & CT
 
API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)
 
不只自動化而且更敏捷的Android開發工具 gradle
不只自動化而且更敏捷的Android開發工具 gradle不只自動化而且更敏捷的Android開發工具 gradle
不只自動化而且更敏捷的Android開發工具 gradle
 
Future of Grails
Future of GrailsFuture of Grails
Future of Grails
 
Publishing API documentation -- Workshop
Publishing API documentation -- WorkshopPublishing API documentation -- Workshop
Publishing API documentation -- Workshop
 
Writer APIs in Java faster with Swagger Inflector
Writer APIs in Java faster with Swagger InflectorWriter APIs in Java faster with Swagger Inflector
Writer APIs in Java faster with Swagger Inflector
 

Destacado

Destacado (7)

Javascript modules
Javascript modulesJavascript modules
Javascript modules
 
Web a Quebec - JS Debugging
Web a Quebec - JS DebuggingWeb a Quebec - JS Debugging
Web a Quebec - JS Debugging
 
Brunch With Coffee
Brunch With CoffeeBrunch With Coffee
Brunch With Coffee
 
Javascript Dependency Management
Javascript Dependency ManagementJavascript Dependency Management
Javascript Dependency Management
 
JavaScript Modules in Practice
JavaScript Modules in PracticeJavaScript Modules in Practice
JavaScript Modules in Practice
 
Workshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design PatternsWorkshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design Patterns
 
Javascript Module Patterns
Javascript Module PatternsJavascript Module Patterns
Javascript Module Patterns
 

Similar a CommonJS via PINF JavaScript Loader - Introduction

How To Become A DevOps Engineer | Who Is A DevOps Engineer? | DevOps Engineer...
How To Become A DevOps Engineer | Who Is A DevOps Engineer? | DevOps Engineer...How To Become A DevOps Engineer | Who Is A DevOps Engineer? | DevOps Engineer...
How To Become A DevOps Engineer | Who Is A DevOps Engineer? | DevOps Engineer...
Simplilearn
 
Best practices for using open source software in the enterprise
Best practices for using open source software in the enterpriseBest practices for using open source software in the enterprise
Best practices for using open source software in the enterprise
Marcel de Vries
 
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
Simplilearn
 
Building Open Source Communities for AWS Serverless Developer Tools
Building Open Source Communities for AWS Serverless Developer ToolsBuilding Open Source Communities for AWS Serverless Developer Tools
Building Open Source Communities for AWS Serverless Developer Tools
Amazon Web Services
 

Similar a CommonJS via PINF JavaScript Loader - Introduction (20)

DevOps Friendly Doc Publishing for APIs & Microservices
DevOps Friendly Doc Publishing for APIs & MicroservicesDevOps Friendly Doc Publishing for APIs & Microservices
DevOps Friendly Doc Publishing for APIs & Microservices
 
Top DevOps Tools You Should Know In 2023.pdf
Top DevOps Tools You Should Know In 2023.pdfTop DevOps Tools You Should Know In 2023.pdf
Top DevOps Tools You Should Know In 2023.pdf
 
Comprehensive Guide to Hire DevOps Engineer.pdf
Comprehensive Guide to Hire DevOps Engineer.pdfComprehensive Guide to Hire DevOps Engineer.pdf
Comprehensive Guide to Hire DevOps Engineer.pdf
 
How To Become A DevOps Engineer | Who Is A DevOps Engineer? | DevOps Engineer...
How To Become A DevOps Engineer | Who Is A DevOps Engineer? | DevOps Engineer...How To Become A DevOps Engineer | Who Is A DevOps Engineer? | DevOps Engineer...
How To Become A DevOps Engineer | Who Is A DevOps Engineer? | DevOps Engineer...
 
Full Stack Web Developer (MERN STACK Developer.pptx
Full Stack Web Developer (MERN STACK Developer.pptxFull Stack Web Developer (MERN STACK Developer.pptx
Full Stack Web Developer (MERN STACK Developer.pptx
 
Ng spain
Ng spainNg spain
Ng spain
 
Introduction to License Compliance and My research (D. German)
Introduction to License Compliance and My research (D. German)Introduction to License Compliance and My research (D. German)
Introduction to License Compliance and My research (D. German)
 
Top frontend web development tools
Top frontend web development toolsTop frontend web development tools
Top frontend web development tools
 
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
 
"Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa..."Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa...
 
Best practices for using open source software in the enterprise
Best practices for using open source software in the enterpriseBest practices for using open source software in the enterprise
Best practices for using open source software in the enterprise
 
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
DevOps Tutorial For Beginners | DevOps Tutorial | DevOps Tools | DevOps Train...
 
Top 6 DevOps Tools For Web Development In 2022.pdf
Top 6 DevOps Tools For Web Development In 2022.pdfTop 6 DevOps Tools For Web Development In 2022.pdf
Top 6 DevOps Tools For Web Development In 2022.pdf
 
DevOps at Lean Apps
DevOps at Lean AppsDevOps at Lean Apps
DevOps at Lean Apps
 
Building Open Source Communities for AWS Serverless Developer Tools
Building Open Source Communities for AWS Serverless Developer ToolsBuilding Open Source Communities for AWS Serverless Developer Tools
Building Open Source Communities for AWS Serverless Developer Tools
 
Modern Software Architecture
Modern Software Architecture Modern Software Architecture
Modern Software Architecture
 
Guided Path to DevOps Career.
Guided Path to DevOps Career.Guided Path to DevOps Career.
Guided Path to DevOps Career.
 
Prominent Back-end frameworks to consider in 2022!
Prominent Back-end frameworks to consider in 2022!Prominent Back-end frameworks to consider in 2022!
Prominent Back-end frameworks to consider in 2022!
 
SEO consultant Dubai
SEO consultant DubaiSEO consultant Dubai
SEO consultant Dubai
 
SEO packages Dubai
SEO packages DubaiSEO packages Dubai
SEO packages Dubai
 

Último

Último (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

CommonJS via PINF JavaScript Loader - Introduction

  • 1. CommonJS via BETA PINF JavaScript Loader github.com/pinf/loader-js (MIT Licensed) Introduction Boston JavaScript - October 14, 2011 by Christoph Dorn Copyright (c) 2011 Christoph Dorn <christoph@christophdorn.com> License: Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Various names and trademarks copyright respective parties.
  • 3. About Christoph • 15+ years experience (web apps & business)
  • 4. About Christoph • 15+ years experience (web apps & business) • Self taught developer
  • 5. About Christoph • 15+ years experience (web apps & business) • Self taught developer • Independent
  • 6. About Christoph • 15+ years experience (web apps & business) • Self taught developer • Independent • Playing with and integrating toolchains for years
  • 7. About Christoph • 15+ years experience (web apps & business) • Self taught developer • Independent • Playing with and integrating toolchains for years • Firebug Working Group (3 years)
  • 8. About Christoph • 15+ years experience (web apps & business) • Self taught developer • Independent • Playing with and integrating toolchains for years • Firebug Working Group (3 years) • Extensions
  • 9. About Christoph • 15+ years experience (web apps & business) • Self taught developer • Independent • Playing with and integrating toolchains for years • Firebug Working Group (3 years) • Extensions • CommonJS List (2 years)
  • 10. About Christoph • 15+ years experience (web apps & business) • Self taught developer • Independent • Playing with and integrating toolchains for years • Firebug Working Group (3 years) • Extensions • CommonJS List (2 years) • Packages & dependency management
  • 11. About Christoph • 15+ years experience (web apps & business) • Self taught developer • Independent • Playing with and integrating toolchains for years • Firebug Working Group (3 years) • Extensions • CommonJS List (2 years) • Packages & dependency management Focus: Toolchain Design & Efficient Workflows
  • 13. What drives me? I believe a major factor constraining software evolution is the lack of refactorability as a core design goal of toolchains.
  • 14. What drives me? I believe a major factor constraining software evolution is the lack of refactorability as a core design goal of toolchains. If we can easily change our software in every way we can focus on figuring out what actually works the best!
  • 15. What drives me? I believe a major factor constraining software evolution is the lack of refactorability as a core design goal of toolchains. If we can easily change our software in every way we can focus on figuring out what actually works the best! Building a JavaScript based Toolchain Platform!
  • 16. What drives me? I believe a major factor constraining software evolution is the lack of refactorability as a core design goal of toolchains. If we can easily change our software in every way we can focus on figuring out what actually works the best! Building a JavaScript based Toolchain Platform! github.com/pinf (MIT Licensed)
  • 17. What drives me? I believe a major factor constraining software evolution is the lack of refactorability as a core design goal of toolchains. If we can easily change our software in every way we can focus on figuring out what actually works the best! Building a JavaScript based Toolchain Platform! github.com/pinf (MIT Licensed) JavaScript: Very expressive and easy to refactor; everyone will know it
  • 18. What drives me? I believe a major factor constraining software evolution is the lack of refactorability as a core design goal of toolchains. If we can easily change our software in every way we can focus on figuring out what actually works the best! Building a JavaScript based Toolchain Platform! github.com/pinf (MIT Licensed) JavaScript: Very expressive and easy to refactor; everyone will know it CommonJS: Developers seeking to build a JavaScript Ecosystem which allows for:
  • 19. What drives me? I believe a major factor constraining software evolution is the lack of refactorability as a core design goal of toolchains. If we can easily change our software in every way we can focus on figuring out what actually works the best! Building a JavaScript based Toolchain Platform! github.com/pinf (MIT Licensed) JavaScript: Very expressive and easy to refactor; everyone will know it CommonJS: Developers seeking to build a JavaScript Ecosystem which allows for: • Code-sharing, interoperable libraries and portable applications
  • 20. What drives me? I believe a major factor constraining software evolution is the lack of refactorability as a core design goal of toolchains. If we can easily change our software in every way we can focus on figuring out what actually works the best! Building a JavaScript based Toolchain Platform! github.com/pinf (MIT Licensed) JavaScript: Very expressive and easy to refactor; everyone will know it CommonJS: Developers seeking to build a JavaScript Ecosystem which allows for: • Code-sharing, interoperable libraries and portable applications • Transferring the power of JavaScript to various parts of a system
  • 21. What drives me? I believe a major factor constraining software evolution is the lack of refactorability as a core design goal of toolchains. If we can easily change our software in every way we can focus on figuring out what actually works the best! Building a JavaScript based Toolchain Platform! github.com/pinf (MIT Licensed) JavaScript: Very expressive and easy to refactor; everyone will know it CommonJS: Developers seeking to build a JavaScript Ecosystem which allows for: • Code-sharing, interoperable libraries and portable applications • Transferring the power of JavaScript to various parts of a system • Seamless refactoring and re-composition of programs
  • 22. What funds my work?
  • 23. What funds my work?
  • 25. CommonJS Ecosystem Goals • Consistent low-level APIs across platforms
  • 26. CommonJS Ecosystem Goals • Consistent low-level APIs across platforms • Interoperable libraries
  • 27. CommonJS Ecosystem Goals • Consistent low-level APIs across platforms • Interoperable libraries • Securable module sandboxes
  • 28. CommonJS Ecosystem Goals • Consistent low-level APIs across platforms • Interoperable libraries • Securable module sandboxes • Portable applications
  • 29. CommonJS Ecosystem Goals • Consistent low-level APIs across platforms • Interoperable libraries • Securable module sandboxes • Portable applications • Arbitrary & re-configurable program composition
  • 30. CommonJS Ecosystem Goals • Consistent low-level APIs across platforms • Interoperable libraries • Securable module sandboxes • Portable applications • Arbitrary & re-configurable program composition • Non-conflicting namespaces
  • 31. CommonJS Ecosystem Goals • Consistent low-level APIs across platforms • Interoperable libraries • Securable module sandboxes • Portable applications • Arbitrary & re-configurable program composition • Non-conflicting namespaces • Publish code to URIs
  • 32. CommonJS Ecosystem Goals • Consistent low-level APIs across platforms • Interoperable libraries • Securable module sandboxes • Portable applications • Arbitrary & re-configurable program composition • Non-conflicting namespaces • Publish code to URIs • Depend on code from URIs
  • 33. CommonJS Ecosystem Goals • Consistent low-level APIs across platforms • Interoperable libraries • Securable module sandboxes • Portable applications • Arbitrary & re-configurable program composition • Non-conflicting namespaces • Publish code to URIs • Depend on code from URIs • Distributed package registry and repository
  • 34. CommonJS Ecosystem Goals • Consistent low-level APIs across platforms • Interoperable libraries • Securable module sandboxes • Portable applications • Arbitrary & re-configurable program composition • Non-conflicting namespaces • Publish code to URIs • Depend on code from URIs • Distributed package registry and repository • Consistent tooling interface
  • 36. Separate Concerns To achieve our goals I believe we MUST:
  • 37. Separate Concerns To achieve our goals I believe we MUST: • Clearly separate concerns
  • 38. Separate Concerns To achieve our goals I believe we MUST: • Clearly separate concerns • Logically (within runtime by using different API methods vs overloading)
  • 39. Separate Concerns To achieve our goals I believe we MUST: • Clearly separate concerns • Logically (within runtime by using different API methods vs overloading) • Physically (between runtimes and parties)
  • 40. Separate Concerns To achieve our goals I believe we MUST: • Clearly separate concerns • Logically (within runtime by using different API methods vs overloading) • Physically (between runtimes and parties) • Link everything by URIs (globally unique namespace)
  • 41. Separate Concerns To achieve our goals I believe we MUST: • Clearly separate concerns • Logically (within runtime by using different API methods vs overloading) • Physically (between runtimes and parties) • Link everything by URIs (globally unique namespace) • Layer control to introduce possibilities of indirection
  • 42. Separate Concerns To achieve our goals I believe we MUST: • Clearly separate concerns • Logically (within runtime by using different API methods vs overloading) • Physically (between runtimes and parties) • Link everything by URIs (globally unique namespace) • Layer control to introduce possibilities of indirection We are talking about layered re-configurability of a program from the outside in at any point of the program’s pre-run lifecycle.
  • 43. Separate Concerns To achieve our goals I believe we MUST: • Clearly separate concerns • Logically (within runtime by using different API methods vs overloading) • Physically (between runtimes and parties) • Link everything by URIs (globally unique namespace) • Layer control to introduce possibilities of indirection We are talking about layered re-configurability of a program from the outside in at any point of the program’s pre-run lifecycle. It must be:
  • 44. Separate Concerns To achieve our goals I believe we MUST: • Clearly separate concerns • Logically (within runtime by using different API methods vs overloading) • Physically (between runtimes and parties) • Link everything by URIs (globally unique namespace) • Layer control to introduce possibilities of indirection We are talking about layered re-configurability of a program from the outside in at any point of the program’s pre-run lifecycle. It must be: • Easy to learn and understand
  • 45. Separate Concerns To achieve our goals I believe we MUST: • Clearly separate concerns • Logically (within runtime by using different API methods vs overloading) • Physically (between runtimes and parties) • Link everything by URIs (globally unique namespace) • Layer control to introduce possibilities of indirection We are talking about layered re-configurability of a program from the outside in at any point of the program’s pre-run lifecycle. It must be: • Easy to learn and understand • Restrict only where absolutely necessary
  • 46. Separate Concerns To achieve our goals I believe we MUST: • Clearly separate concerns • Logically (within runtime by using different API methods vs overloading) • Physically (between runtimes and parties) • Link everything by URIs (globally unique namespace) • Layer control to introduce possibilities of indirection We are talking about layered re-configurability of a program from the outside in at any point of the program’s pre-run lifecycle. It must be: • Easy to learn and understand • Restrict only where absolutely necessary • Lightweight and easily implemented
  • 47. Separate Concerns To achieve our goals I believe we MUST: • Clearly separate concerns • Logically (within runtime by using different API methods vs overloading) • Physically (between runtimes and parties) • Link everything by URIs (globally unique namespace) • Layer control to introduce possibilities of indirection We are talking about layered re-configurability of a program from the outside in at any point of the program’s pre-run lifecycle. It must be: • Easy to learn and understand • Restrict only where absolutely necessary • Lightweight and easily implemented
  • 50. A/The Solution CommonJS/Modules/2.0 (draft) • function (require, exports, module) {} - Factory
  • 51. A/The Solution CommonJS/Modules/2.0 (draft) • function (require, exports, module) {} - Factory • require(“./<id>”); - Static linking (rel_id)
  • 52. A/The Solution CommonJS/Modules/2.0 (draft) • function (require, exports, module) {} - Factory • require(“./<id>”); - Static linking (rel_id) • module.load($rel_id, function callback() {}); - Dynamic linking
  • 53. A/The Solution CommonJS/Modules/2.0 (draft) • function (require, exports, module) {} - Factory • require(“./<id>”); - Static linking (rel_id) • module.load($rel_id, function callback() {}); - Dynamic linking • module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource())
  • 54. A/The Solution CommonJS/Modules/2.0 (draft) • function (require, exports, module) {} - Factory • require(“./<id>”); - Static linking (rel_id) • module.load($rel_id, function callback() {}); - Dynamic linking • module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource()) • module.declare([“<dep_rel_id>”], factory); - Strict ASYNC
  • 55. A/The Solution CommonJS/Modules/2.0 (draft) • function (require, exports, module) {} - Factory • require(“./<id>”); - Static linking (rel_id) • module.load($rel_id, function callback() {}); - Dynamic linking • module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource()) • module.declare([“<dep_rel_id>”], factory); - Strict ASYNC • require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport
  • 56. A/The Solution CommonJS/Modules/2.0 (draft) • function (require, exports, module) {} - Factory • require(“./<id>”); - Static linking (rel_id) • module.load($rel_id, function callback() {}); - Dynamic linking • module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource()) • module.declare([“<dep_rel_id>”], factory); - Strict ASYNC • require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport CommonJS/Package/Mappings/C (proposal; amendment required)
  • 57. A/The Solution CommonJS/Modules/2.0 (draft) • function (require, exports, module) {} - Factory • require(“./<id>”); - Static linking (rel_id) • module.load($rel_id, function callback() {}); - Dynamic linking • module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource()) • module.declare([“<dep_rel_id>”], factory); - Strict ASYNC • require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport CommonJS/Package/Mappings/C (proposal; amendment required) • {“archive”:”<url>”}, {“location”:”<path>”}, ... - Locators
  • 58. A/The Solution CommonJS/Modules/2.0 (draft) • function (require, exports, module) {} - Factory • require(“./<id>”); - Static linking (rel_id) • module.load($rel_id, function callback() {}); - Dynamic linking • module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource()) • module.declare([“<dep_rel_id>”], factory); - Strict ASYNC • require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport CommonJS/Package/Mappings/C (proposal; amendment required) • {“archive”:”<url>”}, {“location”:”<path>”}, ... - Locators • package.json ~ {“mappings”: {“<alias>”:<locator>}} - Pkg. Descriptor
  • 59. A/The Solution CommonJS/Modules/2.0 (draft) • function (require, exports, module) {} - Factory • require(“./<id>”); - Static linking (rel_id) • module.load($rel_id, function callback() {}); - Dynamic linking • module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource()) • module.declare([“<dep_rel_id>”], factory); - Strict ASYNC • require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport CommonJS/Package/Mappings/C (proposal; amendment required) • {“archive”:”<url>”}, {“location”:”<path>”}, ... - Locators • package.json ~ {“mappings”: {“<alias>”:<locator>}} - Pkg. Descriptor • require(“<alias>/<id>”); - Static linking (alias_id)
  • 60. A/The Solution CommonJS/Modules/2.0 (draft) • function (require, exports, module) {} - Factory • require(“./<id>”); - Static linking (rel_id) • module.load($rel_id, function callback() {}); - Dynamic linking • module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource()) • module.declare([“<dep_rel_id>”], factory); - Strict ASYNC • require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport CommonJS/Package/Mappings/C (proposal; amendment required) • {“archive”:”<url>”}, {“location”:”<path>”}, ... - Locators • package.json ~ {“mappings”: {“<alias>”:<locator>}} - Pkg. Descriptor • require(“<alias>/<id>”); - Static linking (alias_id) • module.load($alias_id, function callback() {}); - Dynamic linking
  • 61. A/The Solution CommonJS/Modules/2.0 (draft) • function (require, exports, module) {} - Factory • require(“./<id>”); - Static linking (rel_id) • module.load($rel_id, function callback() {}); - Dynamic linking • module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource()) • module.declare([“<dep_rel_id>”], factory); - Strict ASYNC • require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport CommonJS/Package/Mappings/C (proposal; amendment required) • {“archive”:”<url>”}, {“location”:”<path>”}, ... - Locators • package.json ~ {“mappings”: {“<alias>”:<locator>}} - Pkg. Descriptor • require(“<alias>/<id>”); - Static linking (alias_id) • module.load($alias_id, function callback() {}); - Dynamic linking • module.declare([“<dep_alias_id>”], factory); - Strict ASYNC
  • 62. A/The Solution CommonJS/Modules/2.0 (draft) • function (require, exports, module) {} - Factory • require(“./<id>”); - Static linking (rel_id) • module.load($rel_id, function callback() {}); - Dynamic linking • module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource()) • module.declare([“<dep_rel_id>”], factory); - Strict ASYNC • require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport CommonJS/Package/Mappings/C (proposal; amendment required) • {“archive”:”<url>”}, {“location”:”<path>”}, ... - Locators • package.json ~ {“mappings”: {“<alias>”:<locator>}} - Pkg. Descriptor • require(“<alias>/<id>”); - Static linking (alias_id) • module.load($alias_id, function callback() {}); - Dynamic linking • module.declare([“<dep_alias_id>”], factory); - Strict ASYNC • require.memoize(“<can_id>”, [“<dep_alias_id>”], factory); - Transport
  • 63. A/The Solution CommonJS/Modules/2.0 (draft) • function (require, exports, module) {} - Factory • require(“./<id>”); - Static linking (rel_id) • module.load($rel_id, function callback() {}); - Dynamic linking • module.declare(factory); - Lazy ASYNC (‘require scraping’ ~ toSource()) • module.declare([“<dep_rel_id>”], factory); - Strict ASYNC • require.memoize(“<can_id>”, [“<dep_rel_id>”], factory); - Transport CommonJS/Package/Mappings/C (proposal; amendment required) • {“archive”:”<url>”}, {“location”:”<path>”}, ... - Locators • package.json ~ {“mappings”: {“<alias>”:<locator>}} - Pkg. Descriptor • require(“<alias>/<id>”); - Static linking (alias_id) • module.load($alias_id, function callback() {}); - Dynamic linking • module.declare([“<dep_alias_id>”], factory); - Strict ASYNC • require.memoize(“<can_id>”, [“<dep_alias_id>”], factory); - Transport • /<packages>/<uri_no_protocol>/<revision>@/<lib>/<id> - Canonical ID
  • 64. Logically separate concerns Plain Module Lazy ASYNC Strict ASYNC
  • 65. Physical layers of indirection
  • 66. PINF JS Loader Overview
  • 67. PINF JS Loader Overview • Loads multiple module source formats:
  • 68. PINF JS Loader Overview • Loads multiple module source formats: • Asynchronous Module Definition (AMD)
  • 69. PINF JS Loader Overview • Loads multiple module source formats: • Asynchronous Module Definition (AMD) • CommonJS Modules 1.1
  • 70. PINF JS Loader Overview • Loads multiple module source formats: • Asynchronous Module Definition (AMD) • CommonJS Modules 1.1 • CommonJS Modules 2.0 (draft)
  • 71. PINF JS Loader Overview • Loads multiple module source formats: • Asynchronous Module Definition (AMD) • CommonJS Modules 1.1 • CommonJS Modules 2.0 (draft) • Plain JavaScript files
  • 72. PINF JS Loader Overview • Loads multiple module source formats: • Asynchronous Module Definition (AMD) • CommonJS Modules 1.1 • CommonJS Modules 2.0 (draft) • Plain JavaScript files • Dynamically downloads and resolves dependencies via CommonJS Package Mappings & Dependencies
  • 73. PINF JS Loader Overview • Loads multiple module source formats: • Asynchronous Module Definition (AMD) • CommonJS Modules 1.1 • CommonJS Modules 2.0 (draft) • Plain JavaScript files • Dynamically downloads and resolves dependencies via CommonJS Package Mappings & Dependencies • Runs an identical CommonJS package on many platforms for development and production:
  • 74. PINF JS Loader Overview • Loads multiple module source formats: • Asynchronous Module Definition (AMD) • CommonJS Modules 1.1 • CommonJS Modules 2.0 (draft) • Plain JavaScript files • Dynamically downloads and resolves dependencies via CommonJS Package Mappings & Dependencies • Runs an identical CommonJS package on many platforms for development and production: • Browser, NodeJS, V8CGI, GPSEE, RingoJS, Narwhal, Jetpack, Titanium, AdobeAir (platform and API support varies)
  • 75. PINF JS Loader Overview • Loads multiple module source formats: • Asynchronous Module Definition (AMD) • CommonJS Modules 1.1 • CommonJS Modules 2.0 (draft) • Plain JavaScript files • Dynamically downloads and resolves dependencies via CommonJS Package Mappings & Dependencies • Runs an identical CommonJS package on many platforms for development and production: • Browser, NodeJS, V8CGI, GPSEE, RingoJS, Narwhal, Jetpack, Titanium, AdobeAir (platform and API support varies) • Can load CommonJS programs and export static bundle (inlined modules) based programs for running in Browser via BravoJS (multiple platforms and loaders coming soon)
  • 76. Where does the loader typically sit?
  • 77. Architecture & process of the loader
  • 78. Architecture & process of the loader
  • 79. Dependency trees afforded by the loader
  • 80. Demo Time! github.com/cadorn/ace-extjs github.com/pinf/test-programs-js
  • 81. Thank you! Slides and links will be made available at: github.com/pinf/loader-js/wiki

Notas del editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n