{"id":22316942,"url":"https://github.com/wszgrcy/static-injector","last_synced_at":"2025-06-25T03:39:44.045Z","repository":{"id":57370096,"uuid":"388806535","full_name":"wszgrcy/static-injector","owner":"wszgrcy","description":"Angular 依赖注入独立版本;Angular dependency injection standalone version","archived":false,"fork":false,"pushed_at":"2025-06-08T08:01:38.000Z","size":854,"stargazers_count":31,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-08T09:18:05.363Z","etag":null,"topics":["angular","dependency-injection","node","static-dependency-injection","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wszgrcy.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-07-23T13:13:44.000Z","updated_at":"2025-06-08T08:01:42.000Z","dependencies_parsed_at":"2024-06-21T01:05:42.556Z","dependency_job_id":"2f565bd2-1c77-4ceb-a85b-700cff147a2f","html_url":"https://github.com/wszgrcy/static-injector","commit_stats":{"total_commits":52,"total_committers":1,"mean_commits":52.0,"dds":0.0,"last_synced_commit":"9a8970602473af7a4026844cbbbb5f5d899b032e"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/wszgrcy/static-injector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wszgrcy%2Fstatic-injector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wszgrcy%2Fstatic-injector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wszgrcy%2Fstatic-injector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wszgrcy%2Fstatic-injector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wszgrcy","download_url":"https://codeload.github.com/wszgrcy/static-injector/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wszgrcy%2Fstatic-injector/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261800808,"owners_count":23211622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","dependency-injection","node","static-dependency-injection","typescript"],"created_at":"2024-12-03T23:08:19.966Z","updated_at":"2025-06-25T03:39:44.033Z","avatar_url":"https://github.com/wszgrcy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"| [中文](https://github.com/wszgrcy/static-injector/blob/main/readme.zh-Hans.md) | [English](./readme.md) |\n| ------------------------------------------------------------------------------ | ---------------------- |\n\n# Introduction\n\n- Angular dependency injection standalone version\n- The usage method is completely consistent with Angular's dependency injection\n- No transformer required\n- 0 dependencies\n- Remove Decorator\n  \u003e `@Injectable()`=\u003e`static injectOptions={}` \u003e `@Inject() xx`=\u003e`xx=inject()` \u003e `@Optional()`=\u003e`xx=inject(token,{optional:true})`\n- `JS`/`TS` Support\n\n# Source\n\n- Angular 20.0.2\n\n# Usage\n\n- Create a first level dependency injector with `createRootInjector`\n\n```ts\nimport {\n  Injector,\n  inject,\n  // root\n  createRootInjector,\n  // child\n  createInjector,\n} from 'static-injector';\n\nclass Main {\n  child = inject(Child);\n}\nclass Child {\n  output() {\n    return 'hello world';\n  }\n}\nlet injector = createRootInjector({ providers: [Main, Child] });\nconst instance = injector.get(Main);\nconsole.log(instance.child.output());\n```\n\n# No Decorator\n\n- The original use of `@Injectable()` to pass parameters has been changed to `static injectOptions={}`. If there are no parameters, there is no need to set them\n- Originally, `@Optional`, `@SkipSelf`, `@Self`, please use the second pass parameter of `inject` instead\n\n# reactivity\n\n- support `signal`,`effect`,`resource`,`linkedSignal`,`computed`\n\n# Test\n\n- Partially conducted unit testing to ensure that most functions are functioning properly\n- Because most of the code itself is extracted from Angular, stability is definitely guaranteed\n\n# Sync\n\n- Currently, the synchronization logic has been refactored and modified using `@code-recycle/cli` to ensure consistency with the official version of `angular`\n\n# Examples\n\n- [https://github.com/wszgrcy/static-injector/tree/main/test/import](https://github.com/wszgrcy/static-injector/tree/main/test/import)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwszgrcy%2Fstatic-injector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwszgrcy%2Fstatic-injector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwszgrcy%2Fstatic-injector/lists"}