Skip to content

fix(script): use registry key for bundler config and proxy lookups - #926

Merged
harlan-zw merged 3 commits into
mainfrom
fix/issue-925
Sep 22, 2026
Merged

harlan-zw merged 3 commits into
mainfrom
fix/issue-925

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

resolves #925

📚 Description

First-party mode silently skipped TikTok Pixel. The bundler guessed the registry key by lowercasing the first letter of the composable name: useScriptTikTokPixel yields tikTokPixel, but the registry entry is keyed tiktokPixel. The proxy config lookup missed, so the bundled pixel kept calling analytics.tiktok.com directly instead of going through /_scripts/p/. I hit this through the repro in #925.

useScriptLinkedInInsight (→ linkedInInsight), useScriptYouTubePlayer (→ youTubePlayer), and useScriptPostHog (→ postHog) carried the same divergence. The bundler now reads the key from the matched registry entry instead of deriving it, so config and proxy lookups use the same canonical key as the rest of the module.

Before, with registry: { tiktokPixel: { id: '...' } } and first-party enabled, the stored bundle kept its origin URLs:

(function(){var e="https://analytics.tiktok.com/i18n/identify";ttq.load("C1234");})();

After, the same build rewrites them through the proxy:

var e=self.location.origin+"/_scripts/p/analytics.tiktok.com/i18n/identify"

One thing I am unsure about: YouTube Player and PostHog resolve their scripts at runtime, so I could not exercise them through the build-time bundler. They inherit the corrected lookup, but I have no direct test for them.

🤖 AI disclosure: Harlan Agent Kit modified this description. My AI open-source policy.

@vercel

vercel Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
scripts-playground Ready Ready Preview Sep 22, 2026 2:33am UTC

Request Review

@pkg-pr-new

pkg-pr-new Bot commented Sep 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/scripts@926

commit: 0d8a7ba

@github-actions

github-actions Bot commented Sep 22, 2026

Copy link
Copy Markdown

📦 Package Size

⚠️ 5 size metrics grew

📚 22 runtime dependencies (no change)

Package output Gzipped Δ
@nuxt/scripts · dist/runtime 101 kB → 102 kB 🔴 +669 B (+0.7%)
@nuxt/scripts · export . 26 kB → 26 kB 🔴 +39 B (+0.2%)
@nuxt/scripts · published payload 218 kB → 219 kB 🔴 +708 B (+0.3%)
@nuxt/scripts · composables runtime 7.5 kB → 7.8 kB 🔴 +316 B (+4.2%)
@nuxt/scripts · utils runtime 2.5 kB → 2.9 kB 🔴 +353 B (+13.9%)
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 436 kB 1.92 MB
@nuxt/scripts · dependency @nuxt/devtools-kit 2.9 kB 7.7 kB
@nuxt/scripts · dependency @oxc-project/types 0 B 0 B
@nuxt/scripts · dependency @vueuse/core 174 kB 707 kB
@nuxt/scripts · dependency @vueuse/shared 39 kB 154 kB
@nuxt/scripts · dependency h3 34 kB 146 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 102 kB 300 kB 🔴
@nuxt/scripts · export . 26 kB 106 kB 🔴
@nuxt/scripts · export ./registry 29 kB 91 kB
@nuxt/scripts · export ./stats 13 kB 91 kB
@nuxt/scripts · export ./types-source 48 kB 244 kB
@nuxt/scripts · published payload 219 kB 832 kB 🔴
@nuxt/scripts · components runtime 2.5 kB 6.4 kB
@nuxt/scripts · composables runtime 7.8 kB 26 kB 🔴
@nuxt/scripts · registry runtime 45 kB 133 kB
@nuxt/scripts · server runtime 29 kB 87 kB
@nuxt/scripts · utils runtime 2.9 kB 8.1 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.5.2
@nuxt/scripts @nuxt/devtools-kit ^3.4.2 3.4.2 📦 2.9 kB gzip
@nuxt/scripts @oxc-project/types ^0.150.0 0.150.0 📦 0 B gzip
@nuxt/scripts @vueuse/core ^14.4.0 14.4.0 📦 174 kB gzip
@nuxt/scripts @vueuse/shared ^14.4.0 14.4.0 📦 39 kB gzip
@nuxt/scripts consola ^3.4.2 3.4.2 ♻️ free via Nuxt 4.5.2
@nuxt/scripts defu ^6.1.7 6.1.7 ♻️ free via Nuxt 4.5.2
@nuxt/scripts h3 ^1.15.11 1.15.11 📦 34 kB gzip
@nuxt/scripts magic-string ^1.4.1 1.4.1 ♻️ free via Nuxt 4.5.2
@nuxt/scripts ofetch ^1.5.1 1.5.1 ♻️ free via Nuxt 4.5.2
@nuxt/scripts ohash ^2.0.12 2.0.12 ♻️ free via Nuxt 4.5.2
@nuxt/scripts oxc-walker ^1.1.1 1.1.1 ♻️ free via Nuxt 4.5.2
@nuxt/scripts pathe ^2.0.3 2.0.3 ♻️ free via Nuxt 4.5.2
@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.2.0 4.2.0 ♻️ free via Nuxt 4.5.2
@nuxt/scripts ufo ^1.6.4 1.6.4 ♻️ free via Nuxt 4.5.2
@nuxt/scripts ultrahtml ^1.7.0 1.7.0 ♻️ free via Nuxt 4.5.2
@nuxt/scripts unplugin ^3.3.0 3.3.0 ♻️ free via Nuxt 4.5.2
@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_@_b13fadbf___2026-09-22 · gzip is the comparison metric · changes below 16 B gzip are ignored

