Skip to content

Conversation

@jaypal1046
Copy link
Collaborator

📝 Description

This PR introduces robust runtime, compiler, and rendering improvements for flutterjs_web. It fixes multiple runtime and import resolution issues, enhances SSR support, improves JS interop, and refactors IR/codegen for better stability.

Highlights

  • Fix HTMLIFrameElement export and BaseRequest import resolution using robust URI matching
  • Add JS interop runtime + rendering scaffold for generated code
  • Implement Dart 3 pattern matching extraction and fix optimizer handling for try/finally
  • Refactor IR & codegen for map literals with conditional/spread support
  • Fix website launch issues (404 runtime, copyWith error, app.js export mismatch)
  • Improve import/symbol resolution and export alias handling
  • Add missing JS sources for Dart & engine packages
  • Implement SSR support improvements
  • Expression transpilation fixes and compiler enhancements
  • General cleanup (remove debug files, logging improvements, build fixes)

🔗 Related Issue

Fixes # (add issue number if applicable)


🏗️ Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🎨 Code style update (formatting, local variables)
  • 🔨 Refactoring (no functional changes, no api changes)
  • 🧪 Tests
  • ⚙️ CI/CD

📋 Checklist

  • I have read the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

📸 Screenshots (if applicable)

Before After
N/A N/A

🧪 How to Test

  1. Build the project and run flutterjs_web example/site.
  2. Verify website launches without 404/runtime errors and no copyWith crash.
  3. Test JS interop runtime and ensure generated code executes correctly.
  4. Validate SSR rendering works without import/runtime failures.
  5. Test Dart 3 pattern matching and try/finally handling in transpiled output.
  6. Confirm map literals support conditional and spread elements correctly.
  7. Ensure import/export resolution works for HTMLIFrameElement, BaseRequest, and alias exports.

…js exports)

- Fixed @flutterjs/runtime package.json main entry point.
- Updated ThemeData to initialize textTheme with TextStyle objects.
- Enhanced BuildIntegrationGenerator to robustly filter app.js imports against actual exports.
- Fixed bare specifier mapping for @flutterjs/material imports.
- Updated ImportRewriter to handle export aliases.
Refactors the IR for map literals to use a unified elements list (entries, conditionals, spreads) instead of only entries, and updates code generation to handle conditional and spread elements in map literals. Adds verbose logging support to extraction and codegen passes, and introduces conditional import/export configuration extraction. Removes duplicate MapEntryIR definition and updates widget analyzer to handle new map IR structure.
…ass field and parameter names being incorrectly imported as external symbols - Add suffix-aware filename matching in ImportAnalyzer for UrlStyle/WindowsStyle/PosixStyle - Filter loop variables, class fields, method params from import symbols - Fix IIFE parenthesis placement in statement generator
Add JS interop runtime and rendering stub, tooling, and several fixes:

- New example `try_test` with minimal try/catch/finally tests and .gitignore.
- Add dart:js_interop and dart:js_interop_unsafe implementations (src + built dist + sourcemaps) and wire them into packages/flutterjs_dart package.json and exports.json.
- Implement pattern-matching support in StatementExtractionPass: handle if-case statements, new _extractPattern routine, update pattern-condition extraction, and add a debug print for TryStmt extraction. This enables Dart 3 pattern matching extraction.
- Fix JS optimizer to track try/finally blocks and avoid removing finally code or treating code inside try as unreachable.
- Improve codegen logging in FileCodeGen (capture stacktrace on errors, log classes, functions) and add a small import map tweak.
- Add @flutterjs/rendering package stub with build script (build.js) that enumerates source files, generates exports and an exports.json manifest for the Dart generator.
- Update pubjs PackageBuilder to stop skipping node_modules builds (enable building 3rd-party packages), add a debug print, and include standard node_modules paths when resolving builds.
- Misc: updated build_info timestamps for several packages.

These changes provide JS interop runtime support for generated code, add a rendering package scaffold, and fix the analyzer/optimizer to correctly handle Dart 3 patterns and try/finally semantics.
@jaypal1046 jaypal1046 merged commit fc54cad into master Feb 5, 2026
1 of 2 checks passed
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.

1 participant