feat: add FAST template converter CLI#7633
Open
janechu wants to merge 7 commits into
Open
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new fast convert subcommand to @microsoft/fast-build, backed by a new microsoft-fast-convert Rust/WASM module, to convert FAST declarative .html templates into either WebUI prerelease HTML or FAST v3 TypeScript output. This extends the existing fast-build CLI/WASM integration model and updates packaging + release/version-sync tooling to treat the converter crate as a bundled asset of the fast-build release.
Changes:
- Added
fast convertCLI subcommand with config loading, path/output validation, and converter WASM dispatch. - Introduced the
microsoft-fast-convertcrate (Rust API + wasm-bindgen export) with conversion + validation tests. - Updated packaging, docs, CI Rust validation, and release scripts to include/sync the bundled converter crate and WASM outputs.
Reviewed changes
Copilot reviewed 35 out of 39 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/fast-build/wasm/convert/.npmignore | Packaging ignore override for converter wasm directory. |
| packages/fast-build/wasm/.npmignore | Packaging ignore override for wasm directory. |
| packages/fast-build/test/wasm-stub.cjs | Test preload stub extended to intercept converter WASM module. |
| packages/fast-build/test/fixtures/convert/validation/unsupported-f-attribute/template.html | Fixture input for unsupported f-* attribute validation. |
| packages/fast-build/test/fixtures/convert/validation/unsupported-f-attribute/fast-convert.config.json | Fixture config for unsupported f-* attribute case. |
| packages/fast-build/test/fixtures/convert/validation/missing-inner-template/template.html | Fixture input for missing inner <template> validation. |
| packages/fast-build/test/fixtures/convert/validation/missing-inner-template/fast-convert.config.json | Fixture config for missing inner <template> case. |
| packages/fast-build/test/fixtures/convert/validation/invalid-repeat/template.html | Fixture input for invalid repeat expression validation. |
| packages/fast-build/test/fixtures/convert/validation/invalid-repeat/fast-convert.config.json | Fixture config for invalid repeat expression case. |
| packages/fast-build/test/fixtures/convert/supported.html | Supported conversion fixture covering directives/attrs/bindings. |
| packages/fast-build/test/fixtures/convert/fast-convert.config.json | Default fixture config used to validate config discovery + output patterns. |
| packages/fast-build/test/fixtures/convert/convert-fixtures.test.js | End-to-end fixture tests for fast convert output + validation errors. |
| packages/fast-build/test/config.test.js | CLI tests extended for convert, help output, and stubbed converter WASM. |
| packages/fast-build/README.md | User-facing documentation for fast convert usage/config/fixtures. |
| packages/fast-build/package.json | Exports/files/scripts updated to include converter WASM and tests. |
| packages/fast-build/DESIGN.md | Architecture docs updated for convert command and bundled WASM/module map. |
| packages/fast-build/build-wasm.cjs | New build helper to build both build and convert WASM artifacts. |
| packages/fast-build/bin/fast.js | CLI updated to dispatch build vs convert, config validation, convert path rules. |
| crates/microsoft-fast-convert/tests/errors.rs | Rust tests for converter validation/unsupported cases. |
| crates/microsoft-fast-convert/tests/conversions.rs | Rust tests for expected conversions for both targets. |
| crates/microsoft-fast-convert/src/wasm.rs | wasm-bindgen export for convert_template. |
| crates/microsoft-fast-convert/src/syntax/webui.rs | WebUI prerelease conversion pass for directives + attribute validation. |
| crates/microsoft-fast-convert/src/syntax/mod.rs | Shared directive parsing/validation helpers for syntax backends. |
| crates/microsoft-fast-convert/src/syntax/fast_v3_ts.rs | FAST v3 TS conversion pass, escaping, and helper import selection. |
| crates/microsoft-fast-convert/src/lib.rs | Public Rust API surface and module wiring. |
| crates/microsoft-fast-convert/src/html.rs | Hand-scanner for tags/attrs and <f-template>/inner <template> extraction. |
| crates/microsoft-fast-convert/src/expression.rs | Limited expression grammar conversion + repeat/event scope handling. |
| crates/microsoft-fast-convert/src/error.rs | Converter error model + contextual error formatting. |
| crates/microsoft-fast-convert/src/converter.rs | Syntax selection and dispatch after shared template validation. |
| crates/microsoft-fast-convert/README.md | Crate-level docs for Rust and WASM usage + validation scope. |
| crates/microsoft-fast-convert/DESIGN.md | Design doc for converter pipeline/modules/targets. |
| crates/microsoft-fast-convert/Cargo.toml | New crate manifest (bundled with fast-build release). |
| crates/microsoft-fast-convert/Cargo.lock | New lockfile for converter crate dependencies. |
| change/@microsoft-fast-build-40280b6e-6a6e-4d63-92ce-3158204cb0e0.json | Beachball change file for @microsoft/fast-build minor feature. |
| build/scripts/download-github-releases.mjs | Release validation updated to support bundled crate pairing for fast-build. |
| build/scripts/create-github-releases.mjs | GitHub release creation updated to attach multiple crate assets per package. |
| beachball.config.js | Version sync updated to bump multiple paired crates for one npm package. |
| .github/workflows/README.md | Docs updated for bundled fast-build release assets (npm + multiple crates). |
| .github/workflows/ci-validate-rust.yml | CI updated to run Rust tests for both fast-build and fast-convert crates. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Pull Request
📖 Description
Adds
fast convertto@microsoft/fast-buildso FAST declarative.htmltemplates can be converted to WebUI prerelease HTML or FAST v3 TypeScript. This includes the newmicrosoft-fast-convertRust crate, Node CLI/config integration, fixture validation, docs, package build/packaging updates, and release/version-sync support for the bundled converter crate.👩💻 Reviewer Notes
Please review the converter's intentionally limited expression grammar and the packaging changes that include converter WASM files under
wasm/convert/.📑 Test Plan
cargo fmt --manifest-path crates/microsoft-fast-convert/Cargo.toml -- --checkcargo check --manifest-path crates/microsoft-fast-convert/Cargo.tomlcargo test --manifest-path crates/microsoft-fast-convert/Cargo.tomlcargo test --manifest-path crates/microsoft-fast-build/Cargo.tomlnpm run build -w @microsoft/fast-buildnpm run test:node -w @microsoft/fast-buildnpm run checkchangenpm run biome:checknpx biome check --no-errors-on-unmatched ...for changed JS/JSON filesnpm pack --dry-run --json -w @microsoft/fast-buildverified converter WASM files are included✅ Checklist
General
$ npm run changeAgents