@toijs/modular 1.0.3 → 1.0.4

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 ADDED
@@ -0,0 +1,409 @@
1
+ # @toijs/modular
2
+
3
+ Compose TypeScript applications with modules, explicit dependency injection, and a small runtime.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@toijs/modular.svg)](https://www.npmjs.com/package/@toijs/modular)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-3178C6.svg)](https://www.typescriptlang.org/)
7
+ [![ESM](https://img.shields.io/badge/module-ESM-brightgreen.svg)](https://nodejs.org/api/esm.html)
8
+ [![GitHub](https://img.shields.io/badge/github-toijs%2Fframework-181717.svg)](https://github.com/toijs/framework)
9
+
10
+ ## Overview
11
+
12
+ `@toijs/modular` is a composition layer for TypeScript applications. It provides a module factory, a dependency injection container, a bootstrap lifecycle, and a small set of runtime services (`Task`, `Config`, `Metadata`, `Shell`).
13
+
14
+ It does **not** include HTTP, routing, validation, GraphQL, or an ORM. Those belong in the application or in separate kits such as `@toijs/express-kit` and `@toijs/typeorm`.
15
+
16
+ ## Why @toijs/modular?
17
+
18
+ Most TypeScript backends either assemble everything by hand or adopt a full platform such as NestJS. `@toijs/modular` sits between those options: you get modules and DI without inheriting an HTTP server, a CLI, or a decorator-heavy application model.
19
+
20
+ Constructor dependencies are **explicit**. `@Injectable([UserRepository])` does not read `design:paramtypes`. That is intentional — the container never infers tokens from TypeScript types.
21
+
22
+ ## Features
23
+
24
+ Implemented in this package:
25
+
26
+ - **Modules as functions** — a factory returns `{ name, dependencies?, prepare?, register?, ready? }`
27
+ - **Dependency injection** — class, value, factory, and existing providers
28
+ - **Explicit tokens** — `@Injectable([tokens])`, `@Inject(token)`, `@Optional()`
29
+ - **Scopes** — `singleton` (default) and `transient` on class and factory providers
30
+ - **Parent/child containers** — `container.createChild()`
31
+ - **Lifecycle** — resolve factories, then `prepare` → `register` → `ready`
32
+ - **Task bus** — `subscribe` / `invoke` (`sequential` or `parallel`)
33
+ - **Config** — nested values via dot paths on a metadata-backed store
34
+ - **Shell** — host-app bootstrap (`create` / `register` / `ready`) used by kits
35
+
36
+ Not in this package:
37
+
38
+ - HTTP server, router, controllers as a framework primitive
39
+ - Request-scoped providers
40
+ - NestJS-style `@Module({ imports, providers })`
41
+ - First-party Lambda, SQS, or worker adapters
42
+ - Tests, changelog, and a published license (see [Open-source status](#open-source-status))
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ npm install @toijs/modular
48
+ # or
49
+ pnpm add @toijs/modular
50
+ ```
51
+
52
+ The package is **ESM-only** (`"type": "module"`). Node.js 18+ is the intended runtime; `engines` is not declared yet.
53
+
54
+ Enable class decorators in the consuming project. `@Injectable` is a class decorator. `@Inject` and `@Optional` are parameter decorators and need `experimentalDecorators` in `tsconfig.json`.
55
+
56
+ ```json
57
+ {
58
+ "compilerOptions": {
59
+ "experimentalDecorators": true
60
+ }
61
+ }
62
+ ```
63
+
64
+ `emitDecoratorMetadata` is **not** required and is **not** read by this container.
65
+
66
+ ## Quick Start
67
+
68
+ ```ts
69
+ import { Injectable, Launcher, type Module } from "@toijs/modular";
70
+
71
+ @Injectable()
72
+ class UserService {
73
+ list() {
74
+ return [{ id: "1", name: "Ada" }];
75
+ }
76
+ }
77
+
78
+ function AppModule(launcher: Launcher): Module {
79
+ const prepare = () => {
80
+ launcher.container.register([UserService]);
81
+ };
82
+
83
+ const ready = () => {
84
+ const users = launcher.container.resolve(UserService);
85
+ console.log(users.list());
86
+ };
87
+
88
+ return { name: "app", prepare, ready };
89
+ }
90
+
91
+ await new Launcher().modules([AppModule]).start();
92
+ ```
93
+
94
+ `start()` throws if `.modules()` was never called with at least one factory.
95
+
96
+ ## Module example
97
+
98
+ A module is a **function**, not a class. There is no `@Module()` decorator.
99
+
100
+ ```ts
101
+ import { Launcher, type Module } from "@toijs/modular";
102
+ import { UserService } from "./user.service.js";
103
+ import { UserRepository } from "./user.repository.js";
104
+
105
+ export function UserModule(launcher: Launcher): Module {
106
+ const prepare = () => {
107
+ launcher.container.register([UserRepository, UserService]);
108
+ };
109
+
110
+ return { name: "feature.user", prepare };
111
+ }
112
+ ```
113
+
114
+ Optional fields:
115
+
116
+ | Field | Role |
117
+ | --- | --- |
118
+ | `name` | Required identity. Duplicate names are **skipped**. Empty names are skipped. |
119
+ | `dependencies` | Extra `ModuleFactory[]` resolved after this module is recorded |
120
+ | `prepare` | Register providers, subscribe to tasks, define routes in a kit |
121
+ | `register` | Create the host (`shell.create`) — used by kits, not feature modules |
122
+ | `ready` | After register; often unused in features |
123
+
124
+ The factory body runs during resolve, **before** any lifecycle hook. Put `config.define` there so later factories can read config.
125
+
126
+ ## Dependency Injection example
127
+
128
+ Tokens must be listed. An empty `@Injectable()` does not inspect constructor types.
129
+
130
+ ```ts
131
+ import { Injectable } from "@toijs/modular";
132
+ import { UserRepository } from "./user.repository.js";
133
+
134
+ @Injectable([UserRepository])
135
+ export class UserService {
136
+ constructor(private readonly users: UserRepository) {}
137
+
138
+ find(id: string) {
139
+ return this.users.findById(id);
140
+ }
141
+ }
142
+ ```
143
+
144
+ Register the class as its own token (singleton by default):
145
+
146
+ ```ts
147
+ launcher.container.register([UserRepository, UserService]);
148
+ ```
149
+
150
+ ## Provider example
151
+
152
+ ```ts
153
+ import { ConnectionManager } from "@toijs/typeorm";
154
+
155
+ // Class as its own token
156
+ launcher.container.register(UserService);
157
+
158
+ // Value
159
+ launcher.container.register({
160
+ provide: ConnectionManager,
161
+ useValue: connectionManager,
162
+ });
163
+
164
+ // Factory
165
+ launcher.container.register({
166
+ provide: "clock",
167
+ useFactory: () => () => Date.now(),
168
+ });
169
+
170
+ // Existing (alias)
171
+ launcher.container.register({
172
+ provide: "Users",
173
+ useExisting: UserService,
174
+ });
175
+
176
+ // Class with explicit inject list and transient scope
177
+ launcher.container.register({
178
+ provide: UserService,
179
+ useClass: UserService,
180
+ inject: [UserRepository],
181
+ scope: "transient",
182
+ });
183
+ ```
184
+
185
+ `useValue` and `useExisting` are always stored as singletons. `scope` is honored only on `useClass` and `useFactory`.
186
+
187
+ ## Token injection
188
+
189
+ ```ts
190
+ import { Inject, Injectable, Optional } from "@toijs/modular";
191
+
192
+ const CONFIG = Symbol("config");
193
+
194
+ @Injectable()
195
+ class ReportService {
196
+ constructor(
197
+ @Inject(CONFIG) private readonly config: { env: string },
198
+ @Optional() @Inject("logger") private readonly logger?: { info(msg: string): void },
199
+ ) {}
200
+ }
201
+
202
+ launcher.container.register({ provide: CONFIG, useValue: { env: "test" } });
203
+ launcher.container.register(ReportService);
204
+ ```
205
+
206
+ `@Optional()` only applies to **class constructor** parameters. Factory `inject` arrays cannot mark a dependency optional; a missing token throws.
207
+
208
+ ## Lifecycle
209
+
210
+ `Launcher.start()`:
211
+
212
+ ```text
213
+ resolve factories (and `dependencies`)
214
+ ↓
215
+ prepare() × all modules (not awaited)
216
+ ↓
217
+ register() × all modules (not awaited)
218
+ ↓
219
+ ready() × all modules (not awaited)
220
+ ```
221
+
222
+ Hooks are typed as `() => void`. Async functions are allowed by TypeScript but **`start()` does not await them**. Sequence async work with `launcher.task.subscribe` / `invoke` (this is how `@toijs/typeorm` signals `event.database.connected`).
223
+
224
+ `Shell` is a second, host-specific flow used by kits:
225
+
226
+ ```text
227
+ shell.create(fn)
228
+ ↓
229
+ invoke "task.root.register"
230
+ ↓
231
+ invoke "task.root.ready"
232
+ ```
233
+
234
+ Feature modules subscribe with `shell.register` / `shell.ready`. They should not call `shell.create`.
235
+
236
+ ## Application composition
237
+
238
+ ```ts
239
+ import { Launcher } from "@toijs/modular";
240
+ import { TypeORMModule } from "@toijs/typeorm";
241
+ import { ConfigModule } from "./config.module.js";
242
+ import { DatabaseModule } from "./database.module.js";
243
+ import { UserModule } from "./user.module.js";
244
+ import { OrderModule } from "./order.module.js";
245
+
246
+ await new Launcher()
247
+ .modules([
248
+ ConfigModule, // factory body: config.define
249
+ TypeORMModule, // separate package
250
+ DatabaseModule, // setEntities before TypeORM register
251
+ UserModule,
252
+ OrderModule,
253
+ ])
254
+ .start();
255
+ ```
256
+
257
+ `Launcher` constructs a `Container` and registers itself plus `Task`, `Metadata`, `Config`, and `Shell` as value providers.
258
+
259
+ `launcher.define("http", client)` attaches a property on the launcher **and** registers it in DI. It throws if the property already exists.
260
+
261
+ ## Testing
262
+
263
+ There is no test helper in this package. Replace a production provider with a test double by registering over the same token:
264
+
265
+ ```ts
266
+ import { Launcher } from "@toijs/modular";
267
+ import { UserModule } from "./user.module.js";
268
+ import { UserRepository } from "./user.repository.js";
269
+ import { InMemoryUserRepository } from "./user.repository.memory.js";
270
+
271
+ const launcher = new Launcher();
272
+ await launcher.modules([UserModule]).start();
273
+
274
+ launcher.container.register({
275
+ provide: UserRepository,
276
+ useClass: InMemoryUserRepository,
277
+ });
278
+
279
+ const users = launcher.container.resolve(UserRepository);
280
+ ```
281
+
282
+ `register` deletes any cached singleton for that token, so the next `resolve` builds a new instance.
283
+
284
+ `container.tryResolve(token)` returns `undefined` instead of throwing. `container.has(token)` walks parent containers.
285
+
286
+ ## Architecture
287
+
288
+ ```text
289
+ Launcher
290
+ ├── container DI (providers, resolve, child containers)
291
+ ├── task named handler bus
292
+ ├── metadata key/value + change events
293
+ ├── config metadata-backed settings (dot paths)
294
+ └── shell host instance (Express, Vue, …)
295
+
296
+ Module factory
297
+ ├── factory body runs at resolve time
298
+ ├── prepare
299
+ ├── register
300
+ └── ready
301
+ ```
302
+
303
+ Keep domain types and business logic as plain TypeScript. Depend on `@toijs/modular` only at the composition root (modules, `@Injectable`, `container.register`).
304
+
305
+ ## Use cases
306
+
307
+ Fits:
308
+
309
+ - API process composed with a kit such as `@toijs/express-kit`
310
+ - Vue SPA composed with `@toijs/vue-kit`
311
+ - CLI / batch scripts that need modules + DI
312
+ - Long-running workers, if **you** wire the consumer (no SQS adapter ships here)
313
+ - Lambda handlers, if **you** bootstrap `Launcher` per cold start (no Lambda adapter ships here)
314
+
315
+ Does not fit as a drop-in:
316
+
317
+ - Teams that want NestJS’s HTTP, OpenAPI, microservices, and ecosystem
318
+ - Request-scoped per-HTTP-request providers
319
+ - Effect-style typed functional programming
320
+ - CommonJS-only deployments
321
+
322
+ ## Comparison
323
+
324
+ | | `@toijs/modular` | NestJS |
325
+ | --- | --- | --- |
326
+ | DI | Explicit tokens, class/value/factory/existing | Reflection + tokens, large provider model |
327
+ | Module | Function factory | `@Module()` class |
328
+ | Lifecycle | `prepare` → `register` → `ready` (sync call, not awaited) | Nest lifecycle hooks |
329
+ | HTTP | Not included | First-class |
330
+ | CLI | Not included | `@nestjs/cli` |
331
+ | ORM | Separate `@toijs/typeorm` | Separate `@nestjs/typeorm` etc. |
332
+ | Lambda / worker | Usable; no official adapter | Usable; larger bootstrap |
333
+ | Ecosystem | Small (`typeorm`, private kits) | Large |
334
+ | Learning curve | Small API, unusual module shape | Large API, more tutorials |
335
+
336
+ Use NestJS when you want a platform. Use `@toijs/modular` when you want composition and DI without that platform.
337
+
338
+ A longer comparison with Effect and plain Node.js is in [docs/guides/comparison.md](docs/guides/comparison.md).
339
+
340
+ ## API overview
341
+
342
+ | Export | Kind |
343
+ | --- | --- |
344
+ | `Launcher` | Bootstrap: `modules()`, `start()`, `define()`, `container`, `task`, `config`, `metadata`, `shell` |
345
+ | `Container` | `register`, `resolve`, `tryResolve`, `has`, `createChild`, `clear` |
346
+ | `Injectable`, `Inject`, `Optional` | Decorators |
347
+ | `Task` | `subscribe`, `unsubscribe`, `invoke(name, data?, type?)` |
348
+ | `Config` | `define`, `resolve(path?)` |
349
+ | `Metadata` | `define`, `resolve`, `subscribe`, `invoke` |
350
+ | `Shell` | `create`, `register`, `ready`, `getInstance` |
351
+ | `SCOPE_SINGLETON`, `SCOPE_TRANSIENT` | `"singleton"` / `"transient"` |
352
+ | `TASK_ROOT_REGISTER`, `TASK_ROOT_READY` | Shell task names |
353
+ | `METADATA_CONFIG`, `EVENT_METADATA_CHANGED` | Config / metadata keys |
354
+
355
+ ## Packages / integrations
356
+
357
+ | Package | Status | Role |
358
+ | --- | --- | --- |
359
+ | `@toijs/modular` | v1.0.3, `private: false` | Core |
360
+ | `@toijs/typeorm` | v1.0.7, `private: false` | `TypeORMModule`, `ConnectionManager` |
361
+ | `@toijs/express-kit` | `private: true` | Express `shell.create` + router |
362
+ | `@toijs/vue-kit` | `private: true` | Vue `shell.create` + router |
363
+ | `@toijs/graphql` | `private: true` | Stub — do not treat as shipped |
364
+
365
+ HTTP, Vue, i18n, layout, and device kits live outside this package. They are not required to use the container.
366
+
367
+ ## Documentation
368
+
369
+ - [Documentation index](docs/README.md)
370
+ - [Modules](docs/concepts/modules.md)
371
+ - [Dependency injection](docs/concepts/dependency-injection.md)
372
+ - [Containers](docs/concepts/containers.md)
373
+ - [Lifecycle](docs/concepts/lifecycle.md)
374
+ - [Architecture](docs/guides/architecture.md)
375
+ - [Examples](examples/README.md)
376
+
377
+ ## Contributing
378
+
379
+ There is no `CONTRIBUTING.md` yet. Source of truth is `src/` in this package. Do not add NestJS APIs “for familiarity” — this runtime is not NestJS.
380
+
381
+ ## Roadmap
382
+
383
+ Not implemented, not scheduled in-repo (ideas only):
384
+
385
+ - Awaited module hooks
386
+ - Request scope
387
+ - CJS build
388
+ - Official Lambda / SQS examples as packages
389
+ - Test utilities
390
+ - License, changelog, CI, coverage
391
+
392
+ ## Open-source status
393
+
394
+ | Item | Status |
395
+ | --- | --- |
396
+ | Version | `1.0.3` |
397
+ | License | **Missing** (GitHub `license: null`, no `license` field in `package.json`) |
398
+ | Tests | **None** in this package |
399
+ | CI | **None** in the repository |
400
+ | Changelog | **Missing** |
401
+ | Node `engines` | **Not declared** |
402
+ | ESM / CJS | ESM only |
403
+ | README (previous) | **Missing** — this file is new |
404
+
405
+ Version `1.0.3` means the package is versioned, not that it has a stability policy. Treat breaking changes as possible until a changelog and semver policy exist.
406
+
407
+ ## License
408
+
409
+ **NEEDS VERIFICATION.** No license file is present in the package or on [toijs/framework](https://github.com/toijs/framework). Do not assume MIT or any other license until one is published.
@@ -101,10 +101,10 @@ export class Launcher {
101
101
  }
102
102
  let instances = await this.resolveModuleInstances(this.options.modules);
103
103
  for (const instance of instances) {
104
- instance.prepare?.();
104
+ await instance.prepare?.();
105
105
  }
106
106
  for (const instance of instances) {
107
- instance.register?.();
107
+ await instance.register?.();
108
108
  }
109
109
  for (const instance of instances) {
110
110
  instance.ready?.();
@@ -1 +1 @@
1
- {"version":3,"file":"launcher.service.js","sourceRoot":"","sources":["../../../src/launcher/services/launcher.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAuB,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,MAAM,OAAO,QAAQ;IACZ,IAAI,CAAO;IACX,QAAQ,CAAW;IACnB,SAAS,CAAY;IACrB,KAAK,CAAQ;IACb,MAAM,CAAS;IACf,OAAO,GAAiB;QAC7B,OAAO,EAAE,EAAqB;KACf,CAAC;IACX,SAAS,GAAwB,IAAI,GAAG,EAAE,CAAC;IAElD;QACE,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;YACtB,OAAO,EAAE,QAAQ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AAc,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;gBACpE,SAAS;YACX,CAAC;YAED,+BAA+B;YAC/B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;YACxD,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAE/B,+BAA+B;YAC/B,IAAI,cAAc,CAAC,YAAY,EAAE,CAAC;gBAChC,SAAS,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,cAAc,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;YACxF,CAAC;QACH,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,SAAS,GAAa,MAAM,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAElF,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YACjC,MAAM,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;QAC7B,CAAC;QAED,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YACjC,MAAM,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC9B,CAAC;QAED,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YACjC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;QACrB,CAAC;IACH,CAAC;CACF"}
@@ -9,9 +9,9 @@ import { Launcher } from "../services";
9
9
  export type Module = {
10
10
  name: string;
11
11
  dependencies?: ModuleFactory[];
12
- prepare?: () => void;
13
- register?: () => void;
14
- ready?: () => void;
12
+ prepare?: () => void | Promise<void>;
13
+ register?: () => void | Promise<void>;
14
+ ready?: () => void | Promise<void>;
15
15
  };
16
16
  /**
17
17
  * A factory function that creates a module
@@ -1 +1 @@
1
- {"version":3,"file":"module.type.d.ts","sourceRoot":"","sources":["../../../src/launcher/types/module.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,aAAa,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,QAAQ,KAAK,MAAM,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B,CAAC"}
1
+ {"version":3,"file":"module.type.d.ts","sourceRoot":"","sources":["../../../src/launcher/types/module.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,aAAa,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,QAAQ,KAAK,MAAM,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,30 @@
1
1
  {
2
2
  "name": "@toijs/modular",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "private": false,
5
5
  "type": "module",
6
- "description": "Lamtoi modular core (launcher, metadata, config, task, router)",
6
+ "description": "TypeScript module system and explicit dependency injection container for Node.js applications",
7
+ "keywords": [
8
+ "nodejs",
9
+ "typescript",
10
+ "dependency-injection",
11
+ "di",
12
+ "container",
13
+ "module",
14
+ "modular",
15
+ "ioc",
16
+ "composition",
17
+ "launcher"
18
+ ],
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/toijs/framework.git",
22
+ "directory": "modular"
23
+ },
24
+ "homepage": "https://github.com/toijs/framework/tree/develop/modular",
25
+ "bugs": {
26
+ "url": "https://github.com/toijs/framework/issues"
27
+ },
7
28
  "main": "dist/index.js",
8
29
  "types": "dist/index.d.ts",
9
30
  "exports": {