Skip to content

fix(nuxt): update unctx to v3 beta#35540

Merged
danielroe merged 8 commits into
mainfrom
fix/unctx-v3-mem-leak-fix
Jul 13, 2026
Merged

fix(nuxt): update unctx to v3 beta#35540
danielroe merged 8 commits into
mainfrom
fix/unctx-v3-mem-leak-fix

Conversation

@DamianGlowala

@DamianGlowala DamianGlowala commented Jul 12, 2026

Copy link
Copy Markdown
Member

🔗 Linked issue

resolves #33644 (see #33644 (comment))

📚 Description

Updates unctx to v3 beta to address ALS memory leak + makes UnctxTransformPlugin async due to API changes introduced in unctx v3.0.0-beta.2.

While in beta, it can be used as a testing playground in userland apps using pkg.pr.new release.

@DamianGlowala
DamianGlowala requested a review from danielroe as a code owner July 12, 2026 20:51
@github-actions github-actions Bot added 5.x 🐛 bug Something isn't working as expected labels Jul 12, 2026
@socket-security

socket-security Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedunctx@​3.0.0-beta.29910010088100

View full report

@pkg-pr-new

pkg-pr-new Bot commented Jul 12, 2026

Copy link
Copy Markdown

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@35540

@nuxt/nitro-server

npm i https://pkg.pr.new/@nuxt/nitro-server@35540

nuxt

npm i https://pkg.pr.new/nuxt@35540

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@35540

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@35540

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@35540

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@35540

commit: 90d2e47

@coderabbitai

This comment has been minimized.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
pnpm-workspace.yaml (1)

44-44: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider adding an explanatory comment for consistency.

Other minimumReleaseAgeExclude entries include comments (e.g., # Renovate security update: [email protected]). Adding a brief comment here would help future developers understand why this beta is excluded and when it can be removed.

♻️ Suggested comment
 minimumReleaseAgeExclude:
   - '`@nuxt/`*'
   # Renovate security update: [email protected]
   - [email protected]
   - vue-bundle-renderer
   # Renovate security update: [email protected]
   - [email protected]
+  # Beta release: unctx v3 (memory leak fix)
   - [email protected]
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pnpm-workspace.yaml` at line 44, Add a brief explanatory comment alongside
the minimumReleaseAgeExclude entry for [email protected], matching the existing
comment style and documenting why this beta is excluded and when the exception
can be removed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pnpm-workspace.yaml`:
- Line 44: Add a brief explanatory comment alongside the
minimumReleaseAgeExclude entry for [email protected], matching the existing
comment style and documenting why this beta is excluded and when the exception
can be removed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 135ad701-8c3d-4ac3-ab49-e140bc236564

📥 Commits

Reviewing files that changed from the base of the PR and between 33f0fdb and 0bb9b7d.

⛔ Files ignored due to path filters (2)
  • packages/nuxt/package.json is excluded by !**/package.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (4)
  • packages/nuxt/src/core/nuxt.ts
  • packages/nuxt/src/core/plugins/unctx.ts
  • packages/nuxt/test/unctx-transform.test.ts
  • pnpm-workspace.yaml

@codspeed-hq

codspeed-hq Bot commented Jul 12, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 21 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing fix/unctx-v3-mem-leak-fix (90d2e47) with main (ea49091)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@danielroe danielroe changed the title fix(nuxt): address ALS memory leak by updating unctx to v3 beta fix(nuxt): update unctx to v3 beta Jul 13, 2026

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
packages/nuxt/src/core/plugins/unctx.ts (1)

24-45: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Consider resetting the cached transformer promise on rejection.

If createTransformer returns a rejected promise, it is cached permanently in transformer via ??=. Every subsequent call to handler will await the same rejected promise and throw, with no recovery path. While transformer creation failures are likely configuration errors (consistent, not transient), adding a catch to reset transformer would make the plugin more resilient.

♻️ Optional resilience improvement
       async handler (code) {
-        const { shouldTransform, transform } = await (transformer ??= createTransformer(options.transformerOptions))
+        try {
+          const { shouldTransform, transform } = await (transformer ??= createTransformer(options.transformerOptions))
+        } catch (e) {
+          transformer = undefined
+          throw e
+        }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/nuxt/src/core/plugins/unctx.ts` around lines 24 - 45, Update the
cached transformer initialization in the transform handler to clear transformer
when createTransformer rejects, allowing subsequent handler calls to retry
creation. Preserve the existing successful caching and transformation behavior
around shouldTransform and transform.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/nuxt/src/core/plugins/unctx.ts`:
- Around line 24-45: Update the cached transformer initialization in the
transform handler to clear transformer when createTransformer rejects, allowing
subsequent handler calls to retry creation. Preserve the existing successful
caching and transformation behavior around shouldTransform and transform.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c5d79ee1-095d-4bd4-a730-4c2a26f7fb7a

📥 Commits

Reviewing files that changed from the base of the PR and between 7d49479 and 04d6ca3.

⛔ Files ignored due to path filters (4)
  • packages/kit/package.json is excluded by !**/package.json
  • packages/nitro-server/package.json is excluded by !**/package.json
  • packages/schema/package.json is excluded by !**/package.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (1)
  • packages/nuxt/src/core/plugins/unctx.ts

@danielroe danielroe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thank you ❤️

@danielroe
danielroe enabled auto-merge July 13, 2026 10:51
@danielroe
danielroe added this pull request to the merge queue Jul 13, 2026
Merged via the queue into main with commit e9b1106 Jul 13, 2026
31 checks passed
@danielroe
danielroe deleted the fix/unctx-v3-mem-leak-fix branch July 13, 2026 11:12
@github-actions github-actions Bot mentioned this pull request Jul 13, 2026
5 tasks
@coolxinshaoye

Copy link
Copy Markdown

so,what can I do ,my version is 4.2.2 ,what is the latest version? has the problem of memory leakage been resolved?

@danielroe

danielroe commented Jul 16, 2026

Copy link
Copy Markdown
Member

just wait for the next nuxt release, which will be 4.5.0 🙏

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

Labels

5.x 🐛 bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory leak in Vue

3 participants