{"_id":"@canmertinyo/fast-di","_rev":"5-08d2eff8bdf729fc11b3ef79f638627f","name":"@canmertinyo/fast-di","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.0":{"name":"@canmertinyo/fast-di","version":"1.0.0","keywords":["di","depedency injector","di library","decorator di library","lightweight di library for typescript"],"author":{"name":"CANMERTINYO"},"license":"ISC","_id":"@canmertinyo/fast-di@1.0.0","maintainers":[{"name":"canmertinyo","email":"squalcan@gmail.com"}],"dist":{"shasum":"035f76ab06adbaaddad5a8b02e4d44737ee744e8","tarball":"https://registry.npmjs.org/@canmertinyo/fast-di/-/fast-di-1.0.0.tgz","fileCount":11,"integrity":"sha512-K+bFq6MWiphabu5kWEe4xPCePgfT98pFr6YvEaXukHOj46oDHUqXzaYj8qMNkc/o6C4jtc4kV1MTWDaVTzjCbQ==","signatures":[{"sig":"MEUCIBDntvPujk8Z0GnJ5YBxJFpMLIz/oswwxQSaXAPgBIxEAiEA/sNdpUKBXPnf5ImegMf5733LT5cp/pLmOWMNAGYXCtA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":397395},"main":"./dist/index.cjs","types":"./dist/index.d.ts","unpkg":"./dist/index.umd.js","module":"./dist/index.esm.js","source":"src/index.ts","exports":{"types":"./dist/index.d.ts","default":"./dist/index.esm.js","require":"./dist/index.cjs"},"gitHead":"c0fbd49c9cba54dbac2b1310934179334459896c","scripts":{"dev":"microbundle watch","build":"microbundle"},"_npmUser":{"name":"canmertinyo","email":"squalcan@gmail.com"},"_npmVersion":"10.8.2","description":"A LIGHTWEIGHT DEPENDENCY INJECTION LIB","directories":{},"_nodeVersion":"20.17.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"ts-node":"^10.9.2","typescript":"^5.6.2","@types/node":"^22.5.4","microbundle":"^0.15.1","reflect-metadata":"^0.2.2"},"_npmOperationalInternal":{"tmp":"tmp/fast-di_1.0.0_1726144784967_0.7041218995240115","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@canmertinyo/fast-di","version":"1.0.1","keywords":["di","depedency injector","di library","decorator di library","lightweight di library for typescript"],"author":{"name":"CANMERTINYO"},"license":"ISC","_id":"@canmertinyo/fast-di@1.0.1","maintainers":[{"name":"canmertinyo","email":"squalcan@gmail.com"}],"dist":{"shasum":"74deb9bf2253f1facd705549c3b7f2fd46827e03","tarball":"https://registry.npmjs.org/@canmertinyo/fast-di/-/fast-di-1.0.1.tgz","fileCount":11,"integrity":"sha512-MtSRhdRJfrNIwqPugyfKaQF0CIEGne7qhEGmA7khY7IsKRvanxVQwdnR7Vb+TQRoZbEEtNQV81PmyeH3QlgmpQ==","signatures":[{"sig":"MEUCIQDrC7bEjNV1cVKS/+DAIQrQf4bl0UQBC+6Dv2VGqGHI6gIgLM5SfhnbZGViZNHOT6opIyCf4Vtgtkc2n4/GD91J7d0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":397395},"main":"./dist/index.cjs","types":"./dist/index.d.ts","unpkg":"./dist/index.umd.js","module":"./dist/index.esm.js","source":"src/index.ts","exports":{"types":"./dist/index.d.ts","default":"./dist/index.esm.js","require":"./dist/index.cjs"},"gitHead":"319fde2dd255b1443ba68050809341beaa2092c1","scripts":{"dev":"microbundle watch","build":"microbundle"},"_npmUser":{"name":"canmertinyo","email":"squalcan@gmail.com"},"_npmVersion":"10.8.2","description":"A LIGHTWEIGHT DEPENDENCY INJECTION LIB","directories":{},"_nodeVersion":"20.17.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"ts-node":"^10.9.2","typescript":"^5.6.2","@types/node":"^22.5.4","microbundle":"^0.15.1","reflect-metadata":"^0.2.2"},"_npmOperationalInternal":{"tmp":"tmp/fast-di_1.0.1_1726149401316_0.5278270719997327","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@canmertinyo/fast-di","version":"1.0.2","keywords":["di","depedency injector","di library","decorator di library","lightweight di library for typescript"],"author":{"name":"CANMERTINYO"},"license":"ISC","_id":"@canmertinyo/fast-di@1.0.2","maintainers":[{"name":"canmertinyo","email":"squalcan@gmail.com"}],"dist":{"shasum":"cb830837c3b34ba205fc9b2fab1f12125e68cc9d","tarball":"https://registry.npmjs.org/@canmertinyo/fast-di/-/fast-di-1.0.2.tgz","fileCount":16,"integrity":"sha512-tLqXjG9Z86FtxHdsJ6rtObpoQfuP32vBmwJZkxpzbJHWudqLdSy9U/0ZjHqEm9frYYJ4DSF5yqO2216pnMrSNg==","signatures":[{"sig":"MEQCIHdu1AN95b0MOVasMyVYMkiqMrqDOc6KqDpk3fwF5DUmAiAHMwJSIqtHzUozlRbhoGcdSHrW6YFCrVzUFQgjaOrmNg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":419135},"main":"./dist/index.cjs","types":"./dist/index.d.ts","unpkg":"./dist/index.umd.js","module":"./dist/index.esm.js","source":"src/index.ts","exports":{"types":"./dist/index.d.ts","default":"./dist/index.esm.js","require":"./dist/index.cjs"},"gitHead":"319fde2dd255b1443ba68050809341beaa2092c1","scripts":{"dev":"microbundle watch","build":"microbundle"},"_npmUser":{"name":"canmertinyo","email":"squalcan@gmail.com"},"_npmVersion":"10.8.2","description":"A LIGHTWEIGHT DEPENDENCY INJECTION LIB","directories":{},"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"devDependencies":{"barrel":"^0.1.0","ts-node":"^10.9.2","typescript":"^5.6.2","@types/node":"^22.5.4","microbundle":"^0.15.1","reflect-metadata":"^0.2.2"},"_npmOperationalInternal":{"tmp":"tmp/fast-di_1.0.2_1726150409112_0.24210805982639205","host":"s3://npm-registry-packages"}},"1.0.3":{"name":"@canmertinyo/fast-di","version":"1.0.3","keywords":["di","depedency injector","di library","decorator di library","lightweight di library for typescript"],"author":{"name":"CANMERTINYO"},"license":"ISC","_id":"@canmertinyo/fast-di@1.0.3","maintainers":[{"name":"canmertinyo","email":"squalcan@gmail.com"}],"dist":{"shasum":"a40d118456f8fe84e95519e1fd7dbec712f19f26","tarball":"https://registry.npmjs.org/@canmertinyo/fast-di/-/fast-di-1.0.3.tgz","fileCount":16,"integrity":"sha512-wVt+5QWaB/CdJht+lB4wFHmq/FHu+MskQ2IvzoB27ImiCCeWa6bBkmTMAmHLKcpLhtfucN/HM5abEX2L8NhzPw==","signatures":[{"sig":"MEYCIQCsBiRI/fpTUO4i7A6NR9Nn6qZwwJd/wFdjrmWD1BiBWQIhAPau6qM6Vk+xWVF/wJ9Zi1gZIQgGmzv78ciwlgQ0uVgf","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":419833},"main":"./dist/index.cjs","types":"./dist/index.d.ts","unpkg":"./dist/index.umd.js","module":"./dist/index.esm.js","source":"src/index.ts","exports":{"types":"./dist/index.d.ts","default":"./dist/index.esm.js","require":"./dist/index.cjs"},"gitHead":"67a03e4390bd6acf2dc75f437af2791476c2820a","scripts":{"dev":"microbundle watch","test":"jest","build":"microbundle"},"_npmUser":{"name":"canmertinyo","email":"squalcan@gmail.com"},"_npmVersion":"10.8.2","description":"A LIGHTWEIGHT DEPENDENCY INJECTION LIB","directories":{},"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","barrel":"^0.1.0","ts-jest":"^29.2.5","ts-node":"^10.9.2","typescript":"^5.6.2","@types/jest":"^29.5.13","@types/node":"^22.5.4","microbundle":"^0.15.1","reflect-metadata":"^0.2.2"},"_npmOperationalInternal":{"tmp":"tmp/fast-di_1.0.3_1726469735929_0.9503399316730219","host":"s3://npm-registry-packages"}},"1.0.4":{"name":"@canmertinyo/fast-di","version":"1.0.4","keywords":["di","depedency injector","di library","decorator di library","lightweight di library for typescript"],"author":{"name":"CANMERTINYO"},"license":"ISC","_id":"@canmertinyo/fast-di@1.0.4","maintainers":[{"name":"canmertinyo","email":"squalcan@gmail.com"}],"dist":{"shasum":"aa411c36b1a5077ef733d113e9f0fd151fd84449","tarball":"https://registry.npmjs.org/@canmertinyo/fast-di/-/fast-di-1.0.4.tgz","fileCount":16,"integrity":"sha512-8FUZ1txEsTom5c5ghyGnQEG5ejbH8lQMmrLmlVGwggVJ/TIBGDcOIPhRYhfNCaXMlTkgfcbcB6aW6u/08FW63g==","signatures":[{"sig":"MEYCIQCCpDH8OFK5gbayKlKGtr/dtCDyRI228VmVj+nJXd+/IgIhAOmPE4geehV4LBQjRkPHRagO60PmcQ4EyS0ODOTymuzn","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":419969},"main":"./dist/index.cjs","types":"./dist/index.d.ts","unpkg":"./dist/index.umd.js","module":"./dist/index.esm.js","source":"src/index.ts","exports":{"types":"./dist/index.d.ts","default":"./dist/index.esm.js","require":"./dist/index.cjs"},"gitHead":"67a03e4390bd6acf2dc75f437af2791476c2820a","scripts":{"dev":"microbundle watch","test":"jest","build":"microbundle"},"_npmUser":{"name":"canmertinyo","email":"squalcan@gmail.com"},"_npmVersion":"10.8.2","description":"A LIGHTWEIGHT DEPENDENCY INJECTION LIB","directories":{},"_nodeVersion":"20.17.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","barrel":"^0.1.0","ts-jest":"^29.2.5","ts-node":"^10.9.2","typescript":"^5.6.2","@types/jest":"^29.5.13","@types/node":"^22.5.4","microbundle":"^0.15.1","reflect-metadata":"^0.2.2"},"_npmOperationalInternal":{"tmp":"tmp/fast-di_1.0.4_1726469798843_0.7514160969927963","host":"s3://npm-registry-packages"}},"1.0.5":{"name":"@canmertinyo/fast-di","version":"1.0.5","source":"src/index.ts","module":"./dist/index.esm.js","unpkg":"./dist/index.umd.js","types":"./dist/index.d.ts","exports":{"types":"./dist/index.d.ts","require":"./dist/index.cjs","default":"./dist/index.esm.js"},"description":"A LIGHTWEIGHT DEPENDENCY INJECTION LIB","main":"./dist/index.cjs","scripts":{"build":"microbundle","dev":"microbundle watch","test":"jest"},"keywords":["di","depedency injector","di library","decorator di library","lightweight di library for typescript"],"author":{"name":"CANMERTINYO"},"license":"ISC","devDependencies":{"@types/jest":"^29.5.13","@types/node":"^22.5.4","barrel":"^0.1.0","jest":"^29.7.0","microbundle":"^0.15.1","reflect-metadata":"^0.2.2","ts-jest":"^29.2.5","ts-node":"^10.9.2","typescript":"^5.6.2"},"_id":"@canmertinyo/fast-di@1.0.5","gitHead":"25cf084998d8779567342097797bf998cd48d6fb","_nodeVersion":"20.17.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-Ot/CappUIDew7L232ox7Lo29Ve8PW/AKGXW4zBYOuxmaTdcEGIg2Zjmy8fJE0Iqspw7mugKGKsva1JhoyVeUAw==","shasum":"23039d831bf3bfacf5cf384b68af39cc02f98425","tarball":"https://registry.npmjs.org/@canmertinyo/fast-di/-/fast-di-1.0.5.tgz","fileCount":21,"unpackedSize":432376,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICjodvhrQNcpEU6fWna3+v/gFZukg79yq/s4mrkpPNNHAiEAyYc3wUSw/7fcitmlVltsjeI1MyliLyUoF0XOUIULh+U="}]},"_npmUser":{"name":"canmertinyo","email":"squalcan@gmail.com"},"directories":{},"maintainers":[{"name":"canmertinyo","email":"squalcan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fast-di_1.0.5_1726482911294_0.4237287573458943"},"_hasShrinkwrap":false}},"time":{"created":"2024-09-12T12:39:44.873Z","modified":"2024-09-16T10:35:11.572Z","1.0.0":"2024-09-12T12:39:45.115Z","1.0.1":"2024-09-12T13:56:41.459Z","1.0.2":"2024-09-12T14:13:29.445Z","1.0.3":"2024-09-16T06:55:36.075Z","1.0.4":"2024-09-16T06:56:38.990Z","1.0.5":"2024-09-16T10:35:11.412Z"},"author":{"name":"CANMERTINYO"},"license":"ISC","keywords":["di","depedency injector","di library","decorator di library","lightweight di library for typescript"],"description":"A LIGHTWEIGHT DEPENDENCY INJECTION LIB","maintainers":[{"name":"canmertinyo","email":"squalcan@gmail.com"}],"readme":"## FastDI a Dependency Injection Library\r\n\r\nInspired by Nest.js structure\r\n\r\n## Installation\r\nhttps://www.npmjs.com/package/@canmertinyo/fast-di\r\n\r\n```bash\r\nnpm i @canmertinyo/fast-di\r\n```\r\n\r\n## Features\r\n\r\n- **Decorator-Based Injection**: Use `@Injectable` to make classes injectable.\r\n- **Lifecycle Management**: Manage service lifecycles as **singleton** or **transient**.\r\n- **Modular Architecture**: Define and load modules dynamically.\r\n- **Dynamic Module Loading**: Load modules on demand.\r\n\r\n\r\nContainer and Injectable\r\nThe Container class is the core of this library, managing instances and dependencies of injectable classes. With @Injectable decorator marks a class as injectable.\r\n## Examples\r\n```typescript\r\nimport {Container, Injectable} from \"@canmertinyo/fast-di\";\r\n\r\n@Injectable()\r\nclass ExampleService {\r\n  public getMessage():string {\r\n    return \"Hello from ExampleService!\";\r\n  }\r\n}\r\n\r\nconst exampleService = Container.get(ExampleService);\r\nconsole.log(exampleService.getMessage());\r\n```\r\n\r\n\r\n# Lifecycle Management\r\nYou can specify the lifecycle of your services using the @Injectable decorator:\r\n\r\nSingleton: A single instance is created and shared throughout the application.\r\n</br>\r\nTransient: A new instance is created every time\r\n\r\n```typescript\r\nimport {Lifecycle, Injectable} from \"@canmertinyo/fast-di\";\r\n\r\n\r\n@Injectable({ lifecycle: Lifecycle.Transient })\r\nclass TransientService {\r\n  public log(message: string):string {\r\n    console.log(`[TransientService] ${message}`);\r\n  }\r\n}\r\n```\r\n\r\nIn this example, TransientService is marked with a transient lifecycle, meaning a new instance will be created each time when it is requested.\r\n\r\n\r\n# Modular Architecture\r\nYou can define and load modules using the @Module decorator. This allows for organizing services and dependencies in a modular way...\r\n\r\n```typescript\r\nimport { Module} from \"@canmertinyo/fast-di\";\r\nimport { ExampleService } from \"./services/example.service\";\r\n\r\n@Module({\r\n  providers: [ExampleService]\r\n})\r\nclass ExampleModule {}\r\n```\r\nNote : We have only the providers at this moment more coming in the way in advance.\r\n\r\nModules are loaded into the container as globally:\r\n```typescript\r\nContainer.loadModule(ExampleModule);\r\n```\r\n\r\n## More Realworld Examples\r\n```typescript\r\nimport { Injectable} from \"@canmertinyo/fast-di\";\r\nimport { DatabaseService } from \"./services/database.service\";\r\nimport { LoggerService } from \"./services/logger.service\";\r\n\r\n@Injectable()\r\nclass UserService {\r\n  constructor(\r\n    private databaseService: DatabaseService,\r\n    private loggerService: LoggerService\r\n  ) {}\r\n\r\n  public getUser(userName:string):string {\r\n    this.loggerService.log(\"Fetching user...\");\r\n    return this.databaseService.query() + \" User: \" + userName;\r\n  }\r\n}\r\n```\r\n\r\n## AuthService example\r\n```typescript\r\nimport {Injectable} from \"@canmertinyo/fast-di\";\r\n\r\n@Injectable()\r\nclass AuthService {\r\n  public authenticate():string {\r\n    return \"Authenticated!\";\r\n  }\r\n}\r\n\r\nimport { Module } from \"./decorators/module\";\r\n\r\n@Module({\r\n  providers: [AuthService]\r\n})\r\nclass AuthModule {}\r\n\r\nContainer.loadModule(AuthModule);\r\nconst authService = Container.get(AuthService);\r\nconsole.log(authService.authenticate());\r\n```\r\nProject Architecture\r\nThe project is structured as follows:\r\n\r\ndecorators: Contains decorators like @Injectable and @Module. </br>\r\nconstants: Defines constants like Lifecycle. </br>\r\ncontainer: Manages dependency injection and lifecycle management. </br>\r\nservices: Contains example services and their implementations. </br>\r\nmodules: Defines application modules and their configurations.\r\n\r\n# Contributing\r\nThe project only for testing&improving myself so i appreciate it. issues or pull request are not going to accept by myside, Thank you for reading :)\r\n","readmeFilename":"README.md"}