Slide 1

Slide 1 text

ݹ઒ཅհ /PEFKT࠷৽ಈ޲ !5FDI'FFE$POGFSFODF

Slide 2

Slide 2 text

Twitter: @yosuke_furukawa Github: yosuke-furukawa

Slide 3

Slide 3 text

Node.js v18

Slide 4

Slide 4 text

fetch (experimental)

Slide 5

Slide 5 text

Fetch Example const res = await fetch('https://nodejs.org/api/documentation.json'); if (res.ok) { const data = await res.json(); console.log(data); } // $ node fetch.mjs
 { type: 'module', source: 'doc/api/documentation.md', introduced_in: 'v0.10.0', ... }

Slide 6

Slide 6 text

WHATWG Stream (experimental)

Slide 7

Slide 7 text

WHATWG Stream example import { ReadableStream } from 'node:stream/web'; import { setInterval as every } from 'node:timers/promises'; import { performance } from 'node:perf_hooks'; const stream = new ReadableStream({ async start(controller) { for await (const _ of every(1000)) controller.enqueue(performance.now()); } }); for await (const value of stream) console.log(value);

Slide 8

Slide 8 text

Test Runner (experimental)

Slide 9

Slide 9 text

Test Runner Example import test from 'node:test'; import assert from 'node:assert'; test('top level test', async (t) => { await t.test('subtest 1', (t) => { assert.strictEqual(1, 1); }); await t.test('subtest 2', (t) => { assert.strictEqual(2, 2); }); }); $ node test.mjs
 TAP version 13 ok 1 - subtest 1 --- duration_ms: 0.000283375

Slide 10

Slide 10 text

userland snapshot

Slide 11

Slide 11 text

userland snapshot • bootstrap ࣌ʹେ͖͍ϑΝΠϧΛಡΈࠐ·ͳ͍ͱ͍͚ͳ ͍৔߹ʹىಈ͕஗͘ͳΔʢྫ: TypeScriptΛಡΈࠐΉʣɻ • ͢ͰʹಡΈࠐΜͩঢ়ଶͰΠϝʔδΛ࡞͓͖͍ͬͯͨ • ͜Ε͕Ͱ͖Δͷ͕ userland snapshot • Node.js build ࣌ʹಡΈࠐ·ͤΔ `./configure --node- snapshot-main=typescript-bootstrap.js && make`

Slide 12

Slide 12 text

5/27 Node.js 13th Birthday 🎂 🎉🎉🎉

Slide 13

Slide 13 text

Node.js next 10

Slide 14

Slide 14 text

Next 10 Milestones • Modern HTTP • Suitable Types for End Users • Documentation • Web Assembly • ESM • Latest ECMAScript Spec • Observability • Permissions • Better Multithread • Single Executable Applications

Slide 15

Slide 15 text

Next 10 Milestones • Modern HTTP • Suitable Types for End Users • Documentation • Web Assembly • ESM • Latest ECMAScript Spec • Observability • Permissions • Better Multithread • Single Executable Applications

Slide 16

Slide 16 text

Modern HTTP

Slide 17

Slide 17 text

Modern HTTP • http 1 / 2 [already supported] • fetch [experimentally supported] • http3 ˒ next target

Slide 18

Slide 18 text

Suitable Types / Document

Slide 19

Slide 19 text

Fetch Example const res = await fetch('https://nodejs.org/api/documentation.json'); if (res.ok) { const data = await res.json(); console.log(data); } // $ node fetch.mjs
 { type: 'module', source: 'doc/api/documentation.md', introduced_in: 'v0.10.0', ... }

Slide 20

Slide 20 text

ઈରؾ͍ͮͯͳ͍ϙΠϯτ fetch("https://nodejs.org/api/documentation.json") ͜ͷURLؾ͍ͮͯΔ...?

Slide 21

Slide 21 text

