@codefast/di 0.3.14-canary.1 → 0.3.14

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 (65) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +42 -26
  3. package/dist/binding-scope.d.mts +11 -0
  4. package/dist/binding-scope.mjs +19 -0
  5. package/dist/binding-select.d.mts +8 -26
  6. package/dist/binding-select.mjs +56 -49
  7. package/dist/binding.d.mts +107 -335
  8. package/dist/binding.mjs +19 -332
  9. package/dist/constraints.d.mts +11 -29
  10. package/dist/constraints.mjs +32 -36
  11. package/dist/constructor-type.d.mts +17 -0
  12. package/dist/constructor-type.mjs +1 -0
  13. package/dist/container.d.mts +43 -122
  14. package/dist/container.mjs +667 -482
  15. package/dist/decorators/inject.d.mts +19 -50
  16. package/dist/decorators/inject.mjs +131 -93
  17. package/dist/decorators/injectable.d.mts +16 -37
  18. package/dist/decorators/injectable.mjs +47 -66
  19. package/dist/decorators/lifecycle-decorators.d.mts +2 -22
  20. package/dist/decorators/lifecycle-decorators.mjs +81 -37
  21. package/dist/dependency-graph.d.mts +24 -54
  22. package/dist/dependency-graph.mjs +51 -153
  23. package/dist/environment.d.mts +38 -12
  24. package/dist/environment.mjs +82 -16
  25. package/dist/errors.d.mts +70 -189
  26. package/dist/errors.mjs +92 -219
  27. package/dist/graph-adapters/cytoscape.d.mts +21 -7
  28. package/dist/graph-adapters/cytoscape.mjs +18 -35
  29. package/dist/graph-adapters/dot.d.mts +1 -4
  30. package/dist/graph-adapters/dot.mjs +6 -86
  31. package/dist/graph-adapters/reactflow.d.mts +26 -7
  32. package/dist/graph-adapters/reactflow.mjs +21 -72
  33. package/dist/graph-adapters/types.d.mts +2 -91
  34. package/dist/index.d.mts +16 -8
  35. package/dist/index.mjs +8 -5
  36. package/dist/inspector.d.mts +35 -74
  37. package/dist/inspector.mjs +61 -88
  38. package/dist/lifecycle.d.mts +20 -53
  39. package/dist/lifecycle.mjs +129 -99
  40. package/dist/metadata/metadata-keys.d.mts +9 -26
  41. package/dist/metadata/metadata-keys.mjs +7 -28
  42. package/dist/metadata/metadata-reader-token.d.mts +7 -0
  43. package/dist/metadata/metadata-reader-token.mjs +5 -0
  44. package/dist/metadata/metadata-types.d.mts +26 -75
  45. package/dist/metadata/symbol-metadata-reader.d.mts +10 -26
  46. package/dist/metadata/symbol-metadata-reader.mjs +32 -45
  47. package/dist/module.d.mts +30 -96
  48. package/dist/module.mjs +26 -72
  49. package/dist/registry.d.mts +32 -63
  50. package/dist/registry.mjs +131 -82
  51. package/dist/resolve-options.d.mts +18 -0
  52. package/dist/resolve-options.mjs +22 -0
  53. package/dist/resolver.d.mts +67 -190
  54. package/dist/resolver.mjs +715 -424
  55. package/dist/scope.d.mts +19 -106
  56. package/dist/scope.mjs +37 -196
  57. package/dist/token.d.mts +8 -22
  58. package/dist/token.mjs +9 -11
  59. package/dist/types.d.mts +48 -0
  60. package/dist/types.mjs +1 -0
  61. package/package.json +36 -14
  62. package/dist/metadata/param-registry.d.mts +0 -16
  63. package/dist/metadata/param-registry.mjs +0 -31
  64. package/dist/scope-validation.d.mts +0 -21
  65. package/dist/scope-validation.mjs +0 -35
@@ -1,21 +0,0 @@
1
- import { RegistryKey } from "./registry.mjs";
2
- import { Binding } from "./binding.mjs";
3
- import { MetadataReader } from "./metadata/metadata-types.mjs";
4
-
5
- //#region src/scope-validation.d.ts
6
- /**
7
- * Walks every binding in the registry and throws {@link ScopeViolationError} on the first
8
- * captive-dependency violation found **along a direct static edge**: for each binding, only
9
- * targets returned by {@link listResolvedDependencies} are considered (not a full recursive
10
- * graph walk). Constant bindings are exempt.
11
- *
12
- * Called by {@link Container.validate} and automatically after each `load()` in non-production
13
- * environments.
14
- */
15
- declare function validateScopeRules(context: {
16
- collectAllRegistryKeys(): readonly RegistryKey[];
17
- lookupBindings(key: RegistryKey): readonly Binding<unknown>[] | undefined;
18
- getMetadataReader(): MetadataReader | undefined;
19
- }): void;
20
- //#endregion
21
- export { validateScopeRules };
@@ -1,35 +0,0 @@
1
- import { ScopeViolationError } from "./errors.mjs";
2
- import { registryKeyLabel } from "./binding-select.mjs";
3
- import { listResolvedDependencies } from "./dependency-graph.mjs";
4
- //#region src/scope-validation.ts
5
- /**
6
- * Walks every binding in the registry and throws {@link ScopeViolationError} on the first
7
- * captive-dependency violation found **along a direct static edge**: for each binding, only
8
- * targets returned by {@link listResolvedDependencies} are considered (not a full recursive
9
- * graph walk). Constant bindings are exempt.
10
- *
11
- * Called by {@link Container.validate} and automatically after each `load()` in non-production
12
- * environments.
13
- */
14
- function validateScopeRules(context) {
15
- const reader = context.getMetadataReader();
16
- const lookupBindings = (key) => context.lookupBindings(key);
17
- for (const registryKey of context.collectAllRegistryKeys()) {
18
- const bindings = lookupBindings(registryKey);
19
- if (bindings === void 0 || bindings.length === 0) continue;
20
- for (const consumer of bindings) {
21
- const deps = listResolvedDependencies(consumer, lookupBindings, reader, [registryKeyLabel(registryKey)]);
22
- for (const dep of deps) if (consumer.scope === "singleton" && dep.binding.kind !== "constant" && (dep.binding.scope === "transient" || dep.binding.scope === "scoped")) throw new ScopeViolationError({
23
- consumerBindingId: consumer.id,
24
- consumerKind: consumer.kind,
25
- consumerScope: consumer.scope,
26
- dependencyBindingId: dep.binding.id,
27
- dependencyKind: dep.binding.kind,
28
- dependencyScope: dep.binding.scope,
29
- resolutionPath: dep.path
30
- });
31
- }
32
- }
33
- }
34
- //#endregion
35
- export { validateScopeRules };