software-mansion / software-mansion/TypeGPU
feat(unplugin-typegpu): Obfuscate functions that were already transformed
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 122
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 34
Description
After #2755, functions will be transformed exactly once, and they will be obfuscated iff the obfuscation option is set to true.
This introduces an issue: what if somebody wants to minify their entire JS shader code, but some of it is included in a built and non-minified package?
The proposed solution is to detect such functions, parse their assigned metadata and swap it. This can be achieved by introducing more directives, for example:
- 'use gpu' means a function was not yet parsed by unplugin,
- 'used gpu' means a function was parsed by unplugin but not minified,
- no directive means a function requires no further action (either parsed & minified, or not typegpu at all).
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.
Research direction
Start by reading the transformation changes in #2755 and tracing the unplugin-typegpu function-processing path. Determine how assigned metadata and directives can distinguish unparsed, transformed-but-not-minified, and already-minified functions; done means existing transformed functions are handled according to the obfuscation option without being transformed twice.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100