TG4 Source Maps
June 2024
Jonathan Kuperman and Agata Belkius
This update
Quick updates
Goals of this update
Constituencies
Our Process
Stage 1
The problem is defined in an explainer document. There might already be a sketch of a solution, but it's not required. There does not need to be agreement on the direction of the solution yet.
Stage 2
List of implementations: https://github.com/jkup/source-map-users
Stage 3
Stage 4 (complete)
Fixes to the spec
Version is always the number “3” as an integer
Fixes to the spec
Clients fetching source maps over HTTP should check for and remove “)]}”
Fixes to the spec
Remove sections.url from index maps
Fixes to the spec
sourcemap HTTP header takes precedence over sourceMappingURL comment
Fixes to the spec
“Columns” in WebAssembly refer to byte offsets from the beginning
Fixes to the spec
“Columns” in WebAssembly refer to byte offsets from the beginning
Fixes to the spec
Deprecate x_google_ignoreList in favor of ignoreList
Fixes to the spec
No longer support x_ extensions
Fixes to the spec
Define WASM module custom section and the names binary format
Fixes to the spec
Describe fetching source maps in terms of the fetch API
Open question in spec
New Proposals
Anatomy of a source map
Mappings
Explainer of VLQ
(lines in the generated file are represented by semicolons)
Scopes
It’s not just names
Scopes Proposal goals
Scopes proposal
Scopes proposal
Scopes proposal
Range Mappings
Debug IDs
Source Maps
Spec Testing
Testing Generators
Testing Generators
same source code
same result
Testing Generators
same source code
different source map
Testing Generators
Testing Generators
Testing Generators
Source map validator can validate:
Testing Generators
npx [todoToolName] --sourceMap sm.js.map --generatedFile g.js --originalFolder src/
Testing Consumers
Testing Consumers
Source map tests:
Testing Consumers
Testing Consumers
Test specification: JSON format�
{
"tests": [
{
"name": "testCaseNameForHarnessUse",
"description": "Descriptive text for reader",
"baseFile": "generated-source-file.js",
"sourceMapFile": "the-source-map.js.map",
"sourceMapIsValid": true
"testActions": [ … ]
}
]
}
Testing Consumers
Test specification: test actions check more detail cases e.g. mappings
"testActions": [
{
"actionType": "checkMapping",
"generatedLine": 10,
"generatedColumn": 13,
"originalSource": "orig.js",
"originalLine": 0,
"originalColumn": 1,
"mappedName": "foobar"
}
]
Testing Consumers
There are several types of actions:
And more will be added!
Testing Consumers
What does valid mean?
Problem:
Solution:
Example: most browsers don't check version field, or check it loosely (string "3" is accepted instead of 3).
Testing Consumers
Tests revealed that more precise spec is needed.
1. VLQs: how should the 32-bit limit be interpreted? https://github.com/tc39/source-map/issues/80
Testing Consumers
Tests revealed that more precise spec is needed
2. Index maps: spell out how implementation knows if it’s an index map
https://github.com/tc39/source-map/issues/81
Testing Consumers
Tests revealed that more precise spec is needed.
3. Many more:
Testing Consumers
For future proposals:
Testing Consumers
Consumers source map spec tests:
Further Testing
Next steps:�C - consumers
G - generators