Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Node.js / Deno 徹底討論の時のスライド

Node.js / Deno 徹底討論の時のスライド

2022/3/17 Node学園38時限目のスライドです。

Yosuke Furukawa

March 31, 2022
Tweet

More Decks by Yosuke Furukawa

Other Decks in Programming

Transcript

  1. ΘΔ͍ͱ͜Ζ • deno: αϙʔτମ੍͕ऑ͍ • deno: ࠷৽ʹ্͛ͯ͘Εͱ͍͏ݴ͍ํʹͳΔ • ͪΐͬͱલͷϚΠφʔόʔδϣϯΛαϙʔτͯ͠΄͍͠ͱ͍͏࿩ʹͳΓ͕ͪ •

    ࠷৽ʹ͍ͭͯདྷΕΔମྗ͕ඞཁʹͳΔ • Node.js: ܕͷαϙʔτ • Node.js: ϞδϡʔϧγεςϜ͕ΰλΰλ • CJS / ESM ͷରԠʹ͍ͭͯ
  2. վળ఺ • Node.js => Deno : Deno ͬͯ npm ϞδϡʔϧΛαϙʔτ͢Δͬͯݴ͚ͬͯͨͲɺΰλΰλ͸

    Ͳ͏͢Δͷ͔ʁ • Deno: ΰλΰλ͝ͱड͚ೖΕͯ΍Δ • Node.js: ͦͨ͠ΒͲͬͪ΋ΰλΰλʹͳΔͷͰ͸ɾɾɾʁ • import fs from "node:fs"; ͜Μͳײ͡ʁ • import fs from "https://deno.land/std/fs/mod.ts"; • Deno: ίϛϡχςΟଆ͸ npm Ϟδϡʔϧͷޓ׵ੑʹ͸൓ରҙݟͩͬͨɻͰ΋Ϧʔμʔ͸ޓ׵ ੑΛਪਐͨ͠ɻͻͷ͞Θ͞Μͷҙݟ͸͸͖ͬΓ۠ผ͢ΔϥΠϯ͕͋Ε͹ྑ͍ͱࢥ͍ͬͯΔ
  3. Permission ʹ͍ͭͯ • mizchi: ࠷ॳ͸ؤு͚ͬͯͭͯΔɺͰ΋ import ͨ͠ઌͰଞͷϝϯόʔ͔Β permission ͕ଞʹඞཁʹͳͬͯ͘Δɻ •

    ѱҙͷ͋Δϝϯόʔ͕ͦΕΛݴ͖ͬͯͨΒ࣮ࡍ๷͙ͷ͸೉͍͠ • kt3k: mizchi ͞ΜʢίʔυΦʔφʔʣ͕ඞཁͱࢥͬͨ permission ͚ͩ෇༩͢Ε͹ྑ͍ͷͰɺͦΕΛڧݻʹकΔ΂͖ • mizchi: ͦΕ͸Θ͔Δ͕ɺαϓϥΠνΣʔϯΞλοΫΛकΔʹ͸࡞Δଆͱ࢖͏ଆͷ྆ํͰͷέΞ͕ඞཁͳͷͰ͸ͳ͍͔ͱࢥ͍ͬͯ Δ • ݖݶ͕ංେԽ͢Δͷ͸ΤίγεςϜͷதͰΑ͋͘Δ΋ͷɺ Android ͱ͔͸ΞϓϦΛΠϯετʔϧ͢Δͱ͖ʹશͯͷݖݶΛཁ ٻ͖ͯͨ͠Γ͢Δ • martin: Node.js policy ػೳ͕͋ΔɻηΩϡϦςΟ͸ίϛϡχςΟͷ໰୊Ͱ͋ͬͯҰͭͷςʔϚͰ͋Δ • policy.json ͰΞϐʔϧͰ͖ΔͷͰ͋Ε͹ͦΕΛίϯτϦϏϡʔτͯ͠ଞͷਓʹͪΌΜͱηΩϡϦςΟ΁ͷ഑ྀΛΞϐʔϧͨ͠ ͍ • ͨͩ࢒೦ͳ͕Βࠓ͸ policy ͷػೳ͸ͦ͜·Ͱͳ͍ͬͯͳ͍ɻ
  4. ਪ͠ػೳ • ݹ઒: Single Executable Application • Martin: webcrypto ͕࣮૷͞ΕͨΑʂ

    • kt3k: Deno task ͕࣮૷͞ΕͨΑʂ • mizchi: deno fetch ͕ϩʔΧϧʹରͯ͠Ͱ͖Δ wasmpack Λͦͷ·· ಡΈࠐΊͨ
  5. Governance ʹ͍ͭͯ • deno: BDFL ϞσϧɺϦʔμʔ͕ܾఆΛ͢Δ • node.js: Open Governance

    ϞσϧɺϦʔμʔෆࡏɺεςΞϦϯάίϛοςΟʔ͕ ܾΊΔɻ • martin: deno ͸ inc Ͱɺձࣾʹͳ͍ͬͯΔɺϦʔμʔ͕ܾΊΔ͚ͩͰ͸ͳ͓ͯۚ͘ ʹΑͬͯࠨӈ΋͞ΕΔ • kt3k: ͦΕ͸͔ͨ͠ʹͦ͏ɻϢʔβʔ਺Λ্͛ΔΑ͏ʹͯ͠ɺ͓ۚΛՔ͙ඞཁ͕͋Δ • node ͷϞδϡʔϧΛαϙʔτ͢Δͷ͸Ϣʔβʔ਺Λ্͛Δඞཁ͕͋ΔͨΊ
  6. ࠓޙ • mizchi: ͓ޓ͍௥Ճ͢Δػೳ͕ࣅ͍ͯΔɺӨڹΛड͚͍͋ͬͯΔɺ޷͖ͳํΛબ΂͹Α͍ͱ͍͏ະདྷʹͳΔɻ • ઈରަΘΒͳ͍ϥΠϯΛMicrosoft͕ʹ͗ͬͯΔɻ • ֦ுࢠͷলུՄ൱ϥΠϯ • kt3k:

    Node.jsޓ׵͕Ͱ͖ΔΑ͏ʹͳΓɺϢʔβʔ͕denoʹ૿͑Δɺདྷ೥͸΋ͬͱ፰߅͢Δɻ • martin: Node.js ͷະདྷ͸ Web Standard ͷػೳ͕΋ͬͱ૿͍͑ͯ͘ɻfetch ͷଞʹ΋ Event Emitter ͱ͔৭ʑ૿ ͍͑ͯ͘ɻ΋ͬͱϒϥ΢βϓϥοτϑΥʔϜؒͷޓ׵ੑ͕ߴ͘ͳΔ͸ͣɻ • test runner ͕ Node.js ʹೖΔ • deno ͷ࡞ઓ => deno inc ͕ microsoft ʹങΘΕΔ • furukawa: