@navios/di-react 0.9.0 → 2.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +45 -665
  3. package/lib/{index.js → index.cjs} +249 -258
  4. package/lib/index.cjs.map +1 -0
  5. package/lib/{index.d.ts → index.d.cts} +94 -123
  6. package/lib/index.d.cts.map +1 -0
  7. package/lib/index.d.mts +93 -122
  8. package/lib/index.d.mts.map +1 -1
  9. package/lib/index.mjs +248 -258
  10. package/lib/index.mjs.map +1 -1
  11. package/package.json +32 -18
  12. package/lib/index.d.ts.map +0 -1
  13. package/lib/index.js.map +0 -1
  14. package/project.json +0 -61
  15. package/src/hooks/__tests__/use-container.spec.mts +0 -53
  16. package/src/hooks/__tests__/use-invalidate.spec.mts +0 -80
  17. package/src/hooks/__tests__/use-optional-service.spec.mts +0 -233
  18. package/src/hooks/__tests__/use-service.spec.mts +0 -212
  19. package/src/hooks/__tests__/use-suspense-service.spec.mts +0 -286
  20. package/src/hooks/index.mts +0 -14
  21. package/src/hooks/use-container.mts +0 -61
  22. package/src/hooks/use-invalidate.mts +0 -41
  23. package/src/hooks/use-optional-service.mts +0 -276
  24. package/src/hooks/use-scope.mts +0 -87
  25. package/src/hooks/use-service.mts +0 -226
  26. package/src/hooks/use-suspense-service.mts +0 -234
  27. package/src/index.mts +0 -8
  28. package/src/providers/__tests__/scope-provider.spec.mts +0 -366
  29. package/src/providers/container-provider.mts +0 -18
  30. package/src/providers/context.mts +0 -15
  31. package/src/providers/index.mts +0 -5
  32. package/src/providers/scope-provider.mts +0 -90
  33. package/src/types.mts +0 -21
  34. package/tsconfig.json +0 -13
  35. package/tsdown.config.mts +0 -14
  36. package/vitest.config.mts +0 -12
package/CHANGELOG.md CHANGED
@@ -5,6 +5,45 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.0.0-alpha.0] - Unreleased
9
+
10
+ ### Fixed
11
+
12
+ - **`ScopeProvider` under `<StrictMode>`**: The scope survives the unmount and re-mount React simulates in development
13
+ - Disposal now waits one microtask and is cancelled by a re-mount; a real unmount and a `key` change still dispose the scope
14
+ - A provider shown again by `<Activity>` after its scope was disposed starts a new scope
15
+ - **Inline args in `useService` and `useOptionalService`**: Args are compared by their JSON form, like `useSuspenseService`, which now tells apart `Map`, `Set`, `RegExp` and `bigint` values
16
+ - An object literal written in the call no longer restarts the hook on every render
17
+ - Changed args still resolve again
18
+ - **Stale instance after an args change**: A hook that read its first instance synchronously kept it when the args, token or container changed
19
+ - **Extra constructor run on dependency invalidation**: `useService` and `useOptionalService` resolve one microtask after the invalidation event, so a dependent is not constructed against a dependency that is still being destroyed
20
+
21
+ ### Removed
22
+
23
+ - Development warning about args "that look the same but are different instances": such args are now treated as unchanged
24
+
25
+ ### Documentation
26
+
27
+ - README: `useContainer()` return type, examples that used `data` before checking it, Standard Schema wording, reserved `metadata.scopeId`, memoization advice
28
+
29
+ ## [1.0.0-alpha.3] - 2026-01-08
30
+
31
+ ### Added
32
+
33
+ - **Comprehensive Test Suite**: Added unit tests for hooks
34
+ - `use-scope.spec.mts` - Scope hook tests
35
+ - Extended `use-container.spec.mts` with additional test cases
36
+
37
+ ### Fixed
38
+
39
+ - **Improved Warning Message**: Changed `useService` args instability warning from `console.log` to `console.warn`
40
+ - Better semantic meaning for warning messages
41
+ - Improved message formatting and readability
42
+
43
+ ### Dependencies
44
+
45
+ - Updated to support `@navios/di` ^1.0.0-alpha.3
46
+
8
47
  ## [0.9.0] - 2025-12-23
9
48
 
10
49
  ### Breaking Changes