Skip to content

Sourcemap fixes#575

Merged
Perryvw merged 8 commits intomasterfrom
sourcemap-fixes-v2
May 11, 2019
Merged

Sourcemap fixes#575
Perryvw merged 8 commits intomasterfrom
sourcemap-fixes-v2

Conversation

@tomblind
Copy link
Copy Markdown
Collaborator

@tomblind tomblind commented May 9, 2019

  • Node positions are no longer hierarchical (this caused a lot of undesired effects in sourcemaps)
  • Source maps are now built with a custom method to ensure no 'empty' mappings are generated
  • Adjustments to which original ts nodes are used for positions on imports, class boilerplate statements, and for...of temps
  • A few additional tests added for source mappings

There's still plenty more that can be done (mostly handling mappings for extra generated code like IIFEs and generators). But, this covers a bunch of common cases.

// TODO is the file: part really required? and should this be handled in the printer?
.toStringWithSourceMap({file: path.basename(sourceFile, path.extname(sourceFile)) + ".lua"});
const sourceRoot = this.options.sourceRoot
|| (this.options.outDir ? path.relative(this.options.outDir, this.options.rootDir || process.cwd()) : ".");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tsc makes the source filename either only the filename or maybe a relative path (Definitely no absolute paths), but this does produce absolute paths, which should probably be changed.

@Perryvw Perryvw merged commit e385af0 into master May 11, 2019
@Perryvw Perryvw deleted the sourcemap-fixes-v2 branch May 11, 2019 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants