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
ts-morphで簡単に始めるAST操作 / ast-manipulation-with-ts...
Search
aose
October 30, 2024
Technology
0
570
ts-morphで簡単に始めるAST操作 / ast-manipulation-with-ts-morph
簡単に始めるシリーズ第二弾として、TypeScriptにおけるASTをあまり知らない方や、まだ触ったことがない方に向けて、簡単にできるASTの操作・ライブラリについてご紹介します。
aose
October 30, 2024
Tweet
Share
More Decks by aose
See All by aose
UnJSで簡単に始めるCLIツール開発 / cli-tool-development-with-unjs
aoseyuu
2
550
Other Decks in Technology
See All in Technology
JAWS DAYS 2025 アーキテクチャ道場 事前説明会 / JAWS DAYS 2025 briefing document
naospon
0
2.7k
データエンジニアリング領域におけるDuckDBのユースケース
chanyou0311
9
2.5k
開発者のための FinOps/FinOps for Engineers
oracle4engineer
PRO
2
230
Introduction to OpenSearch Project - Search Engineering Tech Talk 2025 Winter
tkykenmt
2
170
生成AI×財務経理:PoCで挑むSlack AI Bot開発と現場巻き込みのリアル
pohdccoe
1
790
遷移の高速化 ヤフートップの試行錯誤
narirou
6
1.9k
サイト信頼性エンジニアリングとAmazon Web Services / SRE and AWS
ymotongpoo
7
1.8k
Ruby on Railsで持続可能な開発を行うために取り組んでいること
am1157154
3
160
クラウド食堂とは?
hiyanger
0
120
"TEAM"を導入したら最高のエンジニア"Team"を実現できた / Deploying "TEAM" and Building the Best Engineering "Team"
yuj1osm
1
230
【詳説】コンテンツ配信 システムの複数機能 基盤への拡張
hatena
0
290
Охота на косуль у древних
ashapiro
0
120
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.2k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.7k
Why You Should Never Use an ORM
jnunemaker
PRO
55
9.2k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3k
Scaling GitHub
holman
459
140k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.6k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
Designing for humans not robots
tammielis
250
25k
Raft: Consensus for Rubyists
vanstee
137
6.8k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.3k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
4 Signs Your Business is Dying
shpigford
183
22k
Transcript
ts-morphで簡単に始めるAST操作
Speaker 株式会社ヤプリ フロントエンドエンジニア 青木 優弥 / Aose Yuu • 2023/11〜
ヤプリjoin 来月からヤプリ2年目突入 • Vue Fes ボランティアスタッフ
None
None
ASTとは?
AST ↕ 抽象構文木
抽象構文木(AST:Abstract Syntax Tree) • プログラムのソースコードを階層的に表現するデータ構造 • ツリー構造で、各ノードがプログラムの構成要素を表す • ノード同士の親子関係=ソースコードの構造的な関係
None
ASTでできること • コードの解析(Linter, Formetter) • コードの変換・生成 • リファクタリング
ASTでできること • コードの解析(Linter, Formetter) • コードの変換・生成 • リファクタリング ⬇
気合いの正規表現🔥 漢の文字列置換💪 からの卒業
ts-morphとは?
ts-morph ↕ TypeScript Compiler APIの ラッパーライブラリ
超簡単な例
None
None
None
🤮
None
🥰
None
ts-morphを使った実例 vuex → pinia:簡単&部分的な例
None
None
None
None
None
None
ts-morphを使って AST操作を簡単に始めよう!