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
1.3k
0
Share
ts-morphで簡単に始めるAST操作 / ast-manipulation-with-ts-morph
簡単に始めるシリーズ第二弾として、TypeScriptにおけるASTをあまり知らない方や、まだ触ったことがない方に向けて、簡単にできるASTの操作・ライブラリについてご紹介します。
aose
October 30, 2024
More Decks by aose
See All by aose
alien-signals と自作 OSS で実現する フレームワーク非依存な ロジック共通化の探求 / Exploring Framework-Agnostic Logic Sharing with alien-signals and Custom OSS
aoseyuu
4
7.6k
UnJSで簡単に始めるCLIツール開発 / cli-tool-development-with-unjs
aoseyuu
2
990
Other Decks in Technology
See All in Technology
A Harness for Behaviour: how to get AI to generate code that does what we intend, or "TDD in the age of AI"
xpmatteo
1
520
AI-DLCを活用した高品質・安全なAI駆動開発実践 / AI Driven Development
yoshidashingo
1
260
自称宇宙最速で不合格となったAIP-C01にリベンジを果たすべくAIで問題集アプリを作ってみた。
yama3133
0
240
組織の中で自分を経営する技術
shoota
0
230
GitHub Copilot のこれまでとこれから: From Copilot to Collaborative Agents
yuriemori
1
230
オンコールの負荷軽減のためのBits Assistant 活用方法 / How to Use Bits Assistant to Reduce the Workload on On-Call Staff
sms_tech
1
340
Unlocking the Apps
pimterry
0
110
Claude Codeを組織で使いこなす— サーバサイドAIエージェント運用の実践知
techtekt
PRO
0
130
layerx-fde-practices
cipepser
6
2.9k
Strands Agents超入門
kintotechdev
1
140
さきさん文庫の書籍ができるまで
sakiengineer
0
320
Spring Boot における AOT Cache 活用テクニックと 起動時間改善事例
ntt_dsol_java
0
170
Featured
See All Featured
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
230
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
230
From π to Pie charts
rasagy
0
190
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
130
The Art of Programming - Codeland 2020
erikaheidi
57
14k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
220
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.3k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
160
Amusing Abliteration
ianozsvald
1
190
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
200
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操作を簡単に始めよう!