SlideShare a Scribd company logo
NodeJS future
NodeJS 8.9
NodeJS 9.2
NodeJS VNext
ES6
ES7
ES8
And Michael Jackson…
@sebastienpertus (from Microsoft  )
ES6 / ES7 / ES2015 / ES2016
" ES7 is ES2016"
" ES6 is ES2015 "
" Too long for twitter … "
" How many people here are going to say ES2016 "
" Nobody, good ! "
Ecmascript from past to future
ES 8
ES 7
(ES 2016)
ES 6
(ES 2015)
ES 5
ES 3 Core features
1997 ~~ 1999
new functions
strict mode, json
2009
class, promises, generators,
arrow functions, new syntax
and concepts …
2015
Exponential (**),
array.includes,
2016
Where we are today
ES6 : Where we are today
• > 94%
• > 96% in nighty builds
http://kangax.github.io/compat-table/es6/
ES7 : Where we are today
Chakra
SpiderMonkey
V8
JavaScript Core
Nighty builds
TypeScript 2.6
Transpiler vs Compiler
Transpiler
is a specific term for taking source
code written in one language and
transforming into another
language that has a similar level of
abstraction
Compiler
is the general term for taking
source code written in one
language and transforming into
another.
"CoffeeScript is to Ruby as TypeScript is to Java/C#/C++." - Luke Hoban
The feature gap
And what about Node ?
Node version
Node.js 9.2.0 14/11/2017
Node.js 8.9.1 07/11/2017
Node.js 7.10.1 11/07/2017
Node.js 6.11.4 03/10/2017
ES support : http://node.green/
• > 98% from node 7.5 +
Enhancement Proposals : node-eps
• https://github.com/nodejs/node-eps
• Stream
• ES modules
• Url
• Asynchronous API
NodeJS CTC
• Node.js Core Technical Committee & Collaborators
• https://github.com/nodejs/CTC
From Node 7.5 (with love)
Not the future anymore… but maybe we should talk about …
ES5 : Async Programming
/* Callback Hell */
myFirstOperation(function(err, firstResult){
mySecondOperation(firstResult, function(err, secondResult){
myThirdOperation(secondResult, function(err, thirdResult){
/*
HELL !!!
*/
});
});
});
ES6 : Async Programming
/* Promises */
var myFirstPromise = new Promise(function (resolve, reject) {
// Do something
var everyhtingIsOk = true;
var result = { a: 12, b: "ok" };
if (everyhtingIsOk) {
resolve(result);
} else {
reject(Error('Something went wrong'));
}
});
ES6 : Async Programming
/* Promises */
myFirstPromise()
.then(firstResult => mySecondPromise(firstResult))
.then(secondResult => myThirdPromise(secondResult))
.then(thirdResult => {
/*
Code utilisant le 3ème résultat
*/
}).catch(err => {
/*
Gestion de l’erreur, quelque soit l’étape où elle a eu lieu
*/
});
ES7 : Async Programming
/* async await */
async function myOperations(){
const firstResult = await myFirstOperation();
const secondResult = await mySecondOperation(firstResult);
const thirdResult = await myThirdOperation(secondResult);
/*
Code
*/
};
try {
myOperations();
} catch (err) {
/*
Gestion de l’erreur, quelque soit l’étape où elle a eu lieu
*/
}
async / await
Node 8 / NPM 5
NPM 5.0.0
• --save by default
• Autmaticaly create a package-
lock.json
• npm cache rewrited
• You will have to ree-download all
your package cache
• npm fallback automaticaly to cache
if no network
• -- prefer-offline
• -- prefer-online
• -- offline
• Large package download issue
resolved
http://www.standardista.com/six-
best-new-features-in-npm-5/
Nouveautés Node 8
• Say hello to V8 5.8
• Forward compatibility with V8 5.9 and V8 6.0
Node.js API (N-API)
• Platform for building native addons.
• Independant from the underlying JavaScript Runtime
• API is Application Binary Interface (ABI) stable accross Node.JS
• Every native addons will be compatible with
• Chrome V8
• ChakraCore (https://github.com/nodejs/node-chakracore/ )
Node 8 : async_hooks
async_hooks : nodejs async tracing
“tracking the lifetime of asynchronous resources created inside a
Node.js application”
const async_hooks = require('async_hooks');
const cid = async_hooks.currentId();
const tid = async_hooks.triggerId();
const asyncHook = async_hooks.createHook({ init, before, after, destroy });
asyncHook.enable();
function init(asyncId, type, triggerId, resource) {}
function before(asyncId) {}
function after(asyncId) {}
function destroy(asyncId) {}
Node 8 : WHATWG URL Standard
• URL Standard : https://url.spec.whatwg.org/
• The URL Standard defines URLs, domains, IP addresses, the
application/x-www-form-urlencoded format, and their API.
• The URL standard takes the following approach towards making URLs
fully interoperable
import * as urlUtility from 'url';
const myUrl = new urlUtility.URL('/a/path', 'https://example.org/');
console.log(myUrl.toString());
Node 8 : util.promisify()
• util.promisify() API that allows standard Node.js callback style APIs to
be wrapped in a function that returns a Promise
• Callback Style : (err, value) => {}
function breeze(a: number, callback: (err: any, value?: number) => void) {
if (a > 10) {
callback(undefined, a * a);
} else {
callback("a must be greater than 10");
}
}
const awaitableBreeze = util.promisify(breeze);
NodeJS Future (9, 10)
Les Modules
CommonJS / AMD / ESM ?
Modules in Browser
• Safari 10.1
• Chrome canary 60
• Firefox 54
• Edge 15
With FLAGS
https://jakearchibald.com/2017/es-modules-in-browsers/
NodeJS modules : CommonJS
• Synchronous
• Evaluated during runtime
ESM vs CJS
export class person {
getFullName() { return `${this.lastName} ${this.firstName}`; }
}
import * as people from './person';
var p = new people.person();
class person {
getFullName() { return `${this.lastName} ${this.firstName}`; }
}
exports.person = person;
const people = require("./person");
var p = new people.person();
ESM modules in NodeJS
• https://github.com/nodejs/node-eps/blob/master/002-es-
modules.md
• Implement interoperability for EcmaScript 6 modules (ESM) and
Node’s existing module system (CJS)
• Allow a common module syntax for Browser (ES6 spec) and Server
side
EF modules vs NodeJS modules
• CommonJS is a dynamic loader modules system
• Synchronous
• Evaluated during runtime
• ES is a static loader modules system
• Asynchronous
• Evaluated during parse time
Example
console.log('entry eval');
require('middle');
console.log('entry done);
export {};
console.log('middle eval');
require('right');
console.log('middle done');
entry eval
middle eval
right eval
right done
middle done
entry done
export {};
console.log('right eval');
console.log('right done');
entry eval
entry done
middle eval
middle done
right eval
right done
sync async
What Node wants to :
Node wants to be able to :
• Import a CJS module from ES (import from 'commonjs-module’ )
• Import a ESM module from CJS (require('es6-module’))
ESM vs CJS. Solutions evaluated ?
• Does Node.js want to ship a synchronous or asynchronous module
loader?
• Returning a promise (async)
• Returning an object (sync)
• Both ?
• Multiple Solutions investigated:
• Use CJS (require) for actuals .js files / Use ESM (import) with a newly file .mjs
• Use a double parsing time
• Config file
• Obiwan Kenobi
Detectiong CJS / ES Modules
• https://github.com/nodejs/node/wiki/ES6-Module-Detection-in-Node
• https://github.com/dherman/defense-of-dot-js/blob/master/proposal.md
References
• http://codeheroics.github.io/talks/nodemjs/
• https://medium.com/the-node-js-collection/an-update-on-es6-modules-in-
node-js-42c958b890c
• https://hackernoon.com/node-js-tc-39-and-modules-a1118aecf95e
• https://medium.com/webpack/the-state-of-javascript-modules-
4636d1774358
• https://github.com/nodejs/node-eps/blob/master/002-es6-modules.md
• https://github.com/nodejs/node-eps/issues/57 (mjs tradeoff)
• http://2ality.com/2017/01/babel-esm-spec-mode.html
• http://2ality.com/2017/05/es-module-specifiers.html
Michael Jackson Script
• Code compiler must know if it’s a CJS or ES module
• In certain circumstance an import * from ‘foo’ could be a
CJS module or an ES module (same syntax !)
• Node.js will need to have some kind of mechanism for
identifying in advance what kind of file is being loaded
• foo.js will treat foo.js as CommonJS
• bar.mjs will treat bar.mjs as an ESM Module.
console.log(`Module load ${Date()}`)
Or ..
Changing ES Modules spec in ECMASCRIPT :
• A module allways requires an import or an export
• All modules are parsed. If it doesn't contain any of these statements,
it is not an ES Module.
Or …
Would be recognized as a CommonJS module, while
Would be an ES module.
console.log(`Module load ${Date()}`)
console.log(`Module load ${Date()}`)
export{}
But…
•It works within Babel / Typescript !!
•Under the hood, it’s just a
transpilation to CJS Modules 
Timeline
• At the current point in time, there are still a number of specification
and implementation issues that need to happen on the ES6 and
Virtual Machine side of things before Node.js can even begin working
up a supportable implementation of ES6 modules. Work is in progress
but it is going to take some time —
We’re currently looking at around a year at least.
• Node V10 « around October 2018 »
https://github.com/nodejs/Release
ES6 : Modules (ESM)
• TypeScript : Transpiling ESM Syntax in CommonJS modules
• Node.js 9+ : Implementation with flags
import {Person} from "./People";
import {Person, Material as M} from "./People";
import * as People from "./People";
import guy from './People';
https://medium.com/web-on-the-edge/es-modules-in-node-today-32cff914e4b
ES Modules in Node Today
with polyfil @std/esm
@std/esm
Works from Node.js 4
Use *.mjs modules file extension
Questions ?
@sebastienpertus

More Related Content

What's hot

Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
Akshay Mathur
 
Java script at backend nodejs
Java script at backend   nodejsJava script at backend   nodejs
Java script at backend nodejs
Amit Thakkar
 
Node.js tutoria for beginner
Node.js tutoria for beginnerNode.js tutoria for beginner
Node.js tutoria for beginner
Maninder Singh
 
NodeJS
NodeJSNodeJS
Node ppt
Node pptNode ppt
Use Node.js to create a REST API
Use Node.js to create a REST APIUse Node.js to create a REST API
Use Node.js to create a REST API
Fabien Vauchelles
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.js
Marcus Frödin
 
Getting started with developing Nodejs
Getting started with developing NodejsGetting started with developing Nodejs
Getting started with developing Nodejs
Phil Hawksworth
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Edureka!
 
All aboard the NodeJS Express
All aboard the NodeJS ExpressAll aboard the NodeJS Express
All aboard the NodeJS Express
David Boyer
 
Complete MVC on NodeJS
Complete MVC on NodeJSComplete MVC on NodeJS
Complete MVC on NodeJS
Hüseyin BABAL
 
Nodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web ApplicationsNodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web Applications
Ganesh Iyer
 
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, DhakaJavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
Nurul Ferdous
 
Server Side Event Driven Programming
Server Side Event Driven ProgrammingServer Side Event Driven Programming
Server Side Event Driven Programming
Kamal Hussain
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js Tutorial
Tom Croucher
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Vikash Singh
 
Node.js and How JavaScript is Changing Server Programming
Node.js and How JavaScript is Changing Server Programming  Node.js and How JavaScript is Changing Server Programming
Node.js and How JavaScript is Changing Server Programming
Tom Croucher
 
Node.js Patterns for Discerning Developers
Node.js Patterns for Discerning DevelopersNode.js Patterns for Discerning Developers
Node.js Patterns for Discerning Developers
cacois
 
Nodejs intro
Nodejs introNodejs intro
Nodejs intro
Ndjido Ardo BAR
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
Chris Cowan
 

What's hot (20)

Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
Java script at backend nodejs
Java script at backend   nodejsJava script at backend   nodejs
Java script at backend nodejs
 
Node.js tutoria for beginner
Node.js tutoria for beginnerNode.js tutoria for beginner
Node.js tutoria for beginner
 
NodeJS
NodeJSNodeJS
NodeJS
 
Node ppt
Node pptNode ppt
Node ppt
 
Use Node.js to create a REST API
Use Node.js to create a REST APIUse Node.js to create a REST API
Use Node.js to create a REST API
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.js
 
Getting started with developing Nodejs
Getting started with developing NodejsGetting started with developing Nodejs
Getting started with developing Nodejs
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
 
All aboard the NodeJS Express
All aboard the NodeJS ExpressAll aboard the NodeJS Express
All aboard the NodeJS Express
 
Complete MVC on NodeJS
Complete MVC on NodeJSComplete MVC on NodeJS
Complete MVC on NodeJS
 
Nodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web ApplicationsNodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web Applications
 
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, DhakaJavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
 
Server Side Event Driven Programming
Server Side Event Driven ProgrammingServer Side Event Driven Programming
Server Side Event Driven Programming
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js Tutorial
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Node.js and How JavaScript is Changing Server Programming
Node.js and How JavaScript is Changing Server Programming  Node.js and How JavaScript is Changing Server Programming
Node.js and How JavaScript is Changing Server Programming
 
Node.js Patterns for Discerning Developers
Node.js Patterns for Discerning DevelopersNode.js Patterns for Discerning Developers
Node.js Patterns for Discerning Developers
 
Nodejs intro
Nodejs introNodejs intro
Nodejs intro
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
 

Similar to Future of NodeJS

(2018) Webpack Encore - Asset Management for the rest of us
(2018) Webpack Encore - Asset Management for the rest of us(2018) Webpack Encore - Asset Management for the rest of us
(2018) Webpack Encore - Asset Management for the rest of us
Stefan Adolf
 
Webpack Encore - Asset Management for the rest of us
Webpack Encore - Asset Management for the rest of usWebpack Encore - Asset Management for the rest of us
Webpack Encore - Asset Management for the rest of us
Stefan Adolf
 
EcamScript (ESM) It's about time !
EcamScript (ESM) It's about time !EcamScript (ESM) It's about time !
EcamScript (ESM) It's about time !
Sébastien Pertus
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.js
Chris Cowan
 
Helma / RingoJS – Vienna.js Minitalk
Helma / RingoJS – Vienna.js MinitalkHelma / RingoJS – Vienna.js Minitalk
Helma / RingoJS – Vienna.js Minitalk
Philipp Naderer
 
OUTDATED (Encore)
OUTDATED (Encore)OUTDATED (Encore)
OUTDATED (Encore)
Stefan Adolf
 
RESTful API In Node Js using Express
RESTful API In Node Js using Express RESTful API In Node Js using Express
RESTful API In Node Js using Express
Jeetendra singh
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
soft-shake.ch
 
Node intro
Node introNode intro
Node intro
cloudhead
 
Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assembly
Shakacon
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
orkaplan
 
JS everywhere 2011
JS everywhere 2011JS everywhere 2011
JS everywhere 2011
Oleg Podsechin
 
Jaap : node, npm & grunt
Jaap : node, npm & gruntJaap : node, npm & grunt
Jaap : node, npm & grunt
Bertrand Chevrier
 
Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.js
Yoann Gotthilf
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.
Mike Brevoort
 
ES6 - JavaCro 2016
ES6 - JavaCro 2016ES6 - JavaCro 2016
ES6 - JavaCro 2016
Nenad Pecanac
 
Discovering OpenBSD on AWS
Discovering OpenBSD on AWSDiscovering OpenBSD on AWS
Discovering OpenBSD on AWS
Laurent Bernaille
 
Building and Scaling Node.js Applications
Building and Scaling Node.js ApplicationsBuilding and Scaling Node.js Applications
Building and Scaling Node.js Applications
Ohad Kravchick
 
Nodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredevNodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredev
Felix Geisendörfer
 
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
Susan Potter
 

Similar to Future of NodeJS (20)

(2018) Webpack Encore - Asset Management for the rest of us
(2018) Webpack Encore - Asset Management for the rest of us(2018) Webpack Encore - Asset Management for the rest of us
(2018) Webpack Encore - Asset Management for the rest of us
 
Webpack Encore - Asset Management for the rest of us
Webpack Encore - Asset Management for the rest of usWebpack Encore - Asset Management for the rest of us
Webpack Encore - Asset Management for the rest of us
 
EcamScript (ESM) It's about time !
EcamScript (ESM) It's about time !EcamScript (ESM) It's about time !
EcamScript (ESM) It's about time !
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.js
 
Helma / RingoJS – Vienna.js Minitalk
Helma / RingoJS – Vienna.js MinitalkHelma / RingoJS – Vienna.js Minitalk
Helma / RingoJS – Vienna.js Minitalk
 
OUTDATED (Encore)
OUTDATED (Encore)OUTDATED (Encore)
OUTDATED (Encore)
 
RESTful API In Node Js using Express
RESTful API In Node Js using Express RESTful API In Node Js using Express
RESTful API In Node Js using Express
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
Node intro
Node introNode intro
Node intro
 
Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assembly
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
JS everywhere 2011
JS everywhere 2011JS everywhere 2011
JS everywhere 2011
 
Jaap : node, npm & grunt
Jaap : node, npm & gruntJaap : node, npm & grunt
Jaap : node, npm & grunt
 
Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.js
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.
 
ES6 - JavaCro 2016
ES6 - JavaCro 2016ES6 - JavaCro 2016
ES6 - JavaCro 2016
 
Discovering OpenBSD on AWS
Discovering OpenBSD on AWSDiscovering OpenBSD on AWS
Discovering OpenBSD on AWS
 
Building and Scaling Node.js Applications
Building and Scaling Node.js ApplicationsBuilding and Scaling Node.js Applications
Building and Scaling Node.js Applications
 
Nodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredevNodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredev
 
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
 

Recently uploaded

GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
TIPNGVN2
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 

Recently uploaded (20)

GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 

Future of NodeJS

  • 1. NodeJS future NodeJS 8.9 NodeJS 9.2 NodeJS VNext ES6 ES7 ES8 And Michael Jackson… @sebastienpertus (from Microsoft  )
  • 2. ES6 / ES7 / ES2015 / ES2016 " ES7 is ES2016" " ES6 is ES2015 " " Too long for twitter … " " How many people here are going to say ES2016 " " Nobody, good ! "
  • 3. Ecmascript from past to future ES 8 ES 7 (ES 2016) ES 6 (ES 2015) ES 5 ES 3 Core features 1997 ~~ 1999 new functions strict mode, json 2009 class, promises, generators, arrow functions, new syntax and concepts … 2015 Exponential (**), array.includes, 2016
  • 4. Where we are today
  • 5. ES6 : Where we are today • > 94% • > 96% in nighty builds http://kangax.github.io/compat-table/es6/
  • 6. ES7 : Where we are today Chakra SpiderMonkey V8 JavaScript Core Nighty builds
  • 8. Transpiler vs Compiler Transpiler is a specific term for taking source code written in one language and transforming into another language that has a similar level of abstraction Compiler is the general term for taking source code written in one language and transforming into another. "CoffeeScript is to Ruby as TypeScript is to Java/C#/C++." - Luke Hoban
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 15.
  • 16. And what about Node ?
  • 17. Node version Node.js 9.2.0 14/11/2017 Node.js 8.9.1 07/11/2017 Node.js 7.10.1 11/07/2017 Node.js 6.11.4 03/10/2017
  • 18. ES support : http://node.green/ • > 98% from node 7.5 +
  • 19. Enhancement Proposals : node-eps • https://github.com/nodejs/node-eps • Stream • ES modules • Url • Asynchronous API
  • 20. NodeJS CTC • Node.js Core Technical Committee & Collaborators • https://github.com/nodejs/CTC
  • 21. From Node 7.5 (with love) Not the future anymore… but maybe we should talk about …
  • 22. ES5 : Async Programming /* Callback Hell */ myFirstOperation(function(err, firstResult){ mySecondOperation(firstResult, function(err, secondResult){ myThirdOperation(secondResult, function(err, thirdResult){ /* HELL !!! */ }); }); });
  • 23. ES6 : Async Programming /* Promises */ var myFirstPromise = new Promise(function (resolve, reject) { // Do something var everyhtingIsOk = true; var result = { a: 12, b: "ok" }; if (everyhtingIsOk) { resolve(result); } else { reject(Error('Something went wrong')); } });
  • 24. ES6 : Async Programming /* Promises */ myFirstPromise() .then(firstResult => mySecondPromise(firstResult)) .then(secondResult => myThirdPromise(secondResult)) .then(thirdResult => { /* Code utilisant le 3ème résultat */ }).catch(err => { /* Gestion de l’erreur, quelque soit l’étape où elle a eu lieu */ });
  • 25. ES7 : Async Programming /* async await */ async function myOperations(){ const firstResult = await myFirstOperation(); const secondResult = await mySecondOperation(firstResult); const thirdResult = await myThirdOperation(secondResult); /* Code */ }; try { myOperations(); } catch (err) { /* Gestion de l’erreur, quelque soit l’étape où elle a eu lieu */ }
  • 27.
  • 28. Node 8 / NPM 5
  • 29. NPM 5.0.0 • --save by default • Autmaticaly create a package- lock.json • npm cache rewrited • You will have to ree-download all your package cache • npm fallback automaticaly to cache if no network • -- prefer-offline • -- prefer-online • -- offline • Large package download issue resolved
  • 31.
  • 32. Nouveautés Node 8 • Say hello to V8 5.8 • Forward compatibility with V8 5.9 and V8 6.0
  • 33. Node.js API (N-API) • Platform for building native addons. • Independant from the underlying JavaScript Runtime • API is Application Binary Interface (ABI) stable accross Node.JS • Every native addons will be compatible with • Chrome V8 • ChakraCore (https://github.com/nodejs/node-chakracore/ )
  • 34.
  • 35. Node 8 : async_hooks async_hooks : nodejs async tracing “tracking the lifetime of asynchronous resources created inside a Node.js application” const async_hooks = require('async_hooks'); const cid = async_hooks.currentId(); const tid = async_hooks.triggerId(); const asyncHook = async_hooks.createHook({ init, before, after, destroy }); asyncHook.enable(); function init(asyncId, type, triggerId, resource) {} function before(asyncId) {} function after(asyncId) {} function destroy(asyncId) {}
  • 36. Node 8 : WHATWG URL Standard • URL Standard : https://url.spec.whatwg.org/ • The URL Standard defines URLs, domains, IP addresses, the application/x-www-form-urlencoded format, and their API. • The URL standard takes the following approach towards making URLs fully interoperable import * as urlUtility from 'url'; const myUrl = new urlUtility.URL('/a/path', 'https://example.org/'); console.log(myUrl.toString());
  • 37. Node 8 : util.promisify() • util.promisify() API that allows standard Node.js callback style APIs to be wrapped in a function that returns a Promise • Callback Style : (err, value) => {} function breeze(a: number, callback: (err: any, value?: number) => void) { if (a > 10) { callback(undefined, a * a); } else { callback("a must be greater than 10"); } } const awaitableBreeze = util.promisify(breeze);
  • 39.
  • 40. Les Modules CommonJS / AMD / ESM ?
  • 41. Modules in Browser • Safari 10.1 • Chrome canary 60 • Firefox 54 • Edge 15 With FLAGS https://jakearchibald.com/2017/es-modules-in-browsers/
  • 42. NodeJS modules : CommonJS • Synchronous • Evaluated during runtime
  • 43. ESM vs CJS export class person { getFullName() { return `${this.lastName} ${this.firstName}`; } } import * as people from './person'; var p = new people.person(); class person { getFullName() { return `${this.lastName} ${this.firstName}`; } } exports.person = person; const people = require("./person"); var p = new people.person();
  • 44. ESM modules in NodeJS • https://github.com/nodejs/node-eps/blob/master/002-es- modules.md • Implement interoperability for EcmaScript 6 modules (ESM) and Node’s existing module system (CJS) • Allow a common module syntax for Browser (ES6 spec) and Server side
  • 45. EF modules vs NodeJS modules • CommonJS is a dynamic loader modules system • Synchronous • Evaluated during runtime • ES is a static loader modules system • Asynchronous • Evaluated during parse time
  • 46. Example console.log('entry eval'); require('middle'); console.log('entry done); export {}; console.log('middle eval'); require('right'); console.log('middle done'); entry eval middle eval right eval right done middle done entry done export {}; console.log('right eval'); console.log('right done'); entry eval entry done middle eval middle done right eval right done sync async
  • 47. What Node wants to : Node wants to be able to : • Import a CJS module from ES (import from 'commonjs-module’ ) • Import a ESM module from CJS (require('es6-module’))
  • 48. ESM vs CJS. Solutions evaluated ? • Does Node.js want to ship a synchronous or asynchronous module loader? • Returning a promise (async) • Returning an object (sync) • Both ? • Multiple Solutions investigated: • Use CJS (require) for actuals .js files / Use ESM (import) with a newly file .mjs • Use a double parsing time • Config file • Obiwan Kenobi
  • 49.
  • 50. Detectiong CJS / ES Modules • https://github.com/nodejs/node/wiki/ES6-Module-Detection-in-Node • https://github.com/dherman/defense-of-dot-js/blob/master/proposal.md
  • 51. References • http://codeheroics.github.io/talks/nodemjs/ • https://medium.com/the-node-js-collection/an-update-on-es6-modules-in- node-js-42c958b890c • https://hackernoon.com/node-js-tc-39-and-modules-a1118aecf95e • https://medium.com/webpack/the-state-of-javascript-modules- 4636d1774358 • https://github.com/nodejs/node-eps/blob/master/002-es6-modules.md • https://github.com/nodejs/node-eps/issues/57 (mjs tradeoff) • http://2ality.com/2017/01/babel-esm-spec-mode.html • http://2ality.com/2017/05/es-module-specifiers.html
  • 52. Michael Jackson Script • Code compiler must know if it’s a CJS or ES module • In certain circumstance an import * from ‘foo’ could be a CJS module or an ES module (same syntax !) • Node.js will need to have some kind of mechanism for identifying in advance what kind of file is being loaded • foo.js will treat foo.js as CommonJS • bar.mjs will treat bar.mjs as an ESM Module. console.log(`Module load ${Date()}`)
  • 53. Or .. Changing ES Modules spec in ECMASCRIPT : • A module allways requires an import or an export • All modules are parsed. If it doesn't contain any of these statements, it is not an ES Module.
  • 54. Or … Would be recognized as a CommonJS module, while Would be an ES module. console.log(`Module load ${Date()}`) console.log(`Module load ${Date()}`) export{}
  • 55. But… •It works within Babel / Typescript !! •Under the hood, it’s just a transpilation to CJS Modules 
  • 56. Timeline • At the current point in time, there are still a number of specification and implementation issues that need to happen on the ES6 and Virtual Machine side of things before Node.js can even begin working up a supportable implementation of ES6 modules. Work is in progress but it is going to take some time — We’re currently looking at around a year at least. • Node V10 « around October 2018 » https://github.com/nodejs/Release
  • 57. ES6 : Modules (ESM) • TypeScript : Transpiling ESM Syntax in CommonJS modules • Node.js 9+ : Implementation with flags import {Person} from "./People"; import {Person, Material as M} from "./People"; import * as People from "./People"; import guy from './People';
  • 58.
  • 59. https://medium.com/web-on-the-edge/es-modules-in-node-today-32cff914e4b ES Modules in Node Today with polyfil @std/esm @std/esm Works from Node.js 4 Use *.mjs modules file extension

Editor's Notes

  1. Quand vous compilez du TypeScript, vous transformez votre code en JavaScript. Comme TypeScript est trés proche de JavaScript (ES6+), vous pouvez dire que vous Transpillez.
  2. Démo : Créer un nouveau projet TS avec Node Montrer l’intelissense Monter comment créer un server express rapidement npm install express npm install @types/express import * as express from 'express'; var app = express(); app.use("/", (req, res) => { res.send("Hello World"); }); app.listen(3000); Créer une classe Person pour montrer le passage de E5, ES6 dans TS export class Person{ firstName:string; lastName:string; constructor(fn:string, ln:string, public age=27){ this.firstName = fn; this.lastName = ln; } getFullName(){ return `Full name : ${this.firstName} ${this.lastName} ${this.age} ` } } Montrer comment on lance VS Code avec TS pour l’expérience de débuggage
  3. import fetch from 'node-fetch’; // Demo 1 créer un waiter à partir d'une promise async function wait(delay:number){ return new Promise((rs, rj) => { setTimeout(rs, delay); }); } // Démo : Ajouter node-fecth app.use("/", async (req, res) => { fetch('http://www.google.com').then((v) => { let responseText = `Hello ${p.getFullName()}<br /> ${v.statusText} `; res.send(responseText); }); })
  4. Lancer nvs et lancer chakra core Ajouter dans le rendu de la page [${process.execPath}]
  5. import * as util from "util"; declare module 'util' { export function promisify(fn: Function): (...args: any[]) => Promise<any>; } function breeze(a: number, callback: (err: any, value?: number) => void) { if (a > 10) { callback(undefined, a * a); } else { callback("a must be greater than 10"); } } const breezeAsync = util.promisify(breeze);
  6. export class Person { firstName: string; lastName: string; constructor(fn: string, ln: string, public age = 27) { this.firstName = fn; this.lastName = ln; } getFullName() { return `Full name : ${this.firstName} ${this.lastName} ${this.age} ` } } export class Kid { } export class adzdazddadadzad { } export class people { kid = () => new Kid(); person = (fn, ln, age) => new Person(fn, ln, age); az = () => new Kid() } var pp = new people(); export default pp;
  7. export class Person { constructor(fn, ln, age = 27) { this.firstName = fn; this.lastName = ln; this.age = age; } getFullName() { return `Full name : ${this.firstName} ${this.lastName} ${this.age} ` } } export class Kid { } export class adzdazddadadzad { } export class people { person(fn, ln, age) { return new Person(fn, ln, age) } kid() { return new Kid() } ad() { return new adzdazddadadzad(); } } var pp = new people(); export default pp;