@djodjonx/neosyringe 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.
Files changed (2) hide show
  1. package/README.md +153 -4
  2. package/package.json +7 -6
package/README.md CHANGED
@@ -1,11 +1,160 @@
1
- # @djodjonx/neosyringe
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/djodjonx/neosyringe/main/logo/logo.png" alt="NeoSyringe" width="200">
3
+ </p>
2
4
 
3
- The runtime library for NeoSyringe. Contains strict types and helper functions.
5
+ <p align="center">
6
+ <a href="https://www.npmjs.com/package/@djodjonx/neosyringe"><img src="https://img.shields.io/npm/v/@djodjonx/neosyringe.svg?style=flat-square" alt="npm version"></a>
7
+ <a href="https://github.com/djodjonx/neosyringe/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/djodjonx/neosyringe/ci.yml?style=flat-square&label=tests" alt="Tests"></a>
8
+ <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-5.0+-blue.svg?style=flat-square" alt="TypeScript"></a>
9
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square" alt="License: MIT"></a>
10
+ <a href="https://djodjonx.github.io/neosyringe/"><img src="https://img.shields.io/badge/docs-VitePress-0d9488.svg?style=flat-square" alt="Documentation"></a>
11
+ </p>
4
12
 
5
- ## Installation
13
+ <h1 align="center">Zero-Overhead, Compile-Time Dependency Injection</h1>
14
+
15
+ <p align="center">
16
+ <strong>NeoSyringe</strong> shifts DI resolution from <strong>Runtime</strong> to <strong>Build-Time</strong>.<br>
17
+ No reflection, no decorators, just pure TypeScript.
18
+ </p>
19
+
20
+ <p align="center">
21
+ <a href="https://djodjonx.github.io/neosyringe/"><strong>📚 Read the Documentation →</strong></a>
22
+ </p>
23
+
24
+ <p align="center">
25
+ <a href="https://djodjonx.github.io/neosyringe/guide/getting-started">Getting Started</a> •
26
+ <a href="https://djodjonx.github.io/neosyringe/guide/why-neo-syringe">Why NeoSyringe?</a> •
27
+ <a href="https://djodjonx.github.io/neosyringe/api/types">API Reference</a>
28
+ </p>
29
+
30
+ ---
31
+
32
+ ## ✨ Features
33
+
34
+ - **Use Interfaces as Tokens** - `useInterface<ILogger>()` without manual Symbols
35
+ - **Zero Runtime Overhead** - Generated factory functions, no DI library shipped
36
+ - **Compile-Time Safety** - Errors detected in your IDE, not at runtime
37
+ - **Pure Classes** - No decorators, no DI imports in your business code
38
+ - **Gradual Migration** - Bridge existing containers (tsyringe, InversifyJS)
39
+ - **CI Validation** - CLI to verify your dependency graph
40
+
41
+ ## 📦 Installation
6
42
 
7
43
  ```bash
44
+ # npm
8
45
  npm install @djodjonx/neosyringe
46
+ npm install -D @djodjonx/neosyringe-plugin
47
+
48
+ # pnpm
49
+ pnpm add @djodjonx/neosyringe
50
+ pnpm add -D @djodjonx/neosyringe-plugin
51
+ ```
52
+
53
+ ## 🚀 Quick Example
54
+
55
+ ```typescript
56
+ // Pure TypeScript - no decorators!
57
+ interface ILogger {
58
+ log(msg: string): void;
59
+ }
60
+
61
+ class ConsoleLogger implements ILogger {
62
+ log(msg: string) { console.log(msg); }
63
+ }
64
+
65
+ class UserService {
66
+ constructor(private logger: ILogger) {}
67
+ }
68
+ ```
69
+
70
+ ```typescript
71
+ // container.ts
72
+ import { defineBuilderConfig, useInterface } from '@djodjonx/neosyringe';
73
+
74
+ export const container = defineBuilderConfig({
75
+ injections: [
76
+ // Bind interface to implementation
77
+ { token: useInterface<ILogger>(), provider: ConsoleLogger },
78
+
79
+ // Autowire class (dependencies resolved automatically)
80
+ { token: UserService }
81
+ ]
82
+ });
83
+
84
+ // Use it
85
+ const userService = container.resolve(UserService);
86
+ ```
87
+
88
+ At build time, this generates optimized factory functions. **Zero DI library shipped to production!**
89
+
90
+ ## 📖 Documentation
91
+
92
+ For complete documentation, visit **[djodjonx.github.io/neosyringe](https://djodjonx.github.io/neosyringe/)**
93
+
94
+ | Topic | Description |
95
+ |-------|-------------|
96
+ | [Getting Started](https://djodjonx.github.io/neosyringe/guide/getting-started) | Installation and first container |
97
+ | [Why NeoSyringe?](https://djodjonx.github.io/neosyringe/guide/why-neo-syringe) | Comparison with traditional DI |
98
+ | [Injection Types](https://djodjonx.github.io/neosyringe/guide/injection-types) | Classes, interfaces, factories, primitives |
99
+ | [Lifecycle](https://djodjonx.github.io/neosyringe/guide/lifecycle) | Singleton vs transient |
100
+ | [Scoped Injections](https://djodjonx.github.io/neosyringe/guide/scoped-injections) | Override parent container tokens |
101
+ | [Parent Container](https://djodjonx.github.io/neosyringe/guide/parent-container) | SharedKernel architecture |
102
+ | [Legacy Migration](https://djodjonx.github.io/neosyringe/guide/legacy-migration) | Bridge tsyringe, InversifyJS |
103
+ | [Generated Code](https://djodjonx.github.io/neosyringe/guide/generated-code) | What the compiler produces |
104
+ | [CLI Validator](https://djodjonx.github.io/neosyringe/guide/cli) | Validate in CI/CD |
105
+ | [IDE Plugin](https://djodjonx.github.io/neosyringe/guide/ide-plugin) | Real-time error detection |
106
+ | [API Reference](https://djodjonx.github.io/neosyringe/api/types) | Types and functions |
107
+
108
+ ## 🔧 Build Plugin Setup
109
+
110
+ <details>
111
+ <summary><strong>Vite</strong></summary>
112
+
113
+ ```typescript
114
+ import { neoSyringePlugin } from '@djodjonx/neosyringe-plugin';
115
+
116
+ export default defineConfig({
117
+ plugins: [neoSyringePlugin.vite()]
118
+ });
9
119
  ```
120
+ </details>
121
+
122
+ <details>
123
+ <summary><strong>Rollup</strong></summary>
124
+
125
+ ```typescript
126
+ import { neoSyringePlugin } from '@djodjonx/neosyringe-plugin';
127
+
128
+ export default {
129
+ plugins: [neoSyringePlugin.rollup()]
130
+ };
131
+ ```
132
+ </details>
133
+
134
+ <details>
135
+ <summary><strong>Webpack</strong></summary>
136
+
137
+ ```javascript
138
+ module.exports = {
139
+ plugins: [require('@djodjonx/neosyringe-plugin').webpack()]
140
+ };
141
+ ```
142
+ </details>
143
+
144
+ ## 🛡️ IDE Support
145
+
146
+ Add to `tsconfig.json` for real-time error detection:
147
+
148
+ ```json
149
+ {
150
+ "compilerOptions": {
151
+ "plugins": [
152
+ { "name": "@djodjonx/neosyringe-lsp" }
153
+ ]
154
+ }
155
+ }
156
+ ```
157
+
158
+ ## 📄 License
10
159
 
11
- See [Documentation](https://djodjonx.github.io/neosyringe/).
160
+ MIT
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@djodjonx/neosyringe",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Runtime library for NeoSyringe DI",
5
5
  "type": "module",
6
+ "license": "MIT",
6
7
  "main": "dist/index.cjs",
7
8
  "module": "dist/index.mjs",
8
9
  "types": "dist/index.d.mts",
@@ -19,13 +20,13 @@
19
20
  "publishConfig": {
20
21
  "access": "public"
21
22
  },
23
+ "scripts": {
24
+ "build": "tsdown",
25
+ "test": "vitest run"
26
+ },
22
27
  "devDependencies": {
23
28
  "tsdown": "0.20.0-beta.3",
24
29
  "typescript": "^5.9.3",
25
30
  "vitest": "^4.0.17"
26
- },
27
- "scripts": {
28
- "build": "tsdown",
29
- "test": "vitest run"
30
31
  }
31
- }
32
+ }