Skip to content

fix(scripts): keep bundle option removal valid before spreads/trailing commas - #994

Open
danielroe wants to merge 1 commit into
mainfrom
fix-bundle-spread-transform
Open

danielroe wants to merge 1 commit into
mainfrom
fix-bundle-spread-transform

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

📚 Description

useScript with bundle: true before a spread doesn't compile, e.g.:

useScript('https://example.com/s.js', { bundle: true, ...options })
// useScript('/_scripts/assets/e3b0c44298fc1c14.js', { , ...options })

this PR removes the property along with the adjacent comma, so it can sit anywhere in the options object.

@danielroe
danielroe requested a review from harlan-zw November 29, 2026 11:41
@vercel

vercel Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
scripts-playground Error Error Nov 29, 2026 11:41am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The transform now removes a literal bundle property using the positions of neighbouring properties. Parameterised tests cover its removal before, between, and after properties or spreads, including multiline objects and trailing commas. Each test checks the transformed output and confirms that it parses.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: Minimal · up to 7d9b1

This fixes invalid output when bundle: true appears before a spread in a useScript options object. The change is narrow and has test coverage for the relevant positions. No merge-blocking risk is identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix (keeping bundle option removal valid before spreads and trailing commas), which matches the transform.ts change. It is specific and concise, and it identifies the main change. …
Description check Passed The description states the problem: useScript with bundle: true before a spread produces invalid code. It also states the fix: removing the property with its adjacent comma. This directly describes th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the fix (keeping bundle option removal valid before spreads and trailing commas), which matches the transform.ts change. It is specific and concise, and it identifies the main change. The conventional-commit scope 'scripts' is slightly broader than the affected package path, but this does not affect relevance.

Full details: Description check

Explanation

The description states the problem: useScript with bundle: true before a spread produces invalid code. It also states the fix: removing the property with its adjacent comma. This directly describes the changeset. The linked issue placeholder is unfilled, but the check is lenient on that point.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9202fd0f-4ce0-445d-95c8-714a8c0c4631
Commits

Reviewing files that changed from the base of the PR and between f08c676 and 7d9b106.

Files selected for processing: 2

  • packages/script/src/plugins/transform.ts
  • test/unit/transform.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@harlan-zw

Copy link
Copy Markdown
Collaborator

🟠 Approval needed · outside contributor

Thanks for the pull request. Automated review and repair of 7d9b106 wait for Harlan.

Harlan adds the harlan-agent-review label to start them.

Harlan Agent Kit automated status, not Harlan's · AI policy

@pkg-pr-new

pkg-pr-new Bot commented Nov 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/scripts-devtools@994
npm i https://pkg.pr.new/@nuxt/scripts@994

commit: 7d9b106

@github-actions

Copy link
Copy Markdown

📦 Package Size

⚠️ 2 size metrics grew

📚 22 runtime dependencies (no change)

