mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-23 21:13:35 +00:00
Compare commits
6 Commits
cherrypick
...
4953e917c9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4953e917c9 | ||
|
|
1997110d92 | ||
|
|
0e600ca3a2 | ||
|
|
25ae208ea1 | ||
|
|
685c0ae49c | ||
|
|
98d81b13a8 |
31
CHANGELOG.md
31
CHANGELOG.md
@@ -3,6 +3,37 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 2025-10-20
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Packages with breaking changes:
|
||||||
|
|
||||||
|
- There are no breaking changes in this release.
|
||||||
|
|
||||||
|
Packages with other changes:
|
||||||
|
|
||||||
|
- [`cherrypick` - `v3.0.2`](#cherrypick---v302)
|
||||||
|
- [`cherrypick_flutter` - `v3.0.2`](#cherrypick_flutter---v302)
|
||||||
|
- [`talker_cherrypick_logger` - `v3.0.2`](#talker_cherrypick_logger---v302)
|
||||||
|
|
||||||
|
Packages with dependency updates only:
|
||||||
|
|
||||||
|
> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project.
|
||||||
|
|
||||||
|
- `cherrypick_flutter` - `v3.0.2`
|
||||||
|
- `talker_cherrypick_logger` - `v3.0.2`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### `cherrypick` - `v3.0.2`
|
||||||
|
|
||||||
|
- **FIX**(test): fix warning.
|
||||||
|
- **FIX**(scope): properly clear binding and module references on dispose.
|
||||||
|
|
||||||
|
|
||||||
## 2025-09-09
|
## 2025-09-09
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ packages:
|
|||||||
path: "../cherrypick"
|
path: "../cherrypick"
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "3.0.0"
|
version: "3.0.1"
|
||||||
collection:
|
collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
## 3.0.2
|
||||||
|
|
||||||
|
- **FIX**(test): fix warning.
|
||||||
|
- **FIX**(scope): properly clear binding and module references on dispose.
|
||||||
|
|
||||||
## 3.0.1
|
## 3.0.1
|
||||||
|
|
||||||
- **DOCS**: add Netlify deployment status badge to README files.
|
- **DOCS**: add Netlify deployment status badge to README files.
|
||||||
|
|||||||
@@ -498,5 +498,10 @@ class Scope with CycleDetectionMixin, GlobalCycleDetectionMixin {
|
|||||||
await d.dispose();
|
await d.dispose();
|
||||||
}
|
}
|
||||||
_disposables.clear();
|
_disposables.clear();
|
||||||
|
|
||||||
|
// Clear modules
|
||||||
|
_modulesList.clear();
|
||||||
|
// Clear binding-index
|
||||||
|
_bindingResolvers.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: cherrypick
|
name: cherrypick
|
||||||
description: Cherrypick is a small dependency injection (DI) library for dart/flutter projects.
|
description: Cherrypick is a small dependency injection (DI) library for dart/flutter projects.
|
||||||
version: 3.0.1
|
version: 3.0.2
|
||||||
homepage: https://cherrypick-di.netlify.app
|
homepage: https://cherrypick-di.netlify.app
|
||||||
documentation: https://cherrypick-di.netlify.app/docs/intro
|
documentation: https://cherrypick-di.netlify.app/docs/intro
|
||||||
repository: https://github.com/pese-git/cherrypick
|
repository: https://github.com/pese-git/cherrypick
|
||||||
|
|||||||
65
cherrypick/test/binding_memory_leak_test.dart
Normal file
65
cherrypick/test/binding_memory_leak_test.dart
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'package:cherrypick/cherrypick.dart';
|
||||||
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
|
class HeavyService implements Disposable {
|
||||||
|
static int instanceCount = 0;
|
||||||
|
HeavyService() {
|
||||||
|
instanceCount++;
|
||||||
|
print('HeavyService created. Instance count: '
|
||||||
|
'\u001b[32m$instanceCount\u001b[0m');
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
instanceCount--;
|
||||||
|
print('HeavyService disposed. Instance count: '
|
||||||
|
'\u001b[31m$instanceCount\u001b[0m');
|
||||||
|
}
|
||||||
|
|
||||||
|
static final Finalizer<String> _finalizer = Finalizer((msg) {
|
||||||
|
print('GC FINALIZED HeavyService: $msg');
|
||||||
|
});
|
||||||
|
void registerFinalizer() => _finalizer.attach(this, toString(), detach: this);
|
||||||
|
}
|
||||||
|
|
||||||
|
class HeavyModule extends Module {
|
||||||
|
@override
|
||||||
|
void builder(Scope scope) {
|
||||||
|
bind<HeavyService>().toProvide(() => HeavyService());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
test('Binding memory is cleared after closing and reopening scope', () async {
|
||||||
|
final root = CherryPick.openRootScope();
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
print('\nIteration $i -------------------------------');
|
||||||
|
final subScope = root.openSubScope('leak-test-scope');
|
||||||
|
subScope.installModules([HeavyModule()]);
|
||||||
|
final service = subScope.resolve<HeavyService>();
|
||||||
|
expect(service, isNotNull);
|
||||||
|
await root.closeSubScope('leak-test-scope');
|
||||||
|
// Dart GC не сразу удаляет освобождённые объекты, добавляем паузу и вызываем GC.
|
||||||
|
await Future.delayed(const Duration(milliseconds: 200));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Если dispose не вызвался, instanceCount > 0 => утечка.
|
||||||
|
expect(HeavyService.instanceCount, equals(0));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Service is finalized after scope is closed/cleaned', () async {
|
||||||
|
final root = CherryPick.openRootScope();
|
||||||
|
HeavyService? ref;
|
||||||
|
{
|
||||||
|
final sub = root.openSubScope('s');
|
||||||
|
sub.installModules([HeavyModule()]);
|
||||||
|
ref = sub.resolve<HeavyService>();
|
||||||
|
ref.registerFinalizer();
|
||||||
|
expect(HeavyService.instanceCount, 1);
|
||||||
|
await root.closeSubScope('s');
|
||||||
|
}
|
||||||
|
await Future.delayed(const Duration(seconds: 2));
|
||||||
|
expect(HeavyService.instanceCount, 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
## 3.0.2
|
||||||
|
|
||||||
|
- Update a dependency to the latest release.
|
||||||
|
|
||||||
## 3.0.1
|
## 3.0.1
|
||||||
|
|
||||||
- **DOCS**: add Netlify deployment status badge to README files.
|
- **DOCS**: add Netlify deployment status badge to README files.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: cherrypick_flutter
|
name: cherrypick_flutter
|
||||||
description: "Flutter library that allows access to the root scope through the context using `CherryPickProvider`."
|
description: "Flutter library that allows access to the root scope through the context using `CherryPickProvider`."
|
||||||
version: 3.0.1
|
version: 3.0.2
|
||||||
homepage: https://cherrypick-di.netlify.app
|
homepage: https://cherrypick-di.netlify.app
|
||||||
documentation: https://cherrypick-di.netlify.app/docs/intro
|
documentation: https://cherrypick-di.netlify.app/docs/intro
|
||||||
repository: https://github.com/pese-git/cherrypick
|
repository: https://github.com/pese-git/cherrypick
|
||||||
@@ -19,7 +19,7 @@ environment:
|
|||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
cherrypick: ^3.0.1
|
cherrypick: ^3.0.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
@@ -127,28 +127,28 @@ packages:
|
|||||||
path: "../../cherrypick"
|
path: "../../cherrypick"
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "3.0.0"
|
version: "3.0.1"
|
||||||
cherrypick_annotations:
|
cherrypick_annotations:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "../../cherrypick_annotations"
|
path: "../../cherrypick_annotations"
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "3.0.0"
|
version: "3.0.1"
|
||||||
cherrypick_flutter:
|
cherrypick_flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "../../cherrypick_flutter"
|
path: "../../cherrypick_flutter"
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "3.0.0"
|
version: "3.0.1"
|
||||||
cherrypick_generator:
|
cherrypick_generator:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
path: "../../cherrypick_generator"
|
path: "../../cherrypick_generator"
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "3.0.0"
|
version: "3.0.1"
|
||||||
clock:
|
clock:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -574,4 +574,4 @@ packages:
|
|||||||
version: "3.1.3"
|
version: "3.1.3"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.8.0 <4.0.0"
|
dart: ">=3.8.0 <4.0.0"
|
||||||
flutter: ">=3.18.0-18.0.pre.54"
|
flutter: ">=3.32.0"
|
||||||
|
|||||||
@@ -175,14 +175,14 @@ packages:
|
|||||||
path: "../../cherrypick"
|
path: "../../cherrypick"
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "3.0.0"
|
version: "3.0.1"
|
||||||
cherrypick_annotations:
|
cherrypick_annotations:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "../../cherrypick_annotations"
|
path: "../../cherrypick_annotations"
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "3.0.0"
|
version: "3.0.1"
|
||||||
cherrypick_generator:
|
cherrypick_generator:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
@@ -920,7 +920,7 @@ packages:
|
|||||||
path: "../../talker_cherrypick_logger"
|
path: "../../talker_cherrypick_logger"
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "3.0.0"
|
version: "3.0.1"
|
||||||
talker_dio_logger:
|
talker_dio_logger:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -1131,4 +1131,4 @@ packages:
|
|||||||
version: "2.2.2"
|
version: "2.2.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.8.0 <4.0.0"
|
dart: ">=3.8.0 <4.0.0"
|
||||||
flutter: ">=3.29.0"
|
flutter: ">=3.32.0"
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
## 3.0.2
|
||||||
|
|
||||||
|
- Update a dependency to the latest release.
|
||||||
|
|
||||||
## 3.0.1
|
## 3.0.1
|
||||||
|
|
||||||
- **DOCS**: add Netlify deployment status badge to README files.
|
- **DOCS**: add Netlify deployment status badge to README files.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: talker_cherrypick_logger
|
name: talker_cherrypick_logger
|
||||||
description: A Talker logger integration for CherryPick DI to observe and log DI events and errors.
|
description: A Talker logger integration for CherryPick DI to observe and log DI events and errors.
|
||||||
version: 3.0.1
|
version: 3.0.2
|
||||||
homepage: https://cherrypick-di.netlify.app
|
homepage: https://cherrypick-di.netlify.app
|
||||||
documentation: https://cherrypick-di.netlify.app/docs/intro
|
documentation: https://cherrypick-di.netlify.app/docs/intro
|
||||||
repository: https://github.com/pese-git/cherrypick
|
repository: https://github.com/pese-git/cherrypick
|
||||||
@@ -18,7 +18,7 @@ environment:
|
|||||||
# Add regular dependencies here.
|
# Add regular dependencies here.
|
||||||
dependencies:
|
dependencies:
|
||||||
talker: ^5.0.0
|
talker: ^5.0.0
|
||||||
cherrypick: ^3.0.1
|
cherrypick: ^3.0.2
|
||||||
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|||||||
Reference in New Issue
Block a user