Empty sourcemaps from print
- Dominant language
- TypeScript
- Stars
- 5.3k
- Forks
- 363
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 3
Description
while coming back to:
https://github.com/bmeck/node-ast-investigator
I noticed adding recast sourceFileName to parse and sourceMapName to things that the source map is empty. Maybe I am missing something?
``` javascript
var ScopeChain = require('../analysis/ScopeChain').ScopeChain;
var src = (require('fs').readFileSync(process.argv[2])).toString();
var scope = ScopeChain.fromAST(require('recast').parse(src, {
sourceFileName: 'test.js'
}));
console.log(require('util').inspect(scope, {depth: null, colors: true}))
var result = require('recast').print(scope.children[0].node, {
sourceMapName: '_.json'
});
var SourceMapConsumer = require("source-map").SourceMapConsumer;
var smc = new SourceMapConsumer(result.map);
console.log(smc.originalPositionFor({
line: 3,
column: 0
}));
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the example using recast.parse with sourceFileName and recast.print with sourceMapName, then inspect result.map through source-map's SourceMapConsumer. Trace the parse and print entry points to determine why the generated map is empty; done means the map contains usable mappings and originalPositionFor returns the expected source location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100