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
sourcemap規格概要
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
rchaser53
June 15, 2017
Programming
1.2k
1
Share
sourcemap規格概要
rchaser53
June 15, 2017
More Decks by rchaser53
See All by rchaser53
LLVM IR入門
rchaser53
4
2.9k
pitch loaderについて
rchaser53
1
560
Rustからwasmを生成してみた話
rchaser53
1
790
Base64 VLQ概要
rchaser53
2
1.7k
TypeScript+React入門
rchaser53
1
900
Other Decks in Programming
See All in Programming
Structured Concurrency, Scoped Values and Joiners in the JDK 25 26 27
josepaumard
1
140
Import assertionsが消えた日~ECMAScriptの仕様はどう決まり、なぜ覆るのか~
bicstone
2
180
なぜあなたのコードには「コシ」がないのか?〜AI時代に問う、最後まで美味しい設計と戦略〜 #phpconkagawa / phpconkagawa2026
shogogg
0
140
属人化しないコード品質の作り方_2026.04.07.pdf
muraaano
0
310
クラウドネイティブなエンジニアに向ける Raycastの魅力と実際の活用事例
nealle
2
240
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
140
AI時代のエンジニアリングの原則 / Engineering Principles in the AI Era
haru860
0
1.1k
How We Benchmarked Quarkus: Patterns and anti-patterns
hollycummins
1
180
🦞OpenClaw works with AWS
licux
1
330
HTML-Aware ERB: The Path to Reactive Rendering @ RubyKaigi 2026, Hakodate, Japan
marcoroth
0
640
リセットCSSを1行消したらアクセシビリティが向上した話
pvcresin
4
480
「Linuxサーバー構築標準教科書」を読んでみた #ツナギメオフライン.7
akase244
0
1.4k
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
97
6.6k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
560
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Being A Developer After 40
akosma
91
590k
We Have a Design System, Now What?
morganepeng
55
8.1k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
360
Building Adaptive Systems
keathley
44
3k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
510
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.9k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
180
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
Transcript
Source Map Revision 3 概要 @rchaser53
CAUTION! 発表内容は発表者の独自調査によるものです 間違ってたらすみません
規格(Source Map Revision 3) 2011/4/12 年に初版に初版が公開 非常に短く実質7p くらいしかないので気軽に読める量 ( 気軽に読める内容とは言っていない)
sourcemap の出力結果 実際は1 行だけど見づらいから改行している { "version" : 3, "file": "out.js",
"sourceRoot": "", "sources": ["foo.js", "bar.js"], "sourcesContent": [null, null], "names": ["src", "maps", "are", "fun"], "mappings": "A,AAAB;;ABCDE;" }
interface と概要 { version: 3; // version 3 3固定 file:
string; // 対象 sourceRoot?: string; // 基準 sources: string[]; // 対象 元 sourcesContent?: string[]; // 変換元 names: string[]; // 対象 出力 mappings: string; // 生成前 位置 }
sourcesRoot とsources 変換前のファイルの位置を示す ファイルが存在しないと参照した際に何も表示されない sourcesRoot が空文字なケースもある (sources に全部書かれている)
対象のファイルが存在する場合
対象のファイルが存在しない場合
sourcesContent 変換前のソース ts=>js であればts のファイルの内容が出力されている sources より優先される
こんな感じに書かれている サーバに変換前のファイルを配置しなくてよくなる
name 変換後のファイルにの単語が配列として保存されている mappings で使用される 重複されて記述されることはない [] でも普通に動く
mappings Base64 VLQ というので記述されている 絶対的に情報を指定せず、相対的に情報を指定する 複雑だけど規格書には詳細は定義されていない こんなの ;AAAAA,EAAE,gBABC,CAAEB;
別資料へ… Base64 VLQ 概要
その他の情報 ・inline sourcemap ・X-Sourcemap
inline sourcemap ファイルに直接sourcemap の情報を書き込む xxx.js.map とかいらない ファイルのサイズはお察し
こんな感じになる
sourceMappingURL=data:application/json;base64 json でbase64 フォーマットだということを示して eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlbWFwVGVzdC5qcyIsInN base64 ベースの情報を続けて記述する
eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlbWFwVGVzdC5qcyIsInN ↓ { "version":3, "file":"sourcemapTest.js", "sourceRoot":"", "sources":["../src/sourcemapTest.ts"], "names":[], "mappings":"AAGA,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;AACpB,OAAO,CAAC,G "sourcesContent":["interface
Poyo {\n hoge : string;\n}\nconsole.log }
X-Sourcemap sourcemap の位置をヘッダーで指定する ソースに不要な情報が表示されなくなる 正直ソース読む人はheader も読みそうな気はする
便利なライブラリ集 mozilla/source-map sourcemap を作成やsourcemap 同士の関連付けに使える babel, webpack, uglify などが使用(TypeScript は未使用)
azu/multi-stage-sourcemap お手軽簡単に多段ソースマップが作成できる 上のライブラリのサンプルコードとして使える
ご静聴ありがとうございました!