Skip to content

feat: Include filename in metadata - #3039

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

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

Conversation

@aleksanderkatan

Copy link
Copy Markdown
Member

No description provided.

@aleksanderkatan
aleksanderkatan added this pull request to stack #3025 September 18, 2026 12:07
@aleksanderkatan
aleksanderkatan force-pushed the feat/filename-in-metadata branch from 9937fd6 to fd61f28 Compare September 18, 2026 12:13
@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/eslint-plugin-typegpu@2b4e808e66cf0cf047bedacace3841b3d766efa1
https://pkg.pr.new/software-mansion/TypeGPU/tinyest@2b4e808e66cf0cf047bedacace3841b3d766efa1
https://pkg.pr.new/software-mansion/TypeGPU/tinyest-for-wgsl@2b4e808e66cf0cf047bedacace3841b3d766efa1
https://pkg.pr.new/software-mansion/TypeGPU/typegpu@2b4e808e66cf0cf047bedacace3841b3d766efa1
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/gl@2b4e808e66cf0cf047bedacace3841b3d766efa1
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@2b4e808e66cf0cf047bedacace3841b3d766efa1

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 [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]
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.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]
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.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]
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.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 ($${\color{red}+0.8\%}$$)
tgpu_vertexFn.ts 39.81 kB ($${\color{red}+0.8\%}$$)
tgpu_fragmentFn.ts 40.00 kB ($${\color{red}+0.8\%}$$)
tgpu_fn.ts 39.94 kB ($${\color{red}+0.8\%}$$)
common_fullScreenTriangle.ts 42.63 kB ($${\color{red}+0.8\%}$$)
tgpu_resolveWithContext.ts 165.45 kB ($${\color{red}+0.7\%}$$)
tgpu_resolve.ts 165.51 kB ($${\color{red}+0.7\%}$$)
STATIC_common.ts 59.39 kB ($${\color{red}+0.5\%}$$)

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
9 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 emissionfactory.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 onfactory.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) | 𝕏

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