Pro Yearly is on sale from $80 to $50! »

Node.js v13の気になる変更点 / #kng8

Node.js v13の気になる変更点 / #kng8

関西Node学園 8時限目でNode.js v13の変更点について話しました。
https://nodejs.connpass.com/event/147459/

# Topic
- V8 7.8
- full-icu is default (full support i18n)
- http_parser (legacy HTTP Parser) is removed
- remove http, http2 default server timeout
- ES Modules without flag

5cf7e9533a457726cd51232e06c1da9a?s=128

Masashi Hirano

October 25, 2019
Tweet

Transcript

  1. Node.js v13 Notable Changes ؔ੢NodeֶԂ 8࣌ݶ໨ Masashi Hirano(@shisama)

  2. ฏ໺ ণ࢜ / Masashi Hirano @shisama_ shisama Node.js Core Collaborator

    ؔ੢NodeֶԂOrganizer
  3. https://twitter.com/nodejs/status/1186695960753266689

  4. https://github.com/nodejs/Release 2019/10/21 2020/10 2022/4 2019/10/22 2020/6

  5. Node.js v13ͷಛʹؾʹͳͬͨ มߋ఺Λ঺հ͠·͢ʂ

  6. https://nodejs.org/en/blog/release/v12.0.0/

  7. V8

  8. https://github.com/nodejs/node/pull/29694

  9. V8 7.8 • Objectͷ෼ׂ୅ೖ (`const {id, name} = user;`)ͳͲͷύϑΥʔϚϯεվ ળ

    • ϝϞϦ࢖༻ྔͷ࡟ݮ • WebAssembly (WASM) ͷC/C++ͷAPIΛެࣜαϙʔτɺWASMͷى ಈ࣌ؒվળ • …etc
  10. https://v8.dev/blog/v8-release-78 More details… => v8.dev

  11. Internationalization

  12. https://github.com/nodejs/node/pull/29522

  13. Internationalization • i18nΛϑϧαϙʔτ
 ɾv12·Ͱ͸Intlܥͷؔ਺ͷҰ෦΍NumberͷtoLocaleString()ͳͲ͸ӳޠͷΈ࢖͑ͨ • ͜Ε·Ͱ͸͢΂ͯͷݴޠαϙʔτΛ͠ͳ͍Α͏ʹNode.jsΛϏϧυ͍ͯͨ͠
 ɾNode.jsͷόΠφϦͷαΠζ͕૿͑ΔͨΊආ͚ΒΕ͍ͯͨ
 ɾϑϧαϙʔτ͢ΔϏϧυʹΑΓ~40%αΠζ͕૿͑Δ
 ɾe.g. macOSͩͱ35MB͔Β49MBʹͳΔ

    • v12·Ͱ΋ —with-intl=full-icu ϑϥάΛ෇͚ͯNode.jsΛϏϧυ͢Δ͜ͱͰϑϧαϙʔτͰ͖ ͍ͯͨ
  14. https://nodejs.org/api/intl.html

  15. Intl.DateTimeFormatͷεϖΠϯޠͰͷྫ const january = new Date(9e8); const spanish = new

    Intl.DateTimeFormat('es', { month: 'long' }); console.log(spanish.format(january)); // 'M01' v12 // 'enero` v13 WҎલ TNBMMJDV Ͱ͸`.`ɺ WҎ߱ GVMMJDV Ͱ͸`FOFSP`
  16. http

  17. https://github.com/nodejs/node/pull/29522

  18. http parser • ॳظ͔Β͋ͬͨHTTPύʔαʔͷhttp_parserϞδϡʔϧΛ࡟আ • v12͔Βllhttp͕σϑΥϧτ͕ͩɺ—http-parser=legacy Φϓ γϣϯΛ෇͚Δ͜ͱͰhttp_parser͕࢖͑ͯͨ • v13͔Β—http-parser

    Φϓγϣϯ΋࡟আ͞Εͨ
  19. https://llhttp.org

  20. llhttp • http_parserͷอक͕ࠔ೉ͩͬͨͷͰҰ͔Βॻ͖௚͞Εͨ • llhttp͸TypeScriptͰॻ͔Ε͍ͯͯϝϯς͠΍͘͢ͳ͍ͬͯΔ • http_parserΑΓ࣮ߦ଎౓͕଎͍ • llparseͰTS͔ΒCݴޠ΍LLVMϏοτίʔυʹม׵͍ͯ͠Δ

  21. llhttp https://github.com/nodejs/llhttp

  22. More details… => JSConf EU 2019 https://2019.jsconf.eu/fedor-indutny/llhttp-new-http-11-parser-for-nodejs.html

  23. http, http2

  24. https://github.com/nodejs/node/pull/27558

  25. αʔόʔλΠϜΞ΢τͷ࣌ؒ • ͜Ε·Ͱ͸σϑΥϧτ2෼ͰλΠϜΞ΢τ͍ͯͨ͠ • αʔόʔͰ2෼Λ௒͑ΔॲཧΛ͢Δͱιέοτ͕ด͡ΒΕۭͷϨεϙϯε ͕ฦ͖ͬͯͨ • v13͔Β͸αʔόʔλΠϜΞ΢τ͕ແޮʹͳͬͨ • ͜Ε·Ͱ௨Γserver.setTimeoutͳͲͰλΠϜΞ΢τ·Ͱͷ࣌ؒΛઃఆ͢

    Δ͜ͱ͸Մೳ
  26. ES Modules

  27. https://github.com/nodejs/node/pull/29866

  28. ES Modules • ·ͩϦϦʔεʹؚ·Ε͍ͯͳ͍͕ɺv13ͰೖΓͦ͏ • ES Modules(import / export)͕ϑϥάͳ͠Ͱ࢖͑ΔΑ͏ʹ
 ɾ—experimental-module

    ͕ඞཁͩͬͨ • v12ʹ΋ϚΠφʔόʔδϣϯͷߋ৽ͰόοΫϙʔτ͢Δ͔΋
 ɾ12݄͕3݄ࠒʹ͸v12Ͱ΋ϑϥάͳ͠Ͱ࢖͑Δ͔΋
  29. https://github.com/nodejs/module/issue/400

  30. https://shisama.hatenablog.com/entry/2019/10/23/190842 ͦͷଞͷมߋ఺

  31. ·ͱΊ • V8ͷߋ৽ͰύϑΥʔϚϯεվળͳͲ͕͞Εͨ • i18n͕ϑϧαϙʔτ͞Εͨ • http͸ݹ͍ύʔαʔΛ࡟আ͠ɺσϑΥϧτͰλΠϜΞ΢τແޮʹ • ES Modules͕ϑϥάͳ͠Ͱ࢖͑Δ༧ఆ

  32. એ఻ 11/30(Sat), 12/1(Sun) 11/2(Sat)

  33. Thanks. @shisama_ shisama