Repository navigation
feat: Include filename in metadata - #3039
aleksanderkatan wants to merge 9 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 [1.16, 2.15, 4.89, 8.33, 10.07, 13.98, 28.97, 29.18]
line [1.15, 2.27, 5.00, 7.90, 9.57, 13.41, 29.31, 29.57]
line [1.15, 2.29, 4.80, 7.97, 9.27, 14.10, 29.58, 27.25]
---
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.30, 0.60, 0.84, 1.07, 1.30, 1.45, 1.74, 2.07]
line [0.32, 0.57, 0.80, 0.99, 1.28, 1.36, 1.67, 1.87]
line [0.33, 0.56, 0.76, 0.93, 1.30, 1.37, 1.61, 1.88]
---
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.99, 2.50, 4.67, 8.48, 16.49, 31.17, 63.65, 135.33]
line [1.03, 2.37, 4.48, 8.21, 15.09, 31.69, 64.35, 131.40]
line [0.88, 2.35, 4.22, 8.26, 15.05, 31.56, 66.21, 134.70]
|
Bundle size comparison (
|
| 🟢 Decreased | ➖ Unchanged | 🔴 Increased (max 0.03%) | ❔ Unknown |
|---|---|---|---|
| 0 | 343 | 12 | 0 |
No notable changes.
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) | 𝕏
29ef1b4 to
19d1fcb
Compare
6ec638a to
8eb3304
Compare
8eb3304 to
ccf0151
Compare
ccf0151 to
c0a2a43
Compare
…ilename-in-metadata
…ilename-in-metadata
…ilename-in-metadata

TODO: It may be worth splitting the path into root and relative segments, this would give us more flexibility in the future.this may be impossible, there seems to be no api like this, and best we could do is cut outprocess.cwd()