Skip to content

feat: Include filename in metadata - #3039

Open
aleksanderkatan wants to merge 9 commits into
feat/source-mappingfrom
feat/filename-in-metadata
Open

aleksanderkatan wants to merge 9 commits into
feat/source-mappingfrom
feat/filename-in-metadata

Conversation

@aleksanderkatan

@aleksanderkatan aleksanderkatan commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

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 out process.cwd()

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

pkg.pr.new

packages
Ready to be installed by your favorite package manager ⬇️

https://pkg.pr.new/software-mansion/TypeGPU/tgpu-gen@00deef713b46fc088a8e7c56e38b875ee1cfc3c8
https://pkg.pr.new/software-mansion/TypeGPU/typegpu@00deef713b46fc088a8e7c56e38b875ee1cfc3c8
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/cli@00deef713b46fc088a8e7c56e38b875ee1cfc3c8
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/gl@00deef713b46fc088a8e7c56e38b875ee1cfc3c8
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@00deef713b46fc088a8e7c56e38b875ee1cfc3c8

benchmark
view benchmark

commit
view commit

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

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]
Loading
---
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]
Loading
---
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]
Loading

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Bundle size comparison (import * as ... in PR vs import * as ... in target):

🟢 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.

@aleksanderkatan
aleksanderkatan force-pushed the feat/filename-in-metadata branch from b8ab4f4 to 65f3b22 Compare September 18, 2026 14:30
@aleksanderkatan aleksanderkatan mentioned this pull request Sep 18, 2026
3 of 10 tasks
@aleksanderkatan
aleksanderkatan force-pushed the feat/filename-in-metadata branch 2 times, most recently from a2ee687 to dc84ad2 Compare September 18, 2026 14:52
@aleksanderkatan
aleksanderkatan marked this pull request as ready for review September 18, 2026 14:53
Copilot AI lite review requested due to automatic review settings September 18, 2026 14:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 filename to emitted metadata when unstable_sourceMaps is 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 \x00 virtual 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.

Comment thread packages/unplugin-typegpu/src/core/factory.ts
Comment thread packages/unplugin-typegpu/test/sourceMaps.test.ts
Comment thread packages/unplugin-typegpu/test/sourceMaps.test.ts
pullfrog[bot]

This comment was marked as outdated.

@aleksanderkatan
aleksanderkatan force-pushed the feat/filename-in-metadata branch from 3908856 to 2b4e808 Compare September 18, 2026 15:24
@aleksanderkatan
aleksanderkatan requested review from cieplypolar, iwoplaza, mhawryluk, reczkok and vende11s and removed request for mhawryluk September 18, 2026 15:31

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 filename emission — factory.ts:63 now uses embedJSON(this.filename) instead of raw interpolation, matching the Babel path's t.stringLiteral behavior.
  • Updated source-map snapshots — dropped the replaceAll('\x00', '') masks and pinned filename: "\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:269 uses hires: true under unstable_sourceMaps, falling back to 'boundary' otherwise.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@aleksanderkatan
aleksanderkatan force-pushed the feat/filename-in-metadata branch 5 times, most recently from 29ef1b4 to 19d1fcb Compare September 24, 2026 13:48
@aleksanderkatan
aleksanderkatan force-pushed the feat/filename-in-metadata branch 2 times, most recently from 6ec638a to 8eb3304 Compare October 6, 2026 12:07
@aleksanderkatan
aleksanderkatan force-pushed the feat/filename-in-metadata branch from 8eb3304 to ccf0151 Compare October 13, 2026 08:29
@aleksanderkatan
aleksanderkatan force-pushed the feat/filename-in-metadata branch from ccf0151 to c0a2a43 Compare October 16, 2026 15:49

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants