bogeeee / restfuncs

MIT License
35 stars 1 forks source link

Source maps are broken for user's ServerSession subclasses #2

Open bogeeee opened 4 months ago

bogeeee commented 4 months ago

Occurs for all files with a @remote decorator (those are modified in the restfuncs-transformer stage). I think, there won't be an easy fix for this soon, or we need someone who's really familiar with the tsc compiler internals. See this discussion.

bogeeee commented 2 months ago

I think, the precise problem is in: transformer/index.ts: compilerHost.fileCache.set(sourceFile.fileName, updatedSourceFile);

from there on, the compiler takes this as the original file and i think, there's no way, you could provide a (let's say:) originalSourceFile.ts -> updatedSourceFile.ts source map there. So you'd kind of have the grab the generated code (either from the generated AST, during visiting, or by a diff afterwards) and squeeze all that code into one line inside the original file content at the correct position. Not quiet easy...

bogeeee commented 2 months ago

/reward 200

How to earn this $200.00 reward?
💪 Comment /try and start working on solving the issue! 🙌 And when you open the PR, comment /claim #2 either in the PR description or in a PR's comment