feat: add WebF SQFlite native plugin for SQLite database support#793
feat: add WebF SQFlite native plugin for SQLite database support#793
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR adds a new WebF SQFlite native plugin (Dart bindings, module implementation, TypeScript typings, docs, and packaging), updates the CLI to copy README when generating modules, integrates SQFlite into the example and use-case apps, and fixes flex baseline handling with a new test. Changes
Sequence DiagramsequenceDiagram
actor User
participant React as React Component<br/>(WebFSQFlitePage)
participant JS as WebF JS Bridge<br/>(webf-sqflite)
participant Dart as Dart Module<br/>(SQFliteModule)
participant SQLite as SQLite DB<br/>(sqflite)
User->>React: Open SQFlite Demo
React->>JS: openDatabase(options)
JS->>Dart: invoke('openDatabase', options)
Dart->>SQLite: open database
SQLite-->>Dart: DB instance
Dart-->>JS: OpenDatabaseResult {success, databaseId}
JS-->>React: Promise resolves
React->>React: store databaseId, render UI
User->>React: Add User / Query
React->>JS: insert/query(options)
JS->>Dart: invoke('insert'/'query', options)
Dart->>SQLite: perform operation
SQLite-->>Dart: results
Dart-->>JS: result object
JS-->>React: Promise resolves
React->>React: update state
User->>React: Batch / Transaction
React->>JS: batch/transaction(operations)
JS->>Dart: invoke('batch'/'transaction', ops)
Dart->>SQLite: execute ops atomically
SQLite-->>Dart: aggregated results
Dart-->>JS: BatchResult/TransactionResult
JS-->>React: Promise resolves
React->>React: update UI with results
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly Related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used📓 Path-based instructions (2)webf/**/*.dart📄 CodeRabbit inference engine (webf/CLAUDE.md)
Files:
{bridge/**/*.{cc,h},webf/**/*.dart}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (12)📓 Common learnings📚 Learning: 2025-12-08T23:28:00.818ZApplied to files:
📚 Learning: 2025-12-08T23:28:00.818ZApplied to files:
📚 Learning: 2025-12-08T23:28:11.651ZApplied to files:
📚 Learning: 2025-12-08T23:28:00.818ZApplied to files:
📚 Learning: 2025-12-08T23:28:00.818ZApplied to files:
📚 Learning: 2025-12-08T23:27:15.946ZApplied to files:
📚 Learning: 2025-12-08T23:28:00.818ZApplied to files:
📚 Learning: 2025-12-08T23:28:00.818ZApplied to files:
📚 Learning: 2025-12-08T23:28:00.818ZApplied to files:
📚 Learning: 2025-12-08T23:28:00.818ZApplied to files:
📚 Learning: 2025-12-08T23:28:00.818ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
webf/lib/src/rendering/flex.dart (1)
1753-1756: Remove unused localdyto avoid analyzer noise / CI failures.
dyis assigned but never used.Proposed fix
- double dy = 0; - if (child.parentData is RenderLayoutParentData) { - dy = (child.parentData as RenderLayoutParentData).offset.dy; - } -
🤖 Fix all issues with AI agents
In @native_plugins/sqflite/lib/src/sqflite_module.dart:
- Around line 66-72: The dispose method currently calls asynchronous db.close()
on each database without awaiting, risking incomplete closes; change dispose
(the dispose method in sqflite_module.dart) to return Future<void>, collect all
futures from calling close() on each DB in _databases.values, and await
Future.wait on that list before clearing _databases; update any callers to await
dispose or, if async disposal cannot be supported, add a clear comment on the
intentional fire-and-forget behavior and keep the current signature.
In @native_plugins/sqflite/LICENSE:
- Around line 1-21: Replace the incorrect MIT text with the correct BSD-2-Clause
license text from the upstream sqflite plugin and update the package metadata to
match: replace the LICENSE file contents with the BSD-2-Clause license (keeping
the project copyright/notice as appropriate) and update the pubspec.yaml license
field (and any license-related metadata) to "BSD-2-Clause" so the plugin and its
packaging reflect the upstream license rather than MIT.
In @native_plugins/sqflite/README.md:
- Line 24: Update the README entry for the plugin to match the actual package
version in pubspec.yaml: change the version string "webf_sqflite: ^1.0.0" to
"webf_sqflite: ^1.0.1" (or the exact version declared under version in
pubspec.yaml) so documentation and package metadata are consistent.
In @use_cases/package.json:
- Line 11: Update the dependency entry for the package key
"@openwebf/webf-sqflite" in package.json to use the local file reference
"file:../native_plugins/sqflite-npm" instead of the semver range "^1.0.1" so
installations without a package-lock.json resolve the local plugin correctly;
locate the dependency key "@openwebf/webf-sqflite" in package.json and replace
the version string accordingly.
In @use_cases/src/pages/WebFSQFlitePage.tsx:
- Around line 59-87: When handling the WebFSQFlite.openDatabase response, don't
assume databaseId exists when result.success === 'true'; update the branch that
currently uses result.databaseId! to first verify result.databaseId is a
non-empty value, call setDatabaseId(result.databaseId) only when present, and
only invoke loadUsers(result.databaseId) and loadTasks(result.databaseId) when
that id is present; otherwise log an error via addLog that the database opened
but no databaseId was returned and avoid using the non-null assertion to prevent
a crash (references: WebFSQFlite.openDatabase, result.databaseId, setDatabaseId,
addLog, loadUsers, loadTasks).
- Around line 36-43: The cleanup in the useEffect captures the initial stale
databaseId (null) because deps are [], so the DB may not close; create a ref
(e.g., databaseIdRef) to hold the latest databaseId, update
databaseIdRef.current whenever setDatabaseId is called (inside
initializeDatabase or wherever you assign the id), and use databaseIdRef.current
inside the cleanup to call WebFSQFlite.closeDatabase(databaseIdRef.current).
Also ensure initializeDatabase still calls setDatabaseId as before so the ref
stays in sync.
🧹 Nitpick comments (3)
cli/package.json (1)
3-3: Version bump looks fine; ensure release artifacts align (tags/changelog/publish pipeline).cli/src/commands.ts (1)
1118-1125: Consider using the logger utility for consistency.While the README copy logic is sound, the coding guidelines specify using the logger utility (debug, info, warn, error from './logger') instead of console methods. However, since these appear to be user-facing CLI messages rather than debug logs,
console.logmay be intentional here.For consistency across the codebase, consider whether these messages should use the logger utility.
As per coding guidelines: "Use the logger utility (debug, info, warn, error from './logger') for debugging instead of console methods"
native_plugins/sqflite/lib/src/sqflite.module.d.ts (1)
30-41: Prefer'true' | 'false'overstringforsuccess(andexists) to make callsites type-safe.
Right now TS won’t catchsuccess === truemistakes and can’t narrow on success.Example adjustment
-interface OpenDatabaseResult { - /** "true" on success, "false" on failure. */ - success: string; +type WebFSQFliteBool = 'true' | 'false'; + +interface OpenDatabaseResult { + /** "true" on success, "false" on failure. */ + success: WebFSQFliteBool; /** Unique database handle ID for subsequent operations. */ databaseId?: string; /** Database file path. */ path?: string; /** Current database version. */ version?: number; /** Error message if operation failed. */ error?: string; }Also applies to: 84-93, 112-119, 142-149, 168-175, 192-201, 254-261, 276-283, 288-317
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
cli/package-lock.jsonis excluded by!**/package-lock.jsonuse_cases/package-lock.jsonis excluded by!**/package-lock.jsonuse_cases/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (20)
cli/package.jsoncli/src/commands.tsnative_plugins/sqflite/CHANGELOG.mdnative_plugins/sqflite/LICENSEnative_plugins/sqflite/README.mdnative_plugins/sqflite/lib/src/sq_flite_module_bindings_generated.dartnative_plugins/sqflite/lib/src/sqflite.module.d.tsnative_plugins/sqflite/lib/src/sqflite_module.dartnative_plugins/sqflite/lib/webf_sqflite.dartnative_plugins/sqflite/pubspec.yamlnative_plugins/sqflite/tsconfig.jsonuse_cases/package.jsonuse_cases/src/App.tsxuse_cases/src/pages/FeatureCatalogPage.tsxuse_cases/src/pages/WebFSQFlitePage.tsxwebf/example/macos/Flutter/GeneratedPluginRegistrant.swiftwebf/example/macos/Runner.xcodeproj/project.pbxprojwebf/example/pubspec.yamlwebf/lib/src/rendering/flex.dartwebf/test/src/rendering/flex_baseline_detached_layout_test.dart
🧰 Additional context used
📓 Path-based instructions (6)
webf/**/*.dart
📄 CodeRabbit inference engine (webf/CLAUDE.md)
webf/**/*.dart: Follow rules in webf/analysis_options.yaml for Dart code style
Use single quotes for strings in Dart code
File names must use snake_case in Dart
Class names must use PascalCase in Dart
Variables and functions must use camelCase in Dart
Prefer final fields when applicable in Dart code
Lines should be max 120 characters in Dart code
Always free allocated memory in Dart FFI using malloc.free() for toNativeUtf8() allocations
Free FFI allocated memory in finally blocks to ensure cleanup on exceptions
Track ownership of allocated pointers in FFI callbacks
Free NativeValue pointers after converting with fromNativeValue in FFI code
Document memory ownership clearly in FFI async callbacks
Implement WidgetElement to create custom Flutter widgets integrated into WebF's DOM tree
Register custom WidgetElements using WidgetElementRegistry.register(tagName, builder)
Override buildWidget(BuildContext context) method in WidgetElement to build the Flutter widget
Call updateWidget() when attributes change in WidgetElement implementations
Dispose controllers and subscriptions in WidgetElement for memory management
Follow W3C event standards when dispatching events from WidgetElement
Minimize widget rebuilds in WidgetElement for performance optimization
Implement ARIA attributes in WidgetElement when applicable for accessibilityDart code in webf module must follow naming conventions: snake_case for file names, PascalCase for classes, and camelCase for class members
webf/**/*.dart: Always free allocated memory in Dart FFI
Usemalloc.free()fortoNativeUtf8()allocations in Dart FFI
Track pointer ownership in callbacks within Dart FFI
Files:
webf/test/src/rendering/flex_baseline_detached_layout_test.dartwebf/lib/src/rendering/flex.dart
webf/test/**/*_test.dart
📄 CodeRabbit inference engine (webf/CLAUDE.md)
webf/test/**/*_test.dart: Use WebFWidgetTestUtils.prepareWidgetTest() to test HTML/CSS rendering in widget unit tests
Access render objects in tests to verify layout calculations
Call setupTest() in setUpAll() method for one-time setup in unit tests
When testing with WebFController, wait for initialization with: await controller.controlledInitCompleter.future
Use mock bundles from test/src/foundation/mock_bundle.dart for testing in unit tests
Files:
webf/test/src/rendering/flex_baseline_detached_layout_test.dart
webf/test/**/*.dart
📄 CodeRabbit inference engine (AGENTS.md)
Dart/Flutter widget and unit tests must be placed in
webf/test/and useWebFWidgetTestUtilsandpumpAndSettle()where needed
Files:
webf/test/src/rendering/flex_baseline_detached_layout_test.dart
{bridge/**/*.{cc,h},webf/**/*.dart}
📄 CodeRabbit inference engine (CLAUDE.md)
Document memory ownership clearly in FFI implementations
Files:
webf/test/src/rendering/flex_baseline_detached_layout_test.dartwebf/lib/src/rendering/flex.dart
cli/**/*.ts
📄 CodeRabbit inference engine (cli/CLAUDE.md)
cli/**/*.ts: Use async/await for asynchronous operations in TypeScript implementation files
Implement proper error handling with try-catch and add descriptive error messages
Use the logger utility (debug, info, warn, error from './logger') for debugging instead of console methods
Boolean attributes in TypeScript interfaces must always generate non-nullable bool types in Dart (use generateAttributeSetter for type conversion)
Handle HTML attribute type conversion automatically: booleans use 'value == true || value == empty', integers use int.tryParse with default 0, doubles use double.tryParse with default 0.0, strings use direct assignment
Preserve directory structure from source in generated output files, maintaining original file paths
Clear caches before generation when file changes need to be detected
Process files in batches using processFilesInBatch for optimal parallelism
Check for literal types containing null when handling null type handling in AST analysis
Apply metadata synchronization from pubspec.yaml (version and description) when creating typing projects
Automatically run npm run build after code generation if a build script is present in package.json
Support automatic npm publishing via --publish-to-npm flag and interactive prompts, including custom registry configuration
Validate npm login status before attempting to publish, and manage temporary registry configuration for custom registries
Auto-detect and create missing project files (package.json, global.d.ts, tsconfig.json) when running codegen without an existing project
Detect framework from existing package.json dependencies when not explicitly providedTypeScript code in cli module must use strict TypeScript configuration
Files:
cli/src/commands.ts
webf/lib/src/rendering/**/*.dart
📄 CodeRabbit inference engine (webf/CLAUDE.md)
Use RenderBoxModel as base class for layout in Dart rendering code
Files:
webf/lib/src/rendering/flex.dart
🧠 Learnings (41)
📓 Common learnings
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: No build needed for Dart-only changes in webf/
Learnt from: CR
Repo: openwebf/webf PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T16:32:47.644Z
Learning: Applies to docs/**/*.md : Clarify that WebF builds Flutter apps, not web apps in documentation
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Applies to webf/**/*.dart : Use single quotes for strings in Dart code
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Applies to webf/**/*.dart : Implement WidgetElement to create custom Flutter widgets integrated into WebF's DOM tree
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: No build needed for Dart-only changes in webf/
Applied to files:
use_cases/package.jsonnative_plugins/sqflite/lib/webf_sqflite.dartnative_plugins/sqflite/pubspec.yamlwebf/test/src/rendering/flex_baseline_detached_layout_test.dartwebf/example/pubspec.yaml
📚 Learning: 2025-12-13T16:32:47.644Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T16:32:47.644Z
Learning: Applies to webf/**/*.dart : Use `malloc.free()` for `toNativeUtf8()` allocations in Dart FFI
Applied to files:
native_plugins/sqflite/lib/webf_sqflite.dartnative_plugins/sqflite/lib/src/sq_flite_module_bindings_generated.dart
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Applies to webf/lib/bridge.dart : lib/bridge.dart contains FFI bindings to C++ bridge
Applied to files:
native_plugins/sqflite/lib/webf_sqflite.dart
📚 Learning: 2025-12-08T23:27:15.946Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: bridge/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:27:15.946Z
Learning: Applies to bridge/**/*.{cc,cpp,h,hpp} : Use `WEBF_EXPORT_C` macro for exporting C functions to Dart FFI
Applied to files:
native_plugins/sqflite/lib/webf_sqflite.dart
📚 Learning: 2025-12-08T23:28:11.651Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T23:28:11.651Z
Learning: Applies to webf/**/*.dart : Dart code in webf module must follow naming conventions: snake_case for file names, PascalCase for classes, and camelCase for class members
Applied to files:
native_plugins/sqflite/lib/webf_sqflite.dartnative_plugins/sqflite/pubspec.yaml
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Applies to webf/**/*.dart : Prefer final fields when applicable in Dart code
Applied to files:
native_plugins/sqflite/lib/webf_sqflite.dartnative_plugins/sqflite/lib/src/sq_flite_module_bindings_generated.dart
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Applies to webf/**/*.dart : Use single quotes for strings in Dart code
Applied to files:
native_plugins/sqflite/lib/webf_sqflite.dart
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Applies to webf/**/*.dart : Document memory ownership clearly in FFI async callbacks
Applied to files:
native_plugins/sqflite/lib/webf_sqflite.dart
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Applies to webf/**/*.dart : Follow rules in webf/analysis_options.yaml for Dart code style
Applied to files:
native_plugins/sqflite/lib/webf_sqflite.dartwebf/example/pubspec.yaml
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Applies to webf/**/*.dart : Always free allocated memory in Dart FFI using malloc.free() for toNativeUtf8() allocations
Applied to files:
native_plugins/sqflite/lib/webf_sqflite.dart
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Run Flutter dart tests with: cd webf && flutter test
Applied to files:
native_plugins/sqflite/pubspec.yamlwebf/test/src/rendering/flex_baseline_detached_layout_test.dartwebf/example/pubspec.yaml
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Applies to webf/test/**/*_test.dart : Access render objects in tests to verify layout calculations
Applied to files:
webf/test/src/rendering/flex_baseline_detached_layout_test.dartwebf/lib/src/rendering/flex.dart
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Use widget unit tests to verify rendering changes with: cd webf && flutter test test/src/rendering/
Applied to files:
webf/test/src/rendering/flex_baseline_detached_layout_test.dart
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Applies to webf/test/**/*_test.dart : Use WebFWidgetTestUtils.prepareWidgetTest() to test HTML/CSS rendering in widget unit tests
Applied to files:
webf/test/src/rendering/flex_baseline_detached_layout_test.dart
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Applies to webf/lib/src/rendering/**/*.dart : Use RenderBoxModel as base class for layout in Dart rendering code
Applied to files:
webf/test/src/rendering/flex_baseline_detached_layout_test.dartwebf/lib/src/rendering/flex.dart
📚 Learning: 2025-12-08T23:28:11.651Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T23:28:11.651Z
Learning: Applies to webf/test/**/*.dart : Dart/Flutter widget and unit tests must be placed in `webf/test/` and use `WebFWidgetTestUtils` and `pumpAndSettle()` where needed
Applied to files:
webf/test/src/rendering/flex_baseline_detached_layout_test.dartwebf/example/pubspec.yaml
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Run widget unit tests with: cd webf && flutter test test/src/rendering/
Applied to files:
webf/test/src/rendering/flex_baseline_detached_layout_test.dart
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Applies to webf/test/**/*_test.dart : Use mock bundles from test/src/foundation/mock_bundle.dart for testing in unit tests
Applied to files:
webf/test/src/rendering/flex_baseline_detached_layout_test.dart
📚 Learning: 2025-12-08T23:28:11.651Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T23:28:11.651Z
Learning: Applies to webf/integration_test/**/*.dart : Dart/Flutter integration tests must be placed in `webf/integration_test/` directory
Applied to files:
webf/test/src/rendering/flex_baseline_detached_layout_test.dartwebf/example/pubspec.yaml
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Applies to webf/**/*.dart : Implement WidgetElement to create custom Flutter widgets integrated into WebF's DOM tree
Applied to files:
webf/test/src/rendering/flex_baseline_detached_layout_test.dart
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Applies to webf/test/**/*_test.dart : When testing with WebFController, wait for initialization with: await controller.controlledInitCompleter.future
Applied to files:
webf/test/src/rendering/flex_baseline_detached_layout_test.dart
📚 Learning: 2025-12-08T23:27:41.357Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: scripts/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:27:41.357Z
Learning: The WebF type generation system is composed of interconnected tasks that generate TypeScript definitions from multiple sources in a coordinated pipeline
Applied to files:
native_plugins/sqflite/LICENSE
📚 Learning: 2025-12-13T16:32:47.644Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T16:32:47.644Z
Learning: Applies to docs/**/*.md : Include WebFControllerManager setup in code examples within documentation
Applied to files:
native_plugins/sqflite/LICENSE
📚 Learning: 2025-12-08T23:27:15.946Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: bridge/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:27:15.946Z
Learning: Applies to bridge/ios/webf_ios.podspec : Ensure all source files, particularly `member_installer.cc`, are included in the `source_files` pattern in `ios/webf_ios.podspec`
Applied to files:
webf/example/macos/Runner.xcodeproj/project.pbxproj
📚 Learning: 2025-11-26T10:24:13.090Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: cli/CLAUDE.md:0-0
Timestamp: 2025-11-26T10:24:13.090Z
Learning: Applies to cli/**/*.ts : Apply metadata synchronization from pubspec.yaml (version and description) when creating typing projects
Applied to files:
native_plugins/sqflite/tsconfig.jsoncli/src/commands.ts
📚 Learning: 2025-12-08T23:28:11.651Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T23:28:11.651Z
Learning: Applies to cli/**/*.ts : TypeScript code in cli module must use strict TypeScript configuration
Applied to files:
native_plugins/sqflite/tsconfig.json
📚 Learning: 2025-12-08T23:27:41.357Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: scripts/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:27:41.357Z
Learning: Applies to scripts/bridge/polyfill/**/*.{ts,tsx} : DO NOT manually edit `bridge/typings/polyfill.d.ts` - it is generated from polyfill TypeScript source
Applied to files:
native_plugins/sqflite/tsconfig.json
📚 Learning: 2025-12-08T23:27:41.357Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: scripts/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:27:41.357Z
Learning: Applies to scripts/bridge/polyfill/rollup.config.dts.js : Use `rollup.config.dts.js` in `bridge/polyfill/` directory as the configuration for Rollup-based type generation
Applied to files:
native_plugins/sqflite/tsconfig.json
📚 Learning: 2025-12-08T23:27:41.357Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: scripts/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:27:41.357Z
Learning: Applies to scripts/bridge/polyfill/**/*.{ts,tsx,d.ts} : Use Rollup with `rollup-plugin-dts` to generate types from `bridge/polyfill/src` into `bridge/typings/polyfill.d.ts`
Applied to files:
native_plugins/sqflite/tsconfig.json
📚 Learning: 2025-11-26T10:24:13.090Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: cli/CLAUDE.md:0-0
Timestamp: 2025-11-26T10:24:13.090Z
Learning: Update documentation when adding new features, along with TypeScript interfaces, tests, and templates
Applied to files:
native_plugins/sqflite/tsconfig.jsonnative_plugins/sqflite/lib/src/sqflite.module.d.ts
📚 Learning: 2025-12-08T23:27:27.888Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: integration_tests/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:27:27.888Z
Learning: Applies to integration_tests/specs/**/*.ts : Use TypeScript (.ts extension) for test files
Applied to files:
native_plugins/sqflite/tsconfig.json
📚 Learning: 2025-12-08T23:27:41.357Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: scripts/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:27:41.357Z
Learning: Applies to scripts/bridge/core/**/*.d.ts : Scan all `.d.ts` files in `bridge/core/` directory and merge them into a single `bridge/typings/webf.d.ts` file using the `merge-bridge-typings` task
Applied to files:
native_plugins/sqflite/tsconfig.json
📚 Learning: 2025-11-26T10:24:13.090Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: cli/CLAUDE.md:0-0
Timestamp: 2025-11-26T10:24:13.090Z
Learning: Applies to cli/**/*.ts : Auto-detect and create missing project files (package.json, global.d.ts, tsconfig.json) when running codegen without an existing project
Applied to files:
native_plugins/sqflite/tsconfig.json
📚 Learning: 2025-11-26T10:24:13.090Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: cli/CLAUDE.md:0-0
Timestamp: 2025-11-26T10:24:13.090Z
Learning: Applies to cli/**/*.ts : Preserve directory structure from source in generated output files, maintaining original file paths
Applied to files:
cli/src/commands.ts
📚 Learning: 2025-12-08T23:28:11.651Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T23:28:11.651Z
Learning: Generate bindings and types before commits by running `node scripts/generate_binding_code.js`
Applied to files:
cli/src/commands.ts
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Run a single Flutter test with: cd webf && flutter test test/path/to/test_file.dart
Applied to files:
webf/example/pubspec.yaml
📚 Learning: 2025-12-08T23:27:41.357Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: scripts/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:27:41.357Z
Learning: Applies to scripts/bridge/core/**/*.d.ts : Transform WebF-specific type annotations: `DartImpl<T>` → `T`, `StaticMember<T>` → `T`, `StaticMethod<T>` → `T`, `SupportAsync<T>` → generates both sync and async variants, `DependentsOnLayout<T>` → `T`
Applied to files:
native_plugins/sqflite/lib/src/sqflite.module.d.ts
📚 Learning: 2025-12-08T23:27:41.357Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: scripts/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:27:41.357Z
Learning: Applies to scripts/bridge/core/**/*.d.ts : DO NOT manually edit `bridge/typings/webf.d.ts` - it is generated from bridge/core/*.d.ts
Applied to files:
native_plugins/sqflite/lib/src/sqflite.module.d.ts
📚 Learning: 2025-12-08T23:27:41.357Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: scripts/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:27:41.357Z
Learning: Applies to scripts/bridge/typings/index.d.ts : Configure `bridge/typings/index.d.ts` to reference both `webf.d.ts` and `polyfill.d.ts` and re-export polyfill module exports for a unified interface
Applied to files:
native_plugins/sqflite/lib/src/sqflite.module.d.ts
📚 Learning: 2025-12-08T23:28:00.818Z
Learnt from: CR
Repo: openwebf/webf PR: 0
File: webf/CLAUDE.md:0-0
Timestamp: 2025-12-08T23:28:00.818Z
Learning: Applies to webf/lib/src/css/**/*.dart : Use CSSRenderStyle for style computation and storage in Dart CSS code
Applied to files:
webf/lib/src/rendering/flex.dart
🧬 Code graph analysis (1)
use_cases/src/App.tsx (1)
use_cases/src/pages/WebFSQFlitePage.tsx (1)
WebFSQFlitePage(19-626)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Build iOS Example
- GitHub Check: build_windows_bridge (Debug)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (c-cpp)
- GitHub Check: Analyze (rust)
🔇 Additional comments (16)
webf/example/pubspec.yaml (1)
33-36: Path dependencies verified. Bothwebf_shareandwebf_sqfliteplugins exist at the specified paths with matching package names in their pubspec.yaml files. Configuration is correct.webf/example/macos/Flutter/GeneratedPluginRegistrant.swift (1)
15-15: macOS plugin registrant wiring is correct and consistent with dependencies. The sqflite_darwin import (line 15) and SqflitePlugin registration (line 27) are present, properly wired, and match the webf_sqflite dependency declared in the example's pubspec.yaml. The file is correctly marked as auto-generated and contains no duplicates or syntax errors.native_plugins/sqflite/tsconfig.json (1)
1-25: LGTM! TypeScript configuration follows best practices.The tsconfig.json is well-configured with strict mode enabled, appropriate compiler options for ES2020/CommonJS, and proper include/exclude patterns for a TypeScript declarations project.
native_plugins/sqflite/pubspec.yaml (1)
1-30: LGTM! Package manifest is well-configured.The pubspec.yaml follows Flutter package conventions with appropriate metadata, version constraints, and dependencies. SDK constraint of ^3.6.0 aligns with modern Dart/Flutter requirements.
webf/example/macos/Runner.xcodeproj/project.pbxproj (1)
272-272: LGTM! Standard CocoaPods framework integration.The addition of sqflite_darwin.framework to the inputPaths and outputPaths is the expected CocoaPods-generated configuration for embedding the native SQLite plugin on macOS.
Also applies to: 289-289
native_plugins/sqflite/lib/src/sqflite_module.dart (1)
1-105: Well-structured module with consistent error handling.The implementation follows good patterns:
- Consistent try-catch with result objects
- Clear separation of database management, CRUD, raw SQL, batch, and transaction operations
- Proper null checking and validation
- Single quotes used consistently per coding guidelines
native_plugins/sqflite/lib/src/sq_flite_module_bindings_generated.dart (1)
1-774: Auto-generated bindings look correct.The generated DTOs and bindings follow consistent patterns with proper type guards and null handling in
fromMap()factories. Theinvoke()routing correctly maps method calls to typed implementations.native_plugins/sqflite/lib/webf_sqflite.dart (1)
1-89: Comprehensive library documentation with practical examples.The entry point provides clear setup instructions for both Flutter (Dart) and JavaScript consumers, with working code examples. The library declaration and export are correct.
use_cases/src/App.tsx (1)
20-20: Route integration follows existing patterns.The import and route registration for
WebFSQFlitePageare consistent with other native plugin pages likeWebFSharePage.Also applies to: 219-219
use_cases/src/pages/FeatureCatalogPage.tsx (1)
118-118: Catalog entry correctly added to Native Plugins section.The entry follows the existing pattern and provides a clear description of the feature.
native_plugins/sqflite/CHANGELOG.md (1)
1-11: Comprehensive changelog for initial release.The changelog accurately documents all features implemented in the SQFlite module.
webf/test/src/rendering/flex_baseline_detached_layout_test.dart (2)
34-66: Test correctly verifies baseline calculation with detached children.The test properly follows WebF testing patterns:
- Uses
WebFWidgetTestUtils.prepareWidgetTest()as per guidelines- Calls
setupTest()insetUpAll()- Tests the specific edge case of
parentDatabeing null- Uses
returnsNormallymatcher to verify no crashThe test effectively validates the fix for flex baseline crashes on detached children.
14-17: Test setup follows WebF conventions.The
setUpAllcallssetupTest()as required by the coding guidelines.webf/lib/src/rendering/flex.dart (1)
1584-1614: Good hardening of baseline computation for detached render trees + safer parentData handling.
The new helper avoidsRenderBox.getDistanceToBaselineassertions whenchild.attached == false, and theParentDataoffset extraction no longer assumesRenderLayoutParentData.Also applies to: 1654-1673, 1724-1727, 1781-1803
native_plugins/sqflite/lib/src/sqflite.module.d.ts (1)
12-477: No changes needed.This file is a code generator specification for
webf module-codegen, not a TypeScript module for consumer use. The.module.d.tsfiles define interfaces that the CLI reads and parses to generate the actual npm package (with exports insrc/index.tsandsrc/types.ts) and Dart bindings. The interfaces in this file require no explicitexportordeclare modulestatements—they exist solely as input for the codegen pipeline.use_cases/src/pages/WebFSQFlitePage.tsx (1)
297-308: No issue found. The batch operation encoding is correct.The native
batch()implementation (line 657 in sqflite_module.dart) JSON-decodes the entireoperationsstring once, then expects each operation'svaluesfield to be aMap<String, dynamic>(object)—not a string. The code correctly embeds theuserobject directly in the operations array before JSON stringifying the entire array. AfterjsonDecodeon the native side,valuesbecomes the expectedMaptype. This matches the README documentation (lines 162-169) and the native implementation.
8902a49 to
110aead
Compare
Summary
webf_sqflitenative plugin that wraps the sqflite Flutter package to provide SQLite database operations for WebF applicationsFeatures
The new
webf_sqfliteplugin provides:Changes
native_plugins/sqflite/cli/webf/lib/src/rendering/flex.dartwebf/test/use_cases/Summary by CodeRabbit
New Features
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.