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
760
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
680
Other Decks in Technology
See All in Technology
会社紹介資料 / Sansan Company Profile
sansan33
PRO
6
380k
OCI Oracle Database Services新機能アップデート(2025/06-2025/08)
oracle4engineer
PRO
0
110
DDD集約とサービスコンテキスト境界との関係性
pandayumi
3
280
Firestore → Spanner 移行 を成功させた段階的移行プロセス
athug
1
460
Platform開発が先行する Platform Engineeringの違和感
kintotechdev
4
550
下手な強制、ダメ!絶対! 「ガードレール」を「檻」にさせない"ガバナンス"の取り方とは?
tsukaman
2
430
今!ソフトウェアエンジニアがハードウェアに手を出すには
mackee
12
4.7k
初めてAWSを使うときのセキュリティ覚書〜初心者支部編〜
cmusudakeisuke
1
240
S3アクセス制御の設計ポイント
tommy0124
3
190
Practical Agentic AI in Software Engineering
uzyn
0
100
スマートファクトリーの第一歩 〜AWSマネージドサービスで 実現する予知保全と生成AI活用まで
ganota
2
210
MCPで変わる Amebaデザインシステム「Spindle」の開発
spindle
PRO
3
3.2k
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Context Engineering - Making Every Token Count
addyosmani
1
37
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
112
20k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
61k
We Have a Design System, Now What?
morganepeng
53
7.8k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
810
Six Lessons from altMBA
skipperchong
28
4k
It's Worth the Effort
3n
187
28k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Raft: Consensus for Rubyists
vanstee
140
7.1k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
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操作を簡単に始めよう!