diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84037543..4129d88a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,23 +13,25 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive - # --- Force install Flutter 3.29 manually --- - - name: Install Flutter 3.29 - run: | - git clone https://github.com/flutter/flutter.git --depth 1 --branch 3.29.0 $HOME/flutter - echo "$HOME/flutter/bin" >> $GITHUB_PATH + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + cache: true - # Verify correct version (CRITICAL) + # Verify correct version - name: Verify Flutter & Dart run: | - which flutter flutter --version dart --version # Workspace pub get - name: Install dependencies - run: flutter pub get + run: dart pub get - name: Verify formatting run: dart format --output=none --set-exit-if-changed . diff --git a/.gitignore b/.gitignore index 52c28fc0..3a0e9831 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,6 @@ pubspec_overrides.yaml # βœ… NEW: Ignore build info files **/.build_info.json + +# Marketing and private drafts +marketing_drafts/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..e9110ad4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "examples/flutterjs_website"] + path = examples/flutterjs_website + url = https://github.com/flutterjsdev/flutterjs_website.git 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/README.md b/README.md index 87ecc273..999d6629 100644 --- a/README.md +++ b/README.md @@ -86,28 +86,49 @@ FlutterJS compiles your Flutter/Dart code to **semantic HTML + CSS + JavaScript* ## Installation -### Option 1: npm (Recommended) +### System Requirements + +To develop with or use FlutterJS, you need: + +- **Dart SDK**: `^3.10.0` or higher (Stable). +- **Node.js**: Required for the JavaScript engine and CLI tools. +- **NPM**: Package manager for JS dependencies. +- **Git**: For managing the monorepo and submodules. +- **Flutter SDK**: (Optional but recommended) For resolving SDK dependencies. + +### Option 1: npm (Recommended for users) ```bash npm install -g flutterjs ``` -### Option 2: From Source (Development) +### Option 2: From Source (For contributors) ```bash -git clone https://github.com/flutterjsdev/flutterjs.git +git clone --recursive https://github.com/flutterjsdev/flutterjs.git cd flutterjs dart pub global activate --source path . +dart pub get +dart run tool/init.dart ``` --- +## Current Status & Progress + +βœ… **CI/CD Stabilized**: Full automation with GitHub Actions, supporting recursive submodules and workspace resolution. +βœ… **Ecosystem Launch**: First official package [`flutterjs_seo`](https://pub.dev/packages/flutterjs_seo) is now live on pub.dev. +βœ… **Modern Dart Support**: Fully compatible with Dart 3.10+ features including dot shorthand and records. +βœ… **Monorepo Readiness**: Standardized workspace structure across all 20+ packages. + +--- + ## Quick Start ### 1. Create a New Project ```bash -flutterjs init my-app +flutter create my-app cd my-app ``` diff --git a/analysis_options.yaml b/analysis_options.yaml index 0a72b357..995312d7 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -7,12 +7,12 @@ analyzer: - "**/build/**" - "**/*.g.dart" - "**/*.freezed.dart" - - "**/test/**" # Exclude all test directories - - "**/node_modules/**" # Exclude node_modules - - "packages/**/dist/**" # Exclude flutterjs_material dist - - "examples/**/build/**" # Exclude example build folders - - "**/*.js" # Exclude all JavaScript files - - "**/*.fjs" # Exclude ES modules + - "**/test/**" + - "**/node_modules/**" + - "packages/**/dist/**" + - "examples/**/build/**" + - "**/*.js" + - "**/*.fjs" # Performance optimizations language: @@ -22,9 +22,29 @@ analyzer: # Reduce analysis scope errors: - # Downgrade some checks to improve speed todo: ignore deprecated_member_use: ignore + use_super_parameters: ignore + prefer_final_fields: ignore + avoid_print: ignore + unnecessary_brace_in_string_interps: ignore + use_key_in_widget_constructors: ignore + file_names: ignore + non_constant_identifier_names: ignore + unintended_html_in_doc_comment: ignore + unused_element: ignore + unnecessary_import: ignore + implementation_imports: ignore + unnecessary_library_name: ignore + dangling_library_doc_comments: ignore + must_be_immutable: ignore + unused_catch_stack: ignore + dead_code: ignore + dead_null_aware_expression: ignore + unrelated_type_equality_checks: ignore + collection_methods_unrelated_type: ignore + depend_on_referenced_packages: ignore + annotate_overrides: ignore # Enable strong mode for better performance strong-mode: @@ -33,5 +53,4 @@ analyzer: linter: rules: - # Disable heavy lint rules if needed - # - avoid_print: false \ No newline at end of file + - avoid_print: false \ No newline at end of file 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/docs/FAQ.md b/doc/FAQ.md similarity index 100% rename from docs/FAQ.md rename to doc/FAQ.md diff --git a/docs/README.md b/doc/README.md similarity index 100% rename from docs/README.md rename to doc/README.md diff --git a/docs/architecture/dart-cli-pipeline.md b/doc/architecture/dart-cli-pipeline.md similarity index 100% rename from docs/architecture/dart-cli-pipeline.md rename to doc/architecture/dart-cli-pipeline.md diff --git a/docs/architecture/overview.md b/doc/architecture/overview.md similarity index 100% rename from docs/architecture/overview.md rename to doc/architecture/overview.md diff --git a/docs/architecture/runtime-engine.md b/doc/architecture/runtime-engine.md similarity index 100% rename from docs/architecture/runtime-engine.md rename to doc/architecture/runtime-engine.md diff --git a/docs/architecture/vdom-rendering.md b/doc/architecture/vdom-rendering.md similarity index 100% rename from docs/architecture/vdom-rendering.md rename to doc/architecture/vdom-rendering.md diff --git a/docs/contributing/CONTRIBUTING.md b/doc/contributing/CONTRIBUTING.md similarity index 100% rename from docs/contributing/CONTRIBUTING.md rename to doc/contributing/CONTRIBUTING.md diff --git a/docs/examples/counter-app.md b/doc/examples/counter-app.md similarity index 100% rename from docs/examples/counter-app.md rename to doc/examples/counter-app.md diff --git a/docs/examples/routing-app.md b/doc/examples/routing-app.md similarity index 100% rename from docs/examples/routing-app.md rename to doc/examples/routing-app.md diff --git a/docs/getting-started/cli-commands.md b/doc/getting-started/cli-commands.md similarity index 100% rename from docs/getting-started/cli-commands.md rename to doc/getting-started/cli-commands.md diff --git a/docs/getting-started/installation.md b/doc/getting-started/installation.md similarity index 100% rename from docs/getting-started/installation.md rename to doc/getting-started/installation.md diff --git a/docs/getting-started/project-structure.md b/doc/getting-started/project-structure.md similarity index 100% rename from docs/getting-started/project-structure.md rename to doc/getting-started/project-structure.md diff --git a/docs/getting-started/quick-start.md b/doc/getting-started/quick-start.md similarity index 100% rename from docs/getting-started/quick-start.md rename to doc/getting-started/quick-start.md diff --git a/docs/guides/devtools-hot-reload.md b/doc/guides/devtools-hot-reload.md similarity index 100% rename from docs/guides/devtools-hot-reload.md rename to doc/guides/devtools-hot-reload.md diff --git a/docs/guides/routing-navigation.md b/doc/guides/routing-navigation.md similarity index 100% rename from docs/guides/routing-navigation.md rename to doc/guides/routing-navigation.md diff --git a/docs/guides/ssr-modes.md b/doc/guides/ssr-modes.md similarity index 100% rename from docs/guides/ssr-modes.md rename to doc/guides/ssr-modes.md diff --git a/docs/guides/state-management.md b/doc/guides/state-management.md similarity index 100% rename from docs/guides/state-management.md rename to doc/guides/state-management.md diff --git a/docs/guides/styling-theming.md b/doc/guides/styling-theming.md similarity index 100% rename from docs/guides/styling-theming.md rename to doc/guides/styling-theming.md diff --git a/docs/guides/widget-catalog.md b/doc/guides/widget-catalog.md similarity index 100% rename from docs/guides/widget-catalog.md rename to doc/guides/widget-catalog.md diff --git a/docs/implementation_plan.md b/doc/implementation_plan.md similarity index 100% rename from docs/implementation_plan.md rename to doc/implementation_plan.md diff --git a/doc/pakage_handler/Flutterjs architecture fix.md b/doc/pakage_handler/Flutterjs architecture fix.md new file mode 100644 index 00000000..33bb2841 --- /dev/null +++ b/doc/pakage_handler/Flutterjs architecture fix.md @@ -0,0 +1,593 @@ +# FlutterJS: How to Fix Your Architecture (Practical Guide) + +## The Problem in One Sentence + +**You're trying to convert packages instead of compiling Dart.** + +Jaspr compiles ALL Dart code automatically. You should too. + +--- + +## Step 1: Understand Your Current Mistake + +### What You're Probably Doing Now: + +```dart +// lib/package_mapper.dart - THIS IS THE WRONG APPROACH + +const packageMappings = { + 'package:http/http.dart': { + 'import': 'axios', // ❌ Wrong + 'methods': { ... } // ❌ Wrong + }, + 'package:shared_preferences/shared_preferences.dart': { + 'import': null, + 'methods': { ... } // ❌ Wrong + }, +}; +``` + +**Why this fails:** +- You're manually mapping every package +- Package maintainers won't support this +- You'll never cover all packages +- New packages break your system + +--- + +## Step 2: The Correct Approach (Dart β†’ JS Compilation) + +### Remove Package Mapping, Add Dart Compilation + +```dart +// lib/dart_compiler/compiler.dart - THIS IS THE RIGHT APPROACH + +class DartCompiler { + /// Compile ANY Dart code to JavaScript + /// The code can use ANY packages that are: + /// 1. Pure Dart + /// 2. Available on pub.dev + /// 3. Already have web implementations + + void compile(DartFile source) { + // Step 1: Parse Dart AST + var ast = parse(source); + + // Step 2: Resolve all dependencies + var dependencies = resolveDependencies(ast); + + // Step 3: For each dependency, check compatibility + for (var dep in dependencies) { + if (canCompile(dep)) { + // Recursively compile the package + compilePackage(dep); + } else if (hasWebCompatibleVersion(dep)) { + // Use the web version instead + compilePackage(getWebVersion(dep)); + } else { + // Can't compile (native only) + warnAboutIncompatibility(dep); + } + } + + // Step 4: Generate JavaScript for the compiled Dart + var js = generateJavaScript(ast); + writeOutput(js); + } + + bool canCompile(Package package) { + // Check if package is pure Dart (no FFI/native code) + return !hasFFIDependencies(package) && + !hasNativePlugins(package) && + !hasPlatformChannels(package); + } + + Package? getWebVersion(Package package) { + // For packages like 'http', there's already 'http/browser.dart' + // For 'shared_preferences', web implementation exists + // This method checks pub.dev for alternatives + + switch (package.name) { + case 'http': + return Package.fromPubSpec('http'); // Has browser_client + case 'shared_preferences': + return Package.fromPubSpec('shared_preferences'); // Has web impl + case 'url_launcher': + return Package.fromPubSpec('url_launcher'); // Has web impl + default: + return null; + } + } +} +``` + +--- + +## Step 3: Build a Dart Platform Compatibility Layer + +### The Key: Handle Platform-Specific Imports + +```dart +// lib/dart_stdlib/compatibility.dart + +/// Maps Dart standard library to web equivalents +class DartPlatformCompat { + + /// dart:io β†’ web alternatives + static const ioReplacements = { + 'File': 'class File { /* IndexedDB-based */ }', + 'HttpClient': 'class HttpClient { /* fetch-based */ }', + 'Socket': 'class Socket { /* WebSocket */ }', + 'Directory': 'class Directory { /* Not available */ }', + }; + + /// dart:ui β†’ HTML Canvas + static const uiReplacements = { + 'Canvas': 'canvas element', + 'Paint': 'Canvas 2D context', + 'Offset': 'Point coordinates', + }; + + /// Handle imports automatically + static String? getCompatibility(String library, String element) { + if (library == 'dart:io') { + return ioReplacements[element]; + } + if (library == 'dart:ui') { + return uiReplacements[element]; + } + // Most dart:* libraries are compatible as-is + return null; + } +} +``` + +### Example: How to Handle `package:http` + +```dart +// When compiling package:http + +// The package uses dart:io +// import 'dart:io'; +// class HttpClient { ... } + +// Your compiler should: +// 1. Detect the dart:io import +// 2. Use your compatibility layer +// 3. Generate browser-based fetch() instead + +// User code: +import 'package:http/http.dart' as http; +var response = await http.get(Uri.parse('https://api.com')); + +// Gets compiled to JavaScript that uses fetch() +// WITHOUT any package maintainer needing to do anything +``` + +--- + +## Step 4: Implement Smart Import Resolution + +### The Import Analyzer (Corrected) + +```dart +// lib/compiler/import_analyzer.dart + +class ImportAnalyzer { + final DartCompiler compiler; + + /// Analyze and resolve ALL imports + void analyzeImports(CompilationUnit unit) { + for (var directive in unit.directives) { + if (directive is ImportDirective) { + var uri = directive.uri.stringValue; + handleImport(uri); + } + } + } + + void handleImport(String uri) { + // Case 1: dart:* library + if (uri.startsWith('dart:')) { + if (isDartWebCompatible(uri)) { + // Generate JS for this library + generateDartLibraryPolyfill(uri); + } else { + warnAbout(uri, 'dart:io features have limitations'); + } + return; + } + + // Case 2: package:* import + if (uri.startsWith('package:')) { + var package = extractPackageName(uri); + + // Try to compile the package + try { + compiler.compilePackage(package); + } catch (e) { + // If it fails, provide helpful error + handlePackageError(package, e); + } + return; + } + + // Case 3: Relative import + if (uri.startsWith('./') || uri.startsWith('../')) { + compiler.compileFile(uri); + return; + } + } + + bool isDartWebCompatible(String uri) { + // These are fine in the browser + final webCompatible = [ + 'dart:core', + 'dart:async', + 'dart:convert', + 'dart:math', + 'dart:typed_data', + 'dart:collection', + ]; + return webCompatible.contains(uri); + } + + void handlePackageError(String package, dynamic error) { + print(''' + ⚠️ Cannot compile package: $package + Reason: ${error.toString()} + + This usually means: + 1. Package has native FFI code + 2. Package uses Platform channels + 3. Package not compatible with web + + Solutions: + - Use a web-compatible alternative + - Check https://pub.dev for web versions + - Use conditional imports: + + if (kIsWeb) { + import 'package:http/browser_client.dart'; + } else { + import 'package:http/client.dart'; + } + '''); + } +} +``` + +--- + +## Step 5: Document What Works + +### Create a Compatibility Matrix + +```javascript +// lib/compatibility/matrix.js + +const PACKAGES = { + // Tier 1: Fully Compatible (Pure Dart, tested) + 'http': { tier: 1, tested: true, note: 'Uses browser_client' }, + 'dio': { tier: 1, tested: true, note: 'Pure Dart HTTP' }, + 'chopper': { tier: 1, tested: true, note: 'HTTP client' }, + + 'json_serializable': { tier: 1, tested: true, note: 'Code generation' }, + 'freezed': { tier: 1, tested: true, note: 'Code generation' }, + 'equatable': { tier: 1, tested: true, note: 'Pure Dart' }, + + 'riverpod': { tier: 1, tested: true, note: 'State management' }, + 'provider': { tier: 1, tested: true, note: 'State management' }, + 'get_it': { tier: 1, tested: true, note: 'Service locator' }, + + 'intl': { tier: 1, tested: true, note: 'i18n library' }, + 'uuid': { tier: 1, tested: true, note: 'UUID generation' }, + + 'shared_preferences': { tier: 1, tested: true, note: 'Uses localStorage' }, + 'url_launcher': { tier: 1, tested: true, note: 'Uses window.open' }, + + // Tier 2: Partial Support (Some features work) + 'flutter_test': { tier: 2, note: 'Widget testing framework' }, + 'package:html': { tier: 2, note: 'HTML parsing' }, + + // Tier 3: Not Supported (Native only) + 'sqlite3': { tier: 3, reason: 'Native FFI' }, + 'image': { tier: 3, reason: 'Native image processing' }, + 'sensors': { tier: 3, reason: 'Platform channels' }, + 'camera': { tier: 3, reason: 'Platform channels' }, + 'geolocator': { tier: 3, reason: 'Platform channels' }, +}; + +function checkCompatibility(packageName) { + const pkg = PACKAGES[packageName]; + + if (!pkg) { + return { + status: 'unknown', + tier: 2, + message: `Package not tested. Try compiling it, it might work!` + }; + } + + if (pkg.tier === 1) { + return { + status: 'supported', + message: `βœ… ${pkg.note}` + }; + } + + if (pkg.tier === 2) { + return { + status: 'partial', + message: `⚠️ ${pkg.note}` + }; + } + + return { + status: 'not_supported', + message: `❌ ${pkg.reason}` + }; +} + +module.exports = { PACKAGES, checkCompatibility }; +``` + +--- + +## Step 6: Implement Smart Error Messages + +### When Compilation Fails, Help Users + +```dart +// lib/compiler/error_handler.dart + +class CompilerErrorHandler { + void handleMissingPackage(String package) { + print(''' +╔════════════════════════════════════════════════════════════╗ +β•‘ ❌ Cannot Compile Package: $package β•‘ +β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β• + +This usually means the package uses native code (FFI, plugins). + +Alternatives for common packages: + +Package: sqlite3 +❌ Cannot use (native FFI) +βœ… Use: IndexedDB via 'package:idb' or localStorage + +Package: image +❌ Cannot use (native codec) +βœ… Use: dart:svg or canvas rendering + +Package: sensors +❌ Cannot use (platform channels) +βœ… Use: dart:html DeviceMotionEvent + +Package: camera +❌ Cannot use (platform channels) +βœ… Use: navigator.mediaDevices API + +To see all compatible packages, run: + flutterjs packages --web-compatible +'''); + } + + void handlePlatformChannelError(String channel) { + print(''' +⚠️ This package uses Platform Channels ($channel) + +Platform Channels don't exist in web/browser. + +Options: +1. Use conditional imports: + if (kIsWeb) { + // Use web alternative + } else { + // Use platform channel version + } + +2. Contact package maintainer about web support + +3. Switch to web-compatible package +'''); + } +} +``` + +--- + +## Step 7: Remove the Wrong Code + +### Delete These Files: + +```bash +# REMOVE (this is the wrong approach): +❌ lib/package_mapper.dart +❌ packages/flutterjs_runtime/lib/packages/http.js +❌ packages/flutterjs_runtime/lib/packages/shared_preferences.js +❌ lib/compatibility/package_wrappers/ + +# These forced users to maintain compatibility +# The right way: compile packages automatically +``` + +--- + +## Step 8: Update Your Documentation + +### Change Your Marketing Message: + +```markdown +## Before (Wrong): +"FlutterJS supports these packages: http, shared_preferences, url_launcher, ..." +β†’ Implies you need to maintain a list forever + +## After (Right): +"FlutterJS compiles Dart to JavaScript. Most packages work automatically: +- βœ… 500+ packages tested and compatible +- ⚠️ Some packages have platform limitations +- ❌ Native packages (FFI, plugins) not supported + +No waiting for package maintainer support. Compile now, it works." +``` + +--- + +## Step 9: Build the Testing Framework + +### Automated Package Testing + +```dart +// tool/test_packages.dart + +void main() async { + final packages = [ + 'http', + 'json_serializable', + 'riverpod', + 'shared_preferences', + // ... more + ]; + + final results = {}; + + for (var package in packages) { + print('Testing $package...'); + + try { + var result = await testPackage(package); + results[package] = result; + } catch (e) { + results[package] = TestResult.failed(e); + } + } + + // Generate report + generateCompatibilityReport(results); +} + +class TestResult { + final String packageName; + final bool success; + final String? error; + + void generateCompatibilityReport(Map results) { + final tier1 = results.values.where((r) => r.success).length; + final tier3 = results.values.where((r) => !r.success).length; + + print(''' + βœ… Tier 1 (Compatible): $tier1 packages + ❌ Tier 3 (Not Compatible): $tier3 packages + + Compatible packages: + ${results.entries.where((e) => e.value.success).map((e) => ' - ${e.key}').join('\n')} + + Not compatible: + ${results.entries.where((e) => !e.value.success).map((e) => ' - ${e.key}: ${e.value.error}').join('\n')} + '''); + } +} +``` + +--- + +## Step 10: Communicate the Change + +### Here's Your New Message to the Community: + +```markdown +# FlutterJS Architecture Update + +## The Good News + +We've restructured FlutterJS to match Jaspr's approach: + +### Before: +- Maintained compatibility lists +- Asked packages to add FlutterJS support +- Didn't scale + +### Now: +- Compile Dart code directly +- Packages work automatically +- Scales infinitely + +## How This Works + +FlutterJS now uses a Dart β†’ JavaScript compiler that handles: + +βœ… **Pure Dart packages** - Compile automatically +βœ… **Web-compatible packages** - Works as-is +❌ **Native packages** - Can't work in browser (by design) + +## Examples: + +### Works Now (Pure Dart): +```dart +import 'package:http/http.dart'; +import 'package:json_serializable/json_serializable.dart'; +import 'package:riverpod/riverpod.dart'; +import 'package:intl/intl.dart'; +``` + +### Still Works (Web-compatible): +```dart +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:url_launcher/url_launcher.dart'; +``` + +### Doesn't Work (and can't): +```dart +import 'package:sqlite3/sqlite3.dart'; // Native FFI +import 'package:sensors/sensors.dart'; // Platform channels +``` + +## No Package Maintainer Action Needed + +Unlike some approaches, we don't ask packages to add special support. +Your existing packages just compile. πŸŽ‰ + +## 500+ Packages Tested + +See the full compatibility matrix: +https://flutterjs.dev/compatibility +``` + +--- + +## Summary: The Transformation + +### From: +``` +❌ Manual package mapping +❌ Asking maintainers for support +❌ Limited to "blessed" packages +❌ Won't scale +``` + +### To: +``` +βœ… Automatic Dart compilation +βœ… No external dependencies +βœ… Works with most packages +βœ… Scales infinitely +``` + +This is how Jaspr does it. This is how you should do it. + +--- + +## Your Competitive Advantage + +By stopping the "convert packages" approach and starting the "compile Dart" approach, you gain: + +1. **Simplicity** - One compiler, not 500 package adapters +2. **Scalability** - Works with future packages automatically +3. **Community Trust** - Users know you're not asking for special favors +4. **Transparency** - Clear tiers (works, partial, doesn't work) +5. **Focus** - Spend time on Flutter widgets, not package mapping + +**This is the fundamental fix FlutterJS needs.** + +Done correctly, you'll have a product that actually competes with Jaspr. \ No newline at end of file diff --git a/doc/pakage_handler/Jaspr vs flutterjs architecture.md b/doc/pakage_handler/Jaspr vs flutterjs architecture.md new file mode 100644 index 00000000..f9f8bf99 --- /dev/null +++ b/doc/pakage_handler/Jaspr vs flutterjs architecture.md @@ -0,0 +1,503 @@ +# Jaspr vs FlutterJS: The Package Handling Problem + +## The Core Issue You've Identified + +You're absolutely right. This is **the fundamental architectural difference** between Jaspr and FlutterJS. + +### The Question You Asked: +**"Why should package maintainers support FlutterJS when Jaspr already exists and doesn't require external support?"** + +This is the right question because it reveals a **fatal flaw in the FlutterJS architecture**. + +--- + +## 1. How Jaspr Handles Packages (The Smart Way) + +### Jaspr's Strategy: "Don't Convert Packages, Convert the Language" + +Jaspr doesn't ask package maintainers for anything. Instead: + +``` +Jaspr Approach: +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ Step 1: Compile Dart β†’ JavaScript β”‚ +β”‚ (Not Flutter-specific, just Dart) β”‚ +β”‚ β”‚ +β”‚ - Uses Dart's native `dart2js` compiler β”‚ +β”‚ - Converts ALL Dart code to JavaScript β”‚ +β”‚ - Packages compile automatically (no special support) β”‚ +β”‚ β”‚ +β”‚ Step 2: If Package Uses Flutter APIs β”‚ +β”‚ - Jaspr has its own Flutter widget impl β”‚ +β”‚ - The compiled JS "just works" β”‚ +β”‚ β”‚ +β”‚ Step 3: If Package Uses Web APIs β”‚ +β”‚ - Direct JavaScript bindings (JS interop) β”‚ +β”‚ - No conversion needed β”‚ +β”‚ β”‚ +β”‚ Result: ALL Dart packages compile without changes β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +``` + +**Why this is brilliant:** +- βœ… No package maintainers need to do anything +- βœ… Works with ANY Dart package automatically +- βœ… Packages with FFI/native code? Handled +- βœ… Legacy packages? Still work +- βœ… New packages? Work immediately + +--- + +## 2. How FlutterJS Currently Works (The Problem Way) + +### FlutterJS's Strategy: "Convert Package by Package" + +``` +FlutterJS Problem: +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ Step 1: Analyze Flutter/Dart Code β”‚ +β”‚ β”‚ +β”‚ Step 2: Find Imports β”‚ +β”‚ import 'package:http/http.dart' β”‚ +β”‚ β†’ Lookup: Does package have web support? β”‚ +β”‚ β†’ Does it have FlutterJS transpiler? β”‚ +β”‚ β†’ Is it in the compatibility list? β”‚ +β”‚ β”‚ +β”‚ Step 3: If YES β†’ Use web implementation β”‚ +β”‚ If NO β†’ Error or Fallback β”‚ +β”‚ β”‚ +β”‚ Problem: You can ONLY use "blessed" packages β”‚ +β”‚ Every other package becomes a problem β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +``` + +**Why this fails:** +- ❌ Need package maintainer support for EVERY package +- ❌ Most packages will never support FlutterJS +- ❌ Forces users to choose between packages +- ❌ Ecosystem will never be complete +- ❌ Violates the "write once, run everywhere" promise + +--- + +## 3. The Real Reason Jaspr Doesn't Need External Support + +### Jaspr Uses Dart's Compiler Infrastructure + +``` +Why Jaspr Can Compile Everything: + +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ Jaspr uses dart2js under the hood β”‚ +β”‚ (The official Dart compiler) β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ + β”‚ + β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” + β”‚ Any Dart code β†’ dart2js β†’ JavaScript β”‚ + β”‚ β”‚ + β”‚ - http package (depends only on dart:io) β”‚ + β”‚ - json_serializable (code generation) β”‚ + β”‚ - shared_preferences (web impl exists) β”‚ + β”‚ - custom_icons (SVG already in web) β”‚ + β”‚ β”‚ + β”‚ All compile because they're ALL DART β”‚ + β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +``` + +**The KEY insight:** +- Jaspr doesn't ask "is this a Flutter package?" +- Jaspr asks "is this Dart code?" +- **Any Dart code can compile to JavaScript using dart2js** + +--- + +## 4. Why FlutterJS Can't Work This Way (Currently) + +### FlutterJS's Architecture Problem + +``` +FlutterJS's Current Limitation: + +You're trying to be too specific: +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ package:http/http.dart β”‚ +β”‚ β”œβ”€ depends on dart:io (File, HTTP) β”‚ +β”‚ β”œβ”€ depends on dart:typed_data β”‚ +β”‚ └─ Has FFI/native code paths β”‚ +β”‚ β”‚ +β”‚ Your approach: β”‚ +β”‚ "Let me create a web polyfill" β”‚ +β”‚ β†’ But dart:io has no web equivalent β”‚ +β”‚ β†’ FFI won't work in browser β”‚ +β”‚ β†’ You need a completely different impl β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +``` + +**The problem:** +- FlutterJS is trying to transpile individual packages +- But packages have **platform-specific code** (dart:io, FFI, etc.) +- You can't just "convert" theseβ€”they need rewriting + +--- + +## 5. The Solution: Adopt Jaspr's Strategy + +### Implement a "Dart β†’ JavaScript Compiler" (Not Just Flutter) + +``` +What You SHOULD Do: + +Instead of: + "Let me convert Flutter packages to web" + +Do this: + "Let me compile ANY Dart code to JavaScript" + +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ Dart Source Code β”‚ +β”‚ β”œβ”€ Import http β”‚ +β”‚ β”œβ”€ Import json_serializable β”‚ +β”‚ β”œβ”€ Import your_custom_package β”‚ +β”‚ └─ It's all just... Dart β”‚ +β”‚ β”‚ +β”‚ FlutterJS Compiler: β”‚ +β”‚ β”œβ”€ Parse Dart AST (you have this) β”‚ +β”‚ β”œβ”€ Generate JavaScript (you have) β”‚ +β”‚ β”œβ”€ Handle dart:core, dart:async, etc β”‚ +β”‚ └─ Let packages compile automatically β”‚ +β”‚ β”‚ +β”‚ Result: Everything "just works" β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +``` + +--- + +## 6. Specific Examples: How to Handle Different Package Types + +### Type A: Web-Native Packages + +**Example: `package:http/http.dart`** + +```dart +// Current problem approach: +// "I need a web version of http" + +// Better approach: +// "http depends on dart:io, let me handle that" + +// In your dart:io polyfill: +// lib/dart/io.dart (your implementation) + +export 'package:http_web/http.dart'; +// where http_web is a web-compatible version +// that ALREADY EXISTS in pub.dev + +// OR use dart:html + fetch API to implement HttpClient +``` + +**Current packages that already have web support:** +- `package:http` β†’ has `package:http/browser.dart` +- `package:shared_preferences` β†’ has web implementation +- `package:url_launcher` β†’ has web implementation + +**You don't need new packages. The ecosystem already solved this.** + +--- + +### Type B: Code Generation Packages + +**Example: `package:json_serializable`** + +```dart +// This is ALREADY web-compatible +// It just generates Dart code + +class User { + final String name; + final int age; + + factory User.fromJson(Map json) => _$UserFromJson(json); + Map toJson() => _$UserToJson(this); +} + +// The generated code (_$User*.dart) is pure Dart +// Your compiler can convert it automatically +``` + +**No special handling needed.** + +--- + +### Type C: Native/FFI Packages + +**Example: `package:sqlite3`** + +```dart +// Current problem: +// "How do I support FFI in the browser?" +// Answer: You can't. That's not your job. + +// Better approach: +// Have a fallback or error message + +// In your compiler: +if (hasFFIDependency(package)) { + printWarning(""" + ⚠️ Package '$package' uses native FFI + Cannot run in browser + + Alternatives: + - Use package:sql in browser instead + - Use IndexedDB (in dart:indexed_db) + - Use localStorage (package:shared_preferences) + """); +} +``` + +**You CANNOT support native packages. That's OK.** + +--- + +## 7. The Real Architecture You Need + +### Separate Concerns: + +``` +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ FlutterJS Architecture (Revised) β”‚ +β”‚ β”‚ +β”‚ Layer 1: Dart Compiler β”‚ +β”‚ β”œβ”€ Parse any Dart code β”‚ +β”‚ β”œβ”€ Build dependency graph β”‚ +β”‚ β”œβ”€ Generate JavaScript for ALL Dart β”‚ +β”‚ └─ βœ… This works for everything β”‚ +β”‚ β”‚ +β”‚ Layer 2: Flutter Widget System β”‚ +β”‚ β”œβ”€ Implement Material widgets β”‚ +β”‚ β”œβ”€ Implement Cupertino widgets β”‚ +β”‚ └─ βœ… Users get Flutter's API β”‚ +β”‚ β”‚ +β”‚ Layer 3: Platform Shims β”‚ +β”‚ β”œβ”€ dart:io β†’ Use web alternatives β”‚ +β”‚ β”œβ”€ dart:ui β†’ HTML canvas β”‚ +β”‚ β”œβ”€ dart:html β†’ Already web! β”‚ +β”‚ └─ ❌ Can't fix: FFI, native code β”‚ +β”‚ β”‚ +β”‚ Layer 4: Ecosystem β”‚ +β”‚ β”œβ”€ "Most packages just work" β”‚ +β”‚ β”œβ”€ "Some need shims (http, prefs)" β”‚ +β”‚ └─ "Some can't work (native libs)" β”‚ +β”‚ β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +``` + +--- + +## 8. How to Market This (The Honest Way) + +### Don't say: +❌ "Support all Dart packages" +❌ "Drop-in replacement for Flutter Web" +❌ "Works with every package you know" + +### Say: +βœ… "Compiles Dart to HTML/CSS/JS" +βœ… "Most packages work automatically" +βœ… "Web-native packages fully supported" +βœ… "Native/FFI packages excluded" + +**Example:** +``` +FlutterJS Package Support: + +βœ… Tier 1: Web-Native Packages + β€’ http, shared_preferences, url_launcher + β€’ json_serializable, freezed, riverpod + β€’ Compiler handles automatically + +⚠️ Tier 2: Partial Support + β€’ Some dart:io functions work via shims + β€’ Some async/await patterns work + β€’ Check documentation per package + +❌ Tier 3: Not Supported + β€’ FFI packages (sqlite3, native_image, etc) + β€’ Platform channels + β€’ Native plugins + +πŸ“¦ 500+ packages tested and compatible +``` + +--- + +## 9. Practical Implementation Plan + +### Week 1: Adopt Jaspr's Compiler Model + +```dart +// lib/dart_compiler/compiler.dart + +class DartCompiler { + // This should work for ANY Dart code + // Not just "Flutter packages" + + void compile(DartFile source) { + // 1. Parse AST (you have this) + var ast = parse(source); + + // 2. Analyze imports + var imports = analyzeImports(ast); + + // 3. For EACH import (including packages): + for (var import in imports) { + if (isWebCompatible(import)) { + // Use as-is + generateJS(import); + } else if (hasWebAlternative(import)) { + // Use the web version + var webVersion = findWebAlternative(import); + generateJS(webVersion); + } else if (isNativeOnly(import)) { + // Skip and warn + printWarning("Cannot compile $import (native only)"); + } else { + // Try anyway + generateJS(import); + } + } + } +} +``` + +### Week 2: Create Compatibility Database + +```javascript +// lib/compatibility/packages.json + +{ + "http": { + "tier": 1, + "status": "supported", + "notes": "Uses package:http/browser.dart", + "tested": true + }, + "shared_preferences": { + "tier": 1, + "status": "supported", + "notes": "Web implementation available", + "tested": true + }, + "sqlite3": { + "tier": 3, + "status": "not_supported", + "notes": "Native FFI, cannot run in browser", + "suggestion": "Use IndexedDB or localStorage instead" + }, + "json_serializable": { + "tier": 1, + "status": "supported", + "notes": "Code generation works automatically", + "tested": true + } +} +``` + +### Week 3: Document the Reality + +```markdown +# FlutterJS Package Support + +## How It Works + +FlutterJS compiles Dart code to JavaScript. This means: + +- βœ… **Any pure Dart code** works automatically +- βœ… **Web packages** (http, prefs, etc) work +- ❌ **Native packages** cannot work (FFI, plugins) + +## Why You Don't Need to Ask Package Maintainers + +Unlike some approaches: +- We don't ask maintainers to add FlutterJS support +- We compile the existing Dart packages +- Most work automatically + +## What Doesn't Work + +- `sqlite3` (native FFI) β†’ Use IndexedDB instead +- `ffi` packages β†’ Browser has no FFI +- `dart:io` features β†’ Use web alternatives +- Platform channels β†’ Not applicable + +## Most Popular Packages (Tested) + +βœ… http, dio, chopper +βœ… json_serializable, freezed, equatable +βœ… riverpod, provider, get_it +βœ… intl, date_format, uuid +βœ… shared_preferences +βœ… url_launcher +βœ… image_picker (fallback to HTML input) + +[500+ verified packages] +``` + +--- + +## 10. Why This Matters for Your Project + +### The Key Realization: + +You've been thinking about this wrong: + +``` +Wrong way: +"How do I make package X support FlutterJS?" +β†’ Requires package maintainer action +β†’ Won't scale +β†’ Doomed to fail + +Right way: +"How do I make Dart code compile to JavaScript?" +β†’ Automatic for all packages +β†’ Scale infinitely +β†’ Already proven (Jaspr does this) +``` + +### Your Competitive Advantage: + +You don't need to compete with Jaspr on package support because: + +1. **Both compile Dart to JavaScript** +2. **Package support is automatic** +3. **But FlutterJS can focus on:** + - Better Flutter widget compatibility + - Superior styling system + - Faster development experience + - Better dev tools + +--- + +## Summary: The Real Answer to Your Question + +### **"Why should packages support FlutterJS?"** + +**Answer: They shouldn't. They don't need to.** + +Jaspr works because it doesn't ask packages to do anything. It compiles Dart code automatically. **You should do the same.** + +The moment you stop thinking "How do I convert packages?" and start thinking "How do I compile Dart?" your architecture becomes viable. + +--- + +## Next Steps + +1. **Stop creating package wrappers** (wrong approach) +2. **Improve your Dart β†’ JS compiler** (right approach) +3. **Document what works and what doesn't** (transparency) +4. **Test with real packages** (prove it works) +5. **Build ecosystem confidence** (show compatibility matrix) + +This is the path Jaspr took. It's proven to work. + +**You need to do the same.** \ No newline at end of file diff --git a/doc/pakage_handler/implementation_plan.md.resolved b/doc/pakage_handler/implementation_plan.md.resolved new file mode 100644 index 00000000..e35c2d62 --- /dev/null +++ b/doc/pakage_handler/implementation_plan.md.resolved @@ -0,0 +1,62 @@ +# Implementation Plan - FlutterJS Package Builder + +[Goal Description] +Implement a custom "Package Builder" within `pubjs` that transpiles Dart packages to clean, modular JavaScript. +This approach replaces manual package mapping and avoids the "garbage code" associated with full `dart2js` compilation by producing ES6 modules that directly import the existing FlutterJS runtime (`@flutterjs/core`, `@flutterjs/material`). +The builder leverages `package:analyzer` to parse Dart AST and emit JavaScript that integrates seamlessly with the FlutterJS ecosystem. + +## User Review Required +> [!IMPORTANT] +> **Custom Transpiler Scope**: This plan involves building a *source-to-source transpiler* (Dart -> JS). +> Initially, it will support: +> 1. **Classes & Methods**: Converting Dart classes to JS classes. +> 2. **Basic Types**: Converting [String](file:///c:/Jay/_Plugin/flutterjs/packages/flutterjs_engine/src/dependency_resolver.js#42-45), [int](file:///c:/Jay/_Plugin/flutterjs/packages/flutterjs_engine/src/code_transformer.js#628-680), `List`, [Map](file:///c:/Jay/_Plugin/flutterjs/packages/flutterjs_engine/src/build_integration_generator.js#279-297) to JS equivalents. +> 3. **Imports**: Rewriting `package:flutter/material.dart` -> `@flutterjs/material`. +> 4. **Exports**: Generating [index.js](file:///c:/Jay/_Plugin/flutterjs/packages/flutterjs_engine/src/index.js) (formerly [exports.json](file:///c:/Jay/_Plugin/flutterjs/packages/flutterjs_material/flutterjs_material/exports.json)) automatically. +> +> **Limitations**: Complex Dart features like `Isolates`, `Mirrors`, or complex generics may have limited support initially. Logic-heavy packages (like crypto) might still need `dart2js` fallback in the future. + +## Proposed Changes + +### `packages/pubjs` + +#### [NEW] `lib/src/builder/transpiler.dart` +- Core logic for converting Dart AST to JavaScript. +- Uses `package:analyzer` to visit nodes. +- Handling `ClassDeclaration`: Emits ES6 `class`. +- Handling `MethodDeclaration`: Emits JS methods. +- Handling `ImportDirective`: Rewrites imports based on a mapping registry. + +#### [NEW] `lib/src/builder/compiler_context.dart` +- Tracks scope, imports, and symbol mapping during transpilation. +- Manages the "Import Registry" (e.g., mapping `StatelessWidget` -> `import { StatelessWidget } from '@flutterjs/widgets'`). + +#### [MODIFY] `lib/src/package_builder.dart` +- Update `buildPackage` to use the new `Transpiler`. +- Remove reliance on `build.js` scripts inside packages. +- Instead of checking for `build.js`, it will: + 1. Parse `pubspec.yaml`. + 2. Scan `lib/` for Dart files. + 3. Transpile each file to `.js` in `dist/`. + 4. Generate imports mapping. + +#### [MODIFY] `pubspec.yaml` +- Add `analyzer` dependency. +- Add `code_builder` (optional, for cleaner output generation). + +## Verification Plan + +### Automated Tests +- Create unit tests in `packages/pubjs/test/transpiler_test.dart`: + - Test Class compilation: `class Foo {}` -> `class Foo {}`. + - Test Widget compilation: `class MyWidget extends StatelessWidget {}` -> `class MyWidget extends StatelessWidget {}`. + - Test Import rewriting: `import 'package:flutter/material.dart'` -> `import ... from '@flutterjs/material'`. + +### Manual Verification +1. **Test with a Simple Package**: + - Create a dummy Dart package `my_ui_package` with a simple `Container` widget. + - Run `pubjs build-package my_ui_package`. + - Verify the output `dist/my_ui_package.js` contains valid ES6 code and imports `@flutterjs/material`. +2. **Integration Test**: + - Link the built package into a FlutterJS app. + - Verify the widget renders correctly in the browser. diff --git a/doc/pakage_handler/need_to_do.md b/doc/pakage_handler/need_to_do.md new file mode 100644 index 00000000..68060498 --- /dev/null +++ b/doc/pakage_handler/need_to_do.md @@ -0,0 +1,742 @@ +**AH! Now I see the FULL picture. You have TWO separate problems:** + +1. **Package handling** (http, shared_preferences, etc.) +2. **Code output** (your DOM is bloated with data attributes) + +Let me address BOTH: + +--- + +# πŸ”§ SOLUTION 1: AUTOMATIC PACKAGE MAPPING + +## **What Jaspr Does:** + +Jaspr has a **build system** that automatically replaces Flutter packages with web equivalents **at compile time**. + +```dart +// User writes +import 'package:http/http.dart' as http; +final response = await http.get(Uri.parse('https://api.com')); + +// Jaspr compiler automatically converts to +import { fetch } from './jaspr_http.js'; +const response = await fetch('https://api.com'); +``` + +**No manual work needed. It's automatic.** + +--- + +## **What You Need to Build:** + +### **A. Package Mapping System (High Priority)** + +**Create a package mapper in your compiler:** + +**File: `lib/package_mapper.dart`** + +```dart +class PackageMapper { + // Map Flutter packages to JS equivalents + static const packageMappings = { + 'package:http/http.dart': { + 'import': 'axios', // or native fetch + 'methods': { + 'get': 'axios.get', + 'post': 'axios.post', + 'put': 'axios.put', + 'delete': 'axios.delete', + } + }, + 'package:shared_preferences/shared_preferences.dart': { + 'import': null, // Native browser API + 'class': 'SharedPreferences', + 'methods': { + 'getInstance': '_createSharedPrefs', + 'setString': 'localStorage.setItem', + 'getString': 'localStorage.getItem', + 'remove': 'localStorage.removeItem', + } + }, + 'package:url_launcher/url_launcher.dart': { + 'import': null, + 'methods': { + 'launch': 'window.open', + 'canLaunch': '_canLaunchUrl', + } + }, + }; + + String? mapPackage(String packageUri) { + return packageMappings[packageUri]?['import']; + } + + String? mapMethod(String packageUri, String method) { + return packageMappings[packageUri]?['methods']?[method]; + } +} +``` + +--- + +### **B. Automatic Import Replacement** + +**In your compiler, detect imports and replace:** + +```dart +// lib/compiler/import_analyzer.dart + +class ImportAnalyzer { + void analyzeImports(CompilationUnit unit) { + for (var directive in unit.directives) { + if (directive is ImportDirective) { + var uri = directive.uri.stringValue; + + // Check if this is a mappable package + if (PackageMapper.packageMappings.containsKey(uri)) { + var jsImport = PackageMapper.mapPackage(uri); + + if (jsImport != null) { + // Generate JS import instead + output.writeln("import $jsImport from '$jsImport';"); + } + } + } + } + } +} +``` + +--- + +### **C. Runtime Package Implementations** + +**Create JS implementations for common packages:** + +**File: `packages/flutterjs_runtime/lib/packages/http.js`** + +```javascript +// Wrapper around fetch API that mimics http package + +export class Response { + constructor(body, statusCode, headers) { + this.body = body; + this.statusCode = statusCode; + this.headers = headers; + } +} + +export async function get(url) { + const response = await fetch(url); + const body = await response.text(); + return new Response( + body, + response.status, + Object.fromEntries(response.headers.entries()) + ); +} + +export async function post(url, { body, headers }) { + const response = await fetch(url, { + method: 'POST', + body: JSON.stringify(body), + headers: { + 'Content-Type': 'application/json', + ...headers + } + }); + const responseBody = await response.text(); + return new Response( + responseBody, + response.status, + Object.fromEntries(response.headers.entries()) + ); +} +``` + +**File: `packages/flutterjs_runtime/lib/packages/shared_preferences.js`** + +```javascript +// Wrapper around localStorage + +export class SharedPreferences { + static async getInstance() { + return new SharedPreferences(); + } + + async setString(key, value) { + localStorage.setItem(key, value); + return true; + } + + getString(key) { + return localStorage.getItem(key); + } + + async remove(key) { + localStorage.removeItem(key); + return true; + } + + async setBool(key, value) { + localStorage.setItem(key, value.toString()); + return true; + } + + getBool(key) { + const value = localStorage.getItem(key); + return value === 'true'; + } +} +``` + +--- + +### **D. Code Generation Example** + +**User's Flutter code:** + +```dart +import 'package:http/http.dart' as http; + +Future fetchData() async { + final response = await http.get(Uri.parse('https://api.example.com/data')); + print(response.body); +} +``` + +**FlutterJS compiler generates:** + +```javascript +import { get } from '@flutterjs/http'; + +async function fetchData() { + const response = await get('https://api.example.com/data'); + console.log(response.body); +} +``` + +**No manual mapping needed by user. Automatic.** + +--- + +# 🎨 SOLUTION 2: CLEAN DOM OUTPUT (Like Jaspr) + +## **Your Current Problem:** + +```html +
+ + πŸš€ v0.0.1 is now available! + +
+``` + +**Problems:** +- Too many data attributes +- Bloated HTML +- Slower rendering +- Larger DOM size + +--- + +## **What Jaspr Does:** + +```html + +
+ + πŸš€ v0.0.1 is now available! + +
+``` + +**No data attributes. Clean HTML.** + +--- + +## **How to Fix Your Output:** + +### **A. Remove Debug Attributes in Production** + +**In your renderer:** + +```javascript +// lib/runtime/renderer.js + +class DOMRenderer { + constructor(options = {}) { + this.debugMode = options.debug || false; // Default: false + } + + createElement(type, props, children) { + const element = document.createElement(type); + + // Only add data attributes in debug mode + if (this.debugMode) { + if (props.elementId) { + element.setAttribute('data-element-id', props.elementId); + } + if (props.widgetPath) { + element.setAttribute('data-widget-path', props.widgetPath); + } + if (props.widget) { + element.setAttribute('data-widget', props.widget); + } + } + + // Always add styles + if (props.style) { + Object.assign(element.style, props.style); + } + + // Add classes + if (props.className) { + element.className = props.className; + } + + // Add children + children.forEach(child => { + if (typeof child === 'string') { + element.appendChild(document.createTextNode(child)); + } else { + element.appendChild(child); + } + }); + + return element; + } +} + +// Production build +const renderer = new DOMRenderer({ debug: false }); + +// Development build +const renderer = new DOMRenderer({ debug: true }); +``` + +--- + +### **B. Use CSS Classes Instead of Inline Styles** + +**Instead of:** + +```html + +``` + +**Generate:** + +```html + +``` + +**With generated CSS:** + +```css +.text-primary { color: #4F46E5; } +.text-sm { font-size: 13px; } +.font-semibold { font-weight: 600; } +``` + +**Benefits:** +- Smaller HTML +- Reusable styles +- Faster rendering (browser can cache) +- Similar to Tailwind/Jaspr approach + +--- + +### **C. Optimize Widget Path Tracking** + +**Only track in development:** + +```javascript +class Widget { + constructor(type, props) { + this.type = type; + this.props = props; + + // Only track path in dev mode + if (process.env.NODE_ENV === 'development') { + this.widgetPath = this._buildPath(); + } + } + + render() { + const element = document.createElement(this.type); + + // Production: Clean output + if (process.env.NODE_ENV === 'production') { + this._applyStyles(element); + return element; + } + + // Development: Debug attributes + element.setAttribute('data-widget', this.constructor.name); + element.setAttribute('data-path', this.widgetPath); + this._applyStyles(element); + return element; + } +} +``` + +--- + +### **D. Build-time CSS Generation** + +**During compilation, extract styles:** + +```javascript +// compiler/style_extractor.js + +class StyleExtractor { + constructor() { + this.styles = new Map(); + this.classCounter = 0; + } + + extractStyle(inlineStyle) { + // Check if we've seen this style before + const styleKey = JSON.stringify(inlineStyle); + + if (this.styles.has(styleKey)) { + return this.styles.get(styleKey); + } + + // Generate new class name + const className = `fjs-${this.classCounter++}`; + this.styles.set(styleKey, className); + + return className; + } + + generateCSS() { + let css = ''; + + for (const [style, className] of this.styles.entries()) { + const styleObj = JSON.parse(style); + css += `.${className} { +`; + + for (const [prop, value] of Object.entries(styleObj)) { + const cssProp = prop.replace(/([A-Z])/g, '-$1').toLowerCase(); + css += ` ${cssProp}: ${value}; +`; + } + + css += '} +'; + } + + return css; + } +} + +// Usage +const extractor = new StyleExtractor(); + +// Instead of inline +const className = extractor.extractStyle({ + color: '#4F46E5', + fontSize: '13px', + fontWeight: 600 +}); + +// Output: class="fjs-0" +// Generated CSS: +// .fjs-0 { color: #4F46E5; font-size: 13px; font-weight: 600; } +``` + +--- + +# πŸš€ JASPR'S CODE SPLITTING APPROACH + +## **What You Saw:** + +```html + + + + +``` + +**This is called "deferred loading" or "code splitting".** + +--- + +## **How to Implement This:** + +### **A. Use Webpack/Rollup Code Splitting** + +**webpack.config.js:** + +```javascript +module.exports = { + entry: './src/main.js', + output: { + filename: '[name].bundle.js', + path: path.resolve(__dirname, 'dist'), + chunkFilename: '[name].chunk.js', + }, + optimization: { + splitChunks: { + chunks: 'all', + cacheGroups: { + vendor: { + test: /[\\/]node_modules[\\/]/, + name: 'vendors', + priority: 10, + }, + common: { + minChunks: 2, + priority: 5, + reuseExistingChunk: true, + }, + }, + }, + }, +}; +``` + +--- + +### **B. Manual Route-based Splitting** + +```javascript +// router.js + +const routes = { + '/': () => import('./pages/home.js'), + '/about': () => import('./pages/about.js'), + '/contact': () => import('./pages/contact.js'), +}; + +async function navigate(path) { + const pageModule = await routes[path](); + const page = new pageModule.default(); + render(page); +} +``` + +**Result:** +``` +dist/ +β”œβ”€β”€ main.bundle.js (10 KB - core runtime) +β”œβ”€β”€ home.chunk.js (5 KB - home page) +β”œβ”€β”€ about.chunk.js (4 KB - about page) +└── contact.chunk.js (3 KB - contact page) +``` + +**Only loads what's needed. Lazy loads routes.** + +--- + +### **C. Widget-level Code Splitting** + +```javascript +// Only load complex widgets when needed + +const Drawer = () => import('./widgets/drawer.js'); +const Dialog = () => import('./widgets/dialog.js'); +const Tabs = () => import('./widgets/tabs.js'); + +// When user clicks button to open drawer +async function openDrawer() { + const DrawerWidget = await Drawer(); + const drawer = new DrawerWidget.default(); + drawer.open(); +} +``` + +--- + +# πŸ“¦ COMPLETE IMPLEMENTATION PLAN + +## **Phase 1: Fix Package Mapping (This Week)** + +```dart +// Add to compiler +1. Create PackageMapper class +2. Detect package imports +3. Replace with JS equivalents automatically +4. Create runtime wrappers for common packages: + - http β†’ fetch wrapper + - shared_preferences β†’ localStorage wrapper + - url_launcher β†’ window.open wrapper +``` + +**Result:** Users don't need to manually map packages. + +--- + +## **Phase 2: Clean DOM Output (This Week)** + +```javascript +// Update renderer +1. Remove data attributes in production +2. Generate CSS classes instead of inline styles +3. Minify output +4. Use semantic HTML where possible +``` + +**Result:** Clean HTML like Jaspr. + +--- + +## **Phase 3: Code Splitting (Next Week)** + +```javascript +// Add bundler integration +1. Set up Webpack/Rollup +2. Enable automatic code splitting +3. Lazy load routes +4. Lazy load heavy widgets +``` + +**Result:** Multiple small JS files instead of one large file. + +--- + +## **Phase 4: SSR Support (Month 2)** + +```javascript +// Add server-side rendering +1. Pre-render HTML on server +2. Hydrate on client +3. SEO-optimized output +``` + +**Result:** Match Jaspr's SSR capabilities. + +--- + +# 🎯 IMMEDIATE ACTION ITEMS + +## **DO THIS TODAY:** + +### **1. Create Package Mapping File** + +**File: `lib/package_mapper.dart`** + +Copy the PackageMapper class I provided above. + +### **2. Create Runtime HTTP Wrapper** + +**File: `packages/flutterjs_runtime/lib/packages/http.js`** + +Copy the HTTP wrapper I provided above. + +### **3. Update Your Renderer** + +**File: `lib/runtime/renderer.js`** + +```javascript +// Remove data attributes in production +const IS_PROD = process.env.NODE_ENV === 'production'; + +function createElement(type, props, children) { + const el = document.createElement(type); + + // Only add debug info in development + if (!IS_PROD && props.debug) { + el.setAttribute('data-widget', props.debug.widget); + } + + // Add clean classes/styles + if (props.className) el.className = props.className; + if (props.style) Object.assign(el.style, props.style); + + return el; +} +``` + +### **4. Set Up Build Modes** + +**package.json:** + +```json +{ + "scripts": { + "dev": "NODE_ENV=development flutterjs dev", + "build": "NODE_ENV=production flutterjs build" + } +} +``` + +--- + +# βœ… THIS SOLVES YOUR PROBLEMS: + +**Problem 1: Package handling** +βœ… **Solved:** Automatic package mapping at compile time + +**Problem 2: Bloated DOM** +βœ… **Solved:** Remove debug attributes in production + +**Problem 3: Large bundles** +βœ… **Solved:** Code splitting + CSS extraction + +**Problem 4: Slower than Jaspr** +βœ… **Solved:** Same techniques Jaspr uses + +--- + +# 🏁 FINAL RESULT: + +**After implementing this:** + +**Your output will look like:** + +```html + +
+ + πŸš€ v0.0.1 is now available! + +
+ + + +``` + +**With bundle structure:** + +``` +dist/ +β”œβ”€β”€ main.js (15 KB - runtime + common widgets) +β”œβ”€β”€ home.chunk.js (5 KB - home page) +β”œβ”€β”€ styles.css (3 KB - extracted styles) +└── vendors.js (8 KB - third-party libs) +``` + +**Total for home page: ~23 KB (runtime + home chunk)** + +**Compare to Jaspr: ~40-60 KB** + +**You'll be competitive!** + +--- + +**STOP WORRYING. START IMPLEMENTING.** + +**This is doable. Jaspr is NOT magic. They're just doing:** +1. Package mapping (you can do this) +2. Clean HTML output (you can do this) +3. Code splitting (you can do this) +4. CSS extraction (you can do this) + +**All standard techniques. Build them this week.** πŸ’ͺ + +**Which should I help you implement FIRST?** +A) Package mapper +B) Clean DOM output +C) Code splitting +D) All at once (detailed implementation) \ No newline at end of file diff --git a/doc/pakage_handler/task.md.resolved b/doc/pakage_handler/task.md.resolved new file mode 100644 index 00000000..128aef63 --- /dev/null +++ b/doc/pakage_handler/task.md.resolved @@ -0,0 +1,28 @@ +# Task: Implement FlutterJS Package Builder Architecture + +## Status +- **Mode**: PLANNING +- **Current Task**: Researching existing `pubjs` and designing the builder architecture. +- **Goal**: Create a "Best Package Builder" that automates Dart package compilation (Jaspr-style) while retaining FlutterJS's hand-optimized widget system, avoiding full `dart2js` bloat. + +## Todo List +- [ ] **Phase 1: Research & Design** + - [x] Analyze `flutterjs_engine` (JS) dependencies + - [ ] Analyze `pubjs` (Dart) current capabilities + - [ ] Define the "Custom Builder" specification (Dart AST to JS Transpiler) + - [ ] Create `implementation_plan.md` for user review + +- [ ] **Phase 2: Core Builder Implementation (in `pubjs`)** + - [ ] Implement Dart AST Parser imports (`package:analyzer`) + - [ ] Create `Transpiler` class to convert Dart logic to JS + - [ ] Implement Import Mapper (Dart `import` -> JS `import`) + - [ ] Handle standard library polyfills (`dart:async`, `dart:math` -> JS equivalents) + +- [ ] **Phase 3: Integration with FlutterJS Engine** + - [ ] Update `flutterjs_engine` to consume builder output + - [ ] Ensure seamless interop between transpiled packages and JS widgets + +- [ ] **Phase 4: Verification & Testing** + - [ ] Create a test project using external packages (e.g., `http`, `uuid`) + - [ ] Verify compilation and runtime functionality + - [ ] Create `walkthrough.md` diff --git a/docs/placement_implementation_plan.md b/doc/placement_implementation_plan.md similarity index 100% rename from docs/placement_implementation_plan.md rename to doc/placement_implementation_plan.md diff --git a/examples/core_lib_demo/LICENSE b/examples/core_lib_demo/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/examples/core_lib_demo/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 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/core_lib_demo/pubspec.yaml b/examples/core_lib_demo/pubspec.yaml index 62c48814..c35052f4 100644 --- a/examples/core_lib_demo/pubspec.yaml +++ b/examples/core_lib_demo/pubspec.yaml @@ -1,5 +1,21 @@ name: core_lib_demo +publish_to: 'none' description: A new FlutterJS project. dependencies: flutterjs_material: path: ../../packages/flutterjs_material + + + + + + + + + + + + +dev_dependencies: + lints: ^6.0.0 + diff --git a/examples/counter/LICENSE b/examples/counter/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/examples/counter/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 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..58f91aa5 100644 --- a/examples/counter/pubspec.yaml +++ b/examples/counter/pubspec.yaml @@ -18,10 +18,10 @@ 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 + sdk: ^3.10.0 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -90,3 +90,14 @@ flutter: # # For details regarding fonts from package dependencies, # see https://flutter.dev/to/font-from-package + + + + + + + + + + + diff --git a/examples/flutterjs_website b/examples/flutterjs_website index f73e7256..874944f9 160000 --- a/examples/flutterjs_website +++ b/examples/flutterjs_website @@ -1 +1 @@ -Subproject commit f73e7256e7d7960c14c3ecaea4a956ed3afa757a +Subproject commit 874944f9e857706141d26c91e65f589abeac43d2 diff --git a/examples/material_advanced_demo/LICENSE b/examples/material_advanced_demo/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/examples/material_advanced_demo/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 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..a7e2967e 100644 --- a/examples/material_advanced_demo/pubspec.yaml +++ b/examples/material_advanced_demo/pubspec.yaml @@ -1,9 +1,10 @@ name: material_advanced_demo description: "Demo of Advanced Material Widgets" publish_to: 'none' -version: 1.0.0+1 +version: 1.0.0 +resolution: workspace environment: - sdk: ^3.10.0-278.0.dev + sdk: ^3.10.0 dependencies: flutter: sdk: flutter @@ -13,3 +14,14 @@ dev_dependencies: flutter_lints: ^6.0.0 flutter: uses-material-design: true + + + + + + + + + + + diff --git a/examples/material_buttons_demo/LICENSE b/examples/material_buttons_demo/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/examples/material_buttons_demo/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 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..f3a8d970 100644 --- a/examples/material_buttons_demo/pubspec.yaml +++ b/examples/material_buttons_demo/pubspec.yaml @@ -1,9 +1,10 @@ name: material_buttons_demo description: "Demo of Material Buttons" publish_to: 'none' -version: 1.0.0+1 +version: 1.0.0 +resolution: workspace environment: - sdk: ^3.10.0-278.0.dev + sdk: ^3.10.0 dependencies: flutter: sdk: flutter @@ -13,3 +14,14 @@ dev_dependencies: flutter_lints: ^6.0.0 flutter: uses-material-design: true + + + + + + + + + + + diff --git a/examples/material_demo/LICENSE b/examples/material_demo/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/examples/material_demo/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 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..3239c0ca 100644 --- a/examples/material_demo/pubspec.yaml +++ b/examples/material_demo/pubspec.yaml @@ -18,10 +18,10 @@ 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 + sdk: ^3.10.0 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -88,3 +88,14 @@ flutter: # # For details regarding fonts from package dependencies, # see https://flutter.dev/to/font-from-package + + + + + + + + + + + diff --git a/examples/material_display_demo/LICENSE b/examples/material_display_demo/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/examples/material_display_demo/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 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..c5fd10d9 100644 --- a/examples/material_display_demo/pubspec.yaml +++ b/examples/material_display_demo/pubspec.yaml @@ -1,9 +1,10 @@ name: material_display_demo description: "Demo of Material Display Widgets" publish_to: 'none' -version: 1.0.0+1 +version: 1.0.0 +resolution: workspace environment: - sdk: ^3.10.0-278.0.dev + sdk: ^3.10.0 dependencies: flutter: sdk: flutter @@ -13,3 +14,14 @@ dev_dependencies: flutter_lints: ^6.0.0 flutter: uses-material-design: true + + + + + + + + + + + diff --git a/examples/material_inputs_demo/LICENSE b/examples/material_inputs_demo/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/examples/material_inputs_demo/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 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..22d2bd0f 100644 --- a/examples/material_inputs_demo/pubspec.yaml +++ b/examples/material_inputs_demo/pubspec.yaml @@ -1,9 +1,10 @@ name: material_inputs_demo description: "Demo of Material Inputs" publish_to: 'none' -version: 1.0.0+1 +version: 1.0.0 +resolution: workspace environment: - sdk: ^3.10.0-278.0.dev + sdk: ^3.10.0 dependencies: flutter: sdk: flutter @@ -13,3 +14,14 @@ dev_dependencies: flutter_lints: ^6.0.0 flutter: uses-material-design: true + + + + + + + + + + + diff --git a/examples/material_navigation_demo/LICENSE b/examples/material_navigation_demo/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/examples/material_navigation_demo/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 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..55a70ecb 100644 --- a/examples/material_navigation_demo/pubspec.yaml +++ b/examples/material_navigation_demo/pubspec.yaml @@ -1,9 +1,10 @@ name: material_navigation_demo description: "Demo of Material Navigation" publish_to: 'none' -version: 1.0.0+1 +version: 1.0.0 +resolution: workspace environment: - sdk: ^3.10.0-278.0.dev + sdk: ^3.10.0 dependencies: flutter: sdk: flutter @@ -13,3 +14,14 @@ dev_dependencies: flutter_lints: ^6.0.0 flutter: uses-material-design: true + + + + + + + + + + + diff --git a/examples/material_structure_demo/LICENSE b/examples/material_structure_demo/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/examples/material_structure_demo/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 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..3879f249 100644 --- a/examples/material_structure_demo/pubspec.yaml +++ b/examples/material_structure_demo/pubspec.yaml @@ -1,9 +1,10 @@ name: material_structure_demo description: "Demo of Material Structure Widgets" publish_to: 'none' -version: 1.0.0+1 +version: 1.0.0 +resolution: workspace environment: - sdk: ^3.10.0-278.0.dev + sdk: ^3.10.0 dependencies: flutter: sdk: flutter @@ -13,3 +14,14 @@ dev_dependencies: flutter_lints: ^6.0.0 flutter: uses-material-design: true + + + + + + + + + + + diff --git a/examples/multi_file_test/LICENSE b/examples/multi_file_test/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/examples/multi_file_test/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 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..d403ac86 100644 --- a/examples/multi_file_test/pubspec.yaml +++ b/examples/multi_file_test/pubspec.yaml @@ -16,10 +16,10 @@ 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 + sdk: ^3.10.0 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -89,3 +89,14 @@ flutter: # # For details regarding fonts from package dependencies, # see https://flutter.dev/to/font-from-package + + + + + + + + + + + diff --git a/examples/pub_test_app/LICENSE b/examples/pub_test_app/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/examples/pub_test_app/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 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/pub_test_app/pubspec.yaml b/examples/pub_test_app/pubspec.yaml index 20b6ab5d..672b2aed 100644 --- a/examples/pub_test_app/pubspec.yaml +++ b/examples/pub_test_app/pubspec.yaml @@ -1,7 +1,23 @@ name: pub_test_app +publish_to: 'none' version: 1.0.0 resolution: workspace environment: - sdk: ^3.5.0 + sdk: ^3.10.0 dependencies: uuid: ^4.0.0 + + + + + + + + + + + + +dev_dependencies: + lints: ^6.0.0 + diff --git a/examples/routing_app/LICENSE b/examples/routing_app/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/examples/routing_app/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 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..6c065a93 100644 --- a/examples/routing_app/pubspec.yaml +++ b/examples/routing_app/pubspec.yaml @@ -1,11 +1,11 @@ name: routing_app description: "A new FlutterJS Routing Example." publish_to: 'none' -version: 1.0.0+1 +version: 1.0.0 resolution: workspace environment: - sdk: ^3.10.0-278.0.dev + sdk: ^3.10.0 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -75,3 +75,14 @@ flutter: # # For details regarding fonts from package dependencies, # see https://flutter.dev/to/font-from-package + + + + + + + + + + + diff --git a/examples/try_test/LICENSE b/examples/try_test/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/examples/try_test/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 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..f985e85b 100644 --- a/examples/try_test/pubspec.yaml +++ b/examples/try_test/pubspec.yaml @@ -1,6 +1,23 @@ name: try_test +publish_to: 'none' description: Minimal test for try/catch/finally -version: 0.0.1 +version: 1.0.0 +resolution: workspace environment: - sdk: ^3.0.0 + sdk: ^3.10.0 + + + + + + + + + + + + +dev_dependencies: + lints: ^6.0.0 + diff --git a/packages/dart_analyzer/LICENSE b/packages/dart_analyzer/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/packages/dart_analyzer/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/dart_analyzer/docs/README.md b/packages/dart_analyzer/doc/README.md similarity index 100% rename from packages/dart_analyzer/docs/README.md rename to packages/dart_analyzer/doc/README.md diff --git a/packages/dart_analyzer/docs/analying_project.md b/packages/dart_analyzer/doc/analying_project.md similarity index 100% rename from packages/dart_analyzer/docs/analying_project.md rename to packages/dart_analyzer/doc/analying_project.md diff --git a/packages/dart_analyzer/docs/dependency_graph.md b/packages/dart_analyzer/doc/dependency_graph.md similarity index 100% rename from packages/dart_analyzer/docs/dependency_graph.md rename to packages/dart_analyzer/doc/dependency_graph.md diff --git a/packages/dart_analyzer/docs/dependency_resolver.md b/packages/dart_analyzer/doc/dependency_resolver.md similarity index 100% rename from packages/dart_analyzer/docs/dependency_resolver.md rename to packages/dart_analyzer/doc/dependency_resolver.md diff --git a/packages/dart_analyzer/docs/flutter_app_ir.md b/packages/dart_analyzer/doc/flutter_app_ir.md similarity index 100% rename from packages/dart_analyzer/docs/flutter_app_ir.md rename to packages/dart_analyzer/doc/flutter_app_ir.md 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/pubspec.yaml b/packages/dart_analyzer/pubspec.yaml index 9c7cad66..968d0b08 100644 --- a/packages/dart_analyzer/pubspec.yaml +++ b/packages/dart_analyzer/pubspec.yaml @@ -1,14 +1,16 @@ name: dart_analyzer -description: A sample command-line application. +publish_to: 'none' +description: Core dart_analyzer implementation for FlutterJS. version: 1.0.0 resolution: workspace # repository: https://github.com/my_org/my_repo environment: - sdk: ^3.10.0-278.0.dev + sdk: ^3.10.0 # Add regular dependencies here. dependencies: + crypto: ^3.0.3 path: ^1.9.0 analyzer: flutterjs_dev_tools: any @@ -16,5 +18,19 @@ dependencies: dev_dependencies: + crypto: ^3.0.3 lints: ^6.0.0 test: ^1.25.6 + + + + + + + + + + + + + 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/LICENSE b/packages/flutterjs_analyzer/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/packages/flutterjs_analyzer/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 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..af080419 100644 --- a/packages/flutterjs_analyzer/pubspec.yaml +++ b/packages/flutterjs_analyzer/pubspec.yaml @@ -1,19 +1,22 @@ name: flutterjs_analyzer -version: 0.1.0 +publish_to: 'none' +version: 1.0.0 +resolution: workspace description: FlutterJS Analyzer - Dart widget analyzer -homepage: https://github.com/flutterjs/flutterjs_analyzer +homepage: https://flutterjs.dev repository: https://github.com/flutterjs/flutterjs_analyzer issue_tracker: https://github.com/flutterjs/flutterjs_analyzer/issues environment: - sdk: '>=2.19.0 <4.0.0' + sdk: ^3.10.0 dependencies: flutter: sdk: flutter dev_dependencies: + lints: ^6.0.0 flutter_test: sdk: flutter @@ -22,3 +25,16 @@ flutterjs: npm_package: "@flutterjs/analyzer" implementation_language: "javascript" js_entry: "flutterjs_analyzer/src/index.js" + + + + + + + + + + + + + diff --git a/packages/flutterjs_animation/LICENSE b/packages/flutterjs_animation/LICENSE index 14fac913..a6d1a857 100644 --- a/packages/flutterjs_animation/LICENSE +++ b/packages/flutterjs_animation/LICENSE @@ -1,21 +1,24 @@ -MIT License +Copyright 2025 The FlutterJS Authors. All rights reserved. -Copyright (c) 2026 +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/flutterjs_animation/example/LICENSE b/packages/flutterjs_animation/example/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/packages/flutterjs_animation/example/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/flutterjs_animation/example/lib/main.dart b/packages/flutterjs_animation/example/lib/main.dart index a425720c..cf9a03f6 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() { @@ -11,9 +15,7 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( title: 'FlutterjsAnimation Example', - theme: ThemeData( - primarySwatch: Colors.blue, - ), + theme: ThemeData(primarySwatch: Colors.blue), home: const ExamplePage(), ); } @@ -32,16 +34,15 @@ 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'; }); } @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar( - title: const Text('FlutterjsAnimation Example'), - ), + appBar: AppBar(title: const Text('FlutterjsAnimation Example')), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/packages/flutterjs_animation/example/pubspec.yaml b/packages/flutterjs_animation/example/pubspec.yaml index af3a894f..c4d6b8a6 100644 --- a/packages/flutterjs_animation/example/pubspec.yaml +++ b/packages/flutterjs_animation/example/pubspec.yaml @@ -4,12 +4,25 @@ description: Example app for flutterjs_animation publish_to: 'none' environment: - sdk: '>=2.19.0 <4.0.0' + sdk: ^3.10.0 dependencies: flutter: sdk: flutter dev_dependencies: + lints: ^6.0.0 flutter_test: sdk: flutter + + + + + + + + + + + + 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..ccb70fe8 100644 --- a/packages/flutterjs_animation/pubspec.yaml +++ b/packages/flutterjs_animation/pubspec.yaml @@ -1,19 +1,22 @@ name: flutterjs_animation -version: 0.1.0 -description: A FlutterJS package +publish_to: 'none' +version: 1.0.0 +resolution: workspace +description: FlutterJS implementation of animation functionalities. -homepage: https://github.com/flutterjs/flutterjs_animation +homepage: https://flutterjs.dev repository: https://github.com/flutterjs/flutterjs_animation issue_tracker: https://github.com/flutterjs/flutterjs_animation/issues environment: - sdk: '>=2.19.0 <4.0.0' + sdk: ^3.10.0 dependencies: flutter: sdk: flutter dev_dependencies: + lints: ^6.0.0 flutter_test: sdk: flutter @@ -22,3 +25,16 @@ flutterjs: npm_package: "@flutterjs/flutterjs_animation" implementation_language: "javascript" js_entry: "js/src/index.js" + + + + + + + + + + + + + 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..e3f50733 100644 --- a/packages/flutterjs_builder/pubspec.yaml +++ b/packages/flutterjs_builder/pubspec.yaml @@ -1,12 +1,10 @@ name: flutterjs_builder -description: "A new Flutter package project." -version: 0.0.1 -homepage: +description: "A tool for building FlutterJS applications." +version: 1.0.0 resolution: workspace environment: - sdk: ^3.11.0-113.0.dev - flutter: ">=1.17.0" + sdk: ^3.7.0 dependencies: flutter: @@ -24,10 +22,6 @@ dev_dependencies: sdk: flutter flutter_lints: ^6.0.0 -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter packages. flutter: # To add assets to your package, add an assets section, like this: @@ -60,3 +54,4 @@ flutter: # # For details regarding fonts in packages, see # https://flutter.dev/to/font-from-package + 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/LICENSE b/packages/flutterjs_core/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/packages/flutterjs_core/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/flutterjs_core/docs/README.md b/packages/flutterjs_core/doc/README.md similarity index 100% rename from packages/flutterjs_core/docs/README.md rename to packages/flutterjs_core/doc/README.md diff --git a/packages/flutterjs_core/docs/analysis-passes.md b/packages/flutterjs_core/doc/analysis-passes.md similarity index 100% rename from packages/flutterjs_core/docs/analysis-passes.md rename to packages/flutterjs_core/doc/analysis-passes.md diff --git a/packages/flutterjs_core/docs/guide-adding-widgets.md b/packages/flutterjs_core/doc/guide-adding-widgets.md similarity index 100% rename from packages/flutterjs_core/docs/guide-adding-widgets.md rename to packages/flutterjs_core/doc/guide-adding-widgets.md diff --git a/packages/flutterjs_core/docs/guide-custom-expressions.md b/packages/flutterjs_core/doc/guide-custom-expressions.md similarity index 100% rename from packages/flutterjs_core/docs/guide-custom-expressions.md rename to packages/flutterjs_core/doc/guide-custom-expressions.md diff --git a/packages/flutterjs_core/docs/guide-extending-analysis.md b/packages/flutterjs_core/doc/guide-extending-analysis.md similarity index 100% rename from packages/flutterjs_core/docs/guide-extending-analysis.md rename to packages/flutterjs_core/doc/guide-extending-analysis.md diff --git a/packages/flutterjs_core/docs/ir-declarations.md b/packages/flutterjs_core/doc/ir-declarations.md similarity index 100% rename from packages/flutterjs_core/docs/ir-declarations.md rename to packages/flutterjs_core/doc/ir-declarations.md diff --git a/packages/flutterjs_core/docs/ir-expressions.md b/packages/flutterjs_core/doc/ir-expressions.md similarity index 100% rename from packages/flutterjs_core/docs/ir-expressions.md rename to packages/flutterjs_core/doc/ir-expressions.md diff --git a/packages/flutterjs_core/docs/ir-statements.md b/packages/flutterjs_core/doc/ir-statements.md similarity index 100% rename from packages/flutterjs_core/docs/ir-statements.md rename to packages/flutterjs_core/doc/ir-statements.md diff --git a/packages/flutterjs_core/docs/ir-system-overview.md b/packages/flutterjs_core/doc/ir-system-overview.md similarity index 100% rename from packages/flutterjs_core/docs/ir-system-overview.md rename to packages/flutterjs_core/doc/ir-system-overview.md diff --git a/packages/flutterjs_core/docs/ir-types.md b/packages/flutterjs_core/doc/ir-types.md similarity index 100% rename from packages/flutterjs_core/docs/ir-types.md rename to packages/flutterjs_core/doc/ir-types.md diff --git a/packages/flutterjs_core/docs/ir-widgets.md b/packages/flutterjs_core/doc/ir-widgets.md similarity index 100% rename from packages/flutterjs_core/docs/ir-widgets.md rename to packages/flutterjs_core/doc/ir-widgets.md 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..3fcceab4 100644 --- a/packages/flutterjs_core/pubspec.yaml +++ b/packages/flutterjs_core/pubspec.yaml @@ -1,20 +1,41 @@ name: flutterjs_core -description: A sample command-line application. +publish_to: 'none' +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 + sdk: ^3.10.0 # Add regular dependencies here. dependencies: + meta: ^1.11.0 + collection: ^1.18.0 + crypto: ^3.0.3 analyzer: ^8.4.1 path: ^1.9.0 flutterjs_dev_utils: path: ../flutterjs_dev_utils dev_dependencies: + meta: ^1.11.0 + collection: ^1.18.0 + crypto: ^3.0.3 lints: ^6.0.0 test: ^1.25.6 + + + + + + + + + + + + + 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/LICENSE b/packages/flutterjs_cupertino/LICENSE index 14fac913..a6d1a857 100644 --- a/packages/flutterjs_cupertino/LICENSE +++ b/packages/flutterjs_cupertino/LICENSE @@ -1,21 +1,24 @@ -MIT License +Copyright 2025 The FlutterJS Authors. All rights reserved. -Copyright (c) 2026 +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/flutterjs_cupertino/example/LICENSE b/packages/flutterjs_cupertino/example/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/packages/flutterjs_cupertino/example/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/flutterjs_cupertino/example/lib/main.dart b/packages/flutterjs_cupertino/example/lib/main.dart index e33e53e4..bc173d7f 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() { @@ -11,9 +15,7 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( title: 'FlutterjsCupertino Example', - theme: ThemeData( - primarySwatch: Colors.blue, - ), + theme: ThemeData(primarySwatch: Colors.blue), home: const ExamplePage(), ); } @@ -32,16 +34,15 @@ 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'; }); } @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar( - title: const Text('FlutterjsCupertino Example'), - ), + appBar: AppBar(title: const Text('FlutterjsCupertino Example')), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/packages/flutterjs_cupertino/example/pubspec.yaml b/packages/flutterjs_cupertino/example/pubspec.yaml index 4746a6bc..d773972e 100644 --- a/packages/flutterjs_cupertino/example/pubspec.yaml +++ b/packages/flutterjs_cupertino/example/pubspec.yaml @@ -4,12 +4,25 @@ description: Example app for flutterjs_cupertino publish_to: 'none' environment: - sdk: '>=2.19.0 <4.0.0' + sdk: ^3.10.0 dependencies: flutter: sdk: flutter dev_dependencies: + lints: ^6.0.0 flutter_test: sdk: flutter + + + + + + + + + + + + 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..076345ff 100644 --- a/packages/flutterjs_cupertino/pubspec.yaml +++ b/packages/flutterjs_cupertino/pubspec.yaml @@ -1,19 +1,22 @@ name: flutterjs_cupertino -version: 0.1.0 -description: A FlutterJS package +publish_to: 'none' +version: 1.0.0 +resolution: workspace +description: FlutterJS implementation of cupertino functionalities. -homepage: https://github.com/flutterjs/flutterjs_cupertino +homepage: https://flutterjs.dev repository: https://github.com/flutterjs/flutterjs_cupertino issue_tracker: https://github.com/flutterjs/flutterjs_cupertino/issues environment: - sdk: '>=2.19.0 <4.0.0' + sdk: ^3.10.0 dependencies: flutter: sdk: flutter dev_dependencies: + lints: ^6.0.0 flutter_test: sdk: flutter @@ -22,3 +25,16 @@ flutterjs: npm_package: "@flutterjs/flutterjs_cupertino" implementation_language: "javascript" js_entry: "js/src/index.js" + + + + + + + + + + + + + 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/LICENSE b/packages/flutterjs_dev_tools/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/packages/flutterjs_dev_tools/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/flutterjs_dev_tools/docs/README.md b/packages/flutterjs_dev_tools/doc/README.md similarity index 100% rename from packages/flutterjs_dev_tools/docs/README.md rename to packages/flutterjs_dev_tools/doc/README.md diff --git a/packages/flutterjs_dev_tools/docs/debugger.md b/packages/flutterjs_dev_tools/doc/debugger.md similarity index 100% rename from packages/flutterjs_dev_tools/docs/debugger.md rename to packages/flutterjs_dev_tools/doc/debugger.md 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/pubspec.yaml b/packages/flutterjs_dev_tools/pubspec.yaml index acd84323..95203aa2 100644 --- a/packages/flutterjs_dev_tools/pubspec.yaml +++ b/packages/flutterjs_dev_tools/pubspec.yaml @@ -1,10 +1,11 @@ name: flutterjs_dev_tools +publish_to: 'none' description: A starting point for Dart libraries or applications. version: 1.0.0 resolution: workspace environment: - sdk: ^3.10.0-278.0.dev + sdk: ^3.10.0 dependencies: shelf: ^1.4.0 @@ -20,3 +21,15 @@ dependencies: dev_dependencies: lints: ^6.0.0 test: ^1.25.6 + + + + + + + + + + + + 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/LICENSE b/packages/flutterjs_dev_utils/LICENSE new file mode 100644 index 00000000..a6d1a857 --- /dev/null +++ b/packages/flutterjs_dev_utils/LICENSE @@ -0,0 +1,24 @@ +Copyright 2025 The FlutterJS Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of FlutterJS nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/flutterjs_dev_utils/docs/README.md b/packages/flutterjs_dev_utils/doc/README.md similarity index 100% rename from packages/flutterjs_dev_utils/docs/README.md rename to packages/flutterjs_dev_utils/doc/README.md 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/pubspec.yaml b/packages/flutterjs_dev_utils/pubspec.yaml index 836ec7df..693f39bd 100644 --- a/packages/flutterjs_dev_utils/pubspec.yaml +++ b/packages/flutterjs_dev_utils/pubspec.yaml @@ -1,11 +1,12 @@ name: flutterjs_dev_utils -description: A sample command-line application. +publish_to: 'none' +description: FlutterJS implementation of dev_utils functionalities. version: 1.0.0 resolution: workspace # repository: https://github.com/my_org/my_repo environment: - sdk: ^3.10.0-278.0.dev + sdk: ^3.10.0 # Add regular dependencies here. dependencies: @@ -14,3 +15,15 @@ dependencies: dev_dependencies: lints: ^6.0.0 test: ^1.25.6 + + + + + + + + + + + + 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/docs/README.md b/packages/flutterjs_engine/doc/README.md similarity index 100% rename from packages/flutterjs_engine/docs/README.md rename to packages/flutterjs_engine/doc/README.md diff --git a/packages/flutterjs_engine/docs/architecture-patterns.md b/packages/flutterjs_engine/doc/architecture-patterns.md similarity index 100% rename from packages/flutterjs_engine/docs/architecture-patterns.md rename to packages/flutterjs_engine/doc/architecture-patterns.md diff --git a/packages/flutterjs_engine/docs/architecture.md b/packages/flutterjs_engine/doc/architecture.md similarity index 100% rename from packages/flutterjs_engine/docs/architecture.md rename to packages/flutterjs_engine/doc/architecture.md diff --git a/packages/flutterjs_engine/docs/file-structure.md b/packages/flutterjs_engine/doc/file-structure.md similarity index 100% rename from packages/flutterjs_engine/docs/file-structure.md rename to packages/flutterjs_engine/doc/file-structure.md diff --git a/packages/flutterjs_engine/docs/integration-plan.md b/packages/flutterjs_engine/doc/integration-plan.md similarity index 100% rename from packages/flutterjs_engine/docs/integration-plan.md rename to packages/flutterjs_engine/doc/integration-plan.md diff --git a/packages/flutterjs_engine/docs/ssr-seo-plan.md b/packages/flutterjs_engine/doc/ssr-seo-plan.md similarity index 100% rename from packages/flutterjs_engine/docs/ssr-seo-plan.md rename to packages/flutterjs_engine/doc/ssr-seo-plan.md 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