feat(core): refactor root scope API, improve logger injection, helpers, and tests

- BREAKING CHANGE: introduce CherryPick.openRootScope
- add logger injection to Scope
- refactor helper and scope logic
- improve internal logging
- enhance and update tests
- add log_format.dart module
This commit is contained in:
Sergey Penkovsky
2025-08-08 11:23:14 +03:00
parent c971b59483
commit 1131be44da
12 changed files with 410 additions and 350 deletions

View File

@@ -47,7 +47,7 @@ class FeatureModule extends Module {
Future<void> main() async {
try {
final scope = openRootScope().installModules([AppModule()]);
final scope = CherryPick.openRootScope().installModules([AppModule()]);
final subScope = scope
.openSubScope("featureScope")

View File

@@ -126,7 +126,7 @@ void main() {
// Example 1: Demonstrate circular dependency
print('1. Attempt to create a scope with circular dependencies:');
try {
final scope = Scope(null);
final scope = CherryPick.openRootScope();
scope.enableCycleDetection(); // Включаем обнаружение циклических зависимостей
scope.installModules([
@@ -144,7 +144,7 @@ void main() {
// Example 2: Without circular dependency detection (dangerous!)
print('2. Same code without circular dependency detection:');
try {
final scope = Scope(null);
final scope = CherryPick.openRootScope();
// НЕ включаем обнаружение циклических зависимостей
scope.installModules([
@@ -166,7 +166,7 @@ void main() {
// Example 3: Correct architecture without circular dependencies
print('3. Correct architecture without circular dependencies:');
try {
final scope = Scope(null);
final scope = CherryPick.openRootScope();
scope.enableCycleDetection(); // Включаем для безопасности
scope.installModules([