feat(plugin-builder): always emit both css payloads with cssMeta#1699
Draft
cmorman89 wants to merge 2 commits into
Draft
feat(plugin-builder): always emit both css payloads with cssMeta#1699cmorman89 wants to merge 2 commits into
cmorman89 wants to merge 2 commits into
Conversation
2 tasks
Emit the full stylesheet asset (linked under shadow isolation) and a
preflight-stripped inline css export (injected under css isolation)
together, plus an export const cssMeta = { supports: ['shadow', 'css'] }
capability marker, so the isolation mode is purely a host/manifest choice.
The inline css is embedded through JSON serialization so Tailwind's escaped
selectors survive module evaluation, and keeps the compiled stylesheet in
order minus the base layer (preflight) the host already provides. A module
that exports its own cssMeta keeps it: the collision guard reads the chunk's
export metadata, reliable across minification and const-to-var lowering.
inlineCss is accepted as a deprecated no-op.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JpAEfftYG74jVAFhZ87EcD
Drop the vite-side inlineCss wiring; the scaffold prompt writes a single value, uiConfig.isolation in the tool server config, and the README states that a registered manifest's ui block is authoritative over it. Point the legacy remedy at rebuilding first, with the manifest flag as the fallback. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JpAEfftYG74jVAFhZ87EcD
cmorman89
force-pushed
the
feat-plugin-css-payloads
branch
from
July 9, 2026 16:35
9a90522 to
22c008b
Compare
cmorman89
marked this pull request as draft
July 23, 2026 19:22
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.
TL;DR
@importrules the stylesheet depends on.cssMetacapability list (supports: ['shadow', 'css']) so hosts know the inline payload is safe.inlineCssis deprecated and ignored; the isolation mode is purely a manifest choice.Details
Corrupted embedding. The extracted CSS was written into the plugin module as a raw template literal, and template-literal evaluation swallows the backslash escapes Tailwind selectors rely on — roughly 40% of rules arrived invalid and were discarded by the browser, and some CSS could make the module fail to load. The export is now emitted through JSON serialization and reaches the runtime byte-for-byte.
Lossy extraction. Only the last utilities layer was kept, unwrapped — so injected rules escaped their cascade layers (overriding host styles document-wide) and lost their supporting theme variables, property registrations, keyframes and
@importrules. Extraction now keeps the compiled stylesheet in its original order and structure and drops only the base layer (preflight).One build, both modes. Previously the build's
inlineCsssetting had to agree with the manifest's isolation mode, and a mismatch shipped silently broken styling. The build now always emits both payloads and advertises them (export const cssMeta = { supports: ['shadow', 'css'] }): the manifest picks the mode, the artifact states which modes it can honor, and there is nothing left to mismatch.inlineCssremains accepted as a deprecated no-op. The plugin template drops its vite-side isolation wiring — the scaffold prompt writes a single value,uiConfig.isolationin the tool server config — and the README documents that a registered manifest'suiblock is authoritative over it.cssMeta collision guard. A module that exports its own
cssMetakeeps it: the builder detects the export from the bundle chunk's export metadata rather than by regexing source text, so detection is reliable across minification, aliasing and const-to-var lowering. It then skips appending its default and warns the author to declaresupportsthemselves. The decision is recomputed per build, so watch mode does not go stale.Verification
packages/plugin-builder: 17 unit tests and the test typecheck pass; lint clean.generateBundle/writeBundlehooks directly.@importrules included) and re-parses with zero errors.cssMetaare emitted identically withinlineCss: true,inlineCss: false, and the option absent.Relationship to the 1.4 line
The host-side compatibility mode ships on the
release/1.4maintenance line as a deploy-only hotfix (it rescues already-deployed plugins by rebuilding from their stylesheet — no rebuild required); its manifest flag (AppUIConfig.css_rebuild) lands there: #1664. This PR carries only the build-tool fix that makes future builds correct at the source, publishing on the main line. Host-side consumption of thecssMetacapability export is deliberately deferred: builds emitting it render correctly under the host's default path, so the marker is forward-looking metadata until a host chooses to read it.Test Plan
🤖 Generated with Claude Code
https://claude.ai/code/session_01JpAEfftYG74jVAFhZ87EcD