Package output Gzipped Δ
@nuxt/scripts · export . 27 kB → 27 kB 🔴 +23 B (+0.1%)
@nuxt/scripts · published payload 244 kB → 244 kB 🔴 +23 B (+0.0%)
All tracked output (25)
Package output Gzipped Raw
@nuxt/scripts-cli · runtime dependencies 72 kB 355 kB ✅
@nuxt/scripts-cli · dependency magicast 72 kB 355 kB ✅
@nuxt/scripts-cli · export . 3.4 kB 12 kB ✅
@nuxt/scripts-cli · published payload 3.4 kB 12 kB ✅
@nuxt/scripts · runtime dependencies 543 kB 2.40 MB ✅
@nuxt/scripts · dependency @oxc-project/types 0 B 0 B ✅
@nuxt/scripts · dependency @vueuse/core 178 kB 720 kB ✅
@nuxt/scripts · dependency @vueuse/shared 39 kB 152 kB ✅
@nuxt/scripts · dependency lru-cache 141 kB 623 kB ✅
@nuxt/scripts · dependency semver 25 kB 72 kB ✅
@nuxt/scripts · dependency sirv 8.8 kB 21 kB ✅
@nuxt/scripts · dependency unstorage 70 kB 225 kB ✅
@nuxt/scripts · dependency valibot 82 kB 590 kB ✅
@nuxt/scripts · dist/runtime 126 kB 337 kB ✅
@nuxt/scripts · export . 27 kB 100 kB 🔴
@nuxt/scripts · export ./registry 288 B 449 B ✅
@nuxt/scripts · export ./stats 12 kB 97 kB ✅
@nuxt/scripts · export ./types-source 50 kB 259 kB ✅
@nuxt/scripts · published payload 244 kB 883 kB 🔴
@nuxt/scripts · app runtime 176 B 658 B ✅
@nuxt/scripts · components runtime 3.6 kB 8.5 kB ✅
@nuxt/scripts · composables runtime 10 kB 29 kB ✅
@nuxt/scripts · registry runtime 52 kB 140 kB ✅
@nuxt/scripts · server runtime 40 kB 108 kB ✅
@nuxt/scripts · utils runtime 3.5 kB 8.6 kB ✅
Runtime dependencies (22)
Package Dependency Requested Resolved Cost
@nuxt/scripts-cli magicast ^0.5.5 0.5.5 📦 72 kB gzip
@nuxt/scripts-cli pathe ^2.0.3 2.0.3 ♻️ free via Nuxt 4.7.0
@nuxt/scripts @nuxt/kit ^4.7.0 4.7.0 ♻️ free via Nuxt 4.7.0
@nuxt/scripts @oxc-project/types ^0.153.0 0.153.0 📦 0 B gzip
@nuxt/scripts @vueuse/core ^15.0.0 15.0.0 📦 178 kB gzip
@nuxt/scripts @vueuse/shared ^15.0.0 15.0.0 📦 39 kB gzip
@nuxt/scripts consola ^3.4.2 3.4.2 ♻️ free via Nuxt 4.7.0
@nuxt/scripts defu ^6.1.7 6.1.7 ♻️ free via Nuxt 4.7.0
@nuxt/scripts lru-cache ^11.5.3 11.5.3 📦 141 kB gzip
@nuxt/scripts magic-string ^1.4.3 1.4.3 ♻️ free via Nuxt 4.7.0
@nuxt/scripts ofetch ^1.5.1 1.5.1 ♻️ free via Nuxt 4.7.0
@nuxt/scripts ohash ^2.0.12 2.0.12 ♻️ free via Nuxt 4.7.0
@nuxt/scripts oxc-walker ^1.1.1 1.1.1 ♻️ free via Nuxt 4.7.0
@nuxt/scripts pathe ^2.0.3 2.0.3 ♻️ free via Nuxt 4.7.0
@nuxt/scripts semver ^7.8.5 7.8.5 📦 25 kB gzip
@nuxt/scripts sirv ^3.0.2 3.0.2 📦 8.8 kB gzip
@nuxt/scripts std-env ^4.3.0 4.3.0 ♻️ free via Nuxt 4.7.0
@nuxt/scripts ufo ^1.6.4 1.6.4 ♻️ free via Nuxt 4.7.0
@nuxt/scripts ultrahtml ^1.7.0 1.7.0 ♻️ free via Nuxt 4.7.0
@nuxt/scripts unplugin ^3.4.0 3.4.0 ♻️ free via Nuxt 4.7.0
@nuxt/scripts unstorage ^1.17.5 1.17.5 📦 70 kB gzip
@nuxt/scripts valibot ^1.5.0 1.5.0 📦 82 kB gzip

Baseline: main_@_f08c676d___2026-11-25 · gzip is the comparison metric · changes below 16 B gzip are ignored

This branch had an error being deployed

1 failed deployment
Preview — 7d9b106f Deployed Nov 29, 2026 by vercel[bot]
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