Skip to content

feat: Source maps #2935

Open
Open

Description

@aleksanderkatan

The goal of this macrotask is to link to an appropriate line and character when 'use gpu' functions turns out to be invalid.

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.

Activity

  1. pullfrog commented on Aug 27, 2026

    @pullfrog
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions