Skip to content

Commit bb0ff08

Browse files
authored
Merge pull request #2 from BackendStack21/rebrand-fast-injection
Rebrand from fast-di to fast-injection
2 parents fda9a87 + 0847618 commit bb0ff08

15 files changed

Lines changed: 89 additions & 89 deletions

File tree

QUICKSTART.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
## Installation
44

55
```bash
6-
bun add fast-di
6+
bun add fast-injection
77
```
88

99
## Basic Usage
1010

1111
### 1. Simple Service Registration
1212

1313
```typescript
14-
import { Container } from "fast-di";
15-
import { singleton } from "fast-di/decorators";
14+
import { Container } from "fast-injection";
15+
import { singleton } from "fast-injection/decorators";
1616

1717
@singleton()
1818
class Logger {
@@ -25,14 +25,14 @@ const container = new Container();
2525
container.register(Logger); // Decorator controls lifetime
2626

2727
const logger = container.resolve(Logger);
28-
logger.log("Hello, fast-di!");
28+
logger.log("Hello, fast-injection!");
2929
```
3030

3131
### 2. Dependency Injection with Factories
3232

3333
```typescript
34-
import { Container } from "fast-di";
35-
import { singleton } from "fast-di/decorators";
34+
import { Container } from "fast-injection";
35+
import { singleton } from "fast-injection/decorators";
3636

3737
@singleton()
3838
class Database {
@@ -68,8 +68,8 @@ console.log(service.getUsers());
6868
### 3. Scoped Containers (for HTTP requests)
6969

7070
```typescript
71-
import { Container } from "fast-di";
72-
import { singleton, scoped, inject } from "fast-di/decorators";
71+
import { Container } from "fast-injection";
72+
import { singleton, scoped, inject } from "fast-injection/decorators";
7373

7474
@singleton()
7575
class Database {
@@ -104,7 +104,7 @@ await requestScope.dispose();
104104
Use `getGlobalContainer()` to access a shared container instance across your entire application without passing it around:
105105

106106
```typescript
107-
import { getGlobalContainer, resetGlobalContainer, Lifetime } from "fast-di";
107+
import { getGlobalContainer, resetGlobalContainer, Lifetime } from "fast-injection";
108108

109109
// Setup at application startup (e.g., in main.ts)
110110
function setupContainer() {
@@ -175,7 +175,7 @@ await container.dispose(); // Calls onDispose on all services
175175
### 7. Testing with Mocks
176176

177177
```typescript
178-
import { createTestContainer } from "fast-di/testing";
178+
import { createTestContainer } from "fast-injection/testing";
179179

180180
// In your tests
181181
const container = createTestContainer();
@@ -198,7 +198,7 @@ const service = container.resolve(UserService);
198198
While decorators are the recommended default, explicit options are useful when:
199199

200200
```typescript
201-
import { Lifetime } from "fast-di";
201+
import { Lifetime } from "fast-injection";
202202

203203
// Override decorator at registration
204204
@singleton()
@@ -220,8 +220,8 @@ You can use decorators to control service lifetimes and document your code. **De
220220
### 8. Decorator-Based Lifetimes
221221

222222
```typescript
223-
import { Container } from "fast-di";
224-
import { singleton, transient, scoped } from "fast-di/decorators";
223+
import { Container } from "fast-injection";
224+
import { singleton, transient, scoped } from "fast-injection/decorators";
225225

226226
@singleton()
227227
class ConfigService {
@@ -267,7 +267,7 @@ console.log(logger1 === logger2); // false
267267
### 8. Using @inject for Interface Tokens
268268

269269
```typescript
270-
import { injectable, inject } from "fast-di/decorators";
270+
import { injectable, inject } from "fast-injection/decorators";
271271

272272
const ILogger = Symbol("ILogger");
273273
const IDatabase = Symbol("IDatabase");
@@ -325,7 +325,7 @@ await service.getUsers();
325325
### 9. Decorators Control Lifetimes
326326

327327
```typescript
328-
import { singleton } from "fast-di/decorators";
328+
import { singleton } from "fast-injection/decorators";
329329

330330
@singleton()
331331
class Database {
@@ -412,7 +412,7 @@ const service = container.resolve(UserService);
412412
}
413413
```
414414

415-
### Decorator Methods (from "fast-di/decorators")
415+
### Decorator Methods (from "fast-injection/decorators")
416416

417417
- `@injectable()` - Mark class as injectable (transient lifetime)
418418
- `@singleton()` - Mark class as singleton lifetime
@@ -495,7 +495,7 @@ container.registerFactory(UserService, (c) => {
495495
});
496496

497497
// Or, with decorators and @inject, no factory is needed:
498-
import { singleton, inject } from "fast-di/decorators";
498+
import { singleton, inject } from "fast-injection/decorators";
499499

500500
@singleton()
501501
class UserService {
@@ -588,4 +588,4 @@ container.registerFactory(ServiceA, (c) => {
588588

589589
---
590590

591-
**fast-di** - Built with ❤️ by [21no.de](https://21no.de) | [MIT License](LICENSE)
591+
**fast-injection** - Built with ❤️ by [21no.de](https://21no.de) | [MIT License](LICENSE)

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# fast-di 🚀
1+
# fast-injection 🚀
22

33
Modern, lightweight TypeScript Dependency Injection optimized for Bun runtime.
44

5-
[![npm version](https://img.shields.io/npm/v/fast-di)](https://www.npmjs.com/package/fast-di)
6-
[![Bundle Size](https://img.shields.io/badge/bundle%20size-%3C5KB-brightgreen)](https://github.com/21no-de/fast-di)
5+
[![npm version](https://img.shields.io/npm/v/fast-injection)](https://www.npmjs.com/package/fast-injection)
6+
[![Bundle Size](https://img.shields.io/badge/bundle%20size-%3C5KB-brightgreen)](https://github.com/21no-de/fast-injection)
77
[![TypeScript](https://img.shields.io/badge/TypeScript-5.0%2B-blue)](https://www.typescriptlang.org/)
88
[![Bun](https://img.shields.io/badge/Bun-1.0%2B-orange)](https://bun.sh)
99
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -24,7 +24,7 @@ Modern, lightweight TypeScript Dependency Injection optimized for Bun runtime.
2424

2525
## Performance
2626

27-
Fast-DI is optimized for speed with minimal overhead. Here are the key performance metrics:
27+
Fast-Injection is optimized for speed with minimal overhead. Here are the key performance metrics:
2828

2929
| Operation | Ops/Second | Avg Time | Notes |
3030
| -------------------- | ------------- | -------- | -------------------------------- |
@@ -59,16 +59,16 @@ Run benchmarks yourself: `bun run bench`
5959
## Installation
6060

6161
```bash
62-
bun add fast-di
62+
bun add fast-injection
6363
```
6464

6565
## Quick Start
6666

6767
### Basic Usage
6868

6969
```typescript
70-
import { Container } from "fast-di";
71-
import { singleton, inject } from "fast-di/decorators";
70+
import { Container } from "fast-injection";
71+
import { singleton, inject } from "fast-injection/decorators";
7272

7373
// Step 1: Define your services
7474
// Use @singleton() decorator to mark this class as a singleton
@@ -106,7 +106,7 @@ const userService = container.resolve(UserService);
106106
### Lifecycle Hooks (Basic)
107107

108108
```typescript
109-
import { Container } from "fast-di";
109+
import { Container } from "fast-injection";
110110

111111
class Cache {
112112
private store = new Map<string, string>();
@@ -144,8 +144,8 @@ await c.dispose();
144144
### Advanced: Multiple Lifetimes
145145

146146
```typescript
147-
import { Container } from "fast-di";
148-
import { singleton, transient, scoped } from "fast-di/decorators";
147+
import { Container } from "fast-injection";
148+
import { singleton, transient, scoped } from "fast-injection/decorators";
149149

150150
// SINGLETON: One instance shared across the entire application
151151
// Perfect for: configuration, database connections, loggers
@@ -196,8 +196,8 @@ const ctx3 = anotherScope.resolve(RequestContext);
196196
### Using @inject for Constructor Injection
197197

198198
```typescript
199-
import { Container } from "fast-di";
200-
import { singleton, inject } from "fast-di/decorators";
199+
import { Container } from "fast-injection";
200+
import { singleton, inject } from "fast-injection/decorators";
201201

202202
// Step 1: Define your dependencies
203203
@singleton()
@@ -279,7 +279,7 @@ bun run bench
279279

280280
## Security
281281

282-
Fast-DI includes multiple security enhancements to protect your applications:
282+
Fast-Injection includes multiple security enhancements to protect your applications:
283283

284284
### Token Validation
285285

@@ -291,7 +291,7 @@ bun run bench
291291

292292
## Security
293293

294-
Fast-DI implements comprehensive security measures to protect against common vulnerabilities. See [SECURITY.md](SECURITY.md) for detailed information.
294+
Fast-Injection implements comprehensive security measures to protect against common vulnerabilities. See [SECURITY.md](SECURITY.md) for detailed information.
295295

296296
**Key Features:**
297297
- 🛡️ **Prototype Pollution Prevention**: Token validation rejects dangerous property names

SECURITY.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Security Enhancements
22

3-
This document describes the security features and best practices implemented in fast-di to protect against common vulnerabilities.
3+
This document describes the security features and best practices implemented in fast-injection to protect against common vulnerabilities.
44

55
## Security Features
66

@@ -77,7 +77,7 @@ const result = await container.resolveAsync("api");
7777
**Solution**: Explicit cleanup function for decorator metadata:
7878

7979
```typescript
80-
import { clearDecoratorMetadata, singleton } from "fast-di/decorators";
80+
import { clearDecoratorMetadata, singleton } from "fast-injection/decorators";
8181

8282
// Create dynamic service
8383
@singleton()
@@ -201,7 +201,7 @@ container.register("prototype", Service); // Throws!
201201
Always dispose containers to prevent resource leaks:
202202

203203
```typescript
204-
import { singleton } from "fast-di/decorators";
204+
import { singleton } from "fast-injection/decorators";
205205

206206
@singleton()
207207
class DatabaseConnection {
@@ -335,7 +335,7 @@ The security test suite includes:
335335

336336
### Not Protected Against
337337

338-
- **Code Injection**: Fast-di does not validate factory function code
338+
- **Code Injection**: The library does not validate factory function code
339339
- **Dependency Confusion**: Users must ensure correct service registration
340340
- **DoS via Circular Dependencies**: Detected but not prevented (throws error)
341341

@@ -355,4 +355,4 @@ The security test suite includes:
355355

356356
---
357357

358-
**fast-di** - Built with ❤️ by [21no.de](https://21no.de)
358+
**fast-injection** - Built with ❤️ by [21no.de](https://21no.de)

benchmarks/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Fast-DI Performance Benchmarks
1+
# Fast-Injection Performance Benchmarks
22

3-
This directory contains comprehensive performance benchmarks for the Fast-DI dependency injection container.
3+
This directory contains comprehensive performance benchmarks for the Fast-Injection dependency injection container.
44

55
## Running Benchmarks
66

@@ -202,7 +202,7 @@ The overhead from these protections is minimal (< 0.01µs per operation) while e
202202

203203
## Comparison with Other DI Containers
204204

205-
Fast-DI is optimized for Bun and provides:
205+
Fast-Injection is optimized for Bun and provides:
206206

207207
- **Ultra-low overhead**: ~0.988µs per transient resolution, ~0.037µs for singletons
208208
- **Excellent singleton performance**: 26.8M ops/sec (explicit), 16.7M ops/sec (decorator)

benchmarks/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ async function runComparisonBenchmarks(): Promise<void> {
561561

562562
// Main execution
563563
async function main(): Promise<void> {
564-
console.log("🚀 Fast-DI Performance Benchmarks");
564+
console.log("🚀 Fast-Injection Performance Benchmarks");
565565
console.log(`Running on Bun ${Bun.version}`);
566566
console.log(`Platform: ${process.platform} ${process.arch}`);
567567

bun.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/CNAME

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fast-di.21no.de
1+
fast-injection.21no.de

0 commit comments

Comments
 (0)