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
320
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 / 森建
非ブラウザランタイムとWeb標準 / Non-Browser Runtimes and Web Standards
petamoriken
0
460
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
200
フロントエンドの標準仕様をどう追っているか / How I follow the frontend standards specs
petamoriken
4
1.7k
ECMAScript、Web標準の型はどう管理されているか / How ECMAScript and Web standards types are maintained
petamoriken
3
500
DOM Observable
petamoriken
1
220
Deno に Web 標準 API を実装する / Implementing Web standards API to Deno
petamoriken
0
630
Stage 2 Decorators の変遷 / Stage 2 Decorators history
petamoriken
0
6.6k
linaria: Zero-Runtime CSS in JS
petamoriken
2
2.2k
ESNext の議論に参加しよう / Join the ESNext discussion
petamoriken
3
820
Other Decks in Programming
See All in Programming
もう僕は OpenAPI を書きたくない
sgash708
4
1.4k
sappoRo.R #12 初心者セッション
kosugitti
0
250
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
170
“あなた” の開発を支援する AI エージェント Bedrock Engineer / introducing-bedrock-engineer
gawa
11
1.9k
Open source software: how to live long and go far
gaelvaroquaux
0
630
Java Webフレームワークの現状 / java web framework at burikaigi
kishida
9
2.2k
データベースのオペレーターであるCloudNativePGがStatefulSetを使わない理由に迫る
nnaka2992
0
130
定理証明プラットフォーム lapisla.net
abap34
1
1.8k
CNCF Project の作者が考えている OSS の運営
utam0k
6
710
color-scheme: light dark; を完全に理解する
uhyo
3
210
2024年のkintone API振り返りと2025年 / kintone API look back in 2024
tasshi
0
220
Multi Step Form, Decentralized Autonomous Organization
pumpkiinbell
1
730
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
74
9.2k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
133
33k
Code Reviewing Like a Champion
maltzj
521
39k
The Cost Of JavaScript in 2023
addyosmani
47
7.3k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Scaling GitHub
holman
459
140k
A Tale of Four Properties
chriscoyier
158
23k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
21
2.5k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
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