Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Contributing to Deno is fun!
Search
petamoriken / 森建
October 20, 2023
Programming
0
360
Contributing to Deno is fun!
Deno Fest ディノフェス - presented by toranoana.deno
https://deno-fest-2023.deno.dev/
petamoriken / 森建
October 20, 2023
Tweet
Share
More Decks by petamoriken / 森建
See All by petamoriken / 森建
Denoでフロントエンド開発 2025年春版 / Frontend Development with Deno (Spring 2025)
petamoriken
1
1.4k
非ブラウザランタイムとWeb標準 / Non-Browser Runtimes and Web Standards
petamoriken
0
510
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
230
フロントエンドの標準仕様をどう追っているか / How I follow the frontend standards specs
petamoriken
4
2k
ECMAScript、Web標準の型はどう管理されているか / How ECMAScript and Web standards types are maintained
petamoriken
3
540
DOM Observable
petamoriken
1
260
Deno に Web 標準 API を実装する / Implementing Web standards API to Deno
petamoriken
0
680
Stage 2 Decorators の変遷 / Stage 2 Decorators history
petamoriken
0
6.8k
linaria: Zero-Runtime CSS in JS
petamoriken
2
2.3k
Other Decks in Programming
See All in Programming
PT AI без купюр
v0lka
0
190
TVer iOSチームの共通認識の作り方 - Findy Job LT iOSアプリ開発の裏側 開発組織が向き合う課題とこれから
techtver
PRO
0
710
MLOps Japan 勉強会 #52 - 特徴量を言語を越えて一貫して管理する, 『特徴量ドリブン』な MLOps の実現への試み
taniiicom
2
570
技術懸念に立ち向かい 法改正を穏便に乗り切った話
pop_cashew
0
750
鯛変だったRubyKaigi 2025 ── それでも楽しかった!
pndcat
0
130
Parallel::Pipesの紹介
skaji
2
870
SpringBootにおけるオブザーバビリティのなにか
irof
1
890
ワンバイナリWebサービスのススメ
mackee
10
7.4k
從零到一:搭建你的第一個 Observability 平台
blueswen
0
210
primeNumberでのRBS導入の現在 && RBS::Traceでinline RBSを拡充してみた
mnmandahalf
0
250
CQRS/ESのクラスとシステムフロー ~ RailsでフルスクラッチでCQRSESを組んで みたことから得た学び~
suzukimar
0
190
Doma で目指す ORM 最適解
nakamura_to
1
160
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3k
Writing Fast Ruby
sferik
628
61k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
32
5.8k
Unsuck your backbone
ammeep
671
58k
Embracing the Ebb and Flow
colly
85
4.7k
We Have a Design System, Now What?
morganepeng
52
7.6k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
34
2.3k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Transcript
Contributing to Deno is fun! pixiv Inc. 森内建太 petamoriken 2023.10.20
2 自己紹介 • Web エンジニア • ECMAScript や WHATWG を追うのが好き • よく仕様についての記事を書いています petamoriken プロダクト支援本部
課題解決部(福岡)
3
4 目次 • Deno の構成 • Deno 内部の JavaScript • primordials.js について • コントリビュート手順
• プルリクエストの具体例
5 Deno の構成 • Cargo (Rust) ワークスペースで管理されている • https://github.com/denoland/deno ◦ cli コマンドライン
◦ runtime 実行部分 ◦ ext Web 標準 API、FFI、Node.js 互換レイヤーなど • https://github.com/denoland/deno_core ◦ core V8、JS と Rust を仲介する部分 (ops) など
6 Deno 内部の JavaScript • Deno API のインターフェースは JavaScript で実装されている ◦ Web 標準 API、Node.js 互換レイヤーなど ◦ ファイルシステム、ネットワークなど外界とのやり取りは Rust
• 実行時に都度テキストとして読み込むと時間がかかる 👉 V8 スナップショット機能で JavaScript と ops の初期化処理を高速化
pub fn create_runtime_snapshot(snapshot_path: PathBuf) { let fs = std::sync::Arc::new(deno_fs::RealFs); let
mut extensions: Vec<Extension> = vec![ deno_webidl::deno_webidl::init_ops_and_esm(), deno_console::deno_console::init_ops_and_esm(), deno_url::deno_url::init_ops_and_esm(), deno_web::deno_web::init_ops_and_esm::<Permissions>( Default::default(), Default::default(), ), // ... ]; 7 deno/runtime/build.rs
function quoteString(string, ctx) { const quote = ArrayPrototypeFind( ctx.quotes, (c)
=> !StringPrototypeIncludes(string, c), ) ?? ctx.quotes[0]; const escapePattern = new SafeRegExp(`(?=[${quote}\\\\])`, "g"); string = StringPrototypeReplace(string, escapePattern, "\\"); if (ctx.escapeSequences) { string = replaceEscapeSequences(string); } return `${quote}${string}${quote}`; } 8 deno/ext/console/01_console.js
9 primordials.js について • プロトタイプ汚染されても問題なく内部コードが実行できるようするためのもの ◦ deno_core/core/00_primordials.js で提供される • CI で dlint prefer-primordials ルールでチェックされる // NG
["foo", "bar"].include("foo"); // OK const { ArrayPrototypeInclude } = window.__bootstrap.primordials; ArrayPrototypeInclude(["foo", "bar"], "foo");
10 コントリビュート手順 1. イシューを見つける • good first issue ラベルが付いているものが取っつきやすいです 2. 取り組むことを宣言する
3. プルリクエストを作成する • わからない箇所は Discord や日本コミュニティ Slack などで気軽に聞いて👌 • 見てもらう前に cargo test ./ tools/format.js ./tools/lint.js を 実行して CI を通す くわしくはコントリビュートガイドへ https://docs.deno.com/runtime/manual/references/contributing/
11 プルリクエストの具体例 • feat(console): Display cause errors in console #12462