feat: Include filename in metadata - #3039
aleksanderkatan wants to merge 6 commits into
Conversation
9937fd6 to
fd61f28
Compare
|
pkg.pr.new packages benchmark commit |
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.81, 1.55, 3.48, 5.01, 6.09, 10.02, 19.43, 20.66]
line [0.76, 1.46, 3.17, 5.08, 6.29, 9.89, 19.63, 17.95]
line [0.72, 1.48, 3.15, 5.33, 5.87, 10.16, 19.46, 20.11]
---
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.29, 0.44, 0.55, 0.68, 0.95, 0.97, 1.13, 1.27]
line [0.26, 0.44, 0.61, 0.62, 0.82, 0.86, 1.14, 1.22]
line [0.20, 0.38, 0.52, 0.63, 0.86, 0.88, 1.09, 1.23]
---
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.78, 1.80, 3.13, 5.49, 10.63, 22.07, 44.97, 91.83]
line [0.73, 1.77, 3.40, 5.45, 9.34, 19.82, 43.49, 87.39]
line [0.65, 1.79, 2.91, 5.34, 9.18, 20.81, 43.27, 87.43]
|
Bundle size comparison (
|
| 🟢 Decreased | ➖ Unchanged | 🔴 Increased (max 0.81%) | ❔ Unknown |
|---|---|---|---|
| 0 | 313 | 12 | 0 |
import * as ... in PR vs import * as ... in target (did bundle size increase?):
| Test | tsdown |
|---|---|
| tgpu_computeFn.ts | 39.52 kB ( |
| tgpu_vertexFn.ts | 39.81 kB ( |
| tgpu_fragmentFn.ts | 40.00 kB ( |
| tgpu_fn.ts | 39.94 kB ( |
| common_fullScreenTriangle.ts | 42.63 kB ( |
| tgpu_resolveWithContext.ts | 165.45 kB ( |
| tgpu_resolve.ts | 165.51 kB ( |
| STATIC_common.ts | 59.39 kB ( |
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.
b8ab4f4 to
65f3b22
Compare
a2ee687 to
dc84ad2
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The unplugin factory emits filename via unescaped string interpolation, which can produce invalid JS for common ids (e.g., Windows backslashes or virtual \x00 ids).
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR extends TypeGPU function metadata to optionally include the originating filename (gated behind unstable_sourceMaps), so downstream tooling can associate collected metadata with the source file.
Changes:
- Add
filenameto emitted metadata whenunstable_sourceMapsis enabled (Babel + unplugin factory paths). - Update TypeGPU metadata normalization types to carry
filename. - Extend tests to validate filename inclusion/omission and adjust Rollup snapshot handling for
\x00virtual ids.
File summaries
| File | Description |
|---|---|
| packages/unplugin-typegpu/test/transform.ts | Allows passing filename into the Babel test transform helper. |
| packages/unplugin-typegpu/test/sourceMaps.test.ts | Adds assertions for filename presence/absence and tweaks Rollup snapshot normalization. |
| packages/unplugin-typegpu/src/core/factory.ts | Emits filename into metadata object literal for unplugin transforms when source maps are enabled. |
| packages/unplugin-typegpu/src/babel.ts | Emits filename into Babel-generated metadata object when source maps are enabled. |
| packages/typegpu/src/shared/normalizeMetadata.ts | Extends raw/normalized metadata typings to include optional filename. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
3908856 to
2b4e808
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the single commit pushed since the prior pullfrog review (39088563, landed as 2b4e808e — "Escape file name"), which resolves the outstanding feedback.
- Escaped the factory
filenameemission —factory.ts:63now usesembedJSON(this.filename)instead of raw interpolation, matching the Babel path'st.stringLiteralbehavior. - Updated source-map snapshots — dropped the
replaceAll('\x00', '')masks and pinnedfilename: "\u0000virtual:code"in the Rollup snapshots, so the escaping is now covered by a test that would fail if it regressed. - Enabled high-resolution source maps when the feature is on —
factory.ts:269useshires: trueunderunstable_sourceMaps, falling back to'boundary'otherwise.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

No description provided.