From ab12000480c3b6eac065ff7cfff6fe098a5a1f6b Mon Sep 17 00:00:00 2001 From: Jayprakash Pal Date: Thu, 5 Feb 2026 21:36:20 +0530 Subject: [PATCH 01/12] chore: prepare SDK for public release (branding, logging, licensing, formatting, versioning) --- CONTRIBUTING.md | 2 +- bin/flutterjs.dart | 22 +++--- examples/core_lib_demo/flutterjs.config.js | 4 + examples/core_lib_demo/lib/main.dart | 7 +- examples/counter/lib/main.dart | 6 +- examples/counter/pubspec.yaml | 2 +- examples/material_advanced_demo/lib/main.dart | 4 + examples/material_advanced_demo/pubspec.yaml | 2 +- examples/material_buttons_demo/lib/main.dart | 4 + examples/material_buttons_demo/pubspec.yaml | 2 +- examples/material_demo/lib/main.dart | 4 + examples/material_demo/pubspec.yaml | 2 +- examples/material_display_demo/lib/main.dart | 4 + examples/material_display_demo/pubspec.yaml | 2 +- examples/material_inputs_demo/lib/main.dart | 4 + examples/material_inputs_demo/pubspec.yaml | 2 +- .../material_navigation_demo/lib/main.dart | 4 + .../material_navigation_demo/pubspec.yaml | 2 +- .../material_structure_demo/lib/main.dart | 4 + examples/material_structure_demo/pubspec.yaml | 2 +- examples/multi_file_test/lib/main.dart | 4 + .../lib/models/data_model.dart | 4 + .../multi_file_test/lib/utils_widget.dart | 4 + .../lib/widgets/action_button.dart | 4 + .../lib/widgets/user_profile_card.dart | 4 + examples/multi_file_test/pubspec.yaml | 2 +- examples/pub_test_app/lib/main.dart | 4 + examples/routing_app/lib/main.dart | 9 ++- examples/routing_app/pubspec.yaml | 2 +- examples/try_test/lib/main.dart | 4 + examples/try_test/pubspec.yaml | 2 +- packages/dart_analyzer/lib/dart_analyzer.dart | 4 + .../lib/src/TypeDeclarationVisitor.dart | 4 + .../lib/src/analysis_output_generator.dart | 4 + .../lib/src/analyze_flutter_app.dart | 4 + .../lib/src/analyzing_project.dart | 4 + .../lib/src/dependency_graph.dart | 4 + .../lib/src/dependency_resolver.dart | 4 + .../lib/src/incremental_cache.dart | 4 + packages/dart_analyzer/lib/src/ir_linker.dart | 4 + .../lib/src/model/analyzer_model.dart | 4 + .../dart_analyzer/lib/src/model/core.dart | 4 + .../dart_analyzer/lib/src/model/other.dart | 4 + .../dart_analyzer/lib/src/model/state.dart | 4 + .../dart_analyzer/lib/src/model/widget.dart | 4 + .../dart_analyzer/lib/src/type_registry.dart | 4 + .../test/flutterjs_analyzer_test.dart | 4 +- .../flutterjs_analyzer/build.js | 4 + .../flutterjs_analyzer/dist/analyzer.js | 4 + .../dist/context_analyzer.js | 4 + .../dist/context_analyzer_data.js | 4 + .../dist/flutter_import_resolver.js | 4 + .../dist/flutter_resolver_config.js | 4 + .../dist/flutterjs_logger.js | 4 + .../dist/flutterjs_parser.js | 4 + .../dist/flutterjs_report_generator.js | 4 + .../dist/flutterjs_widget_analyzer.js | 4 + .../flutterjs_analyzer/dist/lexer.js | 4 + .../flutterjs_analyzer/dist/ssr_analyzer.js | 4 + .../dist/state_analyzer_data.js | 4 + .../dist/state_analyzer_implementation.js | 4 + .../flutterjs_analyzer/src/analyzer.js | 4 + .../src/context_analyzer.js | 4 + .../src/context_analyzer_data.js | 4 + .../src/flutter_import_resolver.js | 6 +- .../src/flutter_resolver_config.js | 4 + .../src/flutterjs_logger.js | 4 + .../src/flutterjs_parser.js | 4 + .../src/flutterjs_report_generator.js | 4 + .../src/flutterjs_widget_analyzer.js | 4 + .../flutterjs_analyzer/src/lexer.js | 4 + .../flutterjs_analyzer/src/ssr_analyzer.js | 4 + .../src/state_analyzer_data.js | 4 + .../src/state_analyzer_implementation.js | 4 + packages/flutterjs_analyzer/pubspec.yaml | 2 +- .../flutterjs_animation/example/lib/main.dart | 7 +- .../flutterjs_animation/build.js | 4 + .../flutterjs_animation/package.json | 2 +- .../flutterjs_animation/src/index.js | 4 + .../lib/flutterjs_animation.dart | 18 +++-- packages/flutterjs_animation/pubspec.yaml | 2 +- .../lib/flutterjs_builder.dart | 4 + .../lib/src/package_compiler.dart | 5 +- .../lib/src/package_resolver.dart | 4 + packages/flutterjs_builder/pubspec.yaml | 2 +- .../test/flutterjs_builder_test.dart | 4 + packages/flutterjs_core/lib/ast_it.dart | 4 + .../flutterjs_core/lib/flutterjs_core.dart | 8 +- .../extraction/component_extractor.dart | 4 + .../extraction/component_registry.dart | 4 + .../extraction/flutter_component_system.dart | 4 + .../extraction/lambda_function_extractor.dart | 4 + .../extraction/statement_extraction_pass.dart | 37 +++++---- .../extraction/statement_widget_analyzer.dart | 6 +- .../symmetric_function_extraction.dart | 4 + .../analysis/passes/expression_visitor.dart | 4 + .../analysis/passes/flow_analysis_pass.dart | 4 + .../analysis/passes/statement_visitor.dart | 4 + .../analysis/passes/symbol_resolution.dart | 4 + .../analysis/passes/type_inference_pass.dart | 4 + .../passes/type_inference_visitor.dart | 4 + .../src/analysis/passes/validation_pass.dart | 4 + .../analysis/passes/variable_collector.dart | 4 + .../analyzer_widget_detection_setup.dart | 4 + .../analysis/visitors/declaration_pass.dart | 34 ++++++-- .../lib/src/ir/core/ir_id_generator.dart | 4 + .../lib/src/ir/core/ir_node.dart | 4 + .../lib/src/ir/core/source_location.dart | 4 + .../lib/src/ir/declarations/class_decl.dart | 4 + .../ir/declarations/dart_file_builder.dart | 4 + .../src/ir/declarations/function_decl.dart | 4 + .../ir/declarations/import_export_stmt.dart | 4 + .../src/ir/declarations/parameter_decl.dart | 4 + .../src/ir/declarations/variable_decl.dart | 4 + .../src/ir/diagnostics/analysis_issue.dart | 4 + .../src/ir/diagnostics/issue_categorizer.dart | 4 + .../src/ir/diagnostics/issue_category.dart | 4 + .../src/ir/diagnostics/issue_collector.dart | 4 + .../lib/src/ir/expressions/advanced.dart | 4 + .../ir/expressions/cascade_expression_ir.dart | 4 + .../enum_member_access_expression.dart | 4 + .../lib/src/ir/expressions/expression_ir.dart | 4 + .../ir/expressions/function_method_calls.dart | 4 + .../lib/src/ir/expressions/literals.dart | 4 + .../lib/src/ir/expressions/operations.dart | 4 + .../src/ir/expressions/vaibales_access.dart | 4 + .../src/ir/flutter/life_cycle_analysis.dart | 4 + .../src/ir/flutter/rebuild_trigger_graph.dart | 4 + .../flutter/state_class_representation.dart | 4 + .../src/ir/flutter/state_field_analysis.dart | 4 + .../lib/src/ir/flutter/state_management.dart | 4 + .../src/ir/flutter/widget_classification.dart | 4 + .../lib/src/ir/flutter/widget_metadata.dart | 4 + .../lib/src/ir/statements/statement_ir.dart | 4 + .../lib/src/ir/types/class_type_ir.dart | 4 + .../lib/src/ir/types/function_type_ir.dart | 4 + .../lib/src/ir/types/generic_type_ir.dart | 4 + .../lib/src/ir/types/nullable_type_ir.dart | 4 + .../lib/src/ir/types/parameter_ir.dart | 4 + .../lib/src/ir/types/primitive_type_ir.dart | 4 + .../lib/src/ir/types/type_hierarchy.dart | 4 + .../lib/src/ir/types/type_ir.dart | 4 + .../lib/src/ir/types/unresolved_type_ir.dart | 4 + .../lib/src/ir/widgets/build_method_ir.dart | 6 +- .../lib/src/ir/widgets/key_type_ir.dart | 6 +- .../lib/src/ir/widgets/widget_node_ir.dart | 4 + .../lib/src/ir/widgets/widget_tree_ir.dart | 4 + packages/flutterjs_core/pubspec.yaml | 8 +- packages/flutterjs_core/test/engine_test.dart | 4 + .../flutterjs_cupertino/example/lib/main.dart | 7 +- .../flutterjs_cupertino/build.js | 4 + .../flutterjs_cupertino/package.json | 2 +- .../flutterjs_cupertino/src/index.js | 4 + .../lib/flutterjs_cupertino.dart | 18 +++-- packages/flutterjs_cupertino/pubspec.yaml | 2 +- packages/flutterjs_dart/build.js | 4 + packages/flutterjs_dart/dist/async/index.js | 4 + .../flutterjs_dart/dist/collection/index.js | 4 + .../dist/collection/priority_queue.js | 4 + .../dist/collection/queue_list.js | 4 + packages/flutterjs_dart/dist/convert/index.js | 4 + packages/flutterjs_dart/dist/core/index.js | 4 + .../flutterjs_dart/dist/developer/index.js | 4 + packages/flutterjs_dart/dist/index.js | 4 + .../flutterjs_dart/dist/js_interop/index.js | 4 + .../dist/js_interop_unsafe/index.js | 4 + packages/flutterjs_dart/dist/math/index.js | 4 + .../flutterjs_dart/dist/typed_data/index.js | 4 + packages/flutterjs_dart/dist/ui/index.js | 4 + packages/flutterjs_dart/package.json | 4 +- packages/flutterjs_dart/src/async/index.js | 4 + .../flutterjs_dart/src/collection/index.js | 4 + .../src/collection/priority_queue.js | 4 + .../src/collection/queue_list.js | 4 + packages/flutterjs_dart/src/convert/index.js | 4 + packages/flutterjs_dart/src/core/index.js | 4 + .../flutterjs_dart/src/developer/index.js | 4 + packages/flutterjs_dart/src/index.js | 4 + .../flutterjs_dart/src/js_interop/index.js | 4 + .../src/js_interop_unsafe/index.js | 4 + packages/flutterjs_dart/src/math/index.js | 4 + .../flutterjs_dart/src/typed_data/index.js | 4 + packages/flutterjs_dart/src/ui/index.js | 4 + .../flutterjs_dev_tools/lib/dev_tools.dart | 4 + .../src/flutterjs_integrated_debugger.dart | 8 +- .../lib/src/html_generator.dart | 4 + .../lib/src/ir_server.dart | 4 + .../lib/src/ir_view/html_scripts.dart | 4 + .../src/ir_view/html_scripts_left_panel.dart | 4 + .../src/ir_view/html_scripts_right_panel.dart | 4 + .../src/ir_view/html_scripts_utilities.dart | 4 + .../lib/src/ir_view/html_styles.dart | 4 + .../src/ir_view/html_styles_left_panel.dart | 4 + .../src/ir_view/html_styles_right_panel.dart | 4 + .../json_view/html_scripts_json_reader.dart | 4 + .../json_view/html_styles_json_reader.dart | 4 + .../test/dev_tools_test.dart | 4 + .../flutterjs_dev_utils/lib/dev_utils.dart | 4 +- .../test/dev_utils_test.dart | 4 + packages/flutterjs_engine/bin/index.js | 4 + .../flutterjs_engine/bin/project-loader.js | 4 + .../example/counter/README.md | 4 +- .../example/counter/flutterjs.config.js | 6 +- .../example/counter/package.json | 2 +- packages/flutterjs_engine/package.json | 6 +- .../flutterjs_engine/src/build_integration.js | 4 + .../src/build_integration_analyzer.js | 4 + .../src/build_integration_generator.js | 4 + .../flutterjs_engine/src/build_pipeline.js | 4 + .../flutterjs_engine/src/code_transformer.js | 4 + .../flutterjs_engine/src/debug_rewriter.js | 4 + packages/flutterjs_engine/src/debug_server.js | 8 +- .../src/dependency_resolver.js | 4 + packages/flutterjs_engine/src/dev.js | 4 + .../src/dynamic_export_loader.js | 4 + .../src/helper/asset_handler_js.js | 4 + .../src/helper/build_cache_js.js | 4 + .../src/helper/css_processor_js.js | 4 + .../src/helper/dependency_manager.js | 4 + .../src/helper/error_handler_js.js | 4 + .../src/helper/file_watcher_js.js | 4 + .../src/helper/flutter_js_hmr_client.js | 4 + .../src/helper/js_bundler_js.js | 4 + .../src/helper/production_optimizer_js.js | 4 + .../src/helper/target_builder_js.js | 4 + .../src/helper/tree_shaker_js.js | 4 + .../flutterjs_engine/src/import_resolver.js | 4 + .../flutterjs_engine/src/import_rewriter.js | 4 + packages/flutterjs_engine/src/index.js | 4 + packages/flutterjs_engine/src/init.js | 4 + .../flutterjs_engine/src/package_collector.js | 4 + .../flutterjs_engine/src/path-resolver.js | 4 + .../src/source_map_generator.js | 4 + .../example/lib/main.dart | 7 +- .../flutterjs_foundation/build.js | 4 + .../flutterjs_foundation/package.json | 2 +- .../flutterjs_foundation/src/index.js | 4 + .../lib/flutterjs_foundation.dart | 18 +++-- packages/flutterjs_foundation/pubspec.yaml | 2 +- .../docs/flutterjs_doc_cli_core.dart | 4 + .../flutterjs_gen/docs/ir_to_js_final_plan.md | 10 +-- packages/flutterjs_gen/lib/flutterjs_gen.dart | 4 + .../class/class_code_generator.dart | 4 + .../enum_member_access_handler.dart | 4 + .../expression/expression_code_generator.dart | 15 +++- .../function/function_code_generator.dart | 4 + .../import_export/import_gen.dart | 4 +- .../parameter/parameter_code_gen.dart | 4 + .../special_language_features.dart | 4 + .../statement/control_flow_handler.dart | 4 +- .../statement/statement_code_generator.dart | 4 + .../src/file_generation/file_code_gen.dart | 36 ++++++--- .../src/file_generation/import_resolver.dart | 5 +- .../src/file_generation/package_manifest.dart | 4 + .../file_generation/runtime_requirements.dart | 4 + .../lib/src/model_to_js_diagnostic.dart | 4 + .../lib/src/model_to_js_integration.dart | 45 ++++++++--- .../src/pre_req_code_gen/build_code_gen.dart | 4 + .../src/pre_req_code_gen/config_code_gen.dart | 4 + .../pre_req_code_gen/firebase_code_gen.dart | 4 + .../pre_req_code_gen/gitignore_code_gen.dart | 4 + .../src/pre_req_code_gen/index_code_gen.dart | 4 + .../src/pre_req_code_gen/init_project.dart | 4 + .../pre_req_code_gen/manifest_code_gen.dart | 4 + .../pre_req_code_gen/service_detection.dart | 4 + .../src/pre_req_code_gen/services_config.dart | 4 + .../lib/src/utils/code_gen_error.dart | 4 + .../lib/src/utils/import_analyzer.dart | 17 +++- .../flutterjs_gen/lib/src/utils/indenter.dart | 4 + .../validation_optimization/js_optimizer.dart | 20 +++-- .../output_validator.dart | 4 + .../build_method/build_method_code_gen.dart | 4 + .../widget_instantiation_code_gen.dart | 4 + .../flutter_prop_converters.dart | 6 +- .../registry/flutter_widget_registry.dart | 4 + .../stateful_widget_js_code_gen.dart | 4 + .../stateless_widget_js_code_gen.dart | 4 + .../test/flutterjs_gen_test.dart | 4 + .../test/import_analyzer_test.dart | 76 +++++++++++------- .../flutterjs_gen/test/repro_issue_test.dart | 8 +- .../flutterjs_gestures/example/lib/main.dart | 7 +- .../flutterjs_gestures/build.js | 4 + .../flutterjs_gestures/package.json | 2 +- .../flutterjs_gestures/src/index.js | 4 + .../lib/flutterjs_gestures.dart | 18 +++-- packages/flutterjs_gestures/pubspec.yaml | 2 +- .../flutterjs_material/example/lib/main.dart | 7 +- .../flutterjs_material/build.js | 4 + .../flutterjs_material/debug_colors.js | 4 + .../flutterjs_material/package.json | 2 +- .../flutterjs_material/src/core/core.js | 4 + .../src/core/widget_element.js | 4 + .../flutterjs_material/src/index.js | 4 + .../flutterjs_material/src/material/about.js | 4 + .../src/material/action_buttons.js | 4 + .../src/material/action_chip.js | 4 + .../src/material/action_icons_theme.js | 4 + .../src/material/alert_dialog.js | 4 + .../src/material/app_bar.js | 4 + .../src/material/app_bar_theme.js | 4 + .../flutterjs_material/src/material/badge.js | 4 + .../src/material/badge_theme.js | 4 + .../flutterjs_material/src/material/banner.js | 4 + .../src/material/banner_theme.js | 4 + .../src/material/bottom_app_bar.js | 4 + .../src/material/bottom_app_bar_theme.js | 4 + .../src/material/bottom_navigation_bar.js | 4 + .../material/bottom_navigation_bar_theme.js | 4 + .../src/material/bottom_sheet.js | 4 + .../src/material/bottom_sheet_theme.js | 4 + .../src/material/button_bar.js | 4 + .../src/material/button_bar_theme.js | 4 + .../src/material/button_style.js | 4 + .../src/material/button_style_button.js | 4 + .../src/material/button_theme.js | 4 + .../src/material/calendar_date_picker.js | 4 + .../flutterjs_material/src/material/card.js | 4 + .../src/material/card_theme.js | 4 + .../src/material/carousel.js | 4 + .../src/material/carousel_theme.js | 4 + .../src/material/checkbox.js | 4 + .../src/material/checkbox_list_tile.js | 4 + .../flutterjs_material/src/material/chip.js | 4 + .../src/material/chip_theme.js | 4 + .../src/material/circle_avatar.js | 4 + .../flutterjs_material/src/material/color.js | 4 + .../src/material/color_scheme.js | 4 + .../src/material/constants.js | 4 + .../src/material/container.js | 4 + .../src/material/data_table.js | 4 + .../src/material/data_table_theme.js | 4 + .../src/material/date_picker_theme.js | 4 + .../flutterjs_material/src/material/dialog.js | 4 + .../flutterjs_material/src/material/drawer.js | 4 + .../src/material/drawer_header.js | 4 + .../src/material/drawer_theme.js | 4 + .../src/material/dropdown.js | 4 + .../src/material/elevated_button.js | 4 + .../src/material/elevated_button_theme.js | 4 + .../src/material/expansion_panel.js | 4 + .../src/material/expansion_tile.js | 4 + .../src/material/filled_button.js | 4 + .../src/material/filled_button_theme.js | 4 + .../src/material/floating_action_button.js | 4 + .../material/floating_action_button_theme.js | 4 + .../src/material/flutter_logo.js | 4 + .../flutterjs_material/src/material/form.js | 4 + .../src/material/gesture_detector.js | 4 + .../src/material/grid_tile.js | 4 + .../flutterjs_material/src/material/icon.js | 4 + .../src/material/icon_button.js | 4 + .../src/material/icon_button_theme.js | 4 + .../src/material/icon_theme.js | 4 + .../flutterjs_material/src/material/image.js | 4 + .../src/material/ink_decoration.js | 4 + .../src/material/ink_well.js | 4 + .../src/material/input_border.js | 4 + .../src/material/input_decoration_theme.js | 4 + .../src/material/input_decorator.js | 4 + .../src/material/list_tile.js | 4 + .../src/material/list_tile_theme.js | 4 + .../src/material/list_view.js | 4 + .../src/material/material.js | 4 + .../src/material/material_app.js | 4 + .../src/material/material_widget.js | 4 + .../src/material/menu_anchor.js | 4 + .../src/material/menu_bar.js | 4 + .../src/material/menu_bar_theme.js | 4 + .../src/material/menu_theme.js | 4 + .../src/material/navigation_bar.js | 4 + .../src/material/navigation_bar_theme.js | 4 + .../src/material/navigation_drawer.js | 4 + .../src/material/navigation_drawer_theme.js | 4 + .../src/material/navigation_rail.js | 4 + .../src/material/navigation_rail_theme.js | 4 + .../src/material/outlined_button.js | 4 + .../src/material/outlined_button_theme.js | 4 + .../src/material/popup_menu.js | 4 + .../src/material/popup_menu_theme.js | 4 + .../src/material/progress_indicator.js | 4 + .../flutterjs_material/src/material/radio.js | 4 + .../src/material/radio_list_tile.js | 4 + .../src/material/radio_theme.js | 4 + .../src/material/refresh_indicator.js | 4 + .../src/material/scaffold.js | 4 + .../src/material/scaffold_messenger.js | 4 + .../src/material/simple_dialog.js | 4 + .../src/material/single_child_scroll_view.js | 4 + .../flutterjs_material/src/material/slider.js | 4 + .../src/material/slider_theme.js | 4 + .../src/material/snack_bar.js | 4 + .../src/material/snack_bar_theme.js | 4 + .../flutterjs_material/src/material/switch.js | 4 + .../src/material/switch_list_tile.js | 4 + .../src/material/switch_theme.js | 4 + .../src/material/tab_bar.js | 4 + .../src/material/tab_bar_theme.js | 4 + .../src/material/tab_controller.js | 4 + .../flutterjs_material/src/material/text.js | 4 + .../src/material/text_button.js | 4 + .../src/material/text_button_theme.js | 4 + .../src/material/text_editing_controller.js | 4 + .../src/material/text_field.js | 4 + .../src/material/text_form_field.js | 4 + .../flutterjs_material/src/material/theme.js | 4 + .../src/material/theme_data.js | 4 + .../src/material/time_picker_theme.js | 4 + .../src/material/toggle_buttons.js | 4 + .../src/material/toggle_buttons_theme.js | 4 + .../src/material/tooltip.js | 4 + .../src/material/tooltip_theme.js | 4 + .../material/user_accounts_drawer_header.js | 4 + .../src/painting/google_fonts.js | 4 + .../src/painting/rounded_rectangle_border.js | 4 + .../src/painting/text_style.js | 4 + .../src/utils/badge_theme.js | 4 + .../flutterjs_material/src/utils/border.js | 4 + .../src/utils/border_radius.js | 4 + .../src/utils/box_constraints.js | 4 + .../src/utils/box_shadow.js | 4 + .../src/utils/build_helper.js | 4 + .../src/utils/checkbox_theme.js | 4 + .../flutterjs_material/src/utils/color.js | 4 + .../src/utils/color_resolver.js | 4 + .../src/utils/colors_theme.js | 4 + .../src/utils/decoration/decoration.js | 4 + .../src/utils/dialog_theme.js | 4 + .../src/utils/divider_theme.js | 4 + .../flutterjs_material/src/utils/duration.js | 4 + .../src/utils/edge_insets.js | 4 + .../flutterjs_material/src/utils/geometry.js | 4 + .../src/utils/input_decoration.js | 4 + .../src/utils/linear_gradient.js | 4 + .../src/utils/motion_theme.js | 4 + .../src/utils/progress_indicator_theme.js | 4 + .../src/utils/property/alignment.js | 4 + .../utils/property/alignment_directional.js | 4 + .../src/utils/property/axis.js | 4 + .../src/utils/property/axis_direction.js | 4 + .../src/utils/property/blend_mode.js | 4 + .../src/utils/property/border_style.js | 4 + .../src/utils/property/box_fit.js | 4 + .../src/utils/property/box_shape.js | 4 + .../src/utils/property/clip.js | 4 + .../utils/property/cross_axis_alignment.js | 4 + .../src/utils/property/decoration_position.js | 4 + .../src/utils/property/filter_quality.js | 4 + .../src/utils/property/flex_fit.js | 4 + .../src/utils/property/font_style.js | 4 + .../src/utils/property/font_weight.js | 4 + .../utils/property/horizontal_direction.js | 4 + .../src/utils/property/keyboard_type.js | 4 + .../src/utils/property/main_axis_alignment.js | 4 + .../src/utils/property/main_axis_size.js | 4 + .../src/utils/property/other.js | 4 + .../src/utils/property/shape_border.js | 4 + .../src/utils/property/stack_fit.js | 4 + .../src/utils/property/text_align.js | 4 + .../src/utils/property/text_baseline.js | 4 + .../src/utils/property/text_decoration.js | 4 + .../src/utils/property/text_direction.js | 4 + .../src/utils/property/text_input_action.js | 4 + .../src/utils/property/text_input_type.js | 4 + .../src/utils/property/text_overflow.js | 4 + .../src/utils/property/vertical_direction.js | 4 + .../src/utils/property/wrap_alignment.js | 4 + .../utils/property/wrap_cross_alignment.js | 4 + .../src/utils/radio_theme.js | 4 + .../src/utils/scrollbar_theme.js | 4 + .../src/utils/shadows_theme.js | 4 + .../src/utils/switch_theme.js | 4 + .../src/utils/text_field_theme.js | 4 + .../src/utils/typography_theme.js | 4 + .../flutterjs_material/src/utils/utils.js | 4 + .../src/widgets/compoment/aspect_ratio.js | 4 + .../src/widgets/compoment/backdrop.js | 4 + .../src/widgets/compoment/card.js | 4 + .../src/widgets/compoment/center.js | 4 + .../src/widgets/compoment/clip.js | 4 + .../widgets/compoment/custom_paint_clip.js | 4 + .../compoment/custom_single_child_layout.js | 4 + .../src/widgets/compoment/directionality.js | 4 + .../src/widgets/compoment/divider.js | 4 + .../src/widgets/compoment/fitted_box.js | 4 + .../compoment/fractional_translation.js | 4 + .../src/widgets/compoment/image_filter.js | 4 + .../src/widgets/compoment/indexed_stack.js | 4 + .../src/widgets/compoment/list_body.js | 4 + .../src/widgets/compoment/mouse_region.js | 4 + .../src/widgets/compoment/multi_child_view.js | 4 + .../src/widgets/compoment/opacity.js | 4 + .../src/widgets/compoment/padding.js | 4 + .../widgets/compoment/physical_model_shape.js | 4 + .../src/widgets/compoment/positioned.js | 4 + .../src/widgets/compoment/raw_image.js | 4 + .../src/widgets/compoment/rich_text.js | 4 + .../src/widgets/compoment/shader_mask.js | 4 + .../src/widgets/compoment/sized_box.js | 4 + .../widgets/compoment/sliver_box_adapter.js | 4 + .../src/widgets/compoment/spacer.js | 4 + .../src/widgets/compoment/stack.js | 4 + .../src/widgets/compoment/transform.js | 4 + .../src/widgets/media_query.js | 4 + .../src/widgets/navigator.js | 4 + .../flutterjs_material/src/widgets/overlay.js | 4 + .../flutterjs_material/src/widgets/widgets.js | 4 + .../lib/flutterjs_material.dart | 18 +++-- packages/flutterjs_material/pubspec.yaml | 2 +- .../flutterjs_painting/example/lib/main.dart | 7 +- .../flutterjs_painting/build.js | 4 + .../flutterjs_painting/package.json | 2 +- .../flutterjs_painting/src/index.js | 4 + .../lib/flutterjs_painting.dart | 18 +++-- packages/flutterjs_painting/pubspec.yaml | 2 +- packages/flutterjs_rendering/build.js | 4 + packages/flutterjs_rendering/dist/index.js | 4 + packages/flutterjs_rendering/package.json | 2 +- packages/flutterjs_rendering/src/index.js | 4 + .../flutterjs_runtime/example/lib/main.dart | 7 +- .../flutterjs_runtime/build.js | 4 + .../flutterjs_runtime/package.json | 2 +- .../flutterjs_runtime/src/build_context.js | 4 + .../flutterjs_runtime/src/datetime.js | 4 + .../flutterjs_runtime/src/element.js | 4 + .../flutterjs_runtime/src/event_system.js | 4 + .../src/flutterjs_runtime.js | 4 + .../flutterjs_runtime/src/focus_manager.js | 4 + .../src/gesture_recognizer.js | 4 + .../flutterjs_runtime/src/index.js | 4 + .../src/inherited_element.js | 4 + .../flutterjs_runtime/src/key.js | 4 + .../flutterjs_runtime/src/memory_manager.js | 4 + .../flutterjs_runtime/src/runtime_engine.js | 4 + .../flutterjs_runtime/src/service_registry.js | 4 + .../flutterjs_runtime/src/state.js | 4 + .../flutterjs_runtime/src/state_tracker.js | 4 + .../flutterjs_runtime/src/update_batcher.js | 4 + .../lib/flutterjs_runtime.dart | 18 +++-- packages/flutterjs_runtime/pubspec.yaml | 2 +- packages/flutterjs_seo/example/lib/main.dart | 4 + packages/flutterjs_seo/flutterjs_seo/build.js | 4 + .../flutterjs_seo/lib/flutterjs_seo.dart | 4 + .../flutterjs_seo/flutterjs_seo/package.json | 2 +- .../flutterjs_seo/flutterjs_seo/src/index.js | 4 + .../flutterjs_seo/flutterjs_seo/src/seo.js | 4 + .../flutterjs_seo/src/seo_manager.js | 4 + packages/flutterjs_seo/lib/flutterjs_seo.dart | 4 + packages/flutterjs_seo/pubspec.yaml | 2 +- .../flutterjs_services/example/lib/main.dart | 7 +- .../flutterjs_services/build.js | 4 + .../flutterjs_services/package.json | 2 +- .../flutterjs_services/src/index.js | 4 + .../lib/flutterjs_services.dart | 18 +++-- packages/flutterjs_services/pubspec.yaml | 2 +- packages/flutterjs_tools/lib/command.dart | 4 + .../lib/src/analyzer/analyze_command.dart | 12 ++- .../lib/src/builder/build_command.dart | 8 +- .../lib/src/cleaner/clean_command.dart | 14 ++-- .../lib/src/commands/create_command.dart | 4 + .../lib/src/commands/publish_command.dart | 4 + .../lib/src/config/config_loader.dart | 4 + .../lib/src/dev_server/dev_server.dart | 16 ++-- .../flutterjs_tools/lib/src/docs_command.dart | 14 ++-- .../lib/src/model/package_profile.dart | 12 ++- packages/flutterjs_tools/lib/src/runner.dart | 6 +- .../lib/src/runner/code_pipleiline.dart | 4 + .../lib/src/runner/engine_bridge.dart | 4 + .../lib/src/runner/helper.dart | 40 ++++++---- .../lib/src/runner/run_command.dart | 48 +++++------- .../lib/src/runner/tracer.dart | 4 + .../lib/src/version_command.dart | 4 + packages/flutterjs_tools/pubspec.yaml | 2 +- .../test/flutterjs_tools_test.dart | 4 + packages/flutterjs_tools/tool/debug_pkg.dart | 5 +- packages/flutterjs_tools/tool/test_build.dart | 4 + packages/flutterjs_vdom/example/lib/main.dart | 4 + .../flutterjs_vdom/flutterjs_vdom/build.js | 4 + .../flutterjs_vdom/package.json | 4 +- .../flutterjs_vdom/src/hydrator.js | 4 + .../flutterjs_vdom/src/patch_applier.js | 4 + .../flutterjs_vdom/src/render_engine.js | 4 + .../flutterjs_vdom/src/runtime_index.js | 4 + .../flutterjs_vdom/src/ssr_renderer.js | 4 + .../flutterjs_vdom/src/state_binding.js | 4 + .../flutterjs_vdom/src/style_converter.js | 4 + .../flutterjs_vdom/src/update_scheduler.js | 4 + .../flutterjs_vdom/src/vnode.js | 4 + .../flutterjs_vdom/src/vnode_builder.js | 4 + .../flutterjs_vdom/src/vnode_differ.js | 4 + .../flutterjs_vdom/src/vnode_renderer.js | 4 + .../flutterjs_vdom/lib/flutterjs_vdom.dart | 18 +++-- packages/flutterjs_vdom/pubspec.yaml | 2 +- .../flutterjs_widgets/example/lib/main.dart | 7 +- .../flutterjs_widgets/build.js | 4 + .../flutterjs_widgets/package.json | 10 ++- .../flutterjs_widgets/src/index.js | 4 + .../lib/flutterjs_widgets.dart | 4 + packages/flutterjs_widgets/pubspec.yaml | 2 +- packages/pubjs/bin/debug_build.dart | 20 +++-- packages/pubjs/bin/migrate_packages.dart | 4 + packages/pubjs/bin/pubjs.dart | 4 + packages/pubjs/lib/pubjs.dart | 4 + .../pubjs/lib/src/builder/transpiler.dart | 4 + packages/pubjs/lib/src/commands.dart | 4 + packages/pubjs/lib/src/config_generator.dart | 4 + packages/pubjs/lib/src/config_resolver.dart | 4 + .../lib/src/flutterjs_registry_client.dart | 4 + .../pubjs/lib/src/model/package_info.dart | 4 + packages/pubjs/lib/src/npm_client.dart | 21 +++-- packages/pubjs/lib/src/package_builder.dart | 6 +- .../pubjs/lib/src/package_downloader.dart | 10 ++- packages/pubjs/lib/src/package_scaffold.dart | 4 + packages/pubjs/lib/src/package_watcher.dart | 4 + packages/pubjs/lib/src/pub_dev_client.dart | 4 + packages/pubjs/lib/src/publisher.dart | 25 +++--- packages/pubjs/lib/src/pubspec_parser.dart | 4 + packages/pubjs/lib/src/registry_client.dart | 4 + .../lib/src/runtime_package_manager.dart | 4 + packages/pubjs/pubspec.yaml | 2 +- pubspec.yaml | 10 ++- tool/add_license.dart | 43 ++++++++++ tool/init.dart | 4 + tool/sync_versions.dart | 78 +++++++++++++++++++ 623 files changed, 2850 insertions(+), 359 deletions(-) create mode 100644 tool/add_license.dart create mode 100644 tool/sync_versions.dart diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 23ed484e..ebe04c15 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -86,7 +86,7 @@ Enhancement suggestions are tracked as [GitHub issues](https://github.com/flutte ## 📜 License -By contributing, you agree that your contributions will be licensed under its MIT License. +By contributing, you agree that your contributions will be licensed under its BSD 3-Clause License. ## ❤️ Code of Conduct diff --git a/bin/flutterjs.dart b/bin/flutterjs.dart index 9cbe246e..2209a8e9 100644 --- a/bin/flutterjs.dart +++ b/bin/flutterjs.dart @@ -1,12 +1,16 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'dart:io'; import 'package:args/command_runner.dart'; import 'package:flutterjs_tools/command.dart'; /// ============================================================================ -/// Flutter.js CLI Entry Point +/// FlutterJS CLI Entry Point /// ============================================================================ /// -/// This file defines the main executable for the **Flutter.js** command-line +/// This file defines the main executable for the **FlutterJS** command-line /// tool. It initializes argument parsing, handles global flags (`-v`, `-h`, /// `doctor`, etc.), configures logging verbosity, and delegates execution to /// `FlutterJSCommandRunner`. @@ -72,13 +76,13 @@ import 'package:flutterjs_tools/command.dart'; /// /// # Constants /// -/// `version` / `kVersion` → Current Flutter.js CLI version +/// `version` / `kVersion` → Current FlutterJS CLI version /// `appName` / `kAppName` → Display name used by the CLI and commands /// /// /// # Summary /// -/// This file contains the complete startup logic for the Flutter.js CLI, +/// This file contains the complete startup logic for the FlutterJS CLI, /// including: /// ✔ Flag normalization /// ✔ Help/doctor routing @@ -91,15 +95,13 @@ import 'package:flutterjs_tools/command.dart'; /// extend. /// -const String version = '2.0.0'; -const String appName = 'Flutter.js'; +const String version = '1.0.0'; +const String appName = 'FlutterJS'; -const String kVersion = '2.0.0'; -const String kAppName = 'Flutter.js'; +const String kVersion = '1.0.0'; +const String kAppName = 'FlutterJS'; Future main(List args) async { - print('--- [SANITY CHECK] FLUTTERJS CLI STARTING ---'); - print('--- [SANITY CHECK] ARGS: $args ---'); // Parse verbose flags early final bool veryVerbose = args.contains('-vv'); final bool verbose = diff --git a/examples/core_lib_demo/flutterjs.config.js b/examples/core_lib_demo/flutterjs.config.js index 4e535e70..2ef40de2 100644 --- a/examples/core_lib_demo/flutterjs.config.js +++ b/examples/core_lib_demo/flutterjs.config.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + module.exports = { packages: { 'flutterjs': null, // TODO: Set to 'flutterjs_flutterjs:version' or { path: './...' } diff --git a/examples/core_lib_demo/lib/main.dart b/examples/core_lib_demo/lib/main.dart index 0130fba2..a5990231 100644 --- a/examples/core_lib_demo/lib/main.dart +++ b/examples/core_lib_demo/lib/main.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutter/material.dart'; import 'dart:math'; import 'dart:async'; @@ -5,7 +9,7 @@ import 'dart:developer' as developer; import 'dart:collection'; import 'dart:typed_data'; -void main() { +void main() { runApp(const MyApp()); } @@ -26,7 +30,6 @@ class MyApp extends StatelessWidget { developer.log('Future completed'); }); - // --- Test dart:collection --- final queue = Queue(); queue.add(1); diff --git a/examples/counter/lib/main.dart b/examples/counter/lib/main.dart index c94b8b4a..56c58231 100644 --- a/examples/counter/lib/main.dart +++ b/examples/counter/lib/main.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutter/material.dart'; void main() { @@ -119,7 +123,7 @@ class _MyHomePageState extends State { ), ), floatingActionButton: FloatingActionButton( - onPressed: ()=> _incrementCounter(), + onPressed: () => _incrementCounter(), tooltip: 'Increment', child: const Icon(Icons.add), ), diff --git a/examples/counter/pubspec.yaml b/examples/counter/pubspec.yaml index 8a71dd25..af493315 100644 --- a/examples/counter/pubspec.yaml +++ b/examples/counter/pubspec.yaml @@ -18,7 +18,7 @@ resolution: workspace # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.0+1 +version: 1.0.0 environment: sdk: ^3.10.0-278.0.dev diff --git a/examples/material_advanced_demo/lib/main.dart b/examples/material_advanced_demo/lib/main.dart index 03bcbb92..a0d6245f 100644 --- a/examples/material_advanced_demo/lib/main.dart +++ b/examples/material_advanced_demo/lib/main.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutter/material.dart'; void main() { diff --git a/examples/material_advanced_demo/pubspec.yaml b/examples/material_advanced_demo/pubspec.yaml index 4bdaa694..dc693b77 100644 --- a/examples/material_advanced_demo/pubspec.yaml +++ b/examples/material_advanced_demo/pubspec.yaml @@ -1,7 +1,7 @@ name: material_advanced_demo description: "Demo of Advanced Material Widgets" publish_to: 'none' -version: 1.0.0+1 +version: 1.0.0 environment: sdk: ^3.10.0-278.0.dev dependencies: diff --git a/examples/material_buttons_demo/lib/main.dart b/examples/material_buttons_demo/lib/main.dart index c1233972..b3a9806e 100644 --- a/examples/material_buttons_demo/lib/main.dart +++ b/examples/material_buttons_demo/lib/main.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutter/material.dart'; void main() { diff --git a/examples/material_buttons_demo/pubspec.yaml b/examples/material_buttons_demo/pubspec.yaml index 5a4de6a7..43ebe067 100644 --- a/examples/material_buttons_demo/pubspec.yaml +++ b/examples/material_buttons_demo/pubspec.yaml @@ -1,7 +1,7 @@ name: material_buttons_demo description: "Demo of Material Buttons" publish_to: 'none' -version: 1.0.0+1 +version: 1.0.0 environment: sdk: ^3.10.0-278.0.dev dependencies: diff --git a/examples/material_demo/lib/main.dart b/examples/material_demo/lib/main.dart index d3f86c26..7b6e31f7 100644 --- a/examples/material_demo/lib/main.dart +++ b/examples/material_demo/lib/main.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutter/material.dart'; void main() { diff --git a/examples/material_demo/pubspec.yaml b/examples/material_demo/pubspec.yaml index 8deea947..cc3253a8 100644 --- a/examples/material_demo/pubspec.yaml +++ b/examples/material_demo/pubspec.yaml @@ -18,7 +18,7 @@ resolution: workspace # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.0+1 +version: 1.0.0 environment: sdk: ^3.10.0-278.0.dev diff --git a/examples/material_display_demo/lib/main.dart b/examples/material_display_demo/lib/main.dart index aeb3562d..5bf32429 100644 --- a/examples/material_display_demo/lib/main.dart +++ b/examples/material_display_demo/lib/main.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutter/material.dart'; void main() { diff --git a/examples/material_display_demo/pubspec.yaml b/examples/material_display_demo/pubspec.yaml index 86f6541a..6a5bdb78 100644 --- a/examples/material_display_demo/pubspec.yaml +++ b/examples/material_display_demo/pubspec.yaml @@ -1,7 +1,7 @@ name: material_display_demo description: "Demo of Material Display Widgets" publish_to: 'none' -version: 1.0.0+1 +version: 1.0.0 environment: sdk: ^3.10.0-278.0.dev dependencies: diff --git a/examples/material_inputs_demo/lib/main.dart b/examples/material_inputs_demo/lib/main.dart index 25d9a804..0c4dff55 100644 --- a/examples/material_inputs_demo/lib/main.dart +++ b/examples/material_inputs_demo/lib/main.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutter/material.dart'; void main() { diff --git a/examples/material_inputs_demo/pubspec.yaml b/examples/material_inputs_demo/pubspec.yaml index 5e1e51f8..126e3efd 100644 --- a/examples/material_inputs_demo/pubspec.yaml +++ b/examples/material_inputs_demo/pubspec.yaml @@ -1,7 +1,7 @@ name: material_inputs_demo description: "Demo of Material Inputs" publish_to: 'none' -version: 1.0.0+1 +version: 1.0.0 environment: sdk: ^3.10.0-278.0.dev dependencies: diff --git a/examples/material_navigation_demo/lib/main.dart b/examples/material_navigation_demo/lib/main.dart index b8860df4..410c8876 100644 --- a/examples/material_navigation_demo/lib/main.dart +++ b/examples/material_navigation_demo/lib/main.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutter/material.dart'; void main() { diff --git a/examples/material_navigation_demo/pubspec.yaml b/examples/material_navigation_demo/pubspec.yaml index 6f439a41..4d903d87 100644 --- a/examples/material_navigation_demo/pubspec.yaml +++ b/examples/material_navigation_demo/pubspec.yaml @@ -1,7 +1,7 @@ name: material_navigation_demo description: "Demo of Material Navigation" publish_to: 'none' -version: 1.0.0+1 +version: 1.0.0 environment: sdk: ^3.10.0-278.0.dev dependencies: diff --git a/examples/material_structure_demo/lib/main.dart b/examples/material_structure_demo/lib/main.dart index 742212bb..6a25a7cd 100644 --- a/examples/material_structure_demo/lib/main.dart +++ b/examples/material_structure_demo/lib/main.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutter/material.dart'; void main() { diff --git a/examples/material_structure_demo/pubspec.yaml b/examples/material_structure_demo/pubspec.yaml index 7eac2519..8a64b1f7 100644 --- a/examples/material_structure_demo/pubspec.yaml +++ b/examples/material_structure_demo/pubspec.yaml @@ -1,7 +1,7 @@ name: material_structure_demo description: "Demo of Material Structure Widgets" publish_to: 'none' -version: 1.0.0+1 +version: 1.0.0 environment: sdk: ^3.10.0-278.0.dev dependencies: diff --git a/examples/multi_file_test/lib/main.dart b/examples/multi_file_test/lib/main.dart index a98e2d1d..2427cb9b 100644 --- a/examples/multi_file_test/lib/main.dart +++ b/examples/multi_file_test/lib/main.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutter/material.dart'; import 'models/data_model.dart'; import 'widgets/user_profile_card.dart'; diff --git a/examples/multi_file_test/lib/models/data_model.dart b/examples/multi_file_test/lib/models/data_model.dart index e311b134..fa08c99d 100644 --- a/examples/multi_file_test/lib/models/data_model.dart +++ b/examples/multi_file_test/lib/models/data_model.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class User { final String name; final String role; diff --git a/examples/multi_file_test/lib/utils_widget.dart b/examples/multi_file_test/lib/utils_widget.dart index 5f5d220a..1832f69b 100644 --- a/examples/multi_file_test/lib/utils_widget.dart +++ b/examples/multi_file_test/lib/utils_widget.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutter/material.dart'; class UtilsWidget extends StatelessWidget { diff --git a/examples/multi_file_test/lib/widgets/action_button.dart b/examples/multi_file_test/lib/widgets/action_button.dart index fc4d079c..759479ef 100644 --- a/examples/multi_file_test/lib/widgets/action_button.dart +++ b/examples/multi_file_test/lib/widgets/action_button.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutter/material.dart'; class ActionButton extends StatelessWidget { diff --git a/examples/multi_file_test/lib/widgets/user_profile_card.dart b/examples/multi_file_test/lib/widgets/user_profile_card.dart index 0ea21e31..11c40753 100644 --- a/examples/multi_file_test/lib/widgets/user_profile_card.dart +++ b/examples/multi_file_test/lib/widgets/user_profile_card.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutter/material.dart'; import '../models/data_model.dart'; import 'action_button.dart'; diff --git a/examples/multi_file_test/pubspec.yaml b/examples/multi_file_test/pubspec.yaml index d6d5c950..adae1177 100644 --- a/examples/multi_file_test/pubspec.yaml +++ b/examples/multi_file_test/pubspec.yaml @@ -16,7 +16,7 @@ resolution: workspace # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.0+1 +version: 1.0.0 environment: sdk: ^3.10.0-278.0.dev diff --git a/examples/pub_test_app/lib/main.dart b/examples/pub_test_app/lib/main.dart index 41515323..c7cd608a 100644 --- a/examples/pub_test_app/lib/main.dart +++ b/examples/pub_test_app/lib/main.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:uuid/uuid.dart'; void main() { diff --git a/examples/routing_app/lib/main.dart b/examples/routing_app/lib/main.dart index 9a5baf7a..564c86fb 100644 --- a/examples/routing_app/lib/main.dart +++ b/examples/routing_app/lib/main.dart @@ -1,4 +1,9 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutter/material.dart'; + void main() { runApp(const RoutingApp()); } @@ -25,7 +30,6 @@ class HomeScreen extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( backgroundColor: Colors.blue, @@ -84,5 +88,6 @@ class DetailsScreen extends StatelessWidget { ); } } + // touch -// force build \ No newline at end of file +// force build diff --git a/examples/routing_app/pubspec.yaml b/examples/routing_app/pubspec.yaml index 08be6be8..504343eb 100644 --- a/examples/routing_app/pubspec.yaml +++ b/examples/routing_app/pubspec.yaml @@ -1,7 +1,7 @@ name: routing_app description: "A new FlutterJS Routing Example." publish_to: 'none' -version: 1.0.0+1 +version: 1.0.0 resolution: workspace environment: diff --git a/examples/try_test/lib/main.dart b/examples/try_test/lib/main.dart index 7ac8432b..62519663 100644 --- a/examples/try_test/lib/main.dart +++ b/examples/try_test/lib/main.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // Minimal test for try/catch/finally transpilation void main() { diff --git a/examples/try_test/pubspec.yaml b/examples/try_test/pubspec.yaml index 88c9d25e..96da648a 100644 --- a/examples/try_test/pubspec.yaml +++ b/examples/try_test/pubspec.yaml @@ -1,6 +1,6 @@ name: try_test description: Minimal test for try/catch/finally -version: 0.0.1 +version: 1.0.0 environment: sdk: ^3.0.0 diff --git a/packages/dart_analyzer/lib/dart_analyzer.dart b/packages/dart_analyzer/lib/dart_analyzer.dart index 158212ae..4d3fb9c1 100644 --- a/packages/dart_analyzer/lib/dart_analyzer.dart +++ b/packages/dart_analyzer/lib/dart_analyzer.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + export 'src/analyzing_project.dart'; export 'src/TypeDeclarationVisitor.dart'; export 'src/analyze_flutter_app.dart'; diff --git a/packages/dart_analyzer/lib/src/TypeDeclarationVisitor.dart b/packages/dart_analyzer/lib/src/TypeDeclarationVisitor.dart index 91579e85..93171195 100644 --- a/packages/dart_analyzer/lib/src/TypeDeclarationVisitor.dart +++ b/packages/dart_analyzer/lib/src/TypeDeclarationVisitor.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/ast/visitor.dart'; import 'package:analyzer/dart/element/element.dart'; diff --git a/packages/dart_analyzer/lib/src/analysis_output_generator.dart b/packages/dart_analyzer/lib/src/analysis_output_generator.dart index c2580172..29f18c4a 100644 --- a/packages/dart_analyzer/lib/src/analysis_output_generator.dart +++ b/packages/dart_analyzer/lib/src/analysis_output_generator.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // lib/src/analyzer/analysis_output_generator.dart import 'dependency_graph.dart'; diff --git a/packages/dart_analyzer/lib/src/analyze_flutter_app.dart b/packages/dart_analyzer/lib/src/analyze_flutter_app.dart index f6922531..b660ceb6 100644 --- a/packages/dart_analyzer/lib/src/analyze_flutter_app.dart +++ b/packages/dart_analyzer/lib/src/analyze_flutter_app.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // Main Declaration container import 'ir_linker.dart' as ir_linker; import 'model/analyzer_model.dart'; diff --git a/packages/dart_analyzer/lib/src/analyzing_project.dart b/packages/dart_analyzer/lib/src/analyzing_project.dart index 1151fee0..d96b9a48 100644 --- a/packages/dart_analyzer/lib/src/analyzing_project.dart +++ b/packages/dart_analyzer/lib/src/analyzing_project.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:analyzer/dart/analysis/analysis_context.dart'; import 'package:analyzer/dart/analysis/analysis_context_collection.dart'; import 'package:analyzer/dart/analysis/results.dart'; diff --git a/packages/dart_analyzer/lib/src/dependency_graph.dart b/packages/dart_analyzer/lib/src/dependency_graph.dart index fb4056fe..fcd1266f 100644 --- a/packages/dart_analyzer/lib/src/dependency_graph.dart +++ b/packages/dart_analyzer/lib/src/dependency_graph.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // lib/src/analyzer/dependency_graph.dart class DependencyGraph { diff --git a/packages/dart_analyzer/lib/src/dependency_resolver.dart b/packages/dart_analyzer/lib/src/dependency_resolver.dart index f0203571..8a2e17d0 100644 --- a/packages/dart_analyzer/lib/src/dependency_resolver.dart +++ b/packages/dart_analyzer/lib/src/dependency_resolver.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // lib/src/analyzer/dependency_resolver.dart import 'dart:io'; diff --git a/packages/dart_analyzer/lib/src/incremental_cache.dart b/packages/dart_analyzer/lib/src/incremental_cache.dart index bae63e24..39e32ee6 100644 --- a/packages/dart_analyzer/lib/src/incremental_cache.dart +++ b/packages/dart_analyzer/lib/src/incremental_cache.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // // lib/src/analyzer/analysis_cache.dart // import 'dart:io'; diff --git a/packages/dart_analyzer/lib/src/ir_linker.dart b/packages/dart_analyzer/lib/src/ir_linker.dart index 82537354..a64c8489 100644 --- a/packages/dart_analyzer/lib/src/ir_linker.dart +++ b/packages/dart_analyzer/lib/src/ir_linker.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // lib/src/analyzer/file_declaration_generator.dart import 'package:analyzer/dart/ast/ast.dart' as ast; diff --git a/packages/dart_analyzer/lib/src/model/analyzer_model.dart b/packages/dart_analyzer/lib/src/model/analyzer_model.dart index 0c100459..be083ef4 100644 --- a/packages/dart_analyzer/lib/src/model/analyzer_model.dart +++ b/packages/dart_analyzer/lib/src/model/analyzer_model.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + export 'core.dart' show SourceLocation, WidgetType, ProviderType, FunctionType; export 'widget.dart' diff --git a/packages/dart_analyzer/lib/src/model/core.dart b/packages/dart_analyzer/lib/src/model/core.dart index bd739091..8020de7c 100644 --- a/packages/dart_analyzer/lib/src/model/core.dart +++ b/packages/dart_analyzer/lib/src/model/core.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class SourceLocation { final int line; final int column; diff --git a/packages/dart_analyzer/lib/src/model/other.dart b/packages/dart_analyzer/lib/src/model/other.dart index fb355a6e..149abf9f 100644 --- a/packages/dart_analyzer/lib/src/model/other.dart +++ b/packages/dart_analyzer/lib/src/model/other.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'dart:convert'; import 'core.dart'; diff --git a/packages/dart_analyzer/lib/src/model/state.dart b/packages/dart_analyzer/lib/src/model/state.dart index a23788fa..7323da92 100644 --- a/packages/dart_analyzer/lib/src/model/state.dart +++ b/packages/dart_analyzer/lib/src/model/state.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'core.dart'; import 'other.dart'; import 'widget.dart'; diff --git a/packages/dart_analyzer/lib/src/model/widget.dart b/packages/dart_analyzer/lib/src/model/widget.dart index a7c04382..47d0bd77 100644 --- a/packages/dart_analyzer/lib/src/model/widget.dart +++ b/packages/dart_analyzer/lib/src/model/widget.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'core.dart'; import 'other.dart'; import 'state.dart'; diff --git a/packages/dart_analyzer/lib/src/type_registry.dart b/packages/dart_analyzer/lib/src/type_registry.dart index 0bda87cc..cd031ac6 100644 --- a/packages/dart_analyzer/lib/src/type_registry.dart +++ b/packages/dart_analyzer/lib/src/type_registry.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // lib/src/analyzer/type_registry.dart import 'package:analyzer/dart/element/element.dart' as aelement; import 'package:path/path.dart' as path; diff --git a/packages/dart_analyzer/test/flutterjs_analyzer_test.dart b/packages/dart_analyzer/test/flutterjs_analyzer_test.dart index 8b137891..5fc36956 100644 --- a/packages/dart_analyzer/test/flutterjs_analyzer_test.dart +++ b/packages/dart_analyzer/test/flutterjs_analyzer_test.dart @@ -1 +1,3 @@ - +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/build.js b/packages/flutterjs_analyzer/flutterjs_analyzer/build.js index 073a0a34..815804c4 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/build.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/build.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // build.js import esbuild from 'esbuild'; import { readdirSync, statSync } from 'fs'; diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/analyzer.js b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/analyzer.js index 641c1a63..bee88c92 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/analyzer.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/analyzer.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import d from"fs";import{Lexer as S}from"./lexer.js";import{Parser as w}from"./flutterjs_parser.js";import{WidgetAnalyzer as x}from"./flutterjs_widget_analyzer.js";import{StateAnalyzer as z}from"./state_analyzer_implementation.js";import{ContextAnalyzer as E}from"./context_analyzer.js";import{SSRAnalyzer as R}from"./ssr_analyzer.js";import{ReportGenerator as v}from"./flutterjs_report_generator.js";import{ImportResolver as $}from"./flutter_import_resolver.js";import{resolverConfig as b}from"./flutter_resolver_config.js";import{initLogger as C}from"./flutterjs_logger.js";class g{constructor(e={}){this.options={sourceFile:null,sourceCode:null,outputFormat:"json",outputFile:null,verbose:!0,strict:!1,projectRoot:process.cwd(),includeMetrics:!0,includeTree:!0,includeValidation:!0,includeSuggestions:!0,includeContext:!0,includeSsr:!0,includeImports:!0,ignoreUnresolvedImports:!0,prettyPrint:!0,debugLevel:"info",...e},this.logger=C({level:this.options.debugLevel,writeToFile:!0,writeToConsole:!1,debugDir:".debug"});const s=this.logger.createComponentLogger("Analyzer");this.log=s,this.importResolver=new $({projectRoot:this.options.projectRoot,ignoreUnresolved:this.options.ignoreUnresolvedImports,...b}),this.results={source:null,tokens:null,ast:null,widgets:null,importResolution:null,state:null,context:null,ssr:null,report:null},this.errors=[],this.timings={}}async analyze(){const e=this.log;e.startSession("FullAnalyzerPipeline");try{if(e.info(` `+"=".repeat(80)),e.info("\u{1F680} FlutterJS ANALYZER - FULL PIPELINE"),e.info("=".repeat(80)),e.startSession("LoadSource"),e.info("STEP 1: Loading source code..."),await this.loadSource(),e.success("Source loaded"),e.endSession("LoadSource"),e.startSession("Lexing"),e.info("STEP 2: Tokenizing (Lexing)..."),this.lex(),e.trace("Tokens generated",this.results.tokens.length),e.success("Lexing complete"),e.endSession("Lexing"),e.startSession("Parsing"),e.info("STEP 3: Building AST (Parsing)..."),this.parse(),e.trace("Top-level items",this.results.ast.body.length),e.success("Parsing complete"),e.endSession("Parsing"),e.startSession("WidgetAnalysis"),e.info("STEP 4: Widget Analysis (Phase 1)..."),this.analyzeWidgets(),e.trace("Widgets detected",this.results.widgets.widgets.length),e.success("Widget analysis complete"),e.endSession("WidgetAnalysis"),this.options.includeImports){e.startSession("ImportResolution"),e.info("STEP 5: Resolving Imports..."),this.analyzeImports();const s=this.results.importResolution?.summary;e.trace("Imports resolved",s?.resolved||0),e.trace("Imports unresolved",s?.unresolved||0),e.success("Import resolution complete"),e.endSession("ImportResolution")}return e.startSession("StateAnalysis"),e.info("STEP 6: State Analysis (Phase 2)..."),this.analyzeState(),e.trace("State classes analyzed",this.results.state.stateClasses.length),e.success("State analysis complete"),e.endSession("StateAnalysis"),this.options.includeContext&&(e.startSession("ContextAnalysis"),e.info("STEP 7: Context Analysis (Phase 3)..."),this.analyzeContext(),e.trace("Inherited widgets detected",this.results.context.inheritedWidgets?.length||0),e.success("Context analysis complete"),e.endSession("ContextAnalysis")),this.options.includeSsr&&(e.startSession("SSRAnalysis"),e.info("STEP 8: SSR Compatibility Analysis (Phase 3)..."),this.analyzeSsr(),e.trace("SSR Compatibility Score",this.results.ssr.ssrCompatibilityScore),e.success("SSR analysis complete"),e.endSession("SSRAnalysis")),e.startSession("ReportGeneration"),e.info("STEP 9: Generating Report..."),this.generateReport(),e.success("Report generated"),e.endSession("ReportGeneration"),e.startSession("Output"),e.info("STEP 10: Output..."),this.output(),e.success("Output complete"),e.endSession("Output"),e.info("=".repeat(80)),e.success("\u2705 ANALYSIS COMPLETE"),e.info("=".repeat(80)+` `),this.logger.saveLogs(),this.getResults()}catch(s){throw e.error("ANALYSIS FAILED"),e.failure("Analysis pipeline",s.message),e.endSession("FullAnalyzerPipeline"),s}}analyzeImports(){const e=Date.now(),s=this.log;try{if(!this.results.source){s.warn("No source code found, skipping import analysis");return}s.info("Processing imports from AST (parsed in Step 3)...");const t=this.results.widgets?.imports||[];s&&(s.info(`Found ${t.length} import statements`),t.forEach((a,c)=>{s.debug(` \u{1F4CD} ${a.source} \u2192 [${a.items.join(", ")}]`)}));const o=this.importResolver.resolveImports(t);if(this.results.importResolution={imports:o.imports,summary:o.summary,parsed:t},s.info(`Resolved: ${o.summary.resolved}`),s.info(`Unresolved: ${o.summary.unresolved}`),s.debug(`Framework packages: ${o.summary.bySource.framework}`),s.debug(`Local imports: ${o.summary.bySource.local}`),!this.options.ignoreUnresolvedImports&&o.imports.errors.length>0)throw new Error(`${o.imports.errors.length} imports could not be resolved`)}catch(t){throw s.error(`Import resolution failed: ${t.message}`),new Error(`Import resolution failed: ${t.message}`)}this.timings.analyzeImports=Date.now()-e}async loadSource(){const e=Date.now(),s=this.log;if(this.options.sourceCode)this.results.source=this.options.sourceCode,s.debug("Using provided source code");else if(this.options.sourceFile)try{this.results.source=d.readFileSync(this.options.sourceFile,"utf-8"),s.debug(`Loaded from file: ${this.options.sourceFile}`),s.trace("Source file size",this.results.source.length)}catch(t){throw s.error(`Cannot read file "${this.options.sourceFile}"`),new Error(`Cannot read file "${this.options.sourceFile}": ${t.message}`)}else throw s.error("No source code or source file provided"),new Error("No source code or source file provided");this.timings.loadSource=Date.now()-e}lex(){const e=Date.now(),s=this.log;try{const t=new S(this.results.source);this.results.tokens=t.tokenize(),t.getErrors().length>0&&(s.warn(`Lexer produced ${t.getErrors().length} warnings`),t.getErrors().forEach(o=>{s.debug(`Lexer: ${o.message}`)}))}catch(t){throw s.error(`Lexing failed: ${t.message}`),new Error(`Lexing failed: ${t.message}`)}this.timings.lex=Date.now()-e}parse(){const e=Date.now(),s=this.log;try{const t=new w(this.results.tokens);if(this.results.ast=t.parse(),t.getErrors().length>0&&(s.warn(`Parser produced ${t.getErrors().length} errors`),t.getErrors().forEach(o=>{s.debug(`Parser: ${o.message}`)}),this.options.strict))throw new Error(`${t.getErrors().length} parser errors found`)}catch(t){throw s.error(`Parsing failed: ${t.message}`),new Error(`Parsing failed: ${t.message}`)}this.timings.parse=Date.now()-e}analyzeWidgets(){const e=Date.now(),s=this.log;try{const t=new x(this.results.ast);this.results.widgets=t.analyze(),this.results.widgets.errors.length>0&&(s.warn(`Widget analysis produced ${this.results.widgets.errors.length} errors`),this.results.widgets.errors.forEach(o=>{s.debug(`Widget: ${o.message}`)}))}catch(t){throw s.error(`Widget analysis failed: ${t.message}`),new Error(`Widget analysis failed: ${t.message}`)}this.timings.analyzeWidgets=Date.now()-e}analyzeState(){const e=Date.now(),s=this.log;try{const t=new z(this.results.ast,this.results.widgets.widgets,{strict:this.options.strict});this.results.state=t.analyze(),this.results.state.errors.length>0&&(s.warn(`State analysis produced ${this.results.state.errors.length} errors`),this.results.state.errors.forEach(o=>{s.debug(`State: ${o.message}`)}))}catch(t){throw s.error(`State analysis failed: ${t.message}`),new Error(`State analysis failed: ${t.message}`)}this.timings.analyzeState=Date.now()-e}analyzeContext(){const e=Date.now(),s=this.log;try{const t=new E(this.results.ast,this.results.widgets.widgets,{strict:this.options.strict});this.results.context=t.analyze(),this.results.context.errors&&this.results.context.errors.length>0&&(s.warn(`Context analysis produced ${this.results.context.errors.length} errors`),this.results.context.errors.forEach(o=>{s.debug(`Context: ${o.message}`)}))}catch(t){throw s.error(`Context analysis failed: ${t.message}`),new Error(`Context analysis failed: ${t.message}`)}this.timings.analyzeContext=Date.now()-e}analyzeSsr(){const e=Date.now(),s=this.log;try{const t=new R(this.results.context,this.results.state,{strict:this.options.strict});this.results.ssr=t.analyze(),this.results.ssr.errors&&this.results.ssr.errors.length>0&&(s.warn(`SSR analysis produced ${this.results.ssr.errors.length} errors`),this.results.ssr.errors.forEach(o=>{s.debug(`SSR: ${o.message}`)}))}catch(t){throw s.error(`SSR analysis failed: ${t.message}`),new Error(`SSR analysis failed: ${t.message}`)}this.timings.analyzeSsr=Date.now()-e}generateReport(){const e=Date.now(),s=this.log;try{const t=new v(this.results.widgets,this.results.state,this.results.context,this.results.ssr,{format:this.options.outputFormat,includeMetrics:this.options.includeMetrics,includeTree:this.options.includeTree,includeValidation:this.options.includeValidation,includeSuggestions:this.options.includeSuggestions,includeContext:this.options.includeContext,includeSsr:this.options.includeSsr,prettyPrint:this.options.prettyPrint});this.results.report=t.generate()}catch(t){throw s.error(`Report generation failed: ${t.message}`),new Error(`Report generation failed: ${t.message}`)}this.timings.generateReport=Date.now()-e}output(){const e=this.log;if(this.options.outputFile)try{d.writeFileSync(this.options.outputFile,this.results.report,"utf-8"),e.success(`Report saved to: ${this.options.outputFile}`)}catch(s){throw e.error(`Cannot write to file "${this.options.outputFile}"`),new Error(`Cannot write to file "${this.options.outputFile}": ${s.message}`)}else this.options.outputFormat!=="console"&&console.log(this.results.report)}getResults(){const e=this.results.widgets?.widgets||[],s=e.filter(r=>r.type==="stateless"),t=e.filter(r=>r.type==="stateful"),o=e.filter(r=>r.type==="state"),a=s.map(r=>r.name),c=t.map(r=>r.name),l={};o.forEach(r=>{const h=r.name.replace(/^_/,"").replace(/State$/,""),f=r.fields||[];l[r.name]=f.map(y=>y.name)}),t.forEach(r=>{const h=`_${r.name}State`;l[h]&&(l[r.name]=l[h])});const u=this.results.importResolution?.parsed||[],n={};return u.forEach(r=>{n[r.source]=r.items}),{source:{length:this.results.source?.length||0,file:this.options.sourceFile},tokens:{count:this.results.tokens?.length||0},ast:{items:this.results.ast?.body?.length||0},widgets:{stateless:a,stateful:c,count:e.length,all:e,stateClasses:l,total:{stateless:s.length,stateful:t.length,state:o.length}},imports:this.options.includeImports?n:null,importResolution:this.options.includeImports?{parsed:u,summary:this.results.importResolution?.summary||{total:u.length,resolved:this.results.importResolution?.summary?.resolved||0,unresolved:this.results.importResolution?.summary?.unresolved||0,errors:this.results.importResolution?.summary?.errors||0,resolutionRate:this.results.importResolution?.summary?.resolutionRate||"N/A",bySource:this.results.importResolution?.summary?.bySource||{framework:0,local:0,cache:0}}}:null,state:{stateClasses:this.results.state?.stateClasses?.length||0,stateFields:this.results.state?.stateFields?.length||0,setStateCalls:this.results.state?.setStateCalls?.length||0,lifecycleMethods:this.results.state?.lifecycleMethods?.length||0,eventHandlers:this.results.state?.eventHandlers?.length||0,validationIssues:this.results.state?.validationResults?.length||0},context:this.options.includeContext?{inheritedWidgets:this.results.context?.inheritedWidgets?.length||0,changeNotifiers:this.results.context?.changeNotifiers?.length||0,providers:this.results.context?.providers?.length||0,contextAccessPoints:this.results.context?.contextAccessPoints?.length||0}:null,ssr:this.options.includeSsr?{compatibility:this.results.ssr?.overallCompatibility||"unknown",compatibilityScore:this.results.ssr?.ssrCompatibilityScore||0,safePatterns:this.results.ssr?.ssrSafePatterns?.length||0,unsafePatterns:this.results.ssr?.ssrUnsafePatterns?.length||0,hydrationNeeded:this.results.ssr?.hydrationCount||0,migrationSteps:this.results.ssr?.ssrMigrationPath?.length||0,estimatedEffort:this.results.ssr?.estimatedEffort||"unknown"}:null,timings:this.timings,report:this.results.report,logger:this.logger.getReport(),debugFiles:this.logger.readDebugFiles()}}}async function P(i,e={}){return new g({sourceCode:i,...e}).analyze()}async function F(i,e={}){return new g({sourceFile:i,...e}).analyze()}async function A(i,e,s={}){return new g({sourceFile:i,outputFile:e,...s}).analyze()}async function p(){const i=process.argv.slice(2);i.length===0&&(m(),process.exit(0));const e=i[0];let s=null,t="json",o=!0,a=!0,c=!0,l=!0,u="info";for(let n=1;nt.callsNotifyListeners)&&this.methods.length>0&&e.push({type:"missing-notify-listeners",severity:"warning",message:`ChangeNotifier "${this.name}" has methods but none call notifyListeners()`}),this.methods.forEach(t=>{t.mutatesFields.length>0&&!t.callsNotifyListeners&&e.push({type:"mutation-without-notification",severity:"warning",message:`Method "${t.name}" mutates state but doesn't call notifyListeners()`})}),this.properties.length>0&&this.getters.length===0&&e.push({type:"missing-getters",severity:"info",message:`ChangeNotifier "${this.name}" has properties but no getters. Consider adding getters for encapsulation.`}),e}summary(){return{name:this.name,properties:this.properties.length,getters:this.getters.length,methods:this.methods.length,consumers:this.consumers.length,consumedBy:this.consumers,isValid:this.methods.some(e=>e.callsNotifyListeners)}}}class c{constructor(e,s,t){this.providerType=e,this.location=s,this.valueType=t,this.createFunction=null,this.lazy=!0,this.dispose=null,this.child=null,this.consumers=[],this.accessPatterns=[],this.flowPath=null}setCreateFunction(e){this.createFunction=e}setDispose(e){this.dispose=e}addConsumer(e){this.consumers.includes(e)||this.consumers.push(e)}addAccessPattern(e){this.accessPatterns.includes(e)||this.accessPatterns.push(e)}validate(){const e=[];return this.createFunction||e.push({type:"missing-create",severity:"error",message:`Provider<${this.valueType}> must have a create function`}),this.consumers.length===0&&e.push({type:"unused-provider",severity:"info",message:`Provider<${this.valueType}> is defined but not consumed by any widget`}),this.accessPatterns.includes("watch")&&!this.accessPatterns.includes("read")&&e.push({type:"watch-without-read",severity:"info",message:"Provider uses context.watch() but not context.read(). Consider both patterns."}),e}summary(){return{type:this.providerType,valueType:this.valueType,consumers:this.consumers.length,consumedBy:this.consumers,accessPatterns:this.accessPatterns,hasCreateFunction:!!this.createFunction,hasDisposeFunction:!!this.dispose}}}class l{constructor(e,s="build"){this.dependent=e,this.method=s,this.contextUsage=[],this.location=null}addUsage(e){e instanceof n&&this.contextUsage.push(e)}getSsrSafeUsages(){return this.contextUsage.filter(e=>e.ssrSafe)}getSsrUnsafeUsages(){return this.contextUsage.filter(e=>!e.ssrSafe)}isSsrCompatible(){return this.getSsrUnsafeUsages().length===0}summary(){return{dependent:this.dependent,method:this.method,totalUsages:this.contextUsage.length,ssrSafeUsages:this.getSsrSafeUsages().length,ssrUnsafeUsages:this.getSsrUnsafeUsages().length,isSsrCompatible:this.isSsrCompatible(),usagePatterns:this.contextUsage.map(e=>e.pattern)}}}class n{constructor(e,s,t,r="T",a=!0,o=""){this.pattern=e,this.type=s,this.location=t,this.returns=r,this.ssrSafe=a,this.reason=o,this.depth=0,this.frequency=1}explain(){return this.ssrSafe?`\u2713 SSR Safe: ${this.reason}`:`\u2717 SSR Unsafe: ${this.reason}`}getMigrationAdvice(){return this.ssrSafe?null:{"provider-watch":"Replace with context.read() for initial SSR render, use watch() in didChangeDependencies() on client","global-state-mutation":"Move mutations to client-only code, wrap in if (!kIsWeb) or similar server check","event-handler":"Event handlers don't exist during SSR, only attach after hydration on client"}[this.type]||null}summary(){return{pattern:this.pattern,type:this.type,returns:this.returns,ssrSafe:this.ssrSafe,reason:this.reason,advice:this.getMigrationAdvice()}}}class h{constructor(e,s,t=0){this.dependency=e,this.reason=s,this.order=t,this.requiredProviders=[],this.requiredState=[]}requiresProvider(e){this.requiredProviders.includes(e)||this.requiredProviders.push(e)}requiresState(e){this.requiredState.includes(e)||this.requiredState.push(e)}summary(){return{dependency:this.dependency,reason:this.reason,order:this.order,requiredProviders:this.requiredProviders,requiredState:this.requiredState}}}class p{constructor(e,s,t="unknown",r="widget"){this.target=e,this.reason=s,this.estimatedSize=t,this.type=r,this.recommendation=null,this.priority="medium"}setRecommendation(e){this.recommendation=e}calculatePriority(e){e>50?this.priority="high":e>20?this.priority="medium":this.priority="low"}summary(){return{target:this.target,type:this.type,reason:this.reason,estimatedSize:this.estimatedSize,priority:this.priority,recommendation:this.recommendation}}}class m{constructor(){this.requiresThemeProvider=!1,this.requiresMediaQuery=!1,this.requiresNavigator=!1,this.requiresChangeNotifierProvider=!1,this.customInheritedWidgets=[],this.requiredProviders=[],this.hydrationRequired=!1,this.hydrationDependencies=[],this.ssrCompatibility="unknown",this.ssrIssues=[],this.ssrMigrationPath=[]}addCustomInheritedWidget(e){this.customInheritedWidgets.includes(e)||this.customInheritedWidgets.push(e)}addRequiredProvider(e){this.requiredProviders.includes(e)||this.requiredProviders.push(e)}addHydrationDependency(e){e instanceof h&&(this.hydrationDependencies.push(e),this.hydrationRequired=!0)}calculateSsrCompatibility(){this.ssrIssues.length===0?this.ssrCompatibility="full":this.ssrIssues.length<=3?this.ssrCompatibility="partial":this.ssrCompatibility="none"}summary(){return{requiresThemeProvider:this.requiresThemeProvider,requiresMediaQuery:this.requiresMediaQuery,requiresNavigator:this.requiresNavigator,requiresChangeNotifierProvider:this.requiresChangeNotifierProvider,customInheritedWidgets:this.customInheritedWidgets,requiredProviders:this.requiredProviders,hydrationRequired:this.hydrationRequired,hydrationCount:this.hydrationDependencies.length,ssrCompatibility:this.ssrCompatibility,ssrIssueCount:this.ssrIssues.length}}}export{u as ChangeNotifierAnalysis,l as ContextDependency,m as ContextRequirementsSummary,n as ContextUsagePattern,h as HydrationRequirement,d as InheritedWidgetMetadata,p as LazyLoadOpportunity,c as ProviderAnalysis}; //# sourceMappingURL=context_analyzer_data.js.map diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutter_import_resolver.js b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutter_import_resolver.js index 6af0d11c..f602d75c 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutter_import_resolver.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutter_import_resolver.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import u from"fs";import c from"path";class h{constructor(e={}){this.options={projectRoot:process.cwd(),frameworkType:"flutter-js",ignoreUnresolved:!1,cacheEnabled:!1,...e},this.frameworkPackages={"@flutterjs/runtime":"file:../../../../../src/runtime","@flutterjs/vdom":"file:../../../../../src/vdom","@flutterjs/analyzer":"file:../../../../analyzer","@flutterjs/material":"file:../../../../../package/material","@flutterjs/cupertino":"file:../../../../../package/cupertino","@flutterjs/foundation":"file:../../../../../package/foundation"},this.customPackageMappings={},this.resolvedCache=new Map,this.unresolvedCache=new Map,this.localSearchPaths=["src","lib","packages","modules","."],this.results={resolved:[],unresolved:[],errors:[]}}parseImportsFromSource(e,a=null){const r=[];a&&(a.info("[ImportResolver] Starting import parsing..."),a.debug(`[ImportResolver] Source code length: ${e.length} characters`));const t=/import\s+([\s\S]*?)\s+from\s+['"`]([^'"`]+)['"`]/g;let s,o=0;for(;(s=t.exec(e))!==null;){o++;const n=s[1],i=s[2];a&&(a.debug(`[ImportResolver] Match #${o} found`),a.debug(` Module path: '${i}'`),a.trace(` Raw clause length: ${n.length} chars`));const l=this.parseImportClause(n,i,a);l?(a&&(a.debug(" \u2713 Successfully parsed"),a.debug(` Items: ${l.items.join(", ")}`)),r.push(l)):a&&a.warn(` \u2717 Parse returned null - clause: ${n.substring(0,100)}`)}return a&&(a.info(`[ImportResolver] FINAL RESULT: Found ${o} imports, parsed ${r.length}`),r.length===0&&o===0&&(a.warn("[ImportResolver] \u26A0\uFE0F NO IMPORTS FOUND - Check regex or source code!"),a.warn(`[ImportResolver] Source starts with: ${e.substring(0,200)}`)),r.forEach((n,i)=>{a.info(`[ImportResolver] [${i}] ${n.source} \u2192 [${n.items.join(", ")}]`)})),r}parseImportClause(e,a,r=null){if(!e||typeof e!="string")return null;let t=e.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/\n/g," ").replace(/\t/g," ").replace(/\s+/g," ").trim();r&&(r.trace(`[ImportResolver] Original: ${e.substring(0,100).replace(/\n/g,"\\n")}`),r.trace(`[ImportResolver] Cleaned: "${t}"`));const s={source:a,items:[],default:null,namespace:null,raw:e},o=t.match(/^\*\s+as\s+(\w+)$/);if(o)return s.namespace=o[1],s.items.push(o[1]),r&&r.trace(`[ImportResolver] \u2192 Namespace import: ${o[1]}`),s;const n=t.match(/\{(.+?)\}/);if(n){r&&r.trace("[ImportResolver] \u2192 Found braces, extracting named imports");const i=n[1];if(this.extractNamedItems(i,s,r),s.items.length>0)return s}if(!t.includes("{")&&t.includes(",")&&(r&&r.trace("[ImportResolver] \u2192 No braces but has commas, treating as named imports"),this.extractNamedItems(t,s,r),s.items.length>0))return s;if(!t.includes("{")&&!t.includes(",")&&t.length>0&&/^[\w$]+$/.test(t))return s.default=t,s.items.push(t),r&&r.trace(`[ImportResolver] \u2192 Default import: ${t}`),s;if(t.includes("{")&&t.includes(",")){const i=t.split("{")[0].trim();if(i&&i!==","&&/^[\w$]+$/.test(i)){s.default=i;const l=t.match(/\{(.+?)\}/);return l&&this.extractNamedItems(l[1],s,r),s.items.length>0?s:null}}return r&&(r.warn("[ImportResolver] \u26A0\uFE0F No valid import pattern detected"),r.debug(`[ImportResolver] Cleaned was: "${t}"`)),null}extractNamedItems(e,a,r=null){const t=e.split(",");r&&r.trace(`[ImportResolver] Found ${t.length} comma-separated items`),t.forEach(s=>{const o=s.trim();if(!o||o.length===0||o.startsWith("//")||o.startsWith("*"))return;const n=o.match(/^(\w+)\s+as\s+(\w+)$/);let i;n?(i=n[2],r&&r.trace(`[ImportResolver] "${n[1]} as ${n[2]}" \u2192 ${i}`)):(i=o,r&&r.trace(`[ImportResolver] "${o}"`)),/^[\w$]+$/.test(i)&&!a.items.includes(i)&&a.items.push(i)})}resolveFromSource(e,a=null){const r=this.parseImportsFromSource(e,a);a&&(a.info(`[ImportResolver] Parsed ${r.length} import statements`),r.forEach((s,o)=>{a.debug(`[ImportResolver] [${o}] ${s.source} \u2192 [${s.items.join(", ")}]`)}));const t={};return r.forEach(s=>{t[s.source]||(t[s.source]=[]),t[s.source]=t[s.source].concat(s.items)}),this.results={resolved:[],unresolved:[],errors:[]},Object.entries(t).forEach(([s,o])=>{this.resolve(s,o)}),{imports:this.results,summary:this.getSummary(),parsed:r}}resolve(e,a=[],r={}){const t=`${e}:${JSON.stringify(a)}`;if(this.resolvedCache.has(t))return this.resolvedCache.get(t);if(this.unresolvedCache.has(t))return this.unresolvedCache.get(t);const s={original:e,items:a,resolved:null,actualPath:null,type:null,source:null,isValid:!1,reason:null,fallbacks:[]};if(this.isFrameworkPackage(e)){const o=this.resolveFrameworkPackage(e,a);if(o.isValid)return s.resolved=o.resolved,s.actualPath=o.actualPath,s.type="framework",s.source="framework",s.isValid=!0,s.reason="Resolved from framework mappings",this.resolvedCache.set(t,s),this.results.resolved.push(s),s;s.fallbacks.push({step:1,tried:"framework-package",found:!1,reason:o.reason})}if(!this.isScopedPackage(e)){const o=this.resolveLocalImport(e,a);if(o.isValid)return s.resolved=o.resolved,s.actualPath=o.actualPath,s.type="local",s.source="local",s.isValid=!0,s.reason=`Found in local project at ${o.actualPath}`,this.resolvedCache.set(t,s),this.results.resolved.push(s),s;s.fallbacks.push({step:2,tried:"local-code",locations:o.searchedLocations,found:!1,reason:o.reason})}if(this.options.cacheEnabled){const o=this.resolveFromCache(e,a);if(o.isValid)return s.resolved=o.resolved,s.actualPath=o.actualPath,s.type="cache",s.source="cache",s.isValid=!0,s.reason=`Found in package cache at ${o.actualPath}`,this.resolvedCache.set(t,s),this.results.resolved.push(s),s;s.fallbacks.push({step:3,tried:"package-cache",found:!1,reason:o.reason})}return s.isValid=!1,s.source="error",s.reason=this.generateErrorMessage(e,s.fallbacks),this.options.ignoreUnresolved||this.results.errors.push(s),this.unresolvedCache.set(t,s),this.results.unresolved.push(s),s}isFrameworkPackage(e){return e.startsWith("@flutterjs/")||e.startsWith("@package:")}isScopedPackage(e){return e.startsWith("@")}resolveFrameworkPackage(e,a){return this.frameworkPackages[e]?{isValid:!0,resolved:this.frameworkPackages[e],actualPath:this.frameworkPackages[e],reason:"Found in framework package mappings"}:this.customPackageMappings[e]?{isValid:!0,resolved:this.customPackageMappings[e],actualPath:this.customPackageMappings[e],reason:"Found in custom package mappings"}:{isValid:!1,reason:`Framework package "${e}" not found in mappings`}}resolveLocalImport(e,a){const r=[];if(e.startsWith("./")||e.startsWith("../")){const t=c.resolve(this.options.projectRoot,e);return r.push(t),this.fileExists(t)?{isValid:!0,resolved:e,actualPath:t,reason:"Relative import found"}:this.fileExists(`${t}.js`)?{isValid:!0,resolved:e,actualPath:`${t}.js`,reason:"Relative import found (with .js)"}:{isValid:!1,searchedLocations:r,reason:`Relative import not found: ${e}`}}for(const t of this.localSearchPaths){const s=c.resolve(this.options.projectRoot,t,e);r.push(s);const o=c.join(s,"index.js");if(this.fileExists(o))return{isValid:!0,resolved:e,actualPath:o,reason:`Found in ${t}/${e}/index.js`};if(this.fileExists(`${s}.js`))return{isValid:!0,resolved:e,actualPath:`${s}.js`,reason:`Found in ${t}/${e}.js`};if(this.fileExists(`${s}.fjs`))return{isValid:!0,resolved:e,actualPath:`${s}.fjs`,reason:`Found in ${t}/${e}.fjs`}}return{isValid:!1,searchedLocations:r,reason:`Local import not found in: ${this.localSearchPaths.join(", ")}`}}resolveFromCache(e,a){return{isValid:!1,reason:"Package cache resolution not yet implemented"}}fileExists(e){try{return u.existsSync(e)}catch{return!1}}generateErrorMessage(e,a){let r=`\u274C Import not found: "${e}" Resolution chain: diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutter_resolver_config.js b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutter_resolver_config.js index 3501c8b4..3692284f 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutter_resolver_config.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutter_resolver_config.js @@ -1,2 +1,6 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + const e={frameworkType:"flutterjs",ignoreUnresolved:!1,cacheEnabled:!1,customPackageMappings:{"@flutterjs/runtime":"./flutterjs_engine/src/runtime","@flutterjs/vdom":"./flutterjs_engine/src/vdom","@flutterjs/material":"./flutterjs_engine/package/material","@flutterjs/http":"./flutterjs_engine/package/http","@flutterjs/core":"./flutterjs_engine/src/core","@flutterjs/foundation":"./flutterjs_engine/src/foundation","@flutterjs/widgets":"./flutterjs_engine/package/widgets"},localSearchPaths:["packages/flutterjs_engine/src","packages/flutterjs_engine/package","src","lib","packages","modules","components","screens","widgets","."],packageAliases:{flutter:"@flutterjs/material",material:"@flutterjs/material",http:"@flutterjs/http"},strict:{enforceNamingConventions:!1,requireVersions:!1,detectCircularImports:!0}};function r(a={}){const{ImportResolver:s}=import("./flutter_import_resolver.js"),t=new s({projectRoot:process.cwd(),...e,...a});return e.customPackageMappings&&t.addPackageMappings(e.customPackageMappings),e.localSearchPaths&&t.setLocalSearchPaths(e.localSearchPaths),t}const c={web:{localSearchPaths:["src","lib","components","."],customPackageMappings:{}},monorepo:{localSearchPaths:["packages/ui","packages/core","packages/models","packages/utils","src","."],customPackageMappings:{"@package:ui":"./packages/ui","@package:core":"./packages/core","@package:models":"./packages/models","@package:utils":"./packages/utils"}},flutter:{localSearchPaths:["lib","lib/screens","lib/widgets","lib/models","lib/services","lib/utils","."],customPackageMappings:{"@flutterjs/runtime":"file:../../../../runtime","@flutterjs/vdom":"file:../../../../vdom","@flutterjs/analyzer":"file:../../../../analyzer","@flutterjs/material":"file:../../../../../package/material"}}};export{r as createResolver,c as presets,e as resolverConfig}; //# sourceMappingURL=flutter_resolver_config.js.map diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutterjs_logger.js b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutterjs_logger.js index c10cd3ba..779458ce 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutterjs_logger.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutterjs_logger.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import s from"fs";import l from"path";class h{constructor(e={}){this.options={debugDir:".debug",enabled:!0,level:"info",writeToFile:!0,writeToConsole:!1,includeTimestamp:!0,includeStackTrace:!1,maxFileSize:10*1024*1024,...e},this.logLevels={error:0,warn:1,info:2,debug:3,trace:4},this.currentLevel=this.logLevels[this.options.level],this.logs=[],this.logSessions={},this.indentLevel=0,this.options.writeToFile&&this.ensureDebugDir()}ensureDebugDir(){s.existsSync(this.options.debugDir)||s.mkdirSync(this.options.debugDir,{recursive:!0})}getLogFilePath(e="general"){return l.join(this.options.debugDir,`${e}.log`)}shouldLog(e){return this.logLevels[e]<=this.currentLevel}formatEntry(e,t,i,r=null){const o=this.options.includeTimestamp?new Date().toISOString():"",g=" ".repeat(this.indentLevel),a=e.toUpperCase().padEnd(5),c=t.padEnd(20);let d=`${o} [${a}] [${c}] ${g}${i}`;return r&&(d+=` `+g+JSON.stringify(r,null,2)),d}write(e,t,i,r){if(!this.shouldLog(e))return;const o=this.formatEntry(e,t,i,r);this.logs.push(o),this.options.writeToConsole&&e==="error"&&console.error(`${t}: ${i}`,r||""),this.options.writeToFile&&this.writeToFile(t,o)}writeToFile(e,t){try{const i=this.getLogFilePath(e);s.appendFileSync(i,t+` `,"utf-8"),s.statSync(i).size>this.options.maxFileSize&&this.rotateLogFile(i)}catch(i){console.error(`Logger failed to write to ${e}: ${i.message}`)}}rotateLogFile(e){const t=new Date().toISOString().replace(/[:.]/g,"-"),i=e.replace(".log",`.${t}.log`);s.renameSync(e,i)}startSession(e,t="general"){this.logSessions[e]={component:t,startTime:Date.now(),startIndent:this.indentLevel},this.indent(),this.info(t,`\u25BA START SESSION: ${e}`)}endSession(e,t="general"){if(this.logSessions[e]){const i=Date.now()-this.logSessions[e].startTime;this.info(t,`\u25C4 END SESSION: ${e} (${i}ms)`),this.unindent(),delete this.logSessions[e]}}indent(){this.indentLevel++}unindent(){this.indentLevel=Math.max(0,this.indentLevel-1)}error(e,t,i){this.write("error",e,t,i)}warn(e,t,i){this.write("warn",e,t,i)}info(e,t,i){this.write("info",e,t,i)}debug(e,t,i){this.write("debug",e,t,i)}trace(e,t,i){this.write("trace",e,t,i)}methodEntry(e,t,i=null){this.indent(),this.trace(e,`\u2192 ${t}()`,i)}methodExit(e,t,i=null){this.trace(e,`\u2190 ${t}()`,i),this.unindent()}success(e,t,i){this.write("info",e,`\u2713 ${t}`,i)}failure(e,t,i){this.write("error",e,`\u2717 ${t}`,i)}count(e,t,i){this.write("info",e,`${t}: ${i}`)}createComponentLogger(e){return{error:(t,i)=>this.error(e,t,i),warn:(t,i)=>this.warn(e,t,i),info:(t,i)=>this.info(e,t,i),debug:(t,i)=>this.debug(e,t,i),trace:(t,i)=>this.trace(e,t,i),success:(t,i)=>this.success(e,t,i),failure:(t,i)=>this.failure(e,t,i),methodEntry:(t,i)=>this.methodEntry(e,t,i),methodExit:(t,i)=>this.methodExit(e,t,i),startSession:t=>this.startSession(t,e),endSession:t=>this.endSession(t,e),indent:()=>this.indent(),unindent:()=>this.unindent()}}getAllLogs(){return this.logs.join(` diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutterjs_parser.js b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutterjs_parser.js index bd43f189..0e3ed8f5 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutterjs_parser.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutterjs_parser.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import{TokenType as n}from"./lexer.js";import{getLogger as x}from"./flutterjs_logger.js";class l{constructor(e,t){this.type=e,this.location=t}}class T extends l{constructor(e=[],t=null){super("Program",t),this.body=e}}class C extends l{constructor(e=[],t=null,s=null){super("ImportDeclaration",s),this.specifiers=e,this.source=t}}class k extends l{constructor(e=null,t=null,s=null){super("ImportSpecifier",s),this.imported=e,this.local=t}}class N extends l{constructor(e=null,t=null,s=null,i=null){super("ClassDeclaration",i),this.id=e,this.superClass=t,this.body=s}}class O extends l{constructor(e=[],t=[],s=null){super("ClassBody",s),this.fields=e,this.methods=t}}class $ extends l{constructor(e=null,t=null,s=null){super("FieldDeclaration",s),this.key=e,this.initialValue=t}}class A extends l{constructor(e=null,t=[],s=null,i=null){super("MethodDeclaration",i),this.key=e,this.params=t,this.body=s}}class E extends l{constructor(e=null,t=!1,s=null,i=null){super("Parameter",i),this.name=e,this.optional=t,this.defaultValue=s}}class D extends l{constructor(e=null,t=[],s=null,i=!1,r=null){super("FunctionDeclaration",r),this.id=e,this.params=t,this.body=s,this.isAsync=i}}class R extends l{constructor(e=[],t=null){super("BlockStatement",t),this.body=e}}class U extends l{constructor(e=null,t=null){super("ReturnStatement",t),this.argument=e}}class w extends l{constructor(e=null,t=null){super("ExpressionStatement",t),this.expression=e}}class o extends l{constructor(e="",t=null){super("Identifier",t),this.name=e}}class h extends l{constructor(e=null,t="",s="string",i=null){super("Literal",i),this.value=e,this.raw=t,this.literalType=s}}class b extends l{constructor(e=null,t=[],s=null){super("CallExpression",s),this.callee=e,this.args=t}}class P extends l{constructor(e=null,t=[],s=null){super("NewExpression",s),this.callee=e,this.args=t,this.isConst=!1}}class F extends l{constructor(e=[],t=null){super("ObjectLiteral",t),this.properties=e}}class S extends l{constructor(e=null,t=null,s=null){super("Property",s),this.key=e,this.value=t,this.shorthand=!1}}class g extends l{constructor(e=[],t=null,s=null){super("ArrowFunctionExpression",s),this.params=e,this.body=t}}class I extends l{constructor(e=null,t=null,s=!1,i=null){super("MemberExpression",i),this.object=e,this.property=t,this.computed=s}}class L{constructor(e=[],t={}){this.tokens=e,this.current=0,this.errors=[],this.options={strict:!1,...t},this.callStack=[],this.debugMode=!0}parse(){const e=[];for(;!this.isAtEnd();)try{const t=this.parseTopLevel();t&&t.type==="ImportDeclaration"&&console.log("DEBUG - ImportDeclaration:",JSON.stringify(t,null,2)),t&&e.push(t)}catch(t){this.errors.push(t),this.synchronize()}return new T(e)}skipComments(){for(;!this.isAtEnd()&&this.check(n.COMMENT);)this.advance()}isComment(){return this.isAtEnd()?!1:this.peek().type===n.COMMENT}parseTopLevel(){if(this.skipComments(),this.isAtEnd())return null;if(this.isKeyword("import"))return this.advance(),this.parseImportDeclaration();if(this.isKeyword("class"))return this.advance(),this.parseClassDeclaration();if(this.isKeyword("function"))return this.advance(),this.parseFunctionDeclaration();const e=this.parseExpression();return this.consumeStatementEnd(),new w(e,this.getLocation())}isKeyword(e){if(this.isAtEnd())return!1;const t=this.peek();return t.type===n.KEYWORD&&t.value===e}isPunctuation(e){if(this.isAtEnd())return!1;const t=this.peek();return t.type===n.PUNCTUATION&&t.value===e}isOperator(e){if(this.isAtEnd())return!1;const t=this.peek();return t.type===n.OPERATOR&&t.value===e}parseImportDeclaration(){const e=x().createComponentLogger("Parser.parseImportDeclaration");e.startSession("parseImportDeclaration");const t=this.getLocation(),s=[];if(e.trace(` Starting import parse at token: ${this.peek().value}`),this.isPunctuation("{")){for(e.trace(" Found opening brace, parsing named imports..."),this.advance(),this.skipComments();!this.isPunctuation("}")&&!this.isAtEnd();){if(this.skipComments(),this.isPunctuation("}")){e.trace(" Found closing brace, exiting loop");break}if(!this.check(n.IDENTIFIER)){e.warn(` Expected identifier but got: ${this.peek().value}`),this.advance();continue}const a=this.consume(n.IDENTIFIER,"Expected identifier").value,u=new o(a);e.trace(` Imported: ${a}`);let p=u;if(this.skipComments(),this.isKeyword("as")){e.trace(" Found 'as' keyword"),this.advance(),this.skipComments();const m=this.consume(n.IDENTIFIER,"Expected identifier after as").value;p=new o(m),e.trace(` Local name: ${m}`)}if(s.push(new k(u,p)),this.skipComments(),this.isPunctuation(",")){e.trace(" Found comma, continuing..."),this.advance(),this.skipComments();continue}else{e.trace(" No comma, expected closing brace next");break}}e.trace(` Parsed ${s.length} named imports`),this.consume(n.PUNCTUATION,"Expected }")}else if(this.check(n.IDENTIFIER)&&this.peekAhead(1).value!=="from"){e.trace(" Found identifier without opening brace, parsing default import...");const a=this.consume(n.IDENTIFIER,"Expected identifier").value,u=new o(a),p=new o(a);if(s.push(new k(u,p)),e.trace(` Default import: ${a}`),this.skipComments(),this.isPunctuation(",")&&(e.trace(" Found comma after default import, checking for named imports..."),this.advance(),this.skipComments(),this.isPunctuation("{"))){for(e.trace(" Found opening brace, parsing additional named imports..."),this.advance(),this.skipComments();!this.isPunctuation("}")&&!this.isAtEnd()&&(this.skipComments(),!this.isPunctuation("}"));){if(!this.check(n.IDENTIFIER)){this.advance();continue}const m=this.consume(n.IDENTIFIER,"Expected identifier").value,d=new o(m);let v=d;if(this.skipComments(),this.isKeyword("as")){this.advance(),this.skipComments();const y=this.consume(n.IDENTIFIER,"Expected identifier after as").value;v=new o(y)}if(s.push(new k(d,v)),this.skipComments(),this.isPunctuation(",")){this.advance(),this.skipComments();continue}else break}this.consume(n.PUNCTUATION,"Expected }")}}this.skipComments(),this.consume(n.KEYWORD,"Expected from"),this.skipComments();const i=this.consume(n.STRING,"Expected module path string"),r=new h(i.value,i.value,"string");return e.trace(` Module path: ${r.value}`),e.trace(` Total specifiers: ${s.length}`),this.consumeStatementEnd(),e.trace(`[parseImportDeclaration] SUCCESS `),new C(s,r,t)}peekAhead(e=1){const t=this.current+e;return t>=this.tokens.length?this.tokens[this.tokens.length-1]:this.tokens[t]}parseClassDeclaration(){const e=x().createComponentLogger("Parser.parseClassDeclaration");e.startSession("parseClassDeclaration"),e.trace(` Current token: ${this.peek().value} (${this.peek().type})`);const t=this.getLocation(),s=this.consume(n.IDENTIFIER,"Expected class name"),i=new o(s.value);e.trace(` Class name: ${i.name}`);let r=null;if(this.isKeyword("extends")){this.advance();const d=this.consume(n.IDENTIFIER,"Expected superclass name").value;r=new o(d),e.trace(` Extends: ${r.name}`),this.isOperator("<")&&(this.advance(),this.consume(n.IDENTIFIER,"Expected type name"),this.consume(n.OPERATOR,"Expected >"))}e.trace(" Looking for opening brace..."),e.trace(` Current token: ${this.peek().value} (${this.peek().type})`),this.consume(n.PUNCTUATION,"Expected {");const a=[],u=[];e.trace(" Parsing class body...");let p=0;for(;!this.isPunctuation("}")&&!this.isAtEnd()&&(this.skipComments(),!this.isPunctuation("}"));){if(e.trace(` [item ${p}] Current token: ${this.peek().value} (${this.peek().type})`),this.isPunctuation(";")){e.trace(" Skipping semicolon"),this.advance();continue}if(this.isKeyword("constructor")){e.trace(" Found constructor"),u.push(this.parseMethodDeclaration()),p++;continue}if(this.check(n.IDENTIFIER)){const d=this.current,y=this.peek().value;if(e.trace(` Found identifier: ${y}`),this.advance(),this.isOperator("=")){e.trace(" -> This is a FIELD (followed by =)"),this.current=d;try{a.push(this.parseFieldDeclaration()),e.trace(" Field parsed successfully"),p++;continue}catch(f){throw console.error(` ERROR parsing field: ${f.message}`),f}}if(this.isPunctuation("(")){e.trace(" -> This is a METHOD (followed by '(')"),this.current=d;try{u.push(this.parseMethodDeclaration()),e.trace(" Method parsed successfully"),p++;continue}catch(f){throw console.error(` ERROR parsing method: ${f.message}`),f}}e.trace(" -> Unknown pattern, skipping"),this.advance();continue}e.trace(` Skipping unknown token: ${this.peek().value}`),this.advance()}e.trace(` Class body parsing complete. Found ${a.length} fields, ${u.length} methods`),this.consume(n.PUNCTUATION,"Expected }");const m=new O(a,u);return e.trace(`[parseClassDeclaration] SUCCESS `),new N(i,r,m,t)}parseMethodDeclaration(){const e=x().createComponentLogger("Parser.parseMethodDeclaration");e.startSession(" [parseMethodDeclaration] STARTING"),e.trace(` Current: ${this.peek().value}`);const t=this.getLocation();let s;this.isKeyword("constructor")?(s="constructor",this.advance()):s=this.consume(n.IDENTIFIER,"Expected method name").value,e.trace(` Method name: ${s}`);const i=new o(s);this.consume(n.PUNCTUATION,"Expected (");const r=this.parseParameterList();e.trace(` Parameters: ${r.length}`),this.consume(n.PUNCTUATION,"Expected )");let a=null;return this.isOperator("=>")?(e.trace(" Arrow function body"),this.advance(),a=this.parseExpression()):this.isPunctuation("{")&&(e.trace(" Block body"),this.advance(),a=this.parseBlock()),e.trace(" [parseMethodDeclaration] SUCCESS"),new A(i,r,a,t)}parseFieldDeclaration(){console.log(" [parseFieldDeclaration] STARTING"),console.log(` Current: ${this.peek().value}`);const e=this.getLocation(),t=this.consume(n.IDENTIFIER,"Expected field name").value,s=new o(t);console.log(` Field name: ${t}`);let i=null;if(this.isOperator("=")){console.log(" Found = operator, parsing initializer..."),this.advance();try{i=this.parseExpression(),console.log(` Initializer parsed: ${i.type}`)}catch(r){throw console.error(` ERROR parsing initializer: ${r.message}`),r}}return this.consumeStatementEnd(),console.log(" [parseFieldDeclaration] SUCCESS"),new $(s,i,e)}parseFunctionDeclaration(){const e=this.getLocation(),t=this.consume(n.IDENTIFIER,"Expected function name"),s=t.value?new o(t.value):null;this.consume(n.PUNCTUATION,"Expected (");const i=this.parseParameterList();this.consume(n.PUNCTUATION,"Expected )"),this.consume(n.PUNCTUATION,"Expected {");const r=this.parseBlock();return new D(s,i,r,!1,e)}parseParameterList(){const e=[];for(;!this.isPunctuation(")")&&!this.isAtEnd();){const t=this.getLocation();if(this.isPunctuation("{")){for(this.advance();!this.isPunctuation("}")&&!this.isAtEnd();){const s=this.consume(n.IDENTIFIER,"Expected param name").value;let i=null;if(this.isOperator("=")){this.advance();const r=this.peek();this.check(n.IDENTIFIER)?i=new o(this.advance().value):this.check(n.NUMBER)?i=new h(parseFloat(this.advance().value),"","number"):this.check(n.UNDEFINED)?(this.advance(),i=new h(void 0,"undefined","undefined")):this.check(n.NULL)?(this.advance(),i=new h(null,"null","null")):this.isKeyword("undefined")?(this.advance(),i=new h(void 0,"undefined","undefined")):this.isKeyword("null")&&(this.advance(),i=new h(null,"null","null"))}if(e.push(new E(new o(s),i!==null,i,t)),!this.isPunctuation(","))break;this.advance()}if(this.consume(n.PUNCTUATION,"Expected }"),this.isOperator("=")&&(this.advance(),this.isPunctuation("{"))){this.advance();let s=1;for(;s>0&&!this.isAtEnd();)this.isPunctuation("{")?s++:this.isPunctuation("}")&&s--,s>0&&this.advance();this.consume(n.PUNCTUATION,"Expected }")}}else if(this.check(n.IDENTIFIER)){const s=this.consume(n.IDENTIFIER,"Expected param name").value;let i=null;if(this.isOperator("=")){this.advance();const r=this.peek();this.check(n.IDENTIFIER)?i=new o(this.advance().value):this.check(n.NUMBER)?i=new h(parseFloat(this.advance().value),"","number"):this.check(n.UNDEFINED)?(this.advance(),i=new h(void 0,"undefined","undefined")):this.check(n.NULL)?(this.advance(),i=new h(null,"null","null")):this.isKeyword("undefined")?(this.advance(),i=new h(void 0,"undefined","undefined")):this.isKeyword("null")&&(this.advance(),i=new h(null,"null","null"))}e.push(new E(new o(s),i!==null,i,t))}else break;if(!this.isPunctuation(","))break;this.advance()}return e}parseBlock(){console.log(` diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutterjs_report_generator.js b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutterjs_report_generator.js index dc3e4b2e..eecd9393 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutterjs_report_generator.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutterjs_report_generator.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import{getLogger as y}from"./flutterjs_logger.js";class S{constructor(t,e,s=null,a=null,i={}){this.widgetResults=t,this.stateResults=e,this.contextResults=s,this.ssrResults=a,this.options={format:"json",includeMetrics:!0,includeTree:!0,includeValidation:!0,includeSuggestions:!0,includeContext:!0,includeSsr:!0,prettyPrint:!0,...i},this.logger=y().createComponentLogger("ReportGenerator"),this.metadata={},this.report={}}generate(){this.logger.startSession("ReportGeneration"),this.logger.info("Generating report");try{this.calculateMetrics(),this.buildReport();let t;switch(this.options.format){case"json":t=this.toJSON();break;case"markdown":t=this.toMarkdown();break;case"console":t=this.toConsole();break;default:t=this.toJSON()}return this.logger.success("Report generation complete"),this.logger.endSession("ReportGeneration"),t}catch(t){throw this.logger.failure("Report generation failed",t.message),this.logger.endSession("ReportGeneration"),t}}calculateMetrics(){const t=this.widgetResults.widgets||[],e=this.widgetResults.functions||[],s=this.widgetResults.imports||[],a=this.stateResults.stateClasses||[],i=this.stateResults.stateFields||[],o=this.stateResults.setStateCalls||[],h=this.stateResults.lifecycleMethods||[],l=this.stateResults.eventHandlers||[],d=this.contextResults?.inheritedWidgets||[],u=this.contextResults?.changeNotifiers||[],c=this.contextResults?.providers||[],m=this.contextResults?.contextAccessPoints||[],p=this.ssrResults?.ssrCompatibilityScore||0,g=this.ssrResults?.ssrSafePatterns||[],f=this.ssrResults?.ssrUnsafePatterns||[],r=this.ssrResults?.hydrationRequirements||[];this.metadata={totalWidgets:t.length,statelessWidgets:t.filter(n=>n.type==="stateless").length,statefulWidgets:t.filter(n=>n.type==="stateful").length,componentWidgets:t.filter(n=>n.type==="component").length,stateClasses:a.length,totalStateFields:i.length,setStateCallCount:o.length,lifecycleMethodCount:h.length,eventHandlerCount:l.length,inheritedWidgets:d.length,changeNotifiers:u.length,providers:c.length,contextAccessPoints:m.length,ssrCompatibilityScore:p,ssrCompatibility:this.ssrResults?.overallCompatibility||"unknown",ssrSafePatterns:g.length,ssrUnsafePatterns:f.length,hydrationRequired:r.length>0,hydrationCount:r.length,totalFunctions:e.length,entryPoint:this.widgetResults.entryPoint,rootWidget:this.widgetResults.rootWidget,totalImports:s.length,externalPackages:new Set(s.map(n=>n.source)).size,treeDepth:this.calculateTreeDepth(this.widgetResults.widgetTree),errorCount:this.countValidationIssues(this.stateResults.validationResults,"error"),warningCount:this.countValidationIssues(this.stateResults.validationResults,"warning"),infoCount:this.countValidationIssues(this.stateResults.validationResults,"info")},this.metadata.healthScore=this.calculateHealthScore(),this.metadata.complexityScore=this.calculateComplexityScore()}calculateTreeDepth(t,e=1){return!t||!t.children||t.children.length===0?e:1+Math.max(...t.children.map(s=>this.calculateTreeDepth(s,e+1)))}countValidationIssues(t,e){return t?t.filter(s=>s.severity===e).length:0}calculateHealthScore(){let t=100;return t-=this.metadata.errorCount*10,t-=this.metadata.warningCount*2,this.metadata.entryPoint&&(t+=5),this.metadata.statefulWidgets>this.metadata.statelessWidgets&&(t-=10),this.metadata.treeDepth>5&&(t-=5),this.metadata.ssrCompatibilityScore<50&&(t-=15),Math.max(0,Math.min(100,t))}calculateComplexityScore(){let t=0;return t+=Math.min(this.metadata.totalStateFields*10,40),t+=Math.min(this.metadata.setStateCallCount*5,30),t+=Math.min(this.metadata.eventHandlerCount*2,20),this.metadata.treeDepth>5&&(t+=10),t+=Math.min(this.metadata.contextAccessPoints*3,15),Math.min(100,t)}buildReport(){const t=this.widgetResults.widgets||[],e=this.stateResults.stateClasses||[],s=this.stateResults.validationResults||[];this.report={analysis:{file:this.widgetResults.file||"analysis",timestamp:new Date().toISOString(),status:s.some(a=>a.severity==="error")?"warning":"success",phase:"phase1+phase2+phase3"},summary:{widgets:{total:this.metadata.totalWidgets,stateless:this.metadata.statelessWidgets,stateful:this.metadata.statefulWidgets,components:this.metadata.componentWidgets},state:{stateClasses:this.metadata.stateClasses,stateFields:this.metadata.totalStateFields,setStateCalls:this.metadata.setStateCallCount,lifecycleMethods:this.metadata.lifecycleMethodCount,eventHandlers:this.metadata.eventHandlerCount},context:this.options.includeContext?{inheritedWidgets:this.metadata.inheritedWidgets,changeNotifiers:this.metadata.changeNotifiers,providers:this.metadata.providers,contextAccessPoints:this.metadata.contextAccessPoints}:null,ssr:this.options.includeSsr?{compatibility:this.metadata.ssrCompatibility,compatibilityScore:this.metadata.ssrCompatibilityScore,safePatterns:this.metadata.ssrSafePatterns,unsafePatterns:this.metadata.ssrUnsafePatterns,hydrationRequired:this.metadata.hydrationRequired,hydrationCount:this.metadata.hydrationCount}:null,functions:this.metadata.totalFunctions,imports:this.metadata.totalImports,externalPackages:this.metadata.externalPackages,entryPoint:this.metadata.entryPoint,rootWidget:this.metadata.rootWidget,treeDepth:this.metadata.treeDepth,healthScore:this.metadata.healthScore,complexityScore:this.metadata.complexityScore},widgets:this.formatWidgets(),stateClasses:this.formatStateClasses(),imports:this.formatImports(),functions:this.formatFunctions(),context:this.options.includeContext?this.formatContext():null,ssr:this.options.includeSsr?this.formatSsr():null,widgetTree:this.options.includeTree?this.formatWidgetTree():null,dependencyGraph:this.formatDependencyGraph(),validation:this.options.includeValidation?this.formatValidation():null,suggestions:this.options.includeSuggestions?this.generateSuggestions():null,metrics:this.options.includeMetrics?this.getDetailedMetrics():null}}formatContext(){return this.contextResults?{inheritedWidgets:this.contextResults.inheritedWidgets?.map(t=>({name:t.name,properties:t.properties,staticAccessors:t.staticAccessors?.map(e=>e.name),updateShouldNotifyImplemented:t.updateShouldNotifyImplemented,usedIn:t.usedIn,usageCount:t.usageCount}))||[],changeNotifiers:this.contextResults.changeNotifiers?.map(t=>({name:t.name,properties:t.properties?.length||0,getters:t.getters?.map(e=>e.name)||[],methods:t.methods?.map(e=>({name:e.name,callsNotifyListeners:e.callsNotifyListeners,mutations:e.mutations}))||[],consumers:t.consumers||[]}))||[],providers:this.contextResults.providers?.map(t=>({type:t.providerType,valueType:t.valueType,consumers:t.consumers||[],accessPatterns:t.accessPatterns||[]}))||[],contextFlow:{inheritedWidgetGraph:this.contextResults.inheritedWidgetGraph||{},providerGraph:this.contextResults.providerGraph||{}},contextAccessPoints:this.contextResults.contextAccessPoints?.map(t=>({pattern:t.pattern,type:t.type,location:t.location,ssrSafe:t.ssrSafe,reason:t.reason}))||[]}:{inheritedWidgets:[],changeNotifiers:[],providers:[],contextFlow:{}}}formatSsr(){return this.ssrResults?{overallCompatibility:this.ssrResults.overallCompatibility,compatibilityScore:this.ssrResults.ssrCompatibilityScore,readinessScore:this.ssrResults.ssrReadinessScore||this.ssrResults.ssrCompatibilityScore,estimatedEffort:this.ssrResults.estimatedEffort,patterns:{safe:this.ssrResults.ssrSafePatterns?.map(t=>({pattern:t.pattern,example:t.example,why:t.why,confidence:t.confidence}))||[],unsafe:this.ssrResults.ssrUnsafePatterns?.map(t=>({pattern:t.pattern,example:t.example,why:t.why,severity:t.severity,suggestion:t.suggestion,location:t.location}))||[]},hydration:{required:this.ssrResults.hydrationCount>0,count:this.ssrResults.hydrationCount,requirements:this.ssrResults.hydrationRequirements?.map(t=>({dependency:t.dependency,reason:t.reason,order:t.order,requiredProviders:t.requiredProviders,requiredState:t.requiredState}))||[]},lazyLoadingOpportunities:this.ssrResults.lazyLoadOpportunities?.map(t=>({target:t.target,reason:t.reason,estimatedSize:t.estimatedSize,priority:t.priority,recommendation:t.recommendation}))||[],migrationPath:this.ssrResults.ssrMigrationPath?.map(t=>({step:t.step,action:t.action,description:t.description,example:t.example,effort:t.effort,priority:t.priority,locations:t.locations}))||[],validationIssues:{critical:this.ssrResults.criticalIssues?.map(t=>({type:t.type,message:t.message,suggestion:t.suggestion,location:t.location}))||[],warnings:this.ssrResults.warningIssues?.map(t=>({type:t.type,message:t.message,suggestion:t.suggestion}))||[]}}:{compatibility:"unknown",score:0,patterns:{safe:[],unsafe:[]},hydration:[],migration:[]}}formatWidgets(){const t={};return(this.widgetResults.widgets||[]).forEach(e=>{t[e.name]={type:e.type,superClass:e.superClass||null,location:e.location,constructor:e.constructor?{params:e.constructor.params||[]}:null,methods:e.methods.map(s=>({name:s.name,params:s.params||[]})),properties:e.properties||[],linkedStateClass:e.linkedStateClass||null,imports:e.imports||[]}}),t}formatStateClasses(){const t={};return(this.stateResults.stateClasses||[]).forEach(e=>{const s=e.metadata||e;t[s.name]={name:s.name,linkedStatefulWidget:s.linkedStatefulWidget,location:s.location,stateFields:(s.stateFields||[]).map(a=>{const i=typeof a.isUsed=="function"?a.isUsed():a.usedInMethods&&a.usedInMethods.length>0;return{name:a.name,type:a.type||"any",initialValue:a.initialValueString||a.initialValue?.toString()||"undefined",isUsed:i,usedInMethods:a.usedInMethods||[],mutatedInMethods:a.mutatedInMethods||[],mutationCount:a.mutations&&a.mutations.length||0}}),lifecycleMethods:(s.lifecycleMethods||[]).map(a=>{const i=typeof a.isValid=="function"?a.isValid():!0;return{name:a.name,callsSuper:a.callsSuper||!1,hasSideEffects:a.hasSideEffects||!1,isValid:i,issues:a.validationIssues||[]}}),otherMethods:(s.otherMethods||[]).map(a=>({name:a.name,params:a.params||[]}))}}),t}formatImports(){const t={};return(this.widgetResults.imports||[]).forEach(e=>{t[e.source]=e.items||[]}),t}formatFunctions(){const t={};return(this.widgetResults.functions||[]).forEach(e=>{t[e.name]={type:e.type,location:e.location,params:(e.params||[]).map(s=>({name:s.name,optional:s.optional})),isEntryPoint:e.isEntryPoint||!1}}),t}formatWidgetTree(){return this.widgetResults.widgetTree?this.treeNodeToObject(this.widgetResults.widgetTree):null}treeNodeToObject(t){return t?{name:t.widget?.name||"Unknown",type:t.widget?.type||"unknown",depth:t.depth||0,children:(t.children||[]).map(e=>this.treeNodeToObject(e))}:null}formatDependencyGraph(){const t=this.stateResults.dependencyGraph;return t?{stateToMethods:Object.fromEntries(t.stateToMethods||[]),methodToState:Object.fromEntries(t.methodToState||[]),eventToState:Object.fromEntries(t.eventToState||[])}:null}formatValidation(){const t=this.stateResults.validationResults||[];return{totalIssues:t.length,errors:t.filter(e=>e.severity==="error"),warnings:t.filter(e=>e.severity==="warning"),info:t.filter(e=>e.severity==="info")}}generateSuggestions(){const t=[];return this.metadata.statefulWidgets>this.metadata.statelessWidgets&&t.push({type:"structure",severity:"info",message:"More stateful than stateless widgets",suggestion:"Consider using stateless widgets where possible for better performance"}),this.metadata.treeDepth>5&&t.push({type:"structure",severity:"warning",message:"Deep widget tree detected",suggestion:"Consider refactoring to reduce nesting depth (aim for < 5 levels)"}),this.options.includeSsr&&this.ssrResults&&(this.metadata.ssrCompatibilityScore<50&&t.push({type:"ssr-compatibility",severity:"warning",message:`Low SSR compatibility score (${this.metadata.ssrCompatibilityScore}/100)`,suggestion:`Follow the ${this.ssrResults.ssrMigrationPath?.length||0} migration steps to improve SSR support`,migrationSteps:this.ssrResults.ssrMigrationPath?.length||0}),this.metadata.ssrUnsafePatterns>5&&t.push({type:"ssr-patterns",severity:"warning",message:`Found ${this.metadata.ssrUnsafePatterns} SSR-unsafe patterns`,suggestion:"Refactor unsafe patterns to enable server-side rendering",unsafePatterns:this.metadata.ssrUnsafePatterns}),this.metadata.hydrationRequired&&t.push({type:"hydration",severity:"info",message:`App requires hydration for ${this.metadata.hydrationCount} dependencies`,suggestion:"Implement hydration layer to re-attach listeners after server render",hydrationDependencies:this.metadata.hydrationCount}),this.ssrResults.lazyLoadOpportunities?.length>0&&t.push({type:"optimization",severity:"info",message:`Found ${this.ssrResults.lazyLoadOpportunities.length} lazy-load opportunities`,suggestion:"Implement code splitting to reduce initial bundle size",opportunities:this.ssrResults.lazyLoadOpportunities.length})),this.options.includeContext&&this.contextResults&&(this.metadata.inheritedWidgets>3&&t.push({type:"context-hierarchy",severity:"info",message:`Multiple InheritedWidgets detected (${this.metadata.inheritedWidgets})`,suggestion:"Consider consolidating context providers to reduce nesting",inheritedWidgets:this.metadata.inheritedWidgets}),this.metadata.providers>0&&t.push({type:"state-management",severity:"info",message:`Using Provider pattern (${this.metadata.providers} providers)`,suggestion:"Ensure providers are properly organized and lazy-initialized where possible",providers:this.metadata.providers})),t}getDetailedMetrics(){return{widgetMetrics:{total:this.metadata.totalWidgets,byType:{stateless:this.metadata.statelessWidgets,stateful:this.metadata.statefulWidgets,component:this.metadata.componentWidgets,state:this.metadata.stateClasses}},stateMetrics:{stateClasses:this.metadata.stateClasses,totalFields:this.metadata.totalStateFields,setStateCalls:this.metadata.setStateCallCount,lifecycleMethods:this.metadata.lifecycleMethodCount,eventHandlers:this.metadata.eventHandlerCount},contextMetrics:this.options.includeContext?{inheritedWidgets:this.metadata.inheritedWidgets,changeNotifiers:this.metadata.changeNotifiers,providers:this.metadata.providers,contextAccessPoints:this.metadata.contextAccessPoints}:null,ssrMetrics:this.options.includeSsr?{compatibilityScore:this.metadata.ssrCompatibilityScore,compatibility:this.metadata.ssrCompatibility,safePatterns:this.metadata.ssrSafePatterns,unsafePatterns:this.metadata.ssrUnsafePatterns,hydrationRequired:this.metadata.hydrationRequired,hydrationCount:this.metadata.hydrationCount}:null,functionMetrics:{total:this.metadata.totalFunctions,entryPoint:this.metadata.entryPoint||"none"},dependencyMetrics:{totalImports:this.metadata.totalImports,externalPackages:this.metadata.externalPackages},structureMetrics:{widgetTreeDepth:this.metadata.treeDepth,rootWidget:this.metadata.rootWidget||"none"},healthMetrics:{healthScore:this.metadata.healthScore,complexityScore:this.metadata.complexityScore,errors:this.metadata.errorCount,warnings:this.metadata.warningCount}}}toJSON(){return this.options.prettyPrint?JSON.stringify(this.report,null,2):JSON.stringify(this.report)}toMarkdown(){let t=`# FlutterJS Code Analysis Report (Phase 1 + 2 + 3) `;if(t+=`**Generated:** ${new Date().toISOString()} diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutterjs_widget_analyzer.js b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutterjs_widget_analyzer.js index 73f42aa7..5767faf6 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutterjs_widget_analyzer.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/flutterjs_widget_analyzer.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import{getLogger as u}from"./flutterjs_logger.js";class d{constructor(t,e={}){this.ast=t,this.options={strict:!1,...e},this.logger=u().createComponentLogger("WidgetAnalyzer"),this.widgets=new Map,this.functions=new Map,this.imports=[],this.externalDependencies=new Set,this.entryPoint=null,this.rootWidget=null,this.widgetTree=null,this.errors=[]}analyze(){if(this.logger.startSession("WidgetAnalyzer"),!this.ast||!this.ast.body)throw new Error("Invalid AST provided");this.logger.trace("[WidgetAnalyzer] Starting analysis...");try{return this.logger.trace("[WidgetAnalyzer] Phase 1: Extracting classes and functions..."),this.extractClassesAndFunctions(),this.logger.trace(`[WidgetAnalyzer] Found ${this.widgets.size} classes in total`),this.logger.trace("[WidgetAnalyzer] Phase 2: Detecting widgets..."),this.detectWidgets(),this.logger.trace(`[WidgetAnalyzer] Detected widgets: ${Array.from(this.widgets.values()).filter(t=>t.type!=="class").length}`),this.logger.trace("[WidgetAnalyzer] Phase 3: Extracting imports..."),this.extractImports(),this.logger.trace(`[WidgetAnalyzer] Found ${this.imports.length} imports`),this.logger.trace("[WidgetAnalyzer] Phase 4: Finding entry point..."),this.findEntryPoint(),this.logger.trace(`[WidgetAnalyzer] Entry point: ${this.entryPoint||"NOT FOUND"}`),this.logger.trace("[WidgetAnalyzer] Phase 5: Building widget tree..."),this.buildWidgetTree(),this.logger.trace(`[WidgetAnalyzer] Tree root: ${this.rootWidget||"NOT FOUND"}`),this.logger.trace(`[WidgetAnalyzer] Analysis complete `),this.getResults()}catch(t){return this.errors.push({type:"analysis-error",message:t.message,stack:t.stack}),this.getResults()}}extractClassesAndFunctions(){if(this.ast.body)for(const t of this.ast.body)t.type==="ClassDeclaration"?this.extractClassDeclaration(t):t.type==="FunctionDeclaration"&&this.extractFunctionDeclaration(t)}extractClassDeclaration(t){const e=t.id?.name;if(!e)return;const i=t.superClass?.name||null,r=t.location,s={name:e,type:"class",location:r,superClass:i,constructor:null,properties:[],methods:[],fieldReferences:{},imports:[],children:[],linkedStateClass:null};if(t.body?.fields&&t.body.fields.forEach(a=>{const n=a.key?.name,o=a.initialValue?this.expressionToString(a.initialValue):null;s.properties.push({name:n,initialValue:o,type:this.inferFieldType(a.initialValue)}),s.fieldReferences[n]||(s.fieldReferences[n]=[])}),t.body?.methods){const a=t.body.methods.find(n=>n.key?.name==="constructor");a&&(s.constructor={name:"constructor",params:a.params||[],location:a.location}),t.body.methods.forEach(n=>{if(n.key?.name!=="constructor"){const o=n.key?.name,l={name:o,params:n.params||[],location:n.location,hasBody:n.body!==null,usesFields:[]};if(n.body){const c=this.findFieldReferencesInBody(n.body);l.usesFields=c,c.forEach(g=>{s.fieldReferences[g]&&s.fieldReferences[g].push(o)})}s.methods.push(l)}})}this.widgets.set(e,s),this.logger.trace(`[WidgetAnalyzer] Extracted class: ${e} extends ${i}`),s.properties.length>0&&this.logger.trace(`[WidgetAnalyzer] Fields: ${s.properties.map(a=>`${a.name}=${a.initialValue}`).join(", ")}`)}findFieldReferencesInBody(t){const e=[],i=r=>{if(r){r.type==="MemberExpression"&&r.object?.name==="this"&&r.property?.name&&e.push(r.property.name);for(const s in r)s!=="location"&&typeof r[s]=="object"&&(Array.isArray(r[s])?r[s].forEach(i):i(r[s]))}};return i(t),[...new Set(e)]}inferFieldType(t){if(!t)return"any";if(t.type==="Literal"){const e=t.value;if(typeof e=="number")return"int"|"double";if(typeof e=="boolean")return"bool";if(typeof e=="string")return"String";if(e===null)return"null"}return t.type==="Identifier"?t.name:t.type==="ArrayExpression"?"List":t.type==="ObjectExpression"?"Map":"dynamic"}extractFunctionDeclaration(t){const e=t.id?.name||"anonymous",i=t.location,r={name:e,type:"function",location:i,params:t.params?.map(s=>({name:s.name?.name||"param",optional:s.optional||!1}))||[],isAsync:t.isAsync||!1,isEntryPoint:!1};this.functions.set(e,r)}detectWidgets(){this.widgets.forEach(t=>{if(!t.superClass){t.type="class";return}const e=t.superClass;e==="StatelessWidget"?(t.type="stateless",this.logger.trace(`[WidgetAnalyzer] ${t.name} is StatelessWidget`)):e==="StatefulWidget"?(t.type="stateful",this.logger.trace(`[WidgetAnalyzer] ${t.name} is StatefulWidget`)):e?.startsWith("State")?(t.type="state",this.logger.trace(`[WidgetAnalyzer] ${t.name} is State class`)):t.type="component"})}extractImports(){this.ast.body&&this.ast.body.forEach(t=>{if(t.type==="ImportDeclaration"){const e=t.source?.value,i=t.specifiers?.map(r=>r.local?.name||r.imported?.name)||[];this.imports.push({source:e,items:i,specifiers:t.specifiers}),this.externalDependencies.add(e)}})}findEntryPoint(){if(this.functions.has("main")){this.entryPoint="main";const t=this.functions.get("main");t.isEntryPoint=!0;const e=this.ast.body.find(i=>i.type==="FunctionDeclaration"&&i.id?.name==="main");e?.body?.body&&(this.rootWidget=this.findRunAppWidget(e.body.body))}}findRunAppWidget(t){for(const e of t){if(e.type==="ExpressionStatement"&&e.expression?.type==="CallExpression"){const i=e.expression;if(i.callee?.name==="runApp"&&i.args?.length>0)return this.getWidgetNameFromExpression(i.args[0])}if(e.type==="ReturnStatement"&&e.argument?.type==="CallExpression"){const i=e.argument;if(i.callee?.name==="runApp"&&i.args?.length>0)return this.getWidgetNameFromExpression(i.args[0])}}return null}getWidgetNameFromExpression(t){return t?t.type==="NewExpression"||t.type==="CallExpression"?t.callee?.name:t.type==="Identifier"?t.name:null:null}buildWidgetTree(){if(!this.rootWidget||!this.widgets.has(this.rootWidget))return;const t=this.widgets.get(this.rootWidget);this.widgetTree={widget:t,depth:0,children:[]}}expressionToString(t){if(!t)return null;if(t.type==="Literal")return t.value;if(t.type==="Identifier"){const e=t.name;return e==="true"||e==="false"?e==="true":e==="null"?null:e==="undefined"?void 0:e}}getResults(){const t=Array.from(this.widgets.values()).filter(e=>e.type==="stateless"||e.type==="stateful"||e.type==="state"||e.type==="component");return this.logger.trace(`[WidgetAnalyzer] getResults() returning ${t.length} widgets`),{widgets:t,functions:Array.from(this.functions.values()),imports:this.imports,externalDependencies:Array.from(this.externalDependencies),entryPoint:this.entryPoint,rootWidget:this.rootWidget,widgetTree:this.widgetTree,errors:this.errors}}getSummary(){const t=Array.from(this.widgets.values()),e=t.filter(s=>s.type==="stateless").length,i=t.filter(s=>s.type==="stateful").length,r=t.filter(s=>s.type==="state").length;return{totalWidgets:t.length,statelessWidgets:e,statefulWidgets:i,stateClasses:r,totalFunctions:this.functions.size,totalImports:this.imports.length,externalPackages:this.externalDependencies.size,entryPoint:this.entryPoint,rootWidget:this.rootWidget}}getErrors(){return this.errors}}export{d as WidgetAnalyzer}; //# sourceMappingURL=flutterjs_widget_analyzer.js.map diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/lexer.js b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/lexer.js index 43b7f7b8..c2aac665 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/lexer.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/lexer.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class h{constructor(t,s,e,i){this.type=t,this.value=s,this.line=e,this.column=i}toString(){return`Token(${this.type}, "${this.value}", ${this.line}:${this.column})`}isType(t){return Array.isArray(t)?t.includes(this.type):this.type===t}}const n={STRING:"STRING",NUMBER:"NUMBER",BOOLEAN:"BOOLEAN",NULL:"NULL",UNDEFINED:"UNDEFINED",KEYWORD:"KEYWORD",IDENTIFIER:"IDENTIFIER",OPERATOR:"OPERATOR",PUNCTUATION:"PUNCTUATION",COMMENT:"COMMENT",WHITESPACE:"WHITESPACE",NEWLINE:"NEWLINE",EOF:"EOF"};class a{constructor(t,s={}){this.source=t,this.position=0,this.line=1,this.column=0,this.tokens=[],this.errors=[],this.options={includeWhitespace:!1,includeComments:!0,...s},this.keywords=new Set(["class","extends","constructor","new","const","function","return","if","else","for","while","this","static","async","await","import","export","from","as","default","true","false","null","undefined","typeof","instanceof","void","delete"])}tokenize(){for(;this.position0&&this.tokens.push(new h(n.WHITESPACE,s,this.line,t))}scanComment(){const t=this.line,s=this.column;let e="";if(this.peekNext()==="/"){for(this.advance(),this.advance();this.position() in build()",example:"context.read()",safeFor:"SSR",why:"Single read at render time, no re-subscription needed",confidence:.95,category:"provider-access",frequency:0}),t.push({pattern:"Theme data access",example:"theme.primaryColor",safeFor:"SSR",why:"Read-only during rendering",confidence:1,category:"value-access",frequency:0}),t.push({pattern:"MediaQuery.of() for responsive layout",example:"MediaQuery.of(context).size.width",safeFor:"SSR",why:"Server can set default viewport; client hydrates with actual size",confidence:.85,category:"responsive-design",frequency:0}),t.push({pattern:"Async data in FutureBuilder (with cached data)",example:"FutureBuilder with pre-fetched data",safeFor:"SSR",why:"Server can execute async, pass pre-rendered HTML to client",confidence:.8,category:"async-operation",frequency:0}),this.contextResults&&this.contextResults.contextAccessPoints&&this.contextResults.contextAccessPoints.forEach(e=>{if(e.ssrSafe){const s=t.find(i=>i.example.includes(e.pattern.split("(")[0]));s&&s.frequency++,this.ssrSafePatterns.push({pattern:e.pattern,type:e.type,location:e.location,example:e.pattern,why:e.reason,confidence:.95})}}),this.ssrSafePatterns.push(...t)}detectSsrUnsafePatterns(){const t=[{pattern:"context.watch() subscriptions",example:"context.watch()",unsafeFor:"SSR",why:"Requires reactive subscription & listeners on client, not available during server render",confidence:1,category:"provider-subscription",severity:"error",frequency:0},{pattern:"State mutations in event handlers",example:"counter.increment() in onPressed",unsafeFor:"SSR",why:"Event handlers don't exist on server, mutations have no effect",confidence:1,category:"state-mutation",severity:"error",frequency:0},{pattern:"ChangeNotifier.notifyListeners() calls",example:"notifyListeners() in method",unsafeFor:"SSR",why:"Listeners don't exist during initial SSR render",confidence:.95,category:"notification",severity:"error",frequency:0},{pattern:"Browser APIs",example:"window.localStorage, document.getElementById()",unsafeFor:"SSR",why:"window and document objects don't exist on Node.js server",confidence:1,category:"browser-api",severity:"critical",frequency:0},{pattern:"Timers and intervals",example:"setTimeout, setInterval, setImmediate",unsafeFor:"SSR",why:"Can cause unexpected behavior and performance issues during server render",confidence:.9,category:"async-operation",severity:"warning",frequency:0},{pattern:"Random values without seeding",example:"Math.random()",unsafeFor:"SSR",why:"Different values on server vs client cause hydration mismatch",confidence:.99,category:"determinism",severity:"error",frequency:0},{pattern:"Navigator and route access",example:"Navigator.of(context).push()",unsafeFor:"SSR",why:"Navigation happens on client, not on server",confidence:1,category:"navigation",severity:"warning",frequency:0},{pattern:"GestureDetector and event handlers",example:"GestureDetector, onTap, onLongPress",unsafeFor:"SSR",why:"User interactions don't exist on server",confidence:1,category:"user-interaction",severity:"warning",frequency:0},{pattern:"setState in initState or build",example:"this.setState(() => {...}) in build()",unsafeFor:"SSR",why:"Triggers re-render during render cycle, can cause infinite loops",confidence:.95,category:"state-management",severity:"critical",frequency:0}];this.contextResults&&this.contextResults.contextAccessPoints&&this.contextResults.contextAccessPoints.forEach(e=>{if(!e.ssrSafe){const s=t.find(i=>i.example.includes(e.pattern.split("(")[0]));s&&s.frequency++,this.ssrUnsafePatterns.push({pattern:e.pattern,type:e.type,location:e.location,example:e.pattern,why:e.reason,confidence:.95,severity:"error",suggestion:e.getMigrationAdvice?.()||"Refactor to SSR-safe pattern"})}}),this.ssrUnsafePatterns.push(...t)}identifyHydrationNeeds(){const t=[];this.contextResults&&this.contextResults.changeNotifiers&&this.contextResults.changeNotifiers.forEach(e=>{if(e.consumers&&e.consumers.length>0){const s=new a(e.name,`State needs to be re-created and listeners re-attached post-hydration for ${e.consumers.length} consumer(s)`,0);e.consumers.forEach(i=>{s.requiredState.push(`${i}.state`)}),t.push(s),this.hydrationCount++}}),this.contextResults&&this.contextResults.providers&&this.contextResults.providers.forEach(e=>{if(e.accessPatterns&&e.accessPatterns.includes("watch")){const s=new a(`Provider<${e.valueType}>`,"context.watch() subscriptions need to be re-established on client for reactive updates",1);s.requiresProvider(e.providerType),t.push(s),this.hydrationCount++}}),this.stateResults&&this.stateResults.eventHandlers&&this.stateResults.eventHandlers.forEach(e=>{if(!t.some(s=>s.dependency===e.handler)){const s=new a(e.handler,`Event handler "${e.handler}" must be attached to DOM after hydration`,2);t.push(s),this.hydrationCount++}}),t.sort((e,s)=>e.order-s.order),this.hydrationRequirements=t}detectLazyLoadOpportunities(){const t=[];this.contextResults&&this.contextResults.inheritedWidgets&&this.contextResults.inheritedWidgets.forEach(e=>{if(e.usageCount===0||e.usageCount&&e.usageCount<=1){const s=new o(e.name,`${e.name} is not needed until user navigates to it`,"15KB","widget");s.setRecommendation("Use LazyRoute or dynamic import: import(widgetPath)"),s.calculatePriority(15),t.push(s)}}),this.contextResults&&this.contextResults.changeNotifiers&&this.contextResults.changeNotifiers.forEach(e=>{if(e.methods&&e.methods.length>10){const s=new o(e.name,`${e.name} is complex and only needed if feature is used`,"8KB","notifier");s.setRecommendation("Lazy create in Provider: create: (context) => Provider.lazy(() => import(...))"),s.calculatePriority(8),t.push(s)}}),this.lazyLoadOpportunities=t}generateMigrationPath(){const t=[],e=this.ssrUnsafePatterns.filter(r=>r.pattern?.includes("watch"));e.length>0&&t.push({step:1,action:"Replace context.watch() with context.read() for SSR",locations:e.map(r=>r.location),description:`Found ${e.length} context.watch() calls that need refactoring`,example:` // Before (not SSR safe): final counter = context.watch(); diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/state_analyzer_data.js b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/state_analyzer_data.js index 99d44182..9de98d68 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/state_analyzer_data.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/state_analyzer_data.js @@ -1,2 +1,6 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class r{constructor(t,e,s=null){this.name=t,this.location=e,this.linkedStatefulWidget=s,this.stateFields=[],this.lifecycleMethods=[],this.eventHandlers=[],this.otherMethods=[],this.extends="State",this.constructor=null}addStateField(t){t instanceof a&&this.stateFields.push(t)}addLifecycleMethod(t){t instanceof n&&this.lifecycleMethods.push(t)}summary(){return{name:this.name,statefulWidget:this.linkedStatefulWidget,fieldCount:this.stateFields.length,lifecycleMethodCount:this.lifecycleMethods.length,totalMethods:this.otherMethods.length}}}class a{constructor(t,e,s,i){this.name=t,this.type=e,this.location=i,this.initialValue=s,this.initialValueString=this.valueToString(s),this.isMutable=!0,this.mutations=[],this.usedInMethods=[],this.mutatedInMethods=[],this.usedInBuild=!1}recordUsage(t){this.usedInMethods.includes(t)||this.usedInMethods.push(t)}recordMutation(t,e="=",s=null){this.mutations.push({method:t,operation:e,location:s,wrappedInSetState:!1}),this.mutatedInMethods.includes(t)||this.mutatedInMethods.push(t)}isUsed(){return this.usedInMethods.length>0||this.usedInBuild}valueToString(t){return t===null?"null":t===void 0?"undefined":typeof t=="string"?`"${t}"`:typeof t=="boolean"?t?"true":"false":String(t)}summary(){return{name:this.name,type:this.type,initialValue:this.initialValueString,isUsed:this.isUsed(),usedInMethods:this.usedInMethods,mutatedInMethods:this.mutatedInMethods,mutationCount:this.mutations.length}}}class n{constructor(t,e,s=[],i=!1,o=!1){this.name=t,this.location=e,this.params=s,this.callsSuper=i,this.hasSideEffects=o,this.shouldCallSuper=!1,this.validationIssues=[]}setMustCallSuper(t){this.shouldCallSuper=t}addIssue(t,e,s="warning"){this.validationIssues.push({type:t,message:e,severity:s})}isValid(){return this.name==="dispose"&&!this.callsSuper||this.name==="initState"&&!this.callsSuper?!1:this.validationIssues.filter(t=>t.severity==="error").length===0}summary(){return{name:this.name,callsSuper:this.callsSuper,shouldCallSuper:this.shouldCallSuper,hasSideEffects:this.hasSideEffects,isValid:this.isValid(),issues:this.validationIssues}}}class l{constructor(t,e,s=[],i){this.location=t,this.method=e,this.stateClassName=i,this.updates=s||[],this.isValid=!0,this.issues=[]}addIssue(t,e,s="error"){this.issues.push({type:t,message:e,severity:s}),s==="error"&&(this.isValid=!1)}updatesField(t){return this.updates.includes(t)}summary(){return{method:this.method,updates:this.updates,isValid:this.isValid,issueCount:this.issues.length,issues:this.issues}}}class u{constructor(t,e,s,i="Unknown"){this.event=t,this.handler=e,this.location=s,this.component=i,this.isValid=!0,this.issues=[],this.triggersSetState=!1}addIssue(t,e,s="error"){this.issues.push({type:t,message:e,severity:s}),s==="error"&&(this.isValid=!1)}marksSetState(t=!0){this.triggersSetState=t}summary(){return{event:this.event,handler:this.handler,component:this.component,triggersSetState:this.triggersSetState,isValid:this.isValid,issues:this.issues}}}class d{constructor(){this.stateToMethods=new Map,this.methodToState=new Map,this.eventToState=new Map,this.methodToMethods=new Map}addStateUse(t,e){this.stateToMethods.has(t)||this.stateToMethods.set(t,[]);const s=this.stateToMethods.get(t);s.includes(e)||s.push(e)}addMethodStateUse(t,e){this.methodToState.has(t)||this.methodToState.set(t,[]);const s=this.methodToState.get(t);s.includes(e)||s.push(e)}addEventStateUse(t,e){this.eventToState.has(t)||this.eventToState.set(t,[]);const s=this.eventToState.get(t);s.includes(e)||s.push(e)}getStateForMethod(t){return this.methodToState.get(t)||[]}getMethodsForState(t){return this.stateToMethods.get(t)||[]}getStateForEvent(t){return this.eventToState.get(t)||[]}summary(){return{stateToMethods:Object.fromEntries(this.stateToMethods),methodToState:Object.fromEntries(this.methodToState),eventToState:Object.fromEntries(this.eventToState)}}}class c{constructor(t,e,s="warning",i=null){this.type=t,this.message=e,this.severity=s,this.location=i,this.suggestion=null,this.affectedItem=null}withSuggestion(t){return this.suggestion=t,this}affecting(t){return this.affectedItem=t,this}toObject(){return{type:this.type,message:this.message,severity:this.severity,location:this.location,suggestion:this.suggestion,affectedItem:this.affectedItem}}}class S{constructor(){this.stateClassCount=0,this.stateFieldCount=0,this.setStateCallCount=0,this.lifecycleMethodCount=0,this.eventHandlerCount=0,this.errorCount=0,this.warningCount=0,this.complexityScore=0,this.healthScore=0}calculateComplexity(){let t=0;return t+=Math.min(this.stateFieldCount*10,40),t+=Math.min(this.setStateCallCount*5,30),t+=Math.min(this.eventHandlerCount*2,20),this.complexityScore=Math.min(100,t),this.complexityScore}calculateHealth(){let t=100;return t-=this.errorCount*10,t-=this.warningCount*2,this.complexityScore>70&&(t-=10),this.healthScore=Math.max(0,t),this.healthScore}toObject(){return{stateClasses:this.stateClassCount,stateFields:this.stateFieldCount,setStateCalls:this.setStateCallCount,lifecycleMethods:this.lifecycleMethodCount,eventHandlers:this.eventHandlerCount,errors:this.errorCount,warnings:this.warningCount,complexityScore:this.complexityScore,healthScore:this.healthScore}}}export{S as AnalysisSummary,d as DependencyGraph,u as EventHandler,n as LifecycleMethod,r as StateClassMetadata,a as StateField,l as StateUpdateCall,c as ValidationResult}; //# sourceMappingURL=state_analyzer_data.js.map diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/state_analyzer_implementation.js b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/state_analyzer_implementation.js index b1b65a33..e3bb7b81 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/dist/state_analyzer_implementation.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/dist/state_analyzer_implementation.js @@ -1,2 +1,6 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class p{constructor(e,s,t={}){this.ast=e,this.widgets=s,this.options={strict:!1,...t},this.stateClasses=new Map,this.stateFields=new Map,this.setStateCalls=[],this.lifecycleMethods=[],this.eventHandlers=[],this.dependencyGraph=null,this.validationResults=[],this.errors=[]}analyze(){if(!this.ast||!this.ast.body)throw new Error("Invalid AST provided");try{return this.linkStatefulToState(),this.extractStateFields(),this.findSetStateCalls(),this.extractLifecycleMethods(),this.extractEventHandlers(),this.buildDependencyGraph(),this.validateState(),this.getResults()}catch(e){return this.errors.push(e),this.getResults()}}linkStatefulToState(){this.widgets.forEach(e=>{if(e.type!=="stateful")return;if(!e.methods.find(o=>o.name==="createState")){this.errors.push({type:"missing-create-state",widget:e.name,message:`StatefulWidget "${e.name}" has no createState() method`});return}const t=this.ast.body.find(o=>o.type==="ClassDeclaration"&&o.id.name===e.name);if(!t)return;const n=t.body.methods.find(o=>o.key.name==="createState");if(!n)return;const i=this.extractReturnedClassName(n.body);if(!i){this.errors.push({type:"cannot-parse-create-state",widget:e.name,message:`Cannot determine which State class is returned by ${e.name}.createState()`});return}const a=this.ast.body.find(o=>o.type==="ClassDeclaration"&&o.id.name===i);if(!a){this.errors.push({type:"missing-state-class",widget:e.name,stateClass:i,message:`State class "${i}" not found`});return}if(!a.superClass||!a.superClass.name.startsWith("State")){this.errors.push({type:"invalid-state-class",stateClass:i,message:`Class "${i}" does not extend State`});return}const r=new d(i,a.location,e.name);this.stateClasses.set(i,{astNode:a,metadata:r}),e.linkedStateClass=i})}extractReturnedClassName(e){if(!e)return null;if(e.type==="BlockStatement"&&e.body){for(const s of e.body)if(s.type==="ReturnStatement"&&s.argument){const t=this.getClassNameFromExpression(s.argument);if(t)return t}}return e.type==="NewExpression"?e.callee.name:null}getClassNameFromExpression(e){return e?e.type==="NewExpression"&&e.callee?e.callee.name:e.type==="Identifier"?e.name:e.type==="CallExpression"&&e.callee&&e.callee.type==="Identifier"?e.callee.name:null:null}extractStateFields(){this.stateClasses.forEach(({astNode:e,metadata:s})=>{!e.body||!e.body.fields||e.body.fields.forEach(t=>{const n=t.key.name,i=t.initialValue,a=this.inferFieldType(i),r=new f(n,a,this.expressionToValue(i),i?i.location:t.location);this.stateFields.set(`${s.name}.${n}`,r),s.stateFields.push(r)})})}inferFieldType(e){if(!e)return"any";if(e.type==="Literal"){if(typeof e.value=="number")return"number";if(typeof e.value=="string")return"string";if(typeof e.value=="boolean")return"boolean";if(e.value===null)return"null"}if(e.type==="Identifier"){const s=e.name;if(s==="true"||s==="false")return"boolean";if(s==="null")return"null";if(s==="undefined")return"undefined"}return e.type==="ArrayLiteral"?"array":e.type==="ObjectLiteral"?"object":(e.type==="CallExpression","any")}expressionToValue(e){if(e){if(e.type==="Literal")return e.value;if(e.type==="Identifier"){const s=e.name;if(s==="true")return!0;if(s==="false")return!1;if(s==="null")return null;if(s==="undefined")return}}}findSetStateCalls(){this.stateClasses.forEach(({astNode:e,metadata:s})=>{!e.body||!e.body.methods||e.body.methods.forEach(t=>{const n=this.findSetStateInMethod(t,s.name);this.setStateCalls.push(...n)})})}findSetStateInMethod(e,s){const t=[],n=e.key.name;return e.body&&(e.body.type==="BlockStatement"?e.body.body:[e.body]).forEach(a=>{this.findSetStateInStatement(a,t,n,s)}),t}findSetStateInStatement(e,s,t,n){e&&(e.type==="ExpressionStatement"&&e.expression&&this.findSetStateInExpression(e.expression,s,t,n),e.type==="ReturnStatement"&&e.argument&&this.findSetStateInExpression(e.argument,s,t,n),e.type==="BlockStatement"&&e.body&&e.body.forEach(i=>{this.findSetStateInStatement(i,s,t,n)}))}findSetStateInExpression(e,s,t,n){if(e){if(e.type==="CallExpression"){if(this.isSetStateCall(e)){const a=this.extractSetStateUpdates(e,n),r=new h(e.location,t,a,n);s.push(r)}e.args.forEach(a=>{this.findSetStateInExpression(a,s,t,n)})}e.type==="ObjectLiteral"&&e.properties&&e.properties.forEach(i=>{this.findSetStateInExpression(i.value,s,t,n)})}}isSetStateCall(e){if(e.type!=="CallExpression"||!e.callee)return!1;if(e.callee.type==="MemberExpression"){const s=e.callee.object,t=e.callee.property;if(s.type==="Identifier"&&s.name==="this"&&t.type==="Identifier"&&t.name==="setState")return!0}return!1}extractSetStateUpdates(e,s){const t=[];if(!e.args||e.args.length===0)return t;const n=e.args[0];if(n.type==="ArrowFunctionExpression"){const i=n.body;if(i.type==="BlockStatement"&&i.body)i.body.forEach(a=>{const r=this.extractMutatedFields(a,s);t.push(...r)});else if(i.type==="UpdateExpression"||i.type==="AssignmentExpression"){const a=this.extractMutatedFields(i,s);t.push(...a)}}return[...new Set(t)]}extractMutatedFields(e,s){const t=[];if(!e)return t;if(e.type==="ExpressionStatement"&&e.expression){const n=e.expression;if(n.type==="AssignmentExpression"){const i=this.getFieldNameFromTarget(n.left);i&&t.push(i)}if(n.type==="UpdateExpression"){const i=this.getFieldNameFromTarget(n.argument);i&&t.push(i)}}if(e.type==="AssignmentExpression"){const n=this.getFieldNameFromTarget(e.left);n&&t.push(n)}if(e.type==="UpdateExpression"){const n=this.getFieldNameFromTarget(e.argument);n&&t.push(n)}return t}getFieldNameFromTarget(e){if(!e)return null;if(e.type==="MemberExpression"){const s=e.object,t=e.property;if(s.type==="Identifier"&&s.name==="this"&&t.type==="Identifier")return t.name}return e.type==="Identifier"?e.name:null}extractLifecycleMethods(){const e=["initState","dispose","didUpdateWidget","build"];this.stateClasses.forEach(({astNode:s,metadata:t})=>{!s.body||!s.body.methods||s.body.methods.forEach(n=>{const i=n.key.name;if(e.includes(i)){const a=new u(i,n.location,n.params||[],this.checkCallsSuper(n),this.checkHasSideEffects(n));this.lifecycleMethods.push(a),t.lifecycleMethods.push(a)}})})}checkCallsSuper(e){if(!e.body)return!1;const s=e.body.type==="BlockStatement"?e.body.body:[e.body];for(const t of s)if(t.type==="ExpressionStatement"&&t.expression){const n=t.expression;if(n.type==="CallExpression"&&n.callee.type==="MemberExpression"){const i=n.callee.object,a=n.callee.property;if(i.type==="Identifier"&&i.name==="super"&&a.type==="Identifier"&&a.name===e.key.name)return!0}}return!1}checkHasSideEffects(e){if(!e.body)return!1;const s=e.body.type==="BlockStatement"?e.body.body:[e.body];for(const t of s)if(t.type==="ExpressionStatement"&&t.expression){const n=t.expression;if(n.type==="AssignmentExpression"||n.type==="UpdateExpression"||n.type==="CallExpression")return!0}return!1}extractEventHandlers(){this.stateClasses.forEach(({astNode:e,metadata:s})=>{if(!e.body||!e.body.methods)return;const t=e.body.methods.find(i=>i.key.name==="build");if(!t)return;const n=this.findEventHandlersInMethod(t,s.name);this.eventHandlers.push(...n)})}findEventHandlersInMethod(e,s){const t=[];return e.body&&(e.body.type==="BlockStatement"?e.body.body:[e.body]).forEach(i=>{this.findEventHandlersInStatement(i,t,s)}),t}findEventHandlersInStatement(e,s,t){e&&(e.type==="ExpressionStatement"&&e.expression&&this.findEventHandlersInExpression(e.expression,s,t),e.type==="ReturnStatement"&&e.argument&&this.findEventHandlersInExpression(e.argument,s,t),e.type==="BlockStatement"&&e.body&&e.body.forEach(n=>{this.findEventHandlersInStatement(n,s,t)}))}findEventHandlersInExpression(e,s,t){e&&(e.type==="ObjectLiteral"&&e.properties&&e.properties.forEach(n=>{const i=this.getPropertyKey(n.key);if(/^on[A-Z]/.test(i)){const r=this.extractEventHandler(n.value,t);r&&s.push({event:i,handler:r,location:n.location,component:this.getComponentNameFromContext(e)})}this.findEventHandlersInExpression(n.value,s,t)}),e.type==="CallExpression"&&e.args&&e.args.forEach(n=>{this.findEventHandlersInExpression(n,s,t)}),e.type==="NewExpression"&&e.args&&e.args.forEach(n=>{this.findEventHandlersInExpression(n,s,t)}))}getPropertyKey(e){return e?e.type==="Identifier"?e.name:e.type==="Literal"?String(e.value):null:null}extractEventHandler(e,s){if(!e)return null;if(e.type==="ArrowFunctionExpression"){if(e.body.type==="CallExpression")return this.getClassNameFromExpression(e.body.callee);if(e.body.type==="Identifier")return e.body.name}return e.type==="Identifier"?e.name:e.type==="MemberExpression"&&e.property.type==="Identifier"?e.property.name:null}getComponentNameFromContext(e){return e.type==="CallExpression"&&e.callee?this.getClassNameFromExpression(e.callee):"Unknown"}buildDependencyGraph(){this.dependencyGraph=new c,this.stateFields.forEach((e,s)=>{const t=this.findMethodsUsingField(e.name);t.length>0&&this.dependencyGraph.stateToMethods.set(e.name,t)}),this.stateClasses.forEach(({metadata:e})=>{e.stateFields.forEach(s=>{const t=this.findMethodsReadingField(e.name,s.name);t.length>0&&this.dependencyGraph.methodToState.set(s.name,t)})}),this.eventHandlers.forEach(e=>{const s=this.findStateChangedByMethod(e.handler);s.length>0&&this.dependencyGraph.eventToState.set(e.event,s)})}findMethodsUsingField(e){const s=new Set;return this.setStateCalls.forEach(t=>{t.updates.includes(e)&&s.add(t.method)}),this.stateClasses.forEach(({astNode:t,metadata:n})=>{if(!t.body||!t.body.methods)return;const i=t.body.methods.find(a=>a.key.name==="build");i&&this.methodUsesField(i,e)&&s.add("build")}),Array.from(s)}methodUsesField(e,s){if(!e.body)return!1;const t=e.body.type==="BlockStatement"?e.body.body:[e.body];for(const n of t)if(this.statementUsesField(n,s))return!0;return!1}statementUsesField(e,s){return e?JSON.stringify(e).includes(s):!1}findMethodsReadingField(e,s){const t=[];return this.stateClasses.forEach(({metadata:n})=>{n.name===e&&n.stateFields.forEach(i=>{i.name===s&&t.push(...i.usedInMethods)})}),t}findStateChangedByMethod(e){const s=new Set;return this.setStateCalls.forEach(t=>{t.method===e&&t.updates.forEach(n=>s.add(n))}),Array.from(s)}validateState(){this.validateSetStatePatterns(),this.validateStateFieldUsage(),this.validateLifecyclePatterns(),this.validateEventHandlers()}validateSetStatePatterns(){this.setStateCalls.forEach(e=>{const s=[];this.stateClasses.get(e.stateClassName)||s.push({type:"invalid-context",message:`setState called outside of ${e.stateClassName}`}),e.updates.length===0&&s.push({type:"empty-update",message:"setState called with no state updates",severity:"warning"}),e.updates.forEach(n=>{this.stateFields.has(`${e.stateClassName}.${n}`)||s.push({type:"unknown-field",message:`setState updates unknown field "${n}"`,field:n})}),e.isValid=s.length===0,e.issues=s})}validateStateFieldUsage(){this.stateFields.forEach((e,s)=>{const t=s.split("."),n=t[0],i=t[1];this.fieldIsUsed(i,n)||this.validationResults.push({type:"unused-state-field",severity:"warning",field:i,location:e.location,message:`State field "${i}" is defined but never used`,suggestion:"Remove unused field or implement its usage"});const a=this.findMutationsOutsideSetState(i,n);a.length>0&&this.validationResults.push({type:"mutation-outside-setstate",severity:"error",field:i,locations:a,message:`State field "${i}" is mutated outside setState()`,suggestion:"Always use setState() to update state fields"})})}fieldIsUsed(e,s){const t=this.stateClasses.get(s);if(!t)return!1;const n=t.astNode.body.methods.find(i=>i.key.name==="build");return n&&this.methodUsesField(n,e)?!0:this.setStateCalls.some(i=>i.updates.includes(e))}findMutationsOutsideSetState(e,s){const t=[],n=new Set;return this.setStateCalls.forEach(i=>{i.updates.forEach(a=>{n.add(a)})}),n.has(e),t}validateLifecyclePatterns(){this.stateClasses.forEach(({metadata:e})=>{const s={};e.lifecycleMethods.forEach(t=>{s[t.name]=t}),s.dispose&&!s.dispose.callsSuper&&this.validationResults.push({type:"lifecycle-issue",severity:"error",method:"dispose",location:s.dispose.location,message:"dispose() should call super.dispose()",suggestion:"Add super.dispose() call at the end of dispose()"}),s.initState&&!s.initState.callsSuper&&this.validationResults.push({type:"lifecycle-issue",severity:"warning",method:"initState",location:s.initState.location,message:"initState() should call super.initState()",suggestion:"Add super.initState() call"})})}validateEventHandlers(){this.eventHandlers.forEach(e=>{!this.stateClasses.values().some(t=>t.metadata.stateFields.some(n=>n.name===e.handler)||t.astNode.body.methods.some(n=>n.key.name===e.handler))&&e.handler&&this.validationResults.push({type:"missing-handler",severity:"error",handler:e.handler,event:e.event,location:e.location,message:`Event handler "${e.handler}" not found`,suggestion:`Create a method called ${e.handler} in the State class`})})}getResults(){return{stateClasses:Array.from(this.stateClasses.entries()).map(([e,s])=>({name:e,metadata:s.metadata})),stateFields:Array.from(this.stateFields.values()),setStateCalls:this.setStateCalls,lifecycleMethods:this.lifecycleMethods,eventHandlers:this.eventHandlers,dependencyGraph:this.dependencyGraph,validationResults:this.validationResults,errors:this.errors}}}class d{constructor(e,s,t){this.name=e,this.location=s,this.linkedStatefulWidget=t,this.stateFields=[],this.lifecycleMethods=[],this.methods=[]}}class f{constructor(e,s,t,n){this.name=e,this.type=s,this.initialValue=t,this.location=n,this.isMutable=!0,this.mutations=[],this.usedInMethods=[],this.usedInBuild=!1}}class u{constructor(e,s,t,n,i){this.name=e,this.location=s,this.params=t,this.callsSuper=n,this.hasSideEffects=i}}class h{constructor(e,s,t,n){this.location=e,this.method=s,this.updates=t||[],this.stateClassName=n,this.isValid=!0,this.issues=[]}}class c{constructor(){this.stateToMethods=new Map,this.methodToState=new Map,this.eventToState=new Map}}export{c as DependencyGraph,u as LifecycleMethod,p as StateAnalyzer,d as StateClassMetadata,f as StateField,h as StateUpdateCall}; //# sourceMappingURL=state_analyzer_implementation.js.map diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/src/analyzer.js b/packages/flutterjs_analyzer/flutterjs_analyzer/src/analyzer.js index a1e2ff0d..8bebed44 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/src/analyzer.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/src/analyzer.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * FlutterJS Analyzer - Main Orchestrator (FIXED Logger Integration) * Properly integrates centralized logging system diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/src/context_analyzer.js b/packages/flutterjs_analyzer/flutterjs_analyzer/src/context_analyzer.js index 83204a80..fbe56da2 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/src/context_analyzer.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/src/context_analyzer.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * FlutterJS Context Analyzer - Phase 3 * Detects InheritedWidget, Provider, BuildContext usage patterns diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/src/context_analyzer_data.js b/packages/flutterjs_analyzer/flutterjs_analyzer/src/context_analyzer_data.js index 45848604..41983b6c 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/src/context_analyzer_data.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/src/context_analyzer_data.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * FlutterJS Context Analyzer - Data Classes * Phase 3 Implementation diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutter_import_resolver.js b/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutter_import_resolver.js index 570a0705..3ae48c7e 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutter_import_resolver.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutter_import_resolver.js @@ -1,5 +1,9 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** - * Advanced Import Resolver for Flutter.js Framework + * Advanced Import Resolver for FlutterJS Framework * ✅ FIXED: Now handles multi-line imports correctly * * Resolution Chain: diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutter_resolver_config.js b/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutter_resolver_config.js index 6c4aec31..f9c3b606 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutter_resolver_config.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutter_resolver_config.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * Import Resolver Configuration * diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutterjs_logger.js b/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutterjs_logger.js index 685341f5..a864f901 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutterjs_logger.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutterjs_logger.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * FlutterJS Logger - Centralized Debug Output System * diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutterjs_parser.js b/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutterjs_parser.js index 639088d8..f6e6f060 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutterjs_parser.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutterjs_parser.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * FlutterJS Parser - Converts tokens to AST (FIXED VERSION) * Phase 1.2 MVP Implementation - Complete Fixes diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutterjs_report_generator.js b/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutterjs_report_generator.js index 05295f64..3fe8a909 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutterjs_report_generator.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutterjs_report_generator.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * FlutterJS Report Generator - Enhanced Phase 3 (FIXED) * Generates JSON, Markdown, and Console reports from analysis results diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutterjs_widget_analyzer.js b/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutterjs_widget_analyzer.js index 8378b4ca..cfecb45a 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutterjs_widget_analyzer.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/src/flutterjs_widget_analyzer.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * WidgetAnalyzer Enhancement - Track field references * diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/src/lexer.js b/packages/flutterjs_analyzer/flutterjs_analyzer/src/lexer.js index 422102f6..55c71eeb 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/src/lexer.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/src/lexer.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * FlutterJS Lexer - Converts source code to tokens * Phase 1.1 MVP Implementation diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/src/ssr_analyzer.js b/packages/flutterjs_analyzer/flutterjs_analyzer/src/ssr_analyzer.js index 794be359..50671aba 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/src/ssr_analyzer.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/src/ssr_analyzer.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * FlutterJS SSR Analyzer - Phase 3 (FIXED) * Analyzes Server-Side Rendering (SSR) compatibility diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/src/state_analyzer_data.js b/packages/flutterjs_analyzer/flutterjs_analyzer/src/state_analyzer_data.js index c1c4b37f..2bf5ba4a 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/src/state_analyzer_data.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/src/state_analyzer_data.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * FlutterJS State Analyzer - Data Classes * Phase 2 Implementation diff --git a/packages/flutterjs_analyzer/flutterjs_analyzer/src/state_analyzer_implementation.js b/packages/flutterjs_analyzer/flutterjs_analyzer/src/state_analyzer_implementation.js index 0990c332..f096b055 100644 --- a/packages/flutterjs_analyzer/flutterjs_analyzer/src/state_analyzer_implementation.js +++ b/packages/flutterjs_analyzer/flutterjs_analyzer/src/state_analyzer_implementation.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * FlutterJS State Analyzer * Phase 2 Implementation diff --git a/packages/flutterjs_analyzer/pubspec.yaml b/packages/flutterjs_analyzer/pubspec.yaml index b2b5fb3b..37733f2c 100644 --- a/packages/flutterjs_analyzer/pubspec.yaml +++ b/packages/flutterjs_analyzer/pubspec.yaml @@ -1,5 +1,5 @@ name: flutterjs_analyzer -version: 0.1.0 +version: 1.0.0 description: FlutterJS Analyzer - Dart widget analyzer homepage: https://github.com/flutterjs/flutterjs_analyzer diff --git a/packages/flutterjs_animation/example/lib/main.dart b/packages/flutterjs_animation/example/lib/main.dart index a425720c..5c63eece 100644 --- a/packages/flutterjs_animation/example/lib/main.dart +++ b/packages/flutterjs_animation/example/lib/main.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutter/material.dart'; void main() { @@ -32,7 +36,8 @@ class _ExamplePageState extends State { void _testPackage() { setState(() { // This will call the JavaScript implementation when running with FlutterJS - result = 'FlutterjsAnimation is ready!\n\nRun: flutterjs run --to-js --serve'; + result = + 'FlutterjsAnimation is ready!\n\nRun: flutterjs run --to-js --serve'; }); } diff --git a/packages/flutterjs_animation/flutterjs_animation/build.js b/packages/flutterjs_animation/flutterjs_animation/build.js index 8f0f4096..f4d88fe6 100644 --- a/packages/flutterjs_animation/flutterjs_animation/build.js +++ b/packages/flutterjs_animation/flutterjs_animation/build.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * Build script for @flutterjs/flutterjs_animation * diff --git a/packages/flutterjs_animation/flutterjs_animation/package.json b/packages/flutterjs_animation/flutterjs_animation/package.json index d25d53f4..817b956a 100644 --- a/packages/flutterjs_animation/flutterjs_animation/package.json +++ b/packages/flutterjs_animation/flutterjs_animation/package.json @@ -1,6 +1,6 @@ { "name": "@flutterjs/flutterjs_animation", - "version": "0.1.0", + "version": "1.0.0", "description": "A FlutterJS package", "main": "src/index.js", "type": "module", diff --git a/packages/flutterjs_animation/flutterjs_animation/src/index.js b/packages/flutterjs_animation/flutterjs_animation/src/index.js index 38395a90..ad86af7c 100644 --- a/packages/flutterjs_animation/flutterjs_animation/src/index.js +++ b/packages/flutterjs_animation/flutterjs_animation/src/index.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * FlutterJS FlutterjsAnimation * diff --git a/packages/flutterjs_animation/lib/flutterjs_animation.dart b/packages/flutterjs_animation/lib/flutterjs_animation.dart index 91fcc961..c6da6435 100644 --- a/packages/flutterjs_animation/lib/flutterjs_animation.dart +++ b/packages/flutterjs_animation/lib/flutterjs_animation.dart @@ -1,25 +1,29 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /// FlutterJS FlutterjsAnimation -/// +/// /// A FlutterJS package -/// +/// /// The actual implementation is in JavaScript. /// This package is a metadata wrapper published to pub.dev. -/// +/// /// ## Usage -/// +/// /// Add to your `pubspec.yaml`: /// ```yaml /// dependencies: /// flutterjs_animation: ^0.1.0 /// ``` -/// +/// /// Then run: /// ```bash /// flutterjs get /// ``` -/// +/// /// The package will be installed to: `build/flutterjs/node_modules/@flutterjs/flutterjs_animation` -/// +/// /// See `example/` for a complete working app. library flutterjs_animation; diff --git a/packages/flutterjs_animation/pubspec.yaml b/packages/flutterjs_animation/pubspec.yaml index 34886831..e86af6bf 100644 --- a/packages/flutterjs_animation/pubspec.yaml +++ b/packages/flutterjs_animation/pubspec.yaml @@ -1,5 +1,5 @@ name: flutterjs_animation -version: 0.1.0 +version: 1.0.0 description: A FlutterJS package homepage: https://github.com/flutterjs/flutterjs_animation diff --git a/packages/flutterjs_builder/lib/flutterjs_builder.dart b/packages/flutterjs_builder/lib/flutterjs_builder.dart index e7ea2b5f..6a3f2467 100644 --- a/packages/flutterjs_builder/lib/flutterjs_builder.dart +++ b/packages/flutterjs_builder/lib/flutterjs_builder.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /// Support for building FlutterJS packages from Dart source. library flutterjs_builder; diff --git a/packages/flutterjs_builder/lib/src/package_compiler.dart b/packages/flutterjs_builder/lib/src/package_compiler.dart index 2a5aa6df..cd412cff 100644 --- a/packages/flutterjs_builder/lib/src/package_compiler.dart +++ b/packages/flutterjs_builder/lib/src/package_compiler.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'dart:io'; import 'dart:async'; import 'dart:convert'; @@ -193,7 +197,6 @@ class PackageCompiler { try { final content = await file.readAsString(); - // 1. Parse Dart to AST final parseResult = parseString(content: content, path: file.path); final unit = parseResult.unit; diff --git a/packages/flutterjs_builder/lib/src/package_resolver.dart b/packages/flutterjs_builder/lib/src/package_resolver.dart index c2708c61..3b56160e 100644 --- a/packages/flutterjs_builder/lib/src/package_resolver.dart +++ b/packages/flutterjs_builder/lib/src/package_resolver.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'dart:convert'; import 'dart:io'; import 'package:path/path.dart' as p; diff --git a/packages/flutterjs_builder/pubspec.yaml b/packages/flutterjs_builder/pubspec.yaml index 007c7929..003fd115 100644 --- a/packages/flutterjs_builder/pubspec.yaml +++ b/packages/flutterjs_builder/pubspec.yaml @@ -1,6 +1,6 @@ name: flutterjs_builder description: "A new Flutter package project." -version: 0.0.1 +version: 1.0.0 homepage: resolution: workspace diff --git a/packages/flutterjs_builder/test/flutterjs_builder_test.dart b/packages/flutterjs_builder/test/flutterjs_builder_test.dart index 750c1fc2..08f64b21 100644 --- a/packages/flutterjs_builder/test/flutterjs_builder_test.dart +++ b/packages/flutterjs_builder/test/flutterjs_builder_test.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // import 'package:flutter_test/flutter_test.dart'; // import 'package:flutterjs_builder/flutterjs_builder.dart'; diff --git a/packages/flutterjs_core/lib/ast_it.dart b/packages/flutterjs_core/lib/ast_it.dart index 4e4c32db..6fcb542d 100644 --- a/packages/flutterjs_core/lib/ast_it.dart +++ b/packages/flutterjs_core/lib/ast_it.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + export 'src/ir/declarations/class_decl.dart'; export 'src/ir/declarations/dart_file_builder.dart'; export 'src/ir/declarations/function_decl.dart'; diff --git a/packages/flutterjs_core/lib/flutterjs_core.dart b/packages/flutterjs_core/lib/flutterjs_core.dart index f68a005a..13e57ce4 100644 --- a/packages/flutterjs_core/lib/flutterjs_core.dart +++ b/packages/flutterjs_core/lib/flutterjs_core.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // ============================================================================ // FIXED: flutterjs_core.dart // ============================================================================ @@ -13,7 +17,7 @@ /// flutterjs_core.dart /// ---------------------------------------------------------------------------- /// -/// Primary entry point for the Flutter.js Core engine. +/// Primary entry point for the FlutterJS Core engine. /// This file aggregates all IR types, AST transformation passes, diagnostics, /// utilities, and builder helpers into a single consumable API. /// @@ -22,7 +26,7 @@ /// • IR-based type inference and control flow analysis /// • Code transformation passes (rewrites, optimizations, validation) /// • Diagnostic reporting with structured source locations -/// • Integration with Flutter.js command-line and runtime tools +/// • Integration with FlutterJS command-line and runtime tools /// /// What this file provides: /// • Stable exports for IR nodes (statements, expressions, types) diff --git a/packages/flutterjs_core/lib/src/analysis/extraction/component_extractor.dart b/packages/flutterjs_core/lib/src/analysis/extraction/component_extractor.dart index b26980fe..323660e5 100644 --- a/packages/flutterjs_core/lib/src/analysis/extraction/component_extractor.dart +++ b/packages/flutterjs_core/lib/src/analysis/extraction/component_extractor.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // ============================================================================ // ENHANCED WIDGET EXTRACTION SYSTEM // ============================================================================ diff --git a/packages/flutterjs_core/lib/src/analysis/extraction/component_registry.dart b/packages/flutterjs_core/lib/src/analysis/extraction/component_registry.dart index c9a0dd9c..052922cb 100644 --- a/packages/flutterjs_core/lib/src/analysis/extraction/component_registry.dart +++ b/packages/flutterjs_core/lib/src/analysis/extraction/component_registry.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // ============================================================================ // ENHANCED COMPONENT REGISTRY (AST-Aware Detection) // ============================================================================ diff --git a/packages/flutterjs_core/lib/src/analysis/extraction/flutter_component_system.dart b/packages/flutterjs_core/lib/src/analysis/extraction/flutter_component_system.dart index 7c717c44..3f349bb3 100644 --- a/packages/flutterjs_core/lib/src/analysis/extraction/flutter_component_system.dart +++ b/packages/flutterjs_core/lib/src/analysis/extraction/flutter_component_system.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutterjs_core/flutterjs_core.dart'; import 'package:meta/meta.dart'; diff --git a/packages/flutterjs_core/lib/src/analysis/extraction/lambda_function_extractor.dart b/packages/flutterjs_core/lib/src/analysis/extraction/lambda_function_extractor.dart index f5219e92..9d90bbe7 100644 --- a/packages/flutterjs_core/lib/src/analysis/extraction/lambda_function_extractor.dart +++ b/packages/flutterjs_core/lib/src/analysis/extraction/lambda_function_extractor.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // ============================================================================ // SIMPLIFIED LAMBDA FUNCTION EXTRACTION // ============================================================================ diff --git a/packages/flutterjs_core/lib/src/analysis/extraction/statement_extraction_pass.dart b/packages/flutterjs_core/lib/src/analysis/extraction/statement_extraction_pass.dart index c8b27978..3efacb1f 100644 --- a/packages/flutterjs_core/lib/src/analysis/extraction/statement_extraction_pass.dart +++ b/packages/flutterjs_core/lib/src/analysis/extraction/statement_extraction_pass.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/element/element.dart'; import 'package:flutterjs_core/flutterjs_core.dart'; @@ -303,7 +307,6 @@ class StatementExtractionPass { /// Extract a single statement StatementIR? _extractStatement(AstNode? stmt) { if (stmt == null) return null; - if (stmt is VariableDeclarationStatement) { return _extractVariableDeclarationStatement(stmt); @@ -328,19 +331,22 @@ class StatementExtractionPass { final guardedPattern = caseClause.guardedPattern; final pattern = guardedPattern.pattern; final whenClause = guardedPattern.whenClause; - + // Extract the pattern final patternIR = _extractPattern(pattern); - + // Extract guard condition if present final guardIR = whenClause != null ? GuardClause( condition: extractExpression(whenClause.expression), - sourceLocation: _extractSourceLocation(whenClause, whenClause.offset), + sourceLocation: _extractSourceLocation( + whenClause, + whenClause.offset, + ), id: builder.generateId('guard'), ) : null; - + return IfCaseStmt( id: builder.generateId('stmt_if_case'), sourceLocation: _extractSourceLocation(stmt, stmt.offset), @@ -355,7 +361,7 @@ class StatementExtractionPass { metadata: {}, ); } - + // Regular if statement without pattern matching return IfStmt( id: builder.generateId('stmt_if'), @@ -384,7 +390,7 @@ class StatementExtractionPass { body: _extractStatementAsBlock(stmt.body), sourceLocation: _extractSourceLocation(stmt, stmt.offset), metadata: {}, - ); + ); } if (stmt is DoStatement) { @@ -667,7 +673,9 @@ class StatementExtractionPass { /// Extract try-catch-finally statement TryStmt _extractTryStatement(TryStatement stmt) { - print('DEBUG_EXTRACT: TryStmt in $filePath. Catch: ${stmt.catchClauses.length}, Finally: ${stmt.finallyBlock != null}'); + print( + 'DEBUG_EXTRACT: TryStmt in $filePath. Catch: ${stmt.catchClauses.length}, Finally: ${stmt.finallyBlock != null}', + ); return TryStmt( id: builder.generateId('stmt_try'), tryBlock: _extractBlockStatement(stmt.body), @@ -1742,10 +1750,7 @@ class StatementExtractionPass { ); } - ExpressionIR _extractPatternCondition( - CaseClause caseClause, - Expression lhs, - ) { + ExpressionIR _extractPatternCondition(CaseClause caseClause, Expression lhs) { // CaseClause has guardedPattern which contains the pattern final guardedPattern = caseClause.guardedPattern; final pattern = guardedPattern.pattern; @@ -2104,7 +2109,8 @@ class StatementExtractionPass { return WildcardPatternIR( id: builder.generateId('pattern_wildcard'), sourceLocation: sourceLocation, - matchedType: _extractTypeFromAnnotation(pattern.type, offset) ?? + matchedType: + _extractTypeFromAnnotation(pattern.type, offset) ?? DynamicTypeIR( id: builder.generateId('type_dynamic'), sourceLocation: sourceLocation, @@ -2116,12 +2122,13 @@ class StatementExtractionPass { // Variable pattern with type: TypeName varName or var varName final varName = pattern.name.lexeme; final hasExplicitType = pattern.type != null; - + return VariablePatternIR( id: builder.generateId('pattern_var'), sourceLocation: sourceLocation, variableName: varName, - matchedType: _extractTypeFromAnnotation(pattern.type, offset) ?? + matchedType: + _extractTypeFromAnnotation(pattern.type, offset) ?? DynamicTypeIR( id: builder.generateId('type_dynamic'), sourceLocation: sourceLocation, diff --git a/packages/flutterjs_core/lib/src/analysis/extraction/statement_widget_analyzer.dart b/packages/flutterjs_core/lib/src/analysis/extraction/statement_widget_analyzer.dart index eaadc783..8810570a 100644 --- a/packages/flutterjs_core/lib/src/analysis/extraction/statement_widget_analyzer.dart +++ b/packages/flutterjs_core/lib/src/analysis/extraction/statement_widget_analyzer.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutterjs_core/flutterjs_core.dart'; import '../../ir/expressions/cascade_expression_ir.dart'; @@ -206,7 +210,7 @@ class StatementWidgetAnalyzer { } } else if (expr is StringInterpolationExpressionIR) { // String interpolation in widget properties - preserve it - // print(' [StringInterpolation] Preserving in property'); + // print(' [StringInterpolation] Preserving in property'); // Just track that we've seen it, don't try to extract widgets from it // (unless it contains widget expressions, which is unlikely) return; diff --git a/packages/flutterjs_core/lib/src/analysis/extraction/symmetric_function_extraction.dart b/packages/flutterjs_core/lib/src/analysis/extraction/symmetric_function_extraction.dart index ed067865..72040f53 100644 --- a/packages/flutterjs_core/lib/src/analysis/extraction/symmetric_function_extraction.dart +++ b/packages/flutterjs_core/lib/src/analysis/extraction/symmetric_function_extraction.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // ============================================================================ // SYMMETRIC FUNCTION EXTRACTION SYSTEM // ============================================================================ diff --git a/packages/flutterjs_core/lib/src/analysis/passes/expression_visitor.dart b/packages/flutterjs_core/lib/src/analysis/passes/expression_visitor.dart index 90e3db32..47d1c9e8 100644 --- a/packages/flutterjs_core/lib/src/analysis/passes/expression_visitor.dart +++ b/packages/flutterjs_core/lib/src/analysis/passes/expression_visitor.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'dart:math'; import 'package:flutterjs_core/ast_it.dart'; diff --git a/packages/flutterjs_core/lib/src/analysis/passes/flow_analysis_pass.dart b/packages/flutterjs_core/lib/src/analysis/passes/flow_analysis_pass.dart index 7f6f0394..dee1f64e 100644 --- a/packages/flutterjs_core/lib/src/analysis/passes/flow_analysis_pass.dart +++ b/packages/flutterjs_core/lib/src/analysis/passes/flow_analysis_pass.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import '../../ir/declarations/dart_file_builder.dart'; import '../../ir/declarations/function_decl.dart'; import '../../ir/statements/statement_ir.dart'; diff --git a/packages/flutterjs_core/lib/src/analysis/passes/statement_visitor.dart b/packages/flutterjs_core/lib/src/analysis/passes/statement_visitor.dart index 23b35c2d..6975d3d1 100644 --- a/packages/flutterjs_core/lib/src/analysis/passes/statement_visitor.dart +++ b/packages/flutterjs_core/lib/src/analysis/passes/statement_visitor.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // ============================================================================= // STATEMENT VISITORS // ============================================================================= diff --git a/packages/flutterjs_core/lib/src/analysis/passes/symbol_resolution.dart b/packages/flutterjs_core/lib/src/analysis/passes/symbol_resolution.dart index b0df8c43..ae16f72b 100644 --- a/packages/flutterjs_core/lib/src/analysis/passes/symbol_resolution.dart +++ b/packages/flutterjs_core/lib/src/analysis/passes/symbol_resolution.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:collection/collection.dart'; import '../../ir/declarations/class_decl.dart'; diff --git a/packages/flutterjs_core/lib/src/analysis/passes/type_inference_pass.dart b/packages/flutterjs_core/lib/src/analysis/passes/type_inference_pass.dart index 551fc614..14a19b3a 100644 --- a/packages/flutterjs_core/lib/src/analysis/passes/type_inference_pass.dart +++ b/packages/flutterjs_core/lib/src/analysis/passes/type_inference_pass.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:collection/collection.dart'; import '../../ir/declarations/class_decl.dart'; diff --git a/packages/flutterjs_core/lib/src/analysis/passes/type_inference_visitor.dart b/packages/flutterjs_core/lib/src/analysis/passes/type_inference_visitor.dart index f71463f0..8bc46e2a 100644 --- a/packages/flutterjs_core/lib/src/analysis/passes/type_inference_visitor.dart +++ b/packages/flutterjs_core/lib/src/analysis/passes/type_inference_visitor.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // File: lib/src/analysis/visitors/type_inference_visitor.dart import 'package:flutterjs_core/flutterjs_core.dart'; diff --git a/packages/flutterjs_core/lib/src/analysis/passes/validation_pass.dart b/packages/flutterjs_core/lib/src/analysis/passes/validation_pass.dart index ff1acc70..bbab0698 100644 --- a/packages/flutterjs_core/lib/src/analysis/passes/validation_pass.dart +++ b/packages/flutterjs_core/lib/src/analysis/passes/validation_pass.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutterjs_core/flutterjs_core.dart'; /// <----------------------------------------------------------------------------> diff --git a/packages/flutterjs_core/lib/src/analysis/passes/variable_collector.dart b/packages/flutterjs_core/lib/src/analysis/passes/variable_collector.dart index fba66118..43a1d51f 100644 --- a/packages/flutterjs_core/lib/src/analysis/passes/variable_collector.dart +++ b/packages/flutterjs_core/lib/src/analysis/passes/variable_collector.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutterjs_core/ast_it.dart'; import 'package:flutterjs_core/src/ir/expressions/enum_member_access_expression.dart'; diff --git a/packages/flutterjs_core/lib/src/analysis/visitors/analyzer_widget_detection_setup.dart b/packages/flutterjs_core/lib/src/analysis/visitors/analyzer_widget_detection_setup.dart index e52c1cb5..381caeb1 100644 --- a/packages/flutterjs_core/lib/src/analysis/visitors/analyzer_widget_detection_setup.dart +++ b/packages/flutterjs_core/lib/src/analysis/visitors/analyzer_widget_detection_setup.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // ============================================================================ // IMPROVED: Widget Detection - Handles Custom Widgets // ============================================================================ diff --git a/packages/flutterjs_core/lib/src/analysis/visitors/declaration_pass.dart b/packages/flutterjs_core/lib/src/analysis/visitors/declaration_pass.dart index 2354c74a..2223893a 100644 --- a/packages/flutterjs_core/lib/src/analysis/visitors/declaration_pass.dart +++ b/packages/flutterjs_core/lib/src/analysis/visitors/declaration_pass.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/ast/ast.dart' as ast; import 'package:analyzer/dart/ast/visitor.dart'; @@ -898,8 +902,9 @@ class DeclarationPass extends RecursiveAstVisitor { } } - final durationMs = - DateTime.now().difference(extractionStartTime).inMilliseconds; + final durationMs = DateTime.now() + .difference(extractionStartTime) + .inMilliseconds; _log(' ⏱️ Extraction time: ${durationMs}ms'); return methodDecl; @@ -951,16 +956,25 @@ class DeclarationPass extends RecursiveAstVisitor { // Add constants as static fields for (final constant in node.constants) { final fieldDecl = FieldDecl( - id: builder.generateId('field', '${enumName}_${constant.name.lexeme}'), + id: builder.generateId( + 'field', + '${enumName}_${constant.name.lexeme}', + ), name: constant.name.lexeme, type: SimpleTypeIR( id: builder.generateId('type'), name: enumName, - sourceLocation: _extractSourceLocation(constant, constant.name.offset), + sourceLocation: _extractSourceLocation( + constant, + constant.name.offset, + ), ), isStatic: true, isFinal: true, - sourceLocation: _extractSourceLocation(constant, constant.name.offset), + sourceLocation: _extractSourceLocation( + constant, + constant.name.offset, + ), ); fields.add(fieldDecl); } @@ -972,7 +986,10 @@ class DeclarationPass extends RecursiveAstVisitor { final fieldDecl = FieldDecl( id: builder.generateId('field', '${enumName}_$fieldName'), name: fieldName, - type: _extractTypeFromAnnotation(member.fields.type, variable.name.offset), + type: _extractTypeFromAnnotation( + member.fields.type, + variable.name.offset, + ), isStatic: member.isStatic, isFinal: member.fields.isFinal, sourceLocation: _extractSourceLocation( @@ -1062,7 +1079,10 @@ class DeclarationPass extends RecursiveAstVisitor { final fieldDecl = FieldDecl( id: builder.generateId('field', '${node.name.lexeme}_$fieldName'), name: fieldName, - type: _extractTypeFromAnnotation(member.fields.type, variable.name.offset), + type: _extractTypeFromAnnotation( + member.fields.type, + variable.name.offset, + ), isStatic: member.isStatic, isFinal: member.fields.isFinal, sourceLocation: _extractSourceLocation( diff --git a/packages/flutterjs_core/lib/src/ir/core/ir_id_generator.dart b/packages/flutterjs_core/lib/src/ir/core/ir_id_generator.dart index fee53405..5f34c0bc 100644 --- a/packages/flutterjs_core/lib/src/ir/core/ir_id_generator.dart +++ b/packages/flutterjs_core/lib/src/ir/core/ir_id_generator.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /// <----------------------------------------------------------------------------> /// ir_id_generator.dart /// ---------------------------------------------------------------------------- diff --git a/packages/flutterjs_core/lib/src/ir/core/ir_node.dart b/packages/flutterjs_core/lib/src/ir/core/ir_node.dart index 4dd7c9e0..b012e7bc 100644 --- a/packages/flutterjs_core/lib/src/ir/core/ir_node.dart +++ b/packages/flutterjs_core/lib/src/ir/core/ir_node.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // lib/src/ir/ir_node.dart import 'package:meta/meta.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/core/source_location.dart b/packages/flutterjs_core/lib/src/ir/core/source_location.dart index 3539b9cc..df7181f8 100644 --- a/packages/flutterjs_core/lib/src/ir/core/source_location.dart +++ b/packages/flutterjs_core/lib/src/ir/core/source_location.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /// <----------------------------------------------------------------------------> /// source_location.dart /// ---------------------------------------------------------------------------- diff --git a/packages/flutterjs_core/lib/src/ir/declarations/class_decl.dart b/packages/flutterjs_core/lib/src/ir/declarations/class_decl.dart index 8b5d329a..a6651265 100644 --- a/packages/flutterjs_core/lib/src/ir/declarations/class_decl.dart +++ b/packages/flutterjs_core/lib/src/ir/declarations/class_decl.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /// <----------------------------------------------------------------------------> /// class_decl.dart /// ---------------------------------------------------------------------------- diff --git a/packages/flutterjs_core/lib/src/ir/declarations/dart_file_builder.dart b/packages/flutterjs_core/lib/src/ir/declarations/dart_file_builder.dart index 7b241b0f..40b36c68 100644 --- a/packages/flutterjs_core/lib/src/ir/declarations/dart_file_builder.dart +++ b/packages/flutterjs_core/lib/src/ir/declarations/dart_file_builder.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /// <----------------------------------------------------------------------------> /// dart_file_builder.dart /// ---------------------------------------------------------------------------- diff --git a/packages/flutterjs_core/lib/src/ir/declarations/function_decl.dart b/packages/flutterjs_core/lib/src/ir/declarations/function_decl.dart index a945b0fe..65fefb1f 100644 --- a/packages/flutterjs_core/lib/src/ir/declarations/function_decl.dart +++ b/packages/flutterjs_core/lib/src/ir/declarations/function_decl.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /// <----------------------------------------------------------------------------> /// function_decl.dart /// ---------------------------------------------------------------------------- diff --git a/packages/flutterjs_core/lib/src/ir/declarations/import_export_stmt.dart b/packages/flutterjs_core/lib/src/ir/declarations/import_export_stmt.dart index c9ecd4a9..2a9d807b 100644 --- a/packages/flutterjs_core/lib/src/ir/declarations/import_export_stmt.dart +++ b/packages/flutterjs_core/lib/src/ir/declarations/import_export_stmt.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /// <----------------------------------------------------------------------------> /// import_export_stmt.dart /// ---------------------------------------------------------------------------- diff --git a/packages/flutterjs_core/lib/src/ir/declarations/parameter_decl.dart b/packages/flutterjs_core/lib/src/ir/declarations/parameter_decl.dart index d7a7c91e..6780a698 100644 --- a/packages/flutterjs_core/lib/src/ir/declarations/parameter_decl.dart +++ b/packages/flutterjs_core/lib/src/ir/declarations/parameter_decl.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import '../core/ir_node.dart'; import '../types/type_ir.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/declarations/variable_decl.dart b/packages/flutterjs_core/lib/src/ir/declarations/variable_decl.dart index c44f4362..5df11f95 100644 --- a/packages/flutterjs_core/lib/src/ir/declarations/variable_decl.dart +++ b/packages/flutterjs_core/lib/src/ir/declarations/variable_decl.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /// <----------------------------------------------------------------------------> /// variable_decl.dart /// ---------------------------------------------------------------------------- diff --git a/packages/flutterjs_core/lib/src/ir/diagnostics/analysis_issue.dart b/packages/flutterjs_core/lib/src/ir/diagnostics/analysis_issue.dart index 67baee23..198aa425 100644 --- a/packages/flutterjs_core/lib/src/ir/diagnostics/analysis_issue.dart +++ b/packages/flutterjs_core/lib/src/ir/diagnostics/analysis_issue.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /// <----------------------------------------------------------------------------> /// analysis_issue.dart /// ---------------------------------------------------------------------------- diff --git a/packages/flutterjs_core/lib/src/ir/diagnostics/issue_categorizer.dart b/packages/flutterjs_core/lib/src/ir/diagnostics/issue_categorizer.dart index 3064e54b..fc62a905 100644 --- a/packages/flutterjs_core/lib/src/ir/diagnostics/issue_categorizer.dart +++ b/packages/flutterjs_core/lib/src/ir/diagnostics/issue_categorizer.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /// <----------------------------------------------------------------------------> /// issue_categorizer.dart /// ---------------------------------------------------------------------------- diff --git a/packages/flutterjs_core/lib/src/ir/diagnostics/issue_category.dart b/packages/flutterjs_core/lib/src/ir/diagnostics/issue_category.dart index 83065676..d983200b 100644 --- a/packages/flutterjs_core/lib/src/ir/diagnostics/issue_category.dart +++ b/packages/flutterjs_core/lib/src/ir/diagnostics/issue_category.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /// <----------------------------------------------------------------------------> /// issue_category.dart /// ---------------------------------------------------------------------------- diff --git a/packages/flutterjs_core/lib/src/ir/diagnostics/issue_collector.dart b/packages/flutterjs_core/lib/src/ir/diagnostics/issue_collector.dart index 7f5de643..08b1420b 100644 --- a/packages/flutterjs_core/lib/src/ir/diagnostics/issue_collector.dart +++ b/packages/flutterjs_core/lib/src/ir/diagnostics/issue_collector.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /// <----------------------------------------------------------------------------> /// issue_collector.dart /// ---------------------------------------------------------------------------- diff --git a/packages/flutterjs_core/lib/src/ir/expressions/advanced.dart b/packages/flutterjs_core/lib/src/ir/expressions/advanced.dart index 58ad36df..b41d9a1f 100644 --- a/packages/flutterjs_core/lib/src/ir/expressions/advanced.dart +++ b/packages/flutterjs_core/lib/src/ir/expressions/advanced.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import 'expression_ir.dart'; import '../statements/statement_ir.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/expressions/cascade_expression_ir.dart b/packages/flutterjs_core/lib/src/ir/expressions/cascade_expression_ir.dart index eb9ee845..dba5ebe0 100644 --- a/packages/flutterjs_core/lib/src/ir/expressions/cascade_expression_ir.dart +++ b/packages/flutterjs_core/lib/src/ir/expressions/cascade_expression_ir.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import 'expression_ir.dart'; import '../types/type_ir.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/expressions/enum_member_access_expression.dart b/packages/flutterjs_core/lib/src/ir/expressions/enum_member_access_expression.dart index 3b290735..3b2b1940 100644 --- a/packages/flutterjs_core/lib/src/ir/expressions/enum_member_access_expression.dart +++ b/packages/flutterjs_core/lib/src/ir/expressions/enum_member_access_expression.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // ============================================================================ // IMPROVED: EnumMemberAccessExpressionIR // ============================================================================ diff --git a/packages/flutterjs_core/lib/src/ir/expressions/expression_ir.dart b/packages/flutterjs_core/lib/src/ir/expressions/expression_ir.dart index d2d35ffe..a9d1f55e 100644 --- a/packages/flutterjs_core/lib/src/ir/expressions/expression_ir.dart +++ b/packages/flutterjs_core/lib/src/ir/expressions/expression_ir.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import '../../../ast_it.dart'; import '../core/source_location.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/expressions/function_method_calls.dart b/packages/flutterjs_core/lib/src/ir/expressions/function_method_calls.dart index 4aac24df..9a89e48d 100644 --- a/packages/flutterjs_core/lib/src/ir/expressions/function_method_calls.dart +++ b/packages/flutterjs_core/lib/src/ir/expressions/function_method_calls.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import 'expression_ir.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/expressions/literals.dart b/packages/flutterjs_core/lib/src/ir/expressions/literals.dart index 448cbfc8..82f72ad7 100644 --- a/packages/flutterjs_core/lib/src/ir/expressions/literals.dart +++ b/packages/flutterjs_core/lib/src/ir/expressions/literals.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import '../../../ast_it.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/expressions/operations.dart b/packages/flutterjs_core/lib/src/ir/expressions/operations.dart index c9904444..860bfe0d 100644 --- a/packages/flutterjs_core/lib/src/ir/expressions/operations.dart +++ b/packages/flutterjs_core/lib/src/ir/expressions/operations.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import 'expression_ir.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/expressions/vaibales_access.dart b/packages/flutterjs_core/lib/src/ir/expressions/vaibales_access.dart index 167b042b..dc6399bb 100644 --- a/packages/flutterjs_core/lib/src/ir/expressions/vaibales_access.dart +++ b/packages/flutterjs_core/lib/src/ir/expressions/vaibales_access.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import 'expression_ir.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/flutter/life_cycle_analysis.dart b/packages/flutterjs_core/lib/src/ir/flutter/life_cycle_analysis.dart index 35e49d44..07ffd60e 100644 --- a/packages/flutterjs_core/lib/src/ir/flutter/life_cycle_analysis.dart +++ b/packages/flutterjs_core/lib/src/ir/flutter/life_cycle_analysis.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import '../diagnostics/analysis_issue.dart'; import '../core/source_location.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/flutter/rebuild_trigger_graph.dart b/packages/flutterjs_core/lib/src/ir/flutter/rebuild_trigger_graph.dart index ea5f3c53..e487f218 100644 --- a/packages/flutterjs_core/lib/src/ir/flutter/rebuild_trigger_graph.dart +++ b/packages/flutterjs_core/lib/src/ir/flutter/rebuild_trigger_graph.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import '../diagnostics/analysis_issue.dart'; import '../core/ir_node.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/flutter/state_class_representation.dart b/packages/flutterjs_core/lib/src/ir/flutter/state_class_representation.dart index b15f6100..453d6c33 100644 --- a/packages/flutterjs_core/lib/src/ir/flutter/state_class_representation.dart +++ b/packages/flutterjs_core/lib/src/ir/flutter/state_class_representation.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import '../declarations/class_decl.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/flutter/state_field_analysis.dart b/packages/flutterjs_core/lib/src/ir/flutter/state_field_analysis.dart index 2f4dde12..19fca3b3 100644 --- a/packages/flutterjs_core/lib/src/ir/flutter/state_field_analysis.dart +++ b/packages/flutterjs_core/lib/src/ir/flutter/state_field_analysis.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import '../diagnostics/analysis_issue.dart'; import '../core/source_location.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/flutter/state_management.dart b/packages/flutterjs_core/lib/src/ir/flutter/state_management.dart index febdc066..a0ca2d07 100644 --- a/packages/flutterjs_core/lib/src/ir/flutter/state_management.dart +++ b/packages/flutterjs_core/lib/src/ir/flutter/state_management.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import '../declarations/class_decl.dart'; import '../core/source_location.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/flutter/widget_classification.dart b/packages/flutterjs_core/lib/src/ir/flutter/widget_classification.dart index 7143188b..3547706b 100644 --- a/packages/flutterjs_core/lib/src/ir/flutter/widget_classification.dart +++ b/packages/flutterjs_core/lib/src/ir/flutter/widget_classification.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutterjs_core/flutterjs_core.dart'; import 'package:meta/meta.dart'; import '../declarations/class_decl.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/flutter/widget_metadata.dart b/packages/flutterjs_core/lib/src/ir/flutter/widget_metadata.dart index 94be769c..a4420a05 100644 --- a/packages/flutterjs_core/lib/src/ir/flutter/widget_metadata.dart +++ b/packages/flutterjs_core/lib/src/ir/flutter/widget_metadata.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + library; import 'package:flutterjs_core/flutterjs_core.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/statements/statement_ir.dart b/packages/flutterjs_core/lib/src/ir/statements/statement_ir.dart index 5607822b..047d794c 100644 --- a/packages/flutterjs_core/lib/src/ir/statements/statement_ir.dart +++ b/packages/flutterjs_core/lib/src/ir/statements/statement_ir.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // lib/src/ir/statement/statement_ir.dart // Complete Statement IR hierarchy with Widget Analysis diff --git a/packages/flutterjs_core/lib/src/ir/types/class_type_ir.dart b/packages/flutterjs_core/lib/src/ir/types/class_type_ir.dart index 7eea7e73..44cca90a 100644 --- a/packages/flutterjs_core/lib/src/ir/types/class_type_ir.dart +++ b/packages/flutterjs_core/lib/src/ir/types/class_type_ir.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import '../core/source_location.dart'; import 'type_ir.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/types/function_type_ir.dart b/packages/flutterjs_core/lib/src/ir/types/function_type_ir.dart index c23ea45b..ff063086 100644 --- a/packages/flutterjs_core/lib/src/ir/types/function_type_ir.dart +++ b/packages/flutterjs_core/lib/src/ir/types/function_type_ir.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'type_ir.dart'; import 'parameter_ir.dart'; import '../core/source_location.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/types/generic_type_ir.dart b/packages/flutterjs_core/lib/src/ir/types/generic_type_ir.dart index 0f5f8db5..f412a676 100644 --- a/packages/flutterjs_core/lib/src/ir/types/generic_type_ir.dart +++ b/packages/flutterjs_core/lib/src/ir/types/generic_type_ir.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import '../core/source_location.dart'; import 'type_ir.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/types/nullable_type_ir.dart b/packages/flutterjs_core/lib/src/ir/types/nullable_type_ir.dart index e6ea23c0..e79842a4 100644 --- a/packages/flutterjs_core/lib/src/ir/types/nullable_type_ir.dart +++ b/packages/flutterjs_core/lib/src/ir/types/nullable_type_ir.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import '../core/source_location.dart'; import 'type_ir.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/types/parameter_ir.dart b/packages/flutterjs_core/lib/src/ir/types/parameter_ir.dart index e1f32545..0bcc0ad9 100644 --- a/packages/flutterjs_core/lib/src/ir/types/parameter_ir.dart +++ b/packages/flutterjs_core/lib/src/ir/types/parameter_ir.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import '../expressions/expression_ir.dart'; import '../core/ir_node.dart'; import 'type_ir.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/types/primitive_type_ir.dart b/packages/flutterjs_core/lib/src/ir/types/primitive_type_ir.dart index 4ebbbf56..67c39fa7 100644 --- a/packages/flutterjs_core/lib/src/ir/types/primitive_type_ir.dart +++ b/packages/flutterjs_core/lib/src/ir/types/primitive_type_ir.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'type_ir.dart'; import '../core/source_location.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/types/type_hierarchy.dart b/packages/flutterjs_core/lib/src/ir/types/type_hierarchy.dart index 54e068ac..908d1a0f 100644 --- a/packages/flutterjs_core/lib/src/ir/types/type_hierarchy.dart +++ b/packages/flutterjs_core/lib/src/ir/types/type_hierarchy.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'type_ir.dart'; import 'class_type_ir.dart'; import 'unresolved_type_ir.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/types/type_ir.dart b/packages/flutterjs_core/lib/src/ir/types/type_ir.dart index 7e653b3b..a93be073 100644 --- a/packages/flutterjs_core/lib/src/ir/types/type_ir.dart +++ b/packages/flutterjs_core/lib/src/ir/types/type_ir.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import '../core/source_location.dart'; import '../core/ir_node.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/types/unresolved_type_ir.dart b/packages/flutterjs_core/lib/src/ir/types/unresolved_type_ir.dart index 3a06c684..72e21948 100644 --- a/packages/flutterjs_core/lib/src/ir/types/unresolved_type_ir.dart +++ b/packages/flutterjs_core/lib/src/ir/types/unresolved_type_ir.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'type_ir.dart'; import '../core/source_location.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/widgets/build_method_ir.dart b/packages/flutterjs_core/lib/src/ir/widgets/build_method_ir.dart index b14091a5..410f1155 100644 --- a/packages/flutterjs_core/lib/src/ir/widgets/build_method_ir.dart +++ b/packages/flutterjs_core/lib/src/ir/widgets/build_method_ir.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import '../diagnostics/analysis_issue.dart'; import '../core/source_location.dart'; @@ -13,7 +17,7 @@ import 'widget_tree_ir.dart'; /// build_method_ir.dart /// ---------------------------------------------------------------------------- /// -/// Defines the IR representation of a widget's `build()` method in Flutter.js. +/// Defines the IR representation of a widget's `build()` method in FlutterJS. /// This structure is responsible for capturing the resulting widget tree /// produced during the build phase. /// diff --git a/packages/flutterjs_core/lib/src/ir/widgets/key_type_ir.dart b/packages/flutterjs_core/lib/src/ir/widgets/key_type_ir.dart index 4e6eb609..cbb13e7c 100644 --- a/packages/flutterjs_core/lib/src/ir/widgets/key_type_ir.dart +++ b/packages/flutterjs_core/lib/src/ir/widgets/key_type_ir.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import '../core/source_location.dart'; import '../core/ir_node.dart'; @@ -7,7 +11,7 @@ import '../types/type_ir.dart'; /// key_type_ir.dart /// ---------------------------------------------------------------------------- /// -/// IR representation of different widget key types used within Flutter.js. +/// IR representation of different widget key types used within FlutterJS. /// /// Purpose: /// • Track key usage on IR-based widget nodes diff --git a/packages/flutterjs_core/lib/src/ir/widgets/widget_node_ir.dart b/packages/flutterjs_core/lib/src/ir/widgets/widget_node_ir.dart index 4c9df99e..1b8c3f70 100644 --- a/packages/flutterjs_core/lib/src/ir/widgets/widget_node_ir.dart +++ b/packages/flutterjs_core/lib/src/ir/widgets/widget_node_ir.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import '../core/source_location.dart'; diff --git a/packages/flutterjs_core/lib/src/ir/widgets/widget_tree_ir.dart b/packages/flutterjs_core/lib/src/ir/widgets/widget_tree_ir.dart index 494fbf0d..3170bf10 100644 --- a/packages/flutterjs_core/lib/src/ir/widgets/widget_tree_ir.dart +++ b/packages/flutterjs_core/lib/src/ir/widgets/widget_tree_ir.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:meta/meta.dart'; import '../core/source_location.dart'; diff --git a/packages/flutterjs_core/pubspec.yaml b/packages/flutterjs_core/pubspec.yaml index 16fdfa92..47c90592 100644 --- a/packages/flutterjs_core/pubspec.yaml +++ b/packages/flutterjs_core/pubspec.yaml @@ -1,9 +1,9 @@ name: flutterjs_core -description: A sample command-line application. +description: Core architecture and primitives for the FlutterJS framework. version: 1.0.0 -publish_to: none -resolution: workspace -# repository: https://github.com/my_org/my_repo +repository: https://github.com/flutterjsdev/flutterjs/tree/main/packages/flutterjs_core +homepage: https://flutterjs.dev +license: BSD-3-Clause environment: sdk: ^3.10.0-278.0.dev diff --git a/packages/flutterjs_core/test/engine_test.dart b/packages/flutterjs_core/test/engine_test.dart index 102cbfab..efc95c13 100644 --- a/packages/flutterjs_core/test/engine_test.dart +++ b/packages/flutterjs_core/test/engine_test.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // import 'package:engine/engine.dart'; // import 'package:test/test.dart'; diff --git a/packages/flutterjs_cupertino/example/lib/main.dart b/packages/flutterjs_cupertino/example/lib/main.dart index e33e53e4..c27ba28d 100644 --- a/packages/flutterjs_cupertino/example/lib/main.dart +++ b/packages/flutterjs_cupertino/example/lib/main.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutter/material.dart'; void main() { @@ -32,7 +36,8 @@ class _ExamplePageState extends State { void _testPackage() { setState(() { // This will call the JavaScript implementation when running with FlutterJS - result = 'FlutterjsCupertino is ready!\n\nRun: flutterjs run --to-js --serve'; + result = + 'FlutterjsCupertino is ready!\n\nRun: flutterjs run --to-js --serve'; }); } diff --git a/packages/flutterjs_cupertino/flutterjs_cupertino/build.js b/packages/flutterjs_cupertino/flutterjs_cupertino/build.js index 854be9d6..9cba13a4 100644 --- a/packages/flutterjs_cupertino/flutterjs_cupertino/build.js +++ b/packages/flutterjs_cupertino/flutterjs_cupertino/build.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * Build script for @flutterjs/flutterjs_cupertino * diff --git a/packages/flutterjs_cupertino/flutterjs_cupertino/package.json b/packages/flutterjs_cupertino/flutterjs_cupertino/package.json index 261be321..da2f3823 100644 --- a/packages/flutterjs_cupertino/flutterjs_cupertino/package.json +++ b/packages/flutterjs_cupertino/flutterjs_cupertino/package.json @@ -1,6 +1,6 @@ { "name": "@flutterjs/flutterjs_cupertino", - "version": "0.1.0", + "version": "1.0.0", "description": "A FlutterJS package", "main": "src/index.js", "type": "module", diff --git a/packages/flutterjs_cupertino/flutterjs_cupertino/src/index.js b/packages/flutterjs_cupertino/flutterjs_cupertino/src/index.js index 7187a7bb..fd5ac9e6 100644 --- a/packages/flutterjs_cupertino/flutterjs_cupertino/src/index.js +++ b/packages/flutterjs_cupertino/flutterjs_cupertino/src/index.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * FlutterJS FlutterjsCupertino * diff --git a/packages/flutterjs_cupertino/lib/flutterjs_cupertino.dart b/packages/flutterjs_cupertino/lib/flutterjs_cupertino.dart index d83a9649..e5bc11fb 100644 --- a/packages/flutterjs_cupertino/lib/flutterjs_cupertino.dart +++ b/packages/flutterjs_cupertino/lib/flutterjs_cupertino.dart @@ -1,25 +1,29 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /// FlutterJS FlutterjsCupertino -/// +/// /// A FlutterJS package -/// +/// /// The actual implementation is in JavaScript. /// This package is a metadata wrapper published to pub.dev. -/// +/// /// ## Usage -/// +/// /// Add to your `pubspec.yaml`: /// ```yaml /// dependencies: /// flutterjs_cupertino: ^0.1.0 /// ``` -/// +/// /// Then run: /// ```bash /// flutterjs get /// ``` -/// +/// /// The package will be installed to: `build/flutterjs/node_modules/@flutterjs/flutterjs_cupertino` -/// +/// /// See `example/` for a complete working app. library flutterjs_cupertino; diff --git a/packages/flutterjs_cupertino/pubspec.yaml b/packages/flutterjs_cupertino/pubspec.yaml index 7468eb53..6d15a58c 100644 --- a/packages/flutterjs_cupertino/pubspec.yaml +++ b/packages/flutterjs_cupertino/pubspec.yaml @@ -1,5 +1,5 @@ name: flutterjs_cupertino -version: 0.1.0 +version: 1.0.0 description: A FlutterJS package homepage: https://github.com/flutterjs/flutterjs_cupertino diff --git a/packages/flutterjs_dart/build.js b/packages/flutterjs_dart/build.js index 2729fe5a..948dfb49 100644 --- a/packages/flutterjs_dart/build.js +++ b/packages/flutterjs_dart/build.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import esbuild from 'esbuild'; import { readFileSync, writeFileSync, readdirSync, statSync, watch } from 'fs'; import { join, relative, extname } from 'path'; diff --git a/packages/flutterjs_dart/dist/async/index.js b/packages/flutterjs_dart/dist/async/index.js index 7624ae0c..8acf7a9d 100644 --- a/packages/flutterjs_dart/dist/async/index.js +++ b/packages/flutterjs_dart/dist/async/index.js @@ -1,2 +1,6 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class l{constructor(e,t){this._timer=setTimeout(t,e.inMilliseconds||e)}static periodic(e,t){const s=new l(0,()=>{});return clearTimeout(s._timer),s._timer=setInterval(()=>t(s),e.inMilliseconds||e),s}static run(e){setTimeout(e,0)}cancel(){clearTimeout(this._timer),clearInterval(this._timer)}}class i{constructor(e){this._promise=new Promise((t,s)=>{try{const r=e();t(r)}catch(r){s(r)}})}static _wrap(e){const t=new i(()=>{});return t._promise=e,t}static value(e){return i._wrap(Promise.resolve(e))}static error(e){return i._wrap(Promise.reject(e))}static delayed(e,t){return i._wrap(new Promise((s,r)=>{setTimeout(()=>{try{s(t?t():null)}catch(o){r(o)}},e.inMilliseconds||e)}))}static wait(e){const t=e.map(s=>s instanceof i?s._promise:s);return i._wrap(Promise.all(t))}then(e,{onError:t}={}){const s=this._promise.then(r=>e(r),r=>{if(t)return t(r);throw r});return i._wrap(s)}catchError(e,{test:t}={}){const s=this._promise.catch(r=>{if(t&&!t(r))throw r;return e(r)});return i._wrap(s)}whenComplete(e){const t=this._promise.finally(()=>e());return i._wrap(t)}thenJS(e,t){return this._promise.then(e,t)}}class d{constructor(){this.future=new i(()=>{}),this.future._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}complete(e){this._resolve(e)}completeError(e){this._reject(e)}get isCompleted(){return!1}}class h{constructor(e){this.callbacks=e,this.isPaused=!1,this.isCanceled=!1}cancel(){this.isCanceled=!0,this.callbacks&&this.callbacks.onCancel&&this.callbacks.onCancel()}pause(){this.isPaused=!0}resume(){this.isPaused=!1}}class u{constructor(e){this._onListen=e}listen(e,{onError:t,onDone:s,cancelOnError:r}={}){const o=new h({onData:e,onError:t,onDone:s,onCancel:()=>{}});if(this._onListen){const c=this._onListen(o);c&&typeof c=="function"&&(o.callbacks.onCancel=c)}return o}map(e){const t=new a;return this.listen(s=>t.add(e(s)),{onError:s=>t.addError(s),onDone:()=>t.close()}),t.stream}static fromIterable(e){const t=new a;return setTimeout(()=>{for(const s of e){if(t.isClosed)break;t.add(s)}t.isClosed||t.close()},0),t.stream}}class a{constructor(){this._listeners=[],this.isClosed=!1}get stream(){return this._stream||(this._stream=new u(e=>(this._listeners.push(e),()=>{const t=this._listeners.indexOf(e);t>=0&&this._listeners.splice(t,1)}))),this._stream}get hasListener(){return this._listeners.length>0}add(e){this.isClosed||[...this._listeners].forEach(t=>{!t.isCanceled&&!t.isPaused&&t.callbacks.onData&&t.callbacks.onData(e)})}addError(e){this.isClosed||[...this._listeners].forEach(t=>{!t.isCanceled&&!t.isPaused&&t.callbacks.onError&&t.callbacks.onError(e)})}close(){this.isClosed||(this.isClosed=!0,[...this._listeners].forEach(e=>{!e.isCanceled&&!e.isPaused&&e.callbacks.onDone&&e.callbacks.onDone()}),this._listeners=[])}}class m{static get current(){return p}fork({specification:e,zoneValues:t}={}){return this}run(e){return e()}bindCallback(e){return e}bindUnaryCallback(e){return e}bindBinaryCallback(e){return e}}const p=new m;function f(n,{zoneValues:e,zoneSpecification:t,onError:s}={}){return n()}function _(n,e,{zoneValues:t,zoneSpecification:s}={}){try{return n()}catch(r){e(r,null)}}export{d as Completer,i as Future,u as Stream,a as StreamController,h as StreamSubscription,l as Timer,m as Zone,f as runZoned,_ as runZonedGuarded}; //# sourceMappingURL=index.js.map diff --git a/packages/flutterjs_dart/dist/collection/index.js b/packages/flutterjs_dart/dist/collection/index.js index 1655edec..7f42cb5e 100644 --- a/packages/flutterjs_dart/dist/collection/index.js +++ b/packages/flutterjs_dart/dist/collection/index.js @@ -1,2 +1,6 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class l{constructor(){this._list=[]}add(t){this._list.push(t)}addFirst(t){this._list.unshift(t)}addLast(t){this._list.push(t)}removeFirst(){return this._list.shift()}removeLast(){return this._list.pop()}get first(){return this._list[0]}get last(){return this._list[this._list.length-1]}get length(){return this._list.length}get isEmpty(){return this._list.length===0}get isNotEmpty(){return this._list.length>0}toList(){return[...this._list]}}class h{constructor(){this._head=null,this._tail=null,this._length=0}add(t){this._head?(this._tail.next=t,t.previous=this._tail,this._tail=t):(this._head=t,this._tail=t),this._length++}get length(){return this._length}}class n{constructor(){this.list=null,this.previous=null,this.next=null}unlink(){}}const o=Map,a=Set;class p{constructor(t){this._list=Array.from(t)}get length(){return this._list.length}operator_get(t){return this._list[t]}}class u{constructor(t){this._map=t}}class g{constructor(t){this._set=t}}class e{get isEmpty(){return this.length===0}get isNotEmpty(){return this.length>0}}class i{get isEmpty(){return this.length===0}get isNotEmpty(){return this.length>0}}class r{get isEmpty(){return this.length===0}get isNotEmpty(){return this.length>0}}class _{}class c extends e{}class x extends i{}class d extends r{}export*from"./priority_queue.js";export*from"./queue_list.js";export{o as HashMap,a as HashSet,_ as IterableBase,h as LinkedList,n as LinkedListEntry,c as ListBase,e as ListMixin,x as MapBase,i as MapMixin,l as Queue,d as SetBase,r as SetMixin,p as UnmodifiableListView,u as UnmodifiableMapView,g as UnmodifiableSetView}; //# sourceMappingURL=index.js.map diff --git a/packages/flutterjs_dart/dist/collection/priority_queue.js b/packages/flutterjs_dart/dist/collection/priority_queue.js index 72ac1c44..a02f8fe6 100644 --- a/packages/flutterjs_dart/dist/collection/priority_queue.js +++ b/packages/flutterjs_dart/dist/collection/priority_queue.js @@ -1,2 +1,6 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class n{constructor(e){this.comparison=e||((t,u)=>tu?1:0),this._queue=[],this._modificationCount=0}get length(){return this._queue.length}get isEmpty(){return this._queue.length===0}get isNotEmpty(){return this._queue.length>0}get first(){if(this._queue.length===0)throw new Error("No element");return this._queue[0]}add(e){this._modificationCount++,this._queue.push(e),this._bubbleUp(this._queue.length-1)}addAll(e){for(const t of e)this.add(t)}removeFirst(){if(this._queue.length===0)throw new Error("No element");this._modificationCount++;const e=this._queue[0],t=this._queue.pop();return this._queue.length>0&&(this._queue[0]=t,this._bubbleDown(0)),e}remove(e){const t=this._queue.indexOf(e);if(t<0)return!1;this._modificationCount++;const u=this._queue.pop();return t0;){const t=e-1>>>1;if(this.comparison(this._queue[e],this._queue[t])>=0)break;this._swap(e,t),e=t}}_bubbleDown(e){const t=this._queue.length;for(;;){const u=e*2+1;if(u>=t)break;let s=u+1,i=u;if(sn in e?a(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var s=(e,n,r)=>(l(e,typeof n!="symbol"?n+"":n,r),r);class w{constructor(){s(this,"name","unknown")}decode(n){throw new Error("Unimplemented: Encoding.decode")}encode(n){throw new Error("Unimplemented: Encoding.encode")}static getByName(n){return n==="utf-8"||n==="utf8"?x:n==="json"?p:null}}const p={decode:e=>JSON.parse(e),encode:e=>JSON.stringify(e)};function y(e){return JSON.parse(e)}function E(e){return JSON.stringify(e)}const u=typeof TextEncoder<"u"?new TextEncoder:null,i=typeof TextDecoder<"u"?new TextDecoder:null,x={name:"utf-8",encode:e=>u?u.encode(e):new Uint8Array(Buffer.from(e,"utf-8")),decode:e=>i?i.decode(e):Buffer.from(e).toString("utf-8")};class f{static encode(n){let r="";const o=n.byteLength;for(let t=0;t=this.left&&t.x=this.top&&t.y=this.left&&t.right<=this.right&&t.top>=this.top&&t.bottom<=this.bottom}}class N extends h{constructor(t,o,s,n){super(t,o,s,n)}}class O{constructor(t){}nextInt(t){return Math.floor(Math.random()*t)}nextDouble(){return Math.random()}nextBool(){return Math.random()>=.5}}export{a as E,i as LN10,x as LN2,p as LOG10E,c as LOG2E,N as MutableRectangle,M as PI,r as Point,O as Random,h as Rectangle,u as SQRT1_2,g as SQRT2,f as acos,w as asin,E as atan,S as atan2,R as cos,T as exp,q as log,d as max,l as min,G as pow,y as sign,L as sin,m as sqrt,b as tan}; //# sourceMappingURL=index.js.map diff --git a/packages/flutterjs_dart/dist/typed_data/index.js b/packages/flutterjs_dart/dist/typed_data/index.js index a703c34e..16fd022c 100644 --- a/packages/flutterjs_dart/dist/typed_data/index.js +++ b/packages/flutterjs_dart/dist/typed_data/index.js @@ -1,2 +1,6 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + const a=Uint8Array,c=Int8Array,h=Uint8ClampedArray,l=Uint16Array,u=Int16Array,x=Uint32Array,p=Int32Array,y=Float32Array,w=Float64Array;class _{constructor(t,s=0,e){t instanceof ArrayBuffer?this._view=new DataView(t,s,e):t instanceof Uint8Array||t instanceof a?this._view=new DataView(t.buffer,t.byteOffset+s,e):this._view=new DataView(new ArrayBuffer(t))}getInt8(t){return this._view.getInt8(t)}setInt8(t,s){this._view.setInt8(t,s)}getUint8(t){return this._view.getUint8(t)}setUint8(t,s){this._view.setUint8(t,s)}getInt16(t,s){return this._view.getInt16(t,s===1)}setInt16(t,s,e){this._view.setInt16(t,s,e===1)}get buffer(){return this._view.buffer}}class g{constructor(t){this._data=t}get lengthInBytes(){return this._data.byteLength||this._data.length||0}}class I{constructor(t,s,e,o){}}class r{constructor(t,s,e,o){}static zero(){return new r(0,0,0,0)}}class i{constructor(t,s){}static zero(){return new i(0,0)}}class U{}class L{}class A{}class d{}class v{}class B{constructor({copy:t=!0}={}){this._chunks=[],this._length=0}add(t){this._chunks.push(t),this._length+=t.length}addByte(t){this._chunks.push(new Uint8Array([t])),this._length++}takeBytes(){const t=this.toBytes();return this.clear(),t}toBytes(){const t=new Uint8Array(this._length);let s=0;for(const e of this._chunks)t.set(e,s),s+=e.length;return t}clear(){this._chunks=[],this._length=0}}export{g as ByteBuffer,_ as ByteData,B as BytesBuilder,y as Float32List,r as Float32x4,L as Float32x4List,w as Float64List,i as Float64x2,A as Float64x2List,u as Int16List,p as Int32List,I as Int32x4,U as Int32x4List,v as Int64List,c as Int8List,l as Uint16List,x as Uint32List,d as Uint64List,h as Uint8ClampedList,a as Uint8List}; //# sourceMappingURL=index.js.map diff --git a/packages/flutterjs_dart/dist/ui/index.js b/packages/flutterjs_dart/dist/ui/index.js index 48e410cf..04554bb6 100644 --- a/packages/flutterjs_dart/dist/ui/index.js +++ b/packages/flutterjs_dart/dist/ui/index.js @@ -1,2 +1,6 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class i{constructor(t,r){this.dx=t,this.dy=r}get distance(){return Math.sqrt(this.dx*this.dx+this.dy*this.dy)}static get zero(){return new i(0,0)}static get infinite(){return new i(1/0,1/0)}translate(t,r){return new i(this.dx+t,this.dy+r)}scale(t,r){return new i(this.dx*t,this.dy*r)}}class n{constructor(t,r){this.width=t,this.height=r}static get zero(){return new n(0,0)}static get infinite(){return new n(1/0,1/0)}}class s{constructor(t,r,e,h){this.left=t,this.top=r,this.right=e,this.bottom=h}get width(){return this.right-this.left}get height(){return this.bottom-this.top}static fromLTWH(t,r,e,h){return new s(t,r,t+e,r+h)}static fromCircle(t,r){return new s(t.dx-r,t.dy-r,t.dx+r,t.dy+r)}}class a{constructor(t){this.value=t}get alpha(){return this.value>>24&255}get opacity(){return this.alpha/255}get red(){return this.value>>16&255}get green(){return this.value>>8&255}get blue(){return this.value&255}withOpacity(t){t=Math.max(0,Math.min(1,t));const r=Math.round(t*255);return new a(this.value&16777215|r<<24)}}class u{constructor(t){this.x=t,this.y=t}static circular(t){return new u(t)}}class c{constructor(){this._rect=new s(0,0,0,0)}static fromRectAndRadius(t,r){const e=new c;return e._rect=t,e}}var o={Offset:i,Size:n,Rect:s,Color:a,Radius:u,RRect:c};export{a as Color,i as Offset,c as RRect,u as Radius,s as Rect,n as Size,o as default}; //# sourceMappingURL=index.js.map diff --git a/packages/flutterjs_dart/package.json b/packages/flutterjs_dart/package.json index 30b9a41e..c10e766c 100644 --- a/packages/flutterjs_dart/package.json +++ b/packages/flutterjs_dart/package.json @@ -32,6 +32,6 @@ "stdlib" ], "author": "", - "license": "MIT", + "license": "BSD-3-Clause", "dependencies": {} -} +} \ No newline at end of file diff --git a/packages/flutterjs_dart/src/async/index.js b/packages/flutterjs_dart/src/async/index.js index 9a40a5e9..61db0b3e 100644 --- a/packages/flutterjs_dart/src/async/index.js +++ b/packages/flutterjs_dart/src/async/index.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // dart:async implementation export class Timer { diff --git a/packages/flutterjs_dart/src/collection/index.js b/packages/flutterjs_dart/src/collection/index.js index 4052d8b1..059f319d 100644 --- a/packages/flutterjs_dart/src/collection/index.js +++ b/packages/flutterjs_dart/src/collection/index.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // dart:collection implementation export class Queue { diff --git a/packages/flutterjs_dart/src/collection/priority_queue.js b/packages/flutterjs_dart/src/collection/priority_queue.js index caf2d700..2278ff73 100644 --- a/packages/flutterjs_dart/src/collection/priority_queue.js +++ b/packages/flutterjs_dart/src/collection/priority_queue.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + export class PriorityQueue { constructor(comparison) { this.comparison = comparison || ((a, b) => a < b ? -1 : (a > b ? 1 : 0)); diff --git a/packages/flutterjs_dart/src/collection/queue_list.js b/packages/flutterjs_dart/src/collection/queue_list.js index e2fce651..247b768f 100644 --- a/packages/flutterjs_dart/src/collection/queue_list.js +++ b/packages/flutterjs_dart/src/collection/queue_list.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import { Queue } from "./index.js"; export class QueueList extends Queue { diff --git a/packages/flutterjs_dart/src/convert/index.js b/packages/flutterjs_dart/src/convert/index.js index 4277f5ce..c4634f94 100644 --- a/packages/flutterjs_dart/src/convert/index.js +++ b/packages/flutterjs_dart/src/convert/index.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // dart:convert implementation // --- Encoding Base Class --- diff --git a/packages/flutterjs_dart/src/core/index.js b/packages/flutterjs_dart/src/core/index.js index 38250b3d..882c163e 100644 --- a/packages/flutterjs_dart/src/core/index.js +++ b/packages/flutterjs_dart/src/core/index.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // ============================================================================ // dart:core - Core Dart types and interfaces // ============================================================================ diff --git a/packages/flutterjs_dart/src/developer/index.js b/packages/flutterjs_dart/src/developer/index.js index 545f7fd7..89c87fad 100644 --- a/packages/flutterjs_dart/src/developer/index.js +++ b/packages/flutterjs_dart/src/developer/index.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // dart:developer implementation export function log(message, { time, sequenceNumber, level = 0, name = '', zone, error, stackTrace } = {}) { diff --git a/packages/flutterjs_dart/src/index.js b/packages/flutterjs_dart/src/index.js index ad79fe43..d67f1841 100644 --- a/packages/flutterjs_dart/src/index.js +++ b/packages/flutterjs_dart/src/index.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + export * as core from './core/index.js'; export * as math from './math/index.js'; export * as async from './async/index.js'; diff --git a/packages/flutterjs_dart/src/js_interop/index.js b/packages/flutterjs_dart/src/js_interop/index.js index 568bce6f..6d39be1b 100644 --- a/packages/flutterjs_dart/src/js_interop/index.js +++ b/packages/flutterjs_dart/src/js_interop/index.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * Dart JS Interop Library diff --git a/packages/flutterjs_dart/src/js_interop_unsafe/index.js b/packages/flutterjs_dart/src/js_interop_unsafe/index.js index 1c7f1ad6..2c46c894 100644 --- a/packages/flutterjs_dart/src/js_interop_unsafe/index.js +++ b/packages/flutterjs_dart/src/js_interop_unsafe/index.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * Dart JS Interop Unsafe Library diff --git a/packages/flutterjs_dart/src/math/index.js b/packages/flutterjs_dart/src/math/index.js index e1132c62..c8522a2a 100644 --- a/packages/flutterjs_dart/src/math/index.js +++ b/packages/flutterjs_dart/src/math/index.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // dart:math implementation export const E = Math.E; diff --git a/packages/flutterjs_dart/src/typed_data/index.js b/packages/flutterjs_dart/src/typed_data/index.js index 43a543d2..2b5c4513 100644 --- a/packages/flutterjs_dart/src/typed_data/index.js +++ b/packages/flutterjs_dart/src/typed_data/index.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // dart:typed_data implementation export const Uint8List = Uint8Array; diff --git a/packages/flutterjs_dart/src/ui/index.js b/packages/flutterjs_dart/src/ui/index.js index 26135b37..af3ce1b2 100644 --- a/packages/flutterjs_dart/src/ui/index.js +++ b/packages/flutterjs_dart/src/ui/index.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * ============================================================================ * dart:ui - Basic implementation for FlutterJS diff --git a/packages/flutterjs_dev_tools/lib/dev_tools.dart b/packages/flutterjs_dev_tools/lib/dev_tools.dart index 4ae7ddf4..7c7a64ad 100644 --- a/packages/flutterjs_dev_tools/lib/dev_tools.dart +++ b/packages/flutterjs_dev_tools/lib/dev_tools.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /// Support for doing something awesome. /// /// More dartdocs go here. diff --git a/packages/flutterjs_dev_tools/lib/src/flutterjs_integrated_debugger.dart b/packages/flutterjs_dev_tools/lib/src/flutterjs_integrated_debugger.dart index ed2b5a32..6d976414 100644 --- a/packages/flutterjs_dev_tools/lib/src/flutterjs_integrated_debugger.dart +++ b/packages/flutterjs_dev_tools/lib/src/flutterjs_integrated_debugger.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'dart:async'; import 'dart:io'; import 'package:intl/intl.dart'; @@ -6,7 +10,7 @@ import 'package:watcher/watcher.dart'; enum DebugLevel { trace, debug, info, warn, error } /// ============================================================================ -/// Flutter.js Integrated Debugger System +/// FlutterJS Integrated Debugger System /// /// Integrates with: flutterjs.dart (CLI) → run_command.dart (pipeline) → ir_server.dart (UI) /// @@ -73,7 +77,7 @@ class FlutterJSIntegratedDebugger { static void _printBanner({required bool verbose}) { print('\n┌────────────────────────────────────────────────────────────┐'); - print('│ 🛠 Flutter.js Integrated Debugger │'); + print('│ 🛠 FlutterJS Integrated Debugger │'); if (verbose) { print('│ Mode: VERBOSE (trace level) │'); } else { diff --git a/packages/flutterjs_dev_tools/lib/src/html_generator.dart b/packages/flutterjs_dev_tools/lib/src/html_generator.dart index 0c4f7e3b..11179a16 100644 --- a/packages/flutterjs_dev_tools/lib/src/html_generator.dart +++ b/packages/flutterjs_dev_tools/lib/src/html_generator.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'package:flutterjs_dev_tools/src/ir_view/html_scripts.dart'; import 'package:flutterjs_dev_tools/src/ir_view/html_scripts_left_panel.dart'; import 'package:flutterjs_dev_tools/src/ir_view/html_scripts_right_panel.dart'; diff --git a/packages/flutterjs_dev_tools/lib/src/ir_server.dart b/packages/flutterjs_dev_tools/lib/src/ir_server.dart index b8115a4a..c472f60a 100644 --- a/packages/flutterjs_dev_tools/lib/src/ir_server.dart +++ b/packages/flutterjs_dev_tools/lib/src/ir_server.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // ============================================================================ // FILE: ir_server_enhanced.dart // Complete Dart backend with error handling, caching, validation, timing diff --git a/packages/flutterjs_dev_tools/lib/src/ir_view/html_scripts.dart b/packages/flutterjs_dev_tools/lib/src/ir_view/html_scripts.dart index 00a6d639..1c11b32a 100644 --- a/packages/flutterjs_dev_tools/lib/src/ir_view/html_scripts.dart +++ b/packages/flutterjs_dev_tools/lib/src/ir_view/html_scripts.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class HtmlScripts { static String getScripts() => ''' // ============================================================================ diff --git a/packages/flutterjs_dev_tools/lib/src/ir_view/html_scripts_left_panel.dart b/packages/flutterjs_dev_tools/lib/src/ir_view/html_scripts_left_panel.dart index 73362e59..d03e69b6 100644 --- a/packages/flutterjs_dev_tools/lib/src/ir_view/html_scripts_left_panel.dart +++ b/packages/flutterjs_dev_tools/lib/src/ir_view/html_scripts_left_panel.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class HtmlScriptsLeftPanel { static String getLeftPanelScript() => ''' // ============================================================================ diff --git a/packages/flutterjs_dev_tools/lib/src/ir_view/html_scripts_right_panel.dart b/packages/flutterjs_dev_tools/lib/src/ir_view/html_scripts_right_panel.dart index ec422023..ee02e059 100644 --- a/packages/flutterjs_dev_tools/lib/src/ir_view/html_scripts_right_panel.dart +++ b/packages/flutterjs_dev_tools/lib/src/ir_view/html_scripts_right_panel.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class HtmlScriptsRightPanel { static String getRightPanelScript() => ''' // ============================================================================ diff --git a/packages/flutterjs_dev_tools/lib/src/ir_view/html_scripts_utilities.dart b/packages/flutterjs_dev_tools/lib/src/ir_view/html_scripts_utilities.dart index ff045eee..4a8d20fb 100644 --- a/packages/flutterjs_dev_tools/lib/src/ir_view/html_scripts_utilities.dart +++ b/packages/flutterjs_dev_tools/lib/src/ir_view/html_scripts_utilities.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class HtmlScriptsUtilities { static String getUtilitiesScript() => ''' // ============================================================================ diff --git a/packages/flutterjs_dev_tools/lib/src/ir_view/html_styles.dart b/packages/flutterjs_dev_tools/lib/src/ir_view/html_styles.dart index 3960520d..bc80c933 100644 --- a/packages/flutterjs_dev_tools/lib/src/ir_view/html_styles.dart +++ b/packages/flutterjs_dev_tools/lib/src/ir_view/html_styles.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class HtmlStyles { static String getStyles() => ''' * { margin: 0; padding: 0; box-sizing: border-box; } diff --git a/packages/flutterjs_dev_tools/lib/src/ir_view/html_styles_left_panel.dart b/packages/flutterjs_dev_tools/lib/src/ir_view/html_styles_left_panel.dart index 9c69bc63..030b778e 100644 --- a/packages/flutterjs_dev_tools/lib/src/ir_view/html_styles_left_panel.dart +++ b/packages/flutterjs_dev_tools/lib/src/ir_view/html_styles_left_panel.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class HtmlStylesLeftPanel { static String getHtmlStylesLeftPanel() => ''' /* ============================================================================ diff --git a/packages/flutterjs_dev_tools/lib/src/ir_view/html_styles_right_panel.dart b/packages/flutterjs_dev_tools/lib/src/ir_view/html_styles_right_panel.dart index 99081d42..9c1732ad 100644 --- a/packages/flutterjs_dev_tools/lib/src/ir_view/html_styles_right_panel.dart +++ b/packages/flutterjs_dev_tools/lib/src/ir_view/html_styles_right_panel.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class HtmlRightPannelStyles { static String getHtmlRightPannelStyles() => ''' /* ============================================================================ diff --git a/packages/flutterjs_dev_tools/lib/src/json_view/html_scripts_json_reader.dart b/packages/flutterjs_dev_tools/lib/src/json_view/html_scripts_json_reader.dart index d2dcc212..74dfd854 100644 --- a/packages/flutterjs_dev_tools/lib/src/json_view/html_scripts_json_reader.dart +++ b/packages/flutterjs_dev_tools/lib/src/json_view/html_scripts_json_reader.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class HtmlScriptsJsonReader { static String getJsonReaderScript() => ''' // ============================================================================ diff --git a/packages/flutterjs_dev_tools/lib/src/json_view/html_styles_json_reader.dart b/packages/flutterjs_dev_tools/lib/src/json_view/html_styles_json_reader.dart index 03c71cf9..7ef319f0 100644 --- a/packages/flutterjs_dev_tools/lib/src/json_view/html_styles_json_reader.dart +++ b/packages/flutterjs_dev_tools/lib/src/json_view/html_styles_json_reader.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + class HtmlStylesJsonReader { static String getJsonReaderStyles() => ''' /* JSON READER STYLES */ diff --git a/packages/flutterjs_dev_tools/test/dev_tools_test.dart b/packages/flutterjs_dev_tools/test/dev_tools_test.dart index 627e4455..c1ce6454 100644 --- a/packages/flutterjs_dev_tools/test/dev_tools_test.dart +++ b/packages/flutterjs_dev_tools/test/dev_tools_test.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // import 'package:flutterjs_dev_tools/dev_tools.dart'; // import 'package:test/test.dart'; diff --git a/packages/flutterjs_dev_utils/lib/dev_utils.dart b/packages/flutterjs_dev_utils/lib/dev_utils.dart index 8b137891..5fc36956 100644 --- a/packages/flutterjs_dev_utils/lib/dev_utils.dart +++ b/packages/flutterjs_dev_utils/lib/dev_utils.dart @@ -1 +1,3 @@ - +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. diff --git a/packages/flutterjs_dev_utils/test/dev_utils_test.dart b/packages/flutterjs_dev_utils/test/dev_utils_test.dart index 4219381c..a40941b4 100644 --- a/packages/flutterjs_dev_utils/test/dev_utils_test.dart +++ b/packages/flutterjs_dev_utils/test/dev_utils_test.dart @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // import 'package:flutterjs_dev_utils/flutterjs_dev_utils.dart'; // import 'package:test/test.dart'; diff --git a/packages/flutterjs_engine/bin/index.js b/packages/flutterjs_engine/bin/index.js index 6a3932d0..49b4a379 100644 --- a/packages/flutterjs_engine/bin/index.js +++ b/packages/flutterjs_engine/bin/index.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + #!/usr/bin/env node /** diff --git a/packages/flutterjs_engine/bin/project-loader.js b/packages/flutterjs_engine/bin/project-loader.js index 96d90549..a16b6cdf 100644 --- a/packages/flutterjs_engine/bin/project-loader.js +++ b/packages/flutterjs_engine/bin/project-loader.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * ============================================================================ * FlutterJS Configuration Loader - Complete Implementation diff --git a/packages/flutterjs_engine/example/counter/README.md b/packages/flutterjs_engine/example/counter/README.md index b62d0553..43eb270c 100644 --- a/packages/flutterjs_engine/example/counter/README.md +++ b/packages/flutterjs_engine/example/counter/README.md @@ -1,6 +1,6 @@ # counter -A Flutter.js application. +A FlutterJS application. ## Getting Started @@ -65,5 +65,5 @@ Edit `flutter.config.js` to customize: ## Learn More -- [Flutter.js Documentation](https://flutter-js.dev) +- [FlutterJS Documentation](https://flutter-js.dev) - [Flutter Documentation](https://flutter.dev) diff --git a/packages/flutterjs_engine/example/counter/flutterjs.config.js b/packages/flutterjs_engine/example/counter/flutterjs.config.js index b0c4ebb1..78a3d3eb 100644 --- a/packages/flutterjs_engine/example/counter/flutterjs.config.js +++ b/packages/flutterjs_engine/example/counter/flutterjs.config.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // ============================================================================ // 1. PERFECT flutterjs.config.js @@ -7,7 +11,7 @@ module.exports = { // Project Identity project: { name: 'counter-app', - description: 'A Flutter.js Counter Application', + description: 'A FlutterJS Counter Application', version: '1.0.0', }, diff --git a/packages/flutterjs_engine/example/counter/package.json b/packages/flutterjs_engine/example/counter/package.json index 3f6ee8fa..fb212d20 100644 --- a/packages/flutterjs_engine/example/counter/package.json +++ b/packages/flutterjs_engine/example/counter/package.json @@ -1,7 +1,7 @@ { "name": "counter-app", "version": "1.0.0", - "description": "A Flutter.js Counter Application - Demonstrating State Management & Material Design", + "description": "A FlutterJS Counter Application - Demonstrating State Management & Material Design", "type": "module", "main": "dist/index.html", "module": "src/main.fjs", diff --git a/packages/flutterjs_engine/package.json b/packages/flutterjs_engine/package.json index c89a34be..94e19b4e 100644 --- a/packages/flutterjs_engine/package.json +++ b/packages/flutterjs_engine/package.json @@ -2,7 +2,7 @@ "name": "flutterjs", "version": "1.0.0", "type": "module", - "description": "Lightweight Flutter.js CLI with zero external dependencies - Build tool for Flutter to JavaScript projects", + "description": "Lightweight FlutterJS CLI with zero external dependencies - Build tool for Flutter to JavaScript projects", "main": "bin/index.js", "bin": { "flutterjs": "./bin/index.js" @@ -51,7 +51,7 @@ "zero-dependency" ], "author": "jayprakash.pal@flutterjs.dev", - "license": "MIT", + "license": "BSD-3-Clause", "engines": { "node": ">=14.0.0" }, @@ -94,5 +94,5 @@ "bugs": { "url": "https://github.com/flutterjsdev/flutterjs/issues" }, - "homepage": "https://github.com/flutterjsdev/flutterjs#readme" + "homepage": "https://flutterjs.dev" } \ No newline at end of file diff --git a/packages/flutterjs_engine/src/build_integration.js b/packages/flutterjs_engine/src/build_integration.js index 5c99fb45..a8606569 100644 --- a/packages/flutterjs_engine/src/build_integration.js +++ b/packages/flutterjs_engine/src/build_integration.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * ============================================================================ * BuildIntegration - Build Pipeline Orchestrator diff --git a/packages/flutterjs_engine/src/build_integration_analyzer.js b/packages/flutterjs_engine/src/build_integration_analyzer.js index 8dc75f0c..36657173 100644 --- a/packages/flutterjs_engine/src/build_integration_analyzer.js +++ b/packages/flutterjs_engine/src/build_integration_analyzer.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + console.log("HELLO FROM BUILD ANALYZER - VERIFYING EXECUTION"); /** * ============================================================================ diff --git a/packages/flutterjs_engine/src/build_integration_generator.js b/packages/flutterjs_engine/src/build_integration_generator.js index e9c81752..113d5b40 100644 --- a/packages/flutterjs_engine/src/build_integration_generator.js +++ b/packages/flutterjs_engine/src/build_integration_generator.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * ============================================================================ * BuildGenerator - Output Generation & Reporting (Phases 8-10) diff --git a/packages/flutterjs_engine/src/build_pipeline.js b/packages/flutterjs_engine/src/build_pipeline.js index 1f673345..9d710f38 100644 --- a/packages/flutterjs_engine/src/build_pipeline.js +++ b/packages/flutterjs_engine/src/build_pipeline.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * ============================================================================ * FlutterJS Build Pipeline - SIMPLIFIED diff --git a/packages/flutterjs_engine/src/code_transformer.js b/packages/flutterjs_engine/src/code_transformer.js index ef466c1a..49d4b038 100644 --- a/packages/flutterjs_engine/src/code_transformer.js +++ b/packages/flutterjs_engine/src/code_transformer.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + /** * ============================================================================ * FlutterJS Code Transformer - Complete Implementation diff --git a/packages/flutterjs_engine/src/debug_rewriter.js b/packages/flutterjs_engine/src/debug_rewriter.js index e86cfa6f..3f18b285 100644 --- a/packages/flutterjs_engine/src/debug_rewriter.js +++ b/packages/flutterjs_engine/src/debug_rewriter.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import ImportRewriter from './import_rewriter.js'; import path from 'path'; diff --git a/packages/flutterjs_engine/src/debug_server.js b/packages/flutterjs_engine/src/debug_server.js index 6585524e..dd2f551b 100644 --- a/packages/flutterjs_engine/src/debug_server.js +++ b/packages/flutterjs_engine/src/debug_server.js @@ -1,3 +1,7 @@ +// Copyright 2025 The FlutterJS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + // debug-server.js - FIXED: Properly display logger data from analysis const http = require('http'); const fs = require('fs'); @@ -177,7 +181,7 @@ function serveDevToolsUI(devServerUrl) { - Flutter.js DevTools - Analysis Dashboard + FlutterJS DevTools - Analysis Dashboard