software-mansion / software-mansion/TypeGPU
feat: Source maps
Open
@aleksanderkatan is already working on this.
Since Aug 27, 2026.
MACROTASK
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 122
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 34
Description
The goal of this macrotask is to link to an appropriate line and character when 'use gpu' functions turns out to be invalid.
- Add a node wrapper for Identifier, so that it can be sourcemapped (#2973)
- Create a function for extracting sourcemaps from tinyest (#3023)
- Accept source maps in
transpileFn(#2975) - Collect source maps in plugin (#2942)
- Include filename in metadata (#3039)
- Update wgsl errors to all go through a report function that returns
never(so that we can later useevalthere) - Include source of error in WGSL errors
- Document the feature
- Make the error link clickable
We could fake-include the errorous file in the stack trace, like WESL does. Something like this:
const fileUrl = `${window.location.origin}/src/main.ts?raw`;
const sourceMap = {
version: 3,
file: 'fakeErrorFile.js',
sources: [fileUrl],
mappings: `AA${toVLQ(/* line */ 11)}${toVLQ(/* char */ 4)}`,
};
const base64Map = btoa(
String.fromCharCode(...new TextEncoder().encode(JSON.stringify(sourceMap))),
);
const errFile = `\
throw new Error(':c');
//# sourceMappingURL=data:application/json;base64,${base64Map}
//# sourceURL=apps/typegpu-docs/src/examples/simple/triangle/index.ts
`;
eval(errFile);
(RFC, extra work outside of original scope) Handle device errors.
WESL provides WeslDevice that takes generated source maps into account. We could do the same.
We should probably start with just catching and re-throwing errors. This may allow for easier RN debugging.
This will require us to collect another source map of generated WGSL.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.