fetch('https://nodejs.org/api/documentation.json') • ͜ͷURL͸Node.jsͷυΩϡϝϯτΛJSONʹͨ͠΋ͷ • ࣮͸APIҎԼͷdocs͸HTMLʹ΋ͳͬͯΔ͠ɺશ෦JSONʹ ΋ͳͬͯΔɻ(/api/fs.json ͱ͔ /api/http.json ΋͋Δ) • ͚ͩ͜͜ͷ৘ใͩͱͨͩͷʮ΁ʔʯͰऴྃ • ࣮͸Ҿ਺ύϥϝʔλͱ͔໭Γ஋ͱ͔ͷܕ΋JSON͔ΒऔΕΔ • ͔ͬ͜Βܕ৘ใੜ੒Ͱ͖ΔΑ͏ͳ৘ใ͕औΕΔɻ

Slide 22

Slide 22 text

Types / Document • ܕ৘ใ͸ԿΒ͔ͷํ๏ͰΤϯυϢʔβʔʹಧ ͚Δ • ·ͣ͸ܕ৘ใΛϓϩάϥϚ͕Ճ޻͠΍͍͢ܗ Ͱಧ͚Δ • ಛఆͷݴޠʹಛԽͨ͠৘ใ΋ಧ͚Δ͔Ͳ͏͔ ͸Ϣʔβʔͷ੠࣍ୈ

Slide 23

Slide 23 text

Single Executable Apps

Slide 24

Slide 24 text

Single Executable Apps • ࠓͷ Node.js ΞϓϦέʔγϣϯ͸ϦϦʔεɾσϓϩΠʹ࣌ ͕͔͔ؒΔ • docker ౳Ͱ΍Δͱຖճ npm install => typescript compile => bundle ͱͳΔ • ୯Ұͷ࣮ߦՄೳͳϑΝΠϧΛ࡞ΓɺͦΕΛ഑ஔ͢Δ͚ͩͰ σϓϩΠͰ͖ΔΑ͏ʹ͢Δ • ·ͩݱ࣌఺Ͱ͸ draft ஈ֊ɺࠓޙʹظ଴

Slide 25

Slide 25 text

Node.js ͷϢʔβʔ͸ ଟछଟ༷

Slide 26

Slide 26 text

ͨͩ͠େ͖͘෼͚Δͱ2छྨ Application Developer Site Reliability Engineer

Slide 27

Slide 27 text

྆ऀͷࢥ࿭ Application Developer Site Reliability Engineer ৽͍͠ػೳΛ࢖͍͍ͨ Ͱ͖Δ͜ͱΛ૿΍͍ͨ͠ ։ൃऀମݧΛ্͍͛ͨ

Slide 28

Slide 28 text

྆ऀͷࢥ࿭ Application Developer Site Reliability Engineer ৽͍͠ػೳΛ࢖͍͍ͨ Ͱ͖Δ͜ͱΛ૿΍͍ͨ͠ ։ൃऀମݧΛ্͍͛ͨ ϒϥ΢β౳ଞͷ8FCϓϥοτϑΥʔ Ϝͱͷޓ׵ੑΛ্͛ͯ΄͍͠

Slide 29

Slide 29 text

྆ऀͷࢥ࿭ Application Developer Site Reliability Engineer Ϗϧυ΍σϓϩΠΛ҆ఆ͍ͤͨ͞ ੑೳΛ༧ଌͰ͖ΔΑ͏ʹ͍ͨ͠ ϞχλϦϯά΍਍அՄೳʹ͍ͨ͠

Slide 30

Slide 30 text

྆ऀͷࢥ࿭ Application Developer Site Reliability Engineer Ϗϧυ΍σϓϩΠΛ҆ఆ͍ͤͨ͞ ੑೳΛ༧ଌͰ͖ΔΑ͏ʹ͍ͨ͠ ϞχλϦϯά΍਍அՄೳʹ͍ͨ͠ ,VCFSOFUFT౳ίϯςφٕज़ͱͷ਌ ࿨ੑ޲্

Slide 31

Slide 31 text

྆ऀͷχʔζΛ׎͑Δඞཁ͕ ͋Δ

Slide 32

Slide 32 text

࣍ͷ Node.js 10೥Λݟਾ͑ͯ ͷ׆ಈத

Slide 33

Slide 33 text

Thanks