feat: Private property access#2594
Draft
aleksanderkatan wants to merge 9 commits into
Draft
Conversation
|
pkg.pr.new packages benchmark commit |
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:No major changes. 📋 All resultsClick to reveal the results table (355 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
Resolution Time Benchmark---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.90, 1.87, 4.10, 6.18, 7.67, 8.96, 20.84, 24.61]
line [0.89, 1.87, 3.88, 6.28, 6.97, 11.79, 21.76, 23.42]
line [0.94, 1.90, 3.79, 5.82, 6.78, 11.50, 20.87, 20.37]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.34, 0.57, 0.74, 0.85, 1.30, 1.28, 1.48, 1.62]
line [0.33, 0.51, 0.67, 0.82, 1.11, 1.17, 1.40, 1.62]
line [0.28, 0.56, 0.72, 0.83, 1.16, 1.20, 1.40, 1.63]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.83, 1.97, 3.29, 6.38, 12.08, 26.70, 54.99, 113.56]
line [1.01, 1.87, 3.50, 6.34, 11.85, 25.50, 55.65, 112.09]
line [0.85, 1.96, 3.82, 5.99, 11.60, 24.58, 51.81, 107.53]
|
There was a problem hiding this comment.
Pull request overview
Adds support across the TypeGPU toolchain (parser → unplugin metadata → runtime resolution → linting) for accessing class private fields (e.g. this.#prop) from 'use gpu' functions, and updates tests to cover the new syntax.
Changes:
- Teach
tinyest-for-wgslto parse/transpile private identifiers and include them in external-name extraction. - Update
unplugin-typegpuexternals serialization + auto-naming to handle class private properties and#...keys. - Relax ESLint rule coverage to allow private identifiers in
'use gpu'functions and add related tests.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/unplugin-typegpu/test/nested-externals.test.ts | Adds regression tests ensuring externals gathering supports this.#prop for Babel/Rollup transforms. |
| packages/unplugin-typegpu/test/auto-naming.test.ts | Adds auto-naming coverage for class private fields (named + anonymous classes) in Babel/Rollup transforms. |
| packages/unplugin-typegpu/src/core/factory.ts | Quotes #... externals keys when generating metadata code strings. |
| packages/unplugin-typegpu/src/core/common.ts | Enables auto-naming for ClassPrivateProperty and adds requiresQuotation() helper. |
| packages/unplugin-typegpu/src/babel.ts | Quotes #... externals keys when generating Babel AST metadata nodes. |
| packages/typegpu/tests/externalPropAccess.test.ts | Adds runtime resolution tests for private property access and '#'-containing property names. |
| packages/tinyest-for-wgsl/tests/parsers.test.ts | Adds parser test asserting this.#v becomes an external name under "this"."#v". |
| packages/tinyest-for-wgsl/src/parsers.ts | Adds transpilers for PrivateName / PrivateIdentifier. |
| packages/tinyest-for-wgsl/src/externals.ts | Extends prop-access chain extraction to include private member names. |
| packages/eslint-plugin/tests/rules/noUnsupportedSyntax.test.ts | Updates rule tests to treat private identifiers as valid in 'use gpu' scope. |
| packages/eslint-plugin/src/rules/noUnsupportedSyntax.ts | Stops reporting PrivateIdentifier as unsupported syntax inside 'use gpu'. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Only the case with both
"#prop"and#proppresent breaks.