@travetto/di 5.0.0-rc.0 → 5.0.0-rc.2

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.
package/README.md CHANGED
@@ -100,10 +100,10 @@ Given the `static` method `initService`, the function will be provided as a vali
100
100
 
101
101
  **Code: Example Conditional Dependency**
102
102
  ```typescript
103
- import { Env } from '@travetto/base';
103
+ import { Runtime } from '@travetto/runtime';
104
104
  import { Inject, Injectable } from '@travetto/di';
105
105
 
106
- @Injectable({ enabled: Env.production })
106
+ @Injectable({ enabled: Runtime.production })
107
107
  class ProductionLogger {
108
108
  async log() {
109
109
  console.log('This will only run in production');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/di",
3
- "version": "5.0.0-rc.0",
3
+ "version": "5.0.0-rc.2",
4
4
  "description": "Dependency registration/management and injection support.",
5
5
  "keywords": [
6
6
  "ast-transformations",
@@ -27,10 +27,10 @@
27
27
  "directory": "module/di"
28
28
  },
29
29
  "dependencies": {
30
- "@travetto/registry": "^5.0.0-rc.0"
30
+ "@travetto/registry": "^5.0.0-rc.2"
31
31
  },
32
32
  "peerDependencies": {
33
- "@travetto/transformer": "^5.0.0-rc.0"
33
+ "@travetto/transformer": "^5.0.0-rc.2"
34
34
  },
35
35
  "peerDependenciesMeta": {
36
36
  "@travetto/transformer": {
package/src/decorator.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Class, ClassInstance } from '@travetto/base';
1
+ import type { Class, ClassInstance } from '@travetto/runtime';
2
2
 
3
3
  import { InjectableFactoryConfig, InjectableConfig, Dependency } from './types';
4
4
  import { DependencyRegistry, ResolutionType } from './registry';
package/src/error.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AppError } from '@travetto/base';
1
+ import { AppError } from '@travetto/runtime';
2
2
  import { ClassTarget } from './types';
3
3
 
4
4
  function getName(symbol: symbol): string {
package/src/registry.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { Class, ClassInstance, ConcreteClass, Env } from '@travetto/base';
1
+ import { Class, ClassInstance, ConcreteClass, Runtime, describeFunction } from '@travetto/runtime';
2
2
  import { MetadataRegistry, RootRegistry, ChangeEvent } from '@travetto/registry';
3
- import { RuntimeIndex } from '@travetto/manifest';
4
3
 
5
4
  import { Dependency, InjectableConfig, ClassTarget, InjectableFactoryConfig } from './types';
6
5
  import { InjectionError } from './error';
@@ -237,7 +236,7 @@ class $DependencyRegistry extends MetadataRegistry<InjectableConfig> {
237
236
 
238
237
  override async init(): Promise<void> {
239
238
  await super.init();
240
- if (Env.dynamic) {
239
+ if (Runtime.dynamic) {
241
240
  const { DependencyRegistration } = await import('../support/dynamic.injection');
242
241
  DependencyRegistration.init(this);
243
242
  }
@@ -432,10 +431,10 @@ class $DependencyRegistry extends MetadataRegistry<InjectableConfig> {
432
431
  }
433
432
 
434
433
  // Allow for the factory to fulfill the target
435
- let parentClass = config.factory ? config.target : Object.getPrototypeOf(cls);
434
+ let parentClass: Function = config.factory ? config.target : Object.getPrototypeOf(cls);
436
435
 
437
436
  if (config.factory) {
438
- while (RuntimeIndex.getFunctionMetadata(Object.getPrototypeOf(parentClass))?.abstract) {
437
+ while (describeFunction(Object.getPrototypeOf(parentClass))?.abstract) {
439
438
  parentClass = Object.getPrototypeOf(parentClass);
440
439
  }
441
440
  if (!this.targetToClass.has(classId)) {
@@ -465,7 +464,7 @@ class $DependencyRegistry extends MetadataRegistry<InjectableConfig> {
465
464
  }
466
465
  }
467
466
 
468
- if (RuntimeIndex.getFunctionMetadata(cls)?.abstract) { // Skip out early, only needed to inherit
467
+ if (describeFunction(cls)?.abstract) { // Skip out early, only needed to inherit
469
468
  return config;
470
469
  }
471
470
 
@@ -500,7 +499,7 @@ class $DependencyRegistry extends MetadataRegistry<InjectableConfig> {
500
499
  }
501
500
 
502
501
  // If targeting self (default @Injectable behavior)
503
- if ((classId === targetId || config.factory) && (parentConfig || RuntimeIndex.getFunctionMetadata(parentClass)?.abstract)) {
502
+ if ((classId === targetId || config.factory) && (parentConfig || describeFunction(parentClass)?.abstract)) {
504
503
  const parentId = parentClass.Ⲑid;
505
504
 
506
505
  if (!this.targetToClass.has(parentId)) {
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Class } from '@travetto/base';
1
+ import { Class } from '@travetto/runtime';
2
2
 
3
3
  export type ClassTarget<T = unknown> = Class<T> | Function;
4
4
 
@@ -1,5 +1,4 @@
1
- import { Class, ClassInstance } from '@travetto/base';
2
- import { RuntimeIndex } from '@travetto/manifest';
1
+ import { Class, ClassInstance, describeFunction } from '@travetto/runtime';
3
2
  import { RetargettingProxy } from '@travetto/registry';
4
3
 
5
4
  import type { DependencyRegistry, ResolutionType, Resolved } from '../src/registry';
@@ -69,7 +68,7 @@ class $DynamicDependencyRegistry {
69
68
  const classId = cls.Ⲑid;
70
69
 
71
70
  if (
72
- !RuntimeIndex.getFunctionMetadata(cls)?.abstract &&
71
+ !describeFunction(cls)?.abstract &&
73
72
  this.#proxies.has(classId) &&
74
73
  this.#proxies.get(classId)!.has(config.qualifier)
75
74
  ) {
@@ -1,4 +1,4 @@
1
- import { Class, ClassInstance } from '@travetto/base';
1
+ import { Class, ClassInstance } from '@travetto/runtime';
2
2
  import { RootRegistry } from '@travetto/registry';
3
3
  import { SuiteRegistry } from '@travetto/test';
4
4