software-mansion / software-mansion/TypeGPU

feat(unplugin-typegpu): Obfuscate functions that were already transformed

Open
#2,783 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.