@nexus-ioc/language-service 0.1.0 → 0.1.1
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 +14 -83
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|

|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
Nexus IoC is a powerful and flexible Inversion of Control (IoC) container for TypeScript applications. Inspired by Angular and NestJS, it leverages decorators to provide a simple and efficient way to manage dependencies and modules.
|
|
5
|
+
[Nexus IoC](https://www.npmjs.com/package/@nexus-ioc/core) is a powerful and flexible Inversion of Control (IoC) container for TypeScript applications. Inspired by Angular and NestJS, it leverages decorators to provide a simple and efficient way to manage dependencies and modules.
|
|
6
|
+
|
|
7
|
+
|
|
6
8
|
|
|
7
9
|
## Table of Contents
|
|
8
10
|
|
|
9
11
|
- [Features](#features)
|
|
10
12
|
- [Installation](#installation)
|
|
11
13
|
- [Quick Start](#quick-start)
|
|
12
|
-
- [Testing](#testing)
|
|
13
14
|
- [License](#license)
|
|
14
15
|
- [Author](#author)
|
|
15
16
|
- [Contributing](#contributing)
|
|
@@ -18,99 +19,29 @@ Nexus IoC is a powerful and flexible Inversion of Control (IoC) container for Ty
|
|
|
18
19
|
|
|
19
20
|
## Features
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
- **Dependency Injection**: Use decorators to inject dependencies into your classes.
|
|
23
|
-
- **Lifecycle Management**: Manage the lifecycle of your components seamlessly.
|
|
24
|
-
- **Asynchronous Module Loading**: Load modules asynchronously for improved performance.
|
|
22
|
+
This plugin adds the ability to autocomplete for dependencies and highlight type errors.
|
|
25
23
|
|
|
26
24
|
## Installation
|
|
27
25
|
|
|
28
26
|
```bash
|
|
29
|
-
npm install @nexus-ioc/
|
|
27
|
+
npm install @nexus-ioc/language-service
|
|
30
28
|
```
|
|
31
29
|
|
|
32
30
|
## Quick Start
|
|
33
31
|
|
|
34
|
-
### Step 1: Define
|
|
35
|
-
|
|
36
|
-
Create a module and a provider using decorators.
|
|
37
|
-
|
|
38
|
-
```typescript
|
|
39
|
-
import { NsModule, Injectable, Inject } from '@nexus-ioc/core';
|
|
40
|
-
|
|
41
|
-
@Injectable()
|
|
42
|
-
class DependencyService {
|
|
43
|
-
public readonly name = 'World';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
@Injectable()
|
|
47
|
-
export class AppService {
|
|
48
|
-
constructor(
|
|
49
|
-
@Inject(DependencyService)
|
|
50
|
-
private readonly dependencyService: DependencyService,
|
|
51
|
-
) {
|
|
52
|
-
}
|
|
32
|
+
### Step 1: Define plugin in tsconfig.json
|
|
53
33
|
|
|
54
|
-
|
|
55
|
-
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"compilerOptions": {
|
|
37
|
+
"plugins": [
|
|
38
|
+
{
|
|
39
|
+
"name": "@nexus-ioc/language-service"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
56
42
|
}
|
|
57
43
|
}
|
|
58
44
|
|
|
59
|
-
@NsModule({
|
|
60
|
-
providers: [AppService, DependencyService],
|
|
61
|
-
})
|
|
62
|
-
export class AppModule {}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Step 2: Create an Application
|
|
66
|
-
|
|
67
|
-
Create and bootstrap your application.
|
|
68
|
-
|
|
69
|
-
```typescript
|
|
70
|
-
import { NexusApplicationsBrowser } from '@nexus-ioc/core/dist/server';
|
|
71
|
-
import { AppModule, AppService } from './app.module';
|
|
72
|
-
|
|
73
|
-
async function bootstrap() {
|
|
74
|
-
const app = await NexusApplicationsBrowser
|
|
75
|
-
.create(AppModule)
|
|
76
|
-
.bootstrap();
|
|
77
|
-
|
|
78
|
-
const appService = app.get<AppService>(AppService);
|
|
79
|
-
|
|
80
|
-
console.log(appService?.getHello());
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
bootstrap();
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Testing
|
|
88
|
-
|
|
89
|
-
### Installation
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
npm install @nexus-ioc/testing
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### Usage
|
|
96
|
-
|
|
97
|
-
```typescript
|
|
98
|
-
import { Injectable } from '@nexus-ioc/core';
|
|
99
|
-
import { Test } from '@nexus-ioc/testing';
|
|
100
|
-
|
|
101
|
-
describe('AppModule', () => {
|
|
102
|
-
it('should create instance', async () => {
|
|
103
|
-
@Injectable()
|
|
104
|
-
class AppService {}
|
|
105
|
-
|
|
106
|
-
const appModule = await Test.createModule({
|
|
107
|
-
providers: [AppService],
|
|
108
|
-
}).compile();
|
|
109
|
-
|
|
110
|
-
const appService = await appModule.get<AppService>(AppService);
|
|
111
|
-
expect(appService).toBeInstanceOf(AppService);
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
45
|
```
|
|
115
46
|
|
|
116
47
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexus-ioc/language-service",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "A powerful IoC container for TypeScript applications",
|
|
5
5
|
"author": "Isqanderm <aleksandr.melnik.personal@gmail.com> (https://www.linkedin.com/in/isqander-melnik)",
|
|
6
6
|
"homepage": "https://github.com/Isqanderm/ioc#readme",
|