fix(site): preserve directives when normalizing imports - #1930
Open
mihar-22 wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for vjs10-site ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
📦 Bundle Size Report🎨 @videojs/html — no changesPresets (7)
Media (12)
Players (5)
Skins (30)
UI Components (39)
Sizes are marginal over the root entry point. ⚛️ @videojs/react — no changesPresets (7)
Media (11)
Skins (27)
UI Components (33)
Sizes are marginal over the root entry point. 🧩 @videojs/core — no changesEntries (75)
🏷️ @videojs/element — no changesEntries (2)
📦 @videojs/store — no changesEntries (3)
🔧 @videojs/utils — no changesEntries (13)
📦 @videojs/media — no changesEntries (14)
📦 @videojs/spf — no changesEntries (5)
ℹ️ How to interpretJS sizes are initial static graph totals (minified + brotli). Lazy dynamic chunks are shown separately when present.
Run |
decepulis
approved these changes
Aug 6, 2026
decepulis
left a comment
Collaborator
There was a problem hiding this comment.
It took me like half an hour to wrap my head around this. Like, what was this fixing if there was no change in ejected-skins.json? If the site was already correctly showing "use client" at the top of ejected skins?
But. I think I get it, now?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1926
Summary
Preserve module directive prologues when consolidating imports so generated React source does not silently lose directives such as
use client.Changes
phaseModifierTesting
pnpm -C site test(518 tests)pnpm -C site ejected-skinsejected-skins.jsonis byte-for-byte unchangedpnpm -C site astro check(0 errors)Note
Low Risk
Scoped to the site import-normalization script and its tests; behavior fix for generated source with no auth or runtime security impact.
Overview
normalizeImportsnow keeps module directive prologues (e.g.'use client') at the top of the file when it merges import lines, instead of dropping them during ejected-skin / generated React output.Directive strings are collected while scanning the prologue, emitted ahead of the normalized import block (with a blank line between directives and imports), and still returned when there are no imports. Statement-level
import typedetection usesimportClause.phaseModifier === ts.SyntaxKind.TypeKeywordinstead of the deprecatedisTypeOnlyflag.Regression tests cover directives above merged imports and multiple directives with no imports.
Reviewed by Cursor Bugbot for commit a53d24f. Bugbot is set up for automated code reviews on this repo. Configure here.