Teach recast.parse about //#sourceURL= and //#sourceMappingURL=
- Dominant language
- TypeScript
- Stars
- 5.3k
- Forks
- 363
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 3
Description
Currently, the `Lines` object created by `recast.parse(source, options)` knows the name of the source file that was parsed only if `options.sourceFileName` is explicitly provided.
When the parsed code contains a `//#sourceURL=` or `//#sourceMappingURL=` comment, we can use that information to inform the `Lines` object where it came from, even if no `options.sourceFileName` is provided.
When the `recast.parse`d AST is reprinted by `recast.print`, we should be able to aggregate all that source mapping information into `recast.print(ast).map`, even if there are fragments from multiple source files mixed together in the final AST.
If we get this right, you'll be able to mix and match ASTs to your heart's content without ever thinking about source maps.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the recast.parse entry point and inspect how the Lines object receives sourceFileName, then trace recast.print(ast).map generation. Use the existing //#sourceURL= and //#sourceMappingURL= comment handling as the scope boundary. Done means parsed source comments populate source information and printed ASTs aggregate mappings from multiple source files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100