@harlan-zw harlan-zw added harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. labels Sep 22, 2026
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: a8c6d0a4-56eb-4552-b87f-7b7a0cccc361

📥 Commits

Reviewing files that changed from the base of the PR and between 9a30eb1 and 0d8a7ba.

📒 Files selected for processing (1)
  • test/fixtures/tiktok-pixel/nuxt.config.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The transformer now uses each registry node's canonical registryKey for integration composables. New tests verify proxy output for TikTok Pixel and LinkedIn Insight, and existing tests define explicit registry keys. The workspace release-age exclusion list now contains only @types/jest-image-snapshot@6.4.2.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Severity of issue fixed: Medium

Merge Risk: 🟡 Moderate · up to 0d8a7

A reported failing test leaves this change not merge-ready until the failure is fixed or explicitly accepted.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The pull request removes the Oxc, PostHog, Nuxt, Unhead, and unimport entries from minimumReleaseAgeExclude in pnpm-workspace.yaml. Issue #925 concerns registry-key resolution, TikTok proxying, … Restore the removed minimumReleaseAgeExclude entries in pnpm-workspace.yaml. Keep the registry-key, proxy, and related test changes.
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main fix: using the canonical registry key for bundler configuration and proxy lookups. It is concise and follows the conventional commit format.
Description check ✅ Passed The description directly explains the TikTok Pixel failure, the registry-key mismatch, the implemented fix, affected providers, and the added test coverage.
Linked Issues check ✅ Passed Issue #925 requires the canonical registry key tiktokPixel for useScriptTikTokPixel and first-party proxying. packages/script/src/plugins/transform.ts now uses registryNode.registryKey for loo…
Full details: Out of Scope Changes check

Explanation

The pull request removes the Oxc, PostHog, Nuxt, Unhead, and unimport entries from minimumReleaseAgeExclude in pnpm-workspace.yaml. Issue #925 concerns registry-key resolution, TikTok proxying, and related tests. The workspace policy change has no demonstrated connection to those objectives.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

Comment @coderabbitai help to get the list of available commands.

@harlan-zw

harlan-zw commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator Author

🤖 MERGED

Harlan Agent Kit posted this automated review. It is not Harlan's personal review or approval. AI open source policy. Last updated: 2026-09-22 02:57 UTC.

GitHub merged this pull request.

No material findings were recorded.

The pull request closed.

@harlan-zw harlan-zw added harlan-agent-blocked The automated Review found a material defect in this head commit. harlan-agent-running An Agent holds a Task on this issue or pull request right now. and removed harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. harlan-agent-blocked The automated Review found a material defect in this head commit. labels Sep 22, 2026
@harlan-zw harlan-zw removed the harlan-agent-running An Agent holds a Task on this issue or pull request right now. label Sep 22, 2026
@harlan-zw harlan-zw added harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-blocked The automated Review found a material defect in this head commit. and removed harlan-agent-running An Agent holds a Task on this issue or pull request right now. labels Sep 22, 2026
The fixture loads the real events.js from analytics.tiktok.com so the
delivery test can watch the array protocol drain. It stayed unbundled
only because the registry key lookup missed, which this branch fixes.
With the lookup correct, the bundle capability applies and the SDK is
downloaded and proxied, so the endpoint assertion failed.

Also restores pnpm-workspace.yaml, which a local pnpm install pruned.
@harlan-zw
harlan-zw merged commit 4bb52cc into main Sep 22, 2026
16 checks passed
@harlan-zw
harlan-zw deleted the fix/issue-925 branch September 22, 2026 02:46
@harlan-zw harlan-zw removed the harlan-agent-blocked The automated Review found a material defect in this head commit. label Sep 22, 2026

This branch was successfully deployed

1 active deployment
Preview 0d8a7ba5 Deployed Sep 22, 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.

useScriptTikTokPixel: incorrect registery key

1 participant