Skip to content

feat: add webui-framework-prerelease conversion target with strip-and-warn directives - #7738

Merged
Jane Chu (janechu) merged 4 commits into
mainfrom
feat/fast-convert-webui-native-target
Oct 9, 2026
Merged

Jane Chu (janechu) merged 4 commits into
mainfrom
feat/fast-convert-webui-native-target

Conversation

@janechu

@janechu Jane Chu (janechu) commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Pull Request

📖 Description

Adds a new conversion target, webui-framework-prerelease, to microsoft-fast-convert / @microsoft/fast-build, alongside the existing webui-prerelease and fast-v3-ts targets. webui-prerelease is unchanged by this PR — it continues to emit HTML for WebUI's own FAST parser plugin exactly as before.

webui-framework-prerelease converts FAST's declarative syntax into the Microsoft WebUI Framework's own declarative runtime syntax, to be leveraged by their web component framework:

  • Transfers Shadow/Light DOM policy: shadowroot-prefixed attributes move from the outer <f-template> wrapper onto the inner <template>, deduping identical values and rejecting conflicting ones (ConflictingShadowRootMode) or unsupported outer attributes (UnsupportedPublisherAttribute).
  • Converts f-ref="{input}" → w-ref="{input}", rejecting non-braced values (InvalidAttributeValue).
  • Rewrites event handler $e to bare e and rejects $c/other FAST event-context tokens that have no equivalent (UnsupportedEventContext).
  • f-slotted and f-children are stripped from the output with a warning instead of being hard errors or passed through verbatim — WebUI Framework has no equivalent for these directives, but failing the whole conversion for them was too strict. Every other unsupported construct remains a hard ConvertError.

Because conversion can now produce non-fatal warnings, convert_template/convert_template_with_options return a new ConvertOutput { output, warnings } (Rust) / ConvertResult (wasm, with output/warnings getters) instead of a bare string, for all three targets — though only webui-framework-prerelease ever returns a non-empty warnings. The fast convert CLI prints each warning to stderr as Warning: <message> and still writes the converted output; it doesn't fail the command. convert_stylesheet is unaffected and still returns a plain string.

The target's name, webui-framework-prerelease, reflects that the WebUI Framework project itself is currently in prerelease — it isn't a statement about the stability of this conversion target's implementation; that wording is intentionally not used elsewhere.

👩‍💻 Reviewer Notes

Most review attention should go to the new crates/microsoft-fast-convert/src/syntax/webui_framework_prerelease.rs (shadow-DOM/f-ref/event logic, strip-with-warning), src/warning.rs (ConvertWarning/ConvertOutput), and src/wasm.rs's ConvertResult struct. syntax/webui.rs is untouched (restored to its original, pre-PR content). packages/fast-build/bin/fast.js has one updated call site that now destructures { output, warnings } for every target, and test/config.test.js has a new CLI test exercising --syntax=webui-framework-prerelease's warning output.

📑 Test Plan

  • cargo test in crates/microsoft-fast-convert: all tests pass (metadata for all 3 targets, original webui-prerelease behavior, webui-framework-prerelease publisher/DOM mode, directive, event, strip-with-warning, robustness, and Avatar-fixture coverage).
  • cargo clippy --all-targets and cargo fmt --check in crates/microsoft-fast-convert: clean.
  • npm run build -w @microsoft/fast-build: wasm rebuilt successfully.
  • npm run test:node -w @microsoft/fast-build: all 83 tests pass, including a CLI test asserting warnings are printed to stderr when webui-framework-prerelease strips f-slotted/f-children.
  • Manual CLI smoke test converting a sample <f-template> with --syntax=webui-framework-prerelease confirmed shadowrootmode transfer, w-ref conversion, $e → e rewriting, and f-slotted stripping with a printed warning, end-to-end; a separate smoke test with --syntax=webui-prerelease confirmed output is unchanged from before this PR.
  • npm run checkchange and npm run biome:check: pass.

✅ Checklist

General

  • I have included a change request file using $ npm run change
  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

Agents

  • I have linked to an existing issue in this project that this change addresses
  • I have read the skills
  • I have read the DESIGN.md file(s) in packages relevant to my changes
  • I have updated the DESIGN.md file(s) in packages relevant to my changes

