@travetto/di 7.0.4 → 7.0.6
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 +5 -5
- package/package.json +3 -3
- package/src/decorator.ts +2 -2
- package/src/error.ts +1 -1
- package/src/registry/registry-adapter.ts +3 -3
- package/src/registry/registry-index.ts +8 -8
- package/src/registry/registry-resolver.ts +3 -3
- package/src/types.ts +1 -1
- package/support/test/suite.ts +1 -1
package/README.md
CHANGED
|
@@ -135,7 +135,7 @@ The [@Inject](https://github.com/travetto/travetto/tree/main/module/di/src/decor
|
|
|
135
135
|
**Code: Example Injectable with dependencies as Inject fields**
|
|
136
136
|
```typescript
|
|
137
137
|
import { Injectable, Inject } from '@travetto/di';
|
|
138
|
-
import { DependentService } from './dependency.ts';
|
|
138
|
+
import type { DependentService } from './dependency.ts';
|
|
139
139
|
|
|
140
140
|
@Injectable()
|
|
141
141
|
class CustomService {
|
|
@@ -153,7 +153,7 @@ The [@Injectable](https://github.com/travetto/travetto/tree/main/module/di/src/d
|
|
|
153
153
|
**Code: Example Injectable with dependencies in constructor**
|
|
154
154
|
```typescript
|
|
155
155
|
import { Injectable } from '@travetto/di';
|
|
156
|
-
import { DependentService } from './dependency.ts';
|
|
156
|
+
import type { DependentService } from './dependency.ts';
|
|
157
157
|
|
|
158
158
|
@Injectable()
|
|
159
159
|
class CustomService {
|
|
@@ -176,7 +176,7 @@ Via [@InjectableFactory](https://github.com/travetto/travetto/tree/main/module/d
|
|
|
176
176
|
```typescript
|
|
177
177
|
import { InjectableFactory } from '@travetto/di';
|
|
178
178
|
|
|
179
|
-
import { DependentService, CustomService } from './dependency.ts';
|
|
179
|
+
import { type DependentService, CustomService } from './dependency.ts';
|
|
180
180
|
|
|
181
181
|
class Config {
|
|
182
182
|
@InjectableFactory()
|
|
@@ -216,7 +216,7 @@ By default, if there is only one candidate without qualification, then that cand
|
|
|
216
216
|
**Code: Example Multiple Candidate Types**
|
|
217
217
|
```typescript
|
|
218
218
|
import { InjectableFactory } from '@travetto/di';
|
|
219
|
-
import { Contract, ComplexContract } from './injectable-multiple-default.ts';
|
|
219
|
+
import type { Contract, ComplexContract } from './injectable-multiple-default.ts';
|
|
220
220
|
|
|
221
221
|
class Config {
|
|
222
222
|
// Complex will be marked as the available Contract
|
|
@@ -235,7 +235,7 @@ It is also possible to directly reference external types, and they will be conve
|
|
|
235
235
|
**Code: Example External Dependencies**
|
|
236
236
|
```typescript
|
|
237
237
|
import { EventEmitter } from 'node:events';
|
|
238
|
-
import { Writable } from 'node:stream';
|
|
238
|
+
import type { Writable } from 'node:stream';
|
|
239
239
|
|
|
240
240
|
import { Inject, Injectable, InjectableFactory } from '@travetto/di';
|
|
241
241
|
import { asFull } from '@travetto/runtime';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/di",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Dependency registration/management and injection support.",
|
|
6
6
|
"keywords": [
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"directory": "module/di"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@travetto/registry": "^7.0.
|
|
31
|
+
"@travetto/registry": "^7.0.6"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@travetto/transformer": "^7.0.
|
|
34
|
+
"@travetto/transformer": "^7.0.5"
|
|
35
35
|
},
|
|
36
36
|
"peerDependenciesMeta": {
|
|
37
37
|
"@travetto/transformer": {
|
package/src/decorator.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Any, castTo, ClassInstance, getClass, type Class } from '@travetto/runtime';
|
|
1
|
+
import { type Any, castTo, type ClassInstance, getClass, type Class } from '@travetto/runtime';
|
|
2
2
|
import { CONSTRUCTOR_PROPERTY } from '@travetto/schema';
|
|
3
3
|
|
|
4
|
-
import { InjectableCandidate, ResolutionType } from './types.ts';
|
|
4
|
+
import type { InjectableCandidate, ResolutionType } from './types.ts';
|
|
5
5
|
import { DependencyRegistryIndex } from './registry/registry-index.ts';
|
|
6
6
|
|
|
7
7
|
const fromInput = <T extends { qualifier?: symbol }>(input?: T | symbol): T =>
|
package/src/error.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { RegistryAdapter } from '@travetto/registry';
|
|
2
|
-
import { Class, classConstruct, describeFunction, safeAssign } from '@travetto/runtime';
|
|
1
|
+
import type { RegistryAdapter } from '@travetto/registry';
|
|
2
|
+
import { type Class, classConstruct, describeFunction, safeAssign } from '@travetto/runtime';
|
|
3
3
|
import { CONSTRUCTOR_PROPERTY, SchemaRegistryIndex } from '@travetto/schema';
|
|
4
4
|
|
|
5
|
-
import { InjectableConfig, getDefaultQualifier, InjectableCandidate } from '../types';
|
|
5
|
+
import { type InjectableConfig, getDefaultQualifier, type InjectableCandidate } from '../types.ts';
|
|
6
6
|
|
|
7
7
|
function combineInjectableCandidates<T extends InjectableCandidate>(base: T, ...overrides: Partial<T>[]): typeof base {
|
|
8
8
|
for (const override of overrides) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { RegistryIndex, RegistryIndexStore, Registry } from '@travetto/registry';
|
|
2
|
-
import { AppError, castKey, castTo, Class, describeFunction, getParentClass, hasFunction, TypedObject } from '@travetto/runtime';
|
|
3
|
-
import { SchemaFieldConfig, SchemaParameterConfig, SchemaRegistryIndex } from '@travetto/schema';
|
|
4
|
-
|
|
5
|
-
import { Dependency, InjectableCandidate, InjectableClassMetadata, InjectableConfig, ResolutionType } from '../types';
|
|
6
|
-
import { DependencyRegistryAdapter } from './registry-adapter';
|
|
7
|
-
import { InjectionError } from '../error';
|
|
8
|
-
import { DependencyRegistryResolver } from './registry-resolver';
|
|
1
|
+
import { type RegistryIndex, RegistryIndexStore, Registry } from '@travetto/registry';
|
|
2
|
+
import { AppError, castKey, castTo, type Class, describeFunction, getParentClass, hasFunction, TypedObject } from '@travetto/runtime';
|
|
3
|
+
import { type SchemaFieldConfig, type SchemaParameterConfig, SchemaRegistryIndex } from '@travetto/schema';
|
|
4
|
+
|
|
5
|
+
import type { Dependency, InjectableCandidate, InjectableClassMetadata, InjectableConfig, ResolutionType } from '../types.ts';
|
|
6
|
+
import { DependencyRegistryAdapter } from './registry-adapter.ts';
|
|
7
|
+
import { InjectionError } from '../error.ts';
|
|
8
|
+
import { DependencyRegistryResolver } from './registry-resolver.ts';
|
|
9
9
|
|
|
10
10
|
const MetadataSymbol = Symbol();
|
|
11
11
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SchemaRegistryIndex } from '@travetto/schema';
|
|
2
|
-
import { castTo, Class } from '@travetto/runtime';
|
|
2
|
+
import { castTo, type Class } from '@travetto/runtime';
|
|
3
3
|
|
|
4
|
-
import { getDefaultQualifier, InjectableCandidate, PrimaryCandidateSymbol, ResolutionType } from '../types';
|
|
5
|
-
import { InjectionError } from '../error';
|
|
4
|
+
import { getDefaultQualifier, type InjectableCandidate, PrimaryCandidateSymbol, type ResolutionType } from '../types.ts';
|
|
5
|
+
import { InjectionError } from '../error.ts';
|
|
6
6
|
|
|
7
7
|
type Resolved<T> = { candidate: InjectableCandidate<T>, qualifier: symbol, target: Class };
|
|
8
8
|
|
package/src/types.ts
CHANGED
package/support/test/suite.ts
CHANGED