⏭ Next Steps

  • The design doc also proposes an optional, typed WebUIConvertOptions (e.g. configurable event-object/unsupported-directive modes). This remains deferred as out of scope; a follow-up PR can add it if needed.
  • crates/microsoft-fast-convert's own crate version was not bumped as part of this PR (unrelated to the beachball change file added for @microsoft/fast-build's wasm artifact); that's left to the maintainers' normal crates.io release process.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: afc59809-2e01-4c2a-8849-b740fe5056d3
@janechu
Jane Chu (janechu) force-pushed the feat/fast-convert-webui-native-target branch from 5ad771b to 00a7e53 Compare October 9, 2026 20:40
@janechu Jane Chu (janechu) changed the title feat: add stable native webui syntax target to fast-convert feat: add native webui syntax target to fast-convert Oct 9, 2026
…s with warnings

Consolidates the native webui conversion target into webui-prerelease,
so there is a single WebUI conversion target that performs Shadow/Light
DOM attribute transfer, f-ref -> w-ref conversion, and $e event-argument
rewriting. f-slotted and f-children are no longer hard errors: they are
stripped from the output and reported via a new warnings list instead,
while all other unsupported constructs remain hard errors.

- Add warning.rs with ConvertWarning/ConvertOutput; convert_template and
  convert_template_with_options now return Result<ConvertOutput, ConvertError>
- Merge webui_native.rs logic into syntax/webui.rs (webui-prerelease target),
  delete webui_native.rs and the separate SYNTAX_METADATA entry
- Rename UnsupportedNativeWebUIEventContext -> UnsupportedEventContext and
  drop UnsupportedNativeWebUIDirective (now a warning, not an error)
- Update wasm bindings with a ConvertResult struct exposing output/warnings
  to JS, and update fast.js to print warnings to stderr
- Update DESIGN.md/README.md for the merged single-target design
- Add/adjust crate and fast-build tests for the new behavior
- Exclude fast-build convert fixtures from biome's HTML formatter so
  literal ${ / {{ }} test content isn't mistaken for bindings

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: afc59809-2e01-4c2a-8849-b740fe5056d3
@janechu Jane Chu (janechu) changed the title feat: add native webui syntax target to fast-convert feat: strip unsupported f-slotted/f-children with warnings in webui-prerelease conversion Oct 9, 2026
Split the previously-merged shadow-DOM/f-ref/event-rewriting conversion
logic out of webui-prerelease into a new, separate syntax target named
webui-framework-prerelease. webui-prerelease is restored to its original,
unmodified behavior (simple f-repeat/f-when conversion with passthrough
of other FAST attributes).

webui-framework-prerelease converts FAST's declarative syntax into the
Microsoft WebUI Framework's own declarative runtime syntax: it transfers
Shadow/Light DOM attributes from the outer <f-template> onto the inner
<template>, converts f-ref to a braced w-ref, rewrites FAST's $e event
argument to bare e, and rejects $c (and other $-prefixed event context
tokens) since WebUI Framework has no repeat-context equivalent.
Unsupported f-slotted/f-children directives are stripped from the output
with a ConvertWarning instead of a hard error, surfaced to CLI callers as
"Warning: <message>" on stderr.

- crates/microsoft-fast-convert: new syntax/webui_framework_prerelease.rs
  module; syntax/webui.rs reverted to its original implementation;
  converter.rs/syntax/mod.rs/lib.rs updated for the 3-target dispatch;
  tests/conversions.rs and tests/errors.rs rewritten to cover all three
  targets.
- packages/fast-build: config.test.js's warning CLI test now targets
  --syntax=webui-framework-prerelease; convert fixture/test files reverted
  to their original webui-prerelease-compatible form since that target no
  longer requires braced f-ref or rejects $c.
- Updated DESIGN.md/README.md in both packages for the 3-target design.
- Updated beachball change file to describe the additive new target
  instead of a breaking change to webui-prerelease.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: afc59809-2e01-4c2a-8849-b740fe5056d3
@janechu Jane Chu (janechu) changed the title feat: strip unsupported f-slotted/f-children with warnings in webui-prerelease conversion feat: add webui-framework-prerelease conversion target with strip-and-warn directives Oct 9, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: afc59809-2e01-4c2a-8849-b740fe5056d3
@janechu
Jane Chu (janechu) merged commit 4c20475 into main Oct 9, 2026
11 checks passed
@janechu
Jane Chu (janechu) deleted the feat/fast-convert-webui-native-target branch October 9, 2026 21:32
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