{"id":16641401,"url":"https://github.com/cmstead/dject-core","last_synced_at":"2026-04-29T03:02:59.091Z","repository":{"id":30496854,"uuid":"125133430","full_name":"cmstead/dject-core","owner":"cmstead","description":"The core DI container system for the Dject library","archived":false,"fork":false,"pushed_at":"2023-04-23T19:01:33.000Z","size":30,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-30T11:20:43.421Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/cmstead.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}},"created_at":"2018-03-14T00:45:15.000Z","updated_at":"2019-05-24T22:11:23.000Z","dependencies_parsed_at":"2025-01-18T15:24:05.156Z","dependency_job_id":"e3ac9d17-dc32-4f38-b489-fc68ece73534","html_url":"https://github.com/cmstead/dject-core","commit_stats":{"total_commits":17,"total_committers":1,"mean_commits":17.0,"dds":0.0,"last_synced_commit":"98572b47f571c5552a29241159da100ab9d59f79"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/cmstead/dject-core","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmstead%2Fdject-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmstead%2Fdject-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmstead%2Fdject-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmstead%2Fdject-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmstead","download_url":"https://codeload.github.com/cmstead/dject-core/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmstead%2Fdject-core/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32408447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T02:37:21.628Z","status":"ssl_error","status_checked_at":"2026-04-29T02:36:50.947Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-10-12T07:46:26.304Z","updated_at":"2026-04-29T03:02:59.075Z","avatar_url":"https://github.com/cmstead.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Dject Core\n==========\n\nDject Core is the core dependency injection system for the Dject dependency injection container. This package is not intended to be used as a standalone DI container.  Instead this is built to support the internal needs for the Dject system, allowing the rest of Dject to be built with good separation of concerns.\n\nFor more information on the Dject library, please see the following package:\n\nhttps://www.npmjs.com/package/dject\n\n## API ##\n\n### New container creation ###\n\nTo create a new container, simply call the DjectCoreFactory function provided by the JS module:\n\n```javascript\n// In node:\nconst container = require('dject-core')();\n\n// In the browser:\nconst container = window.djectCoreFactory();\n```\n\n### Registering a New Module ###\n\nModule registration requires a name, a function which constructs the module and an array of dependency names (as strings).  You can only register a module factory to a name once. Any subsequent registrations will throw an error. Module registration is chainable.\n\n```javascript\ncontainer\n    .register('myDependency', () =\u003e { foo: 'bar' }, [])\n    .register('anotherModule', (myDependency) =\u003e { baz: myDependency }, ['myDependency']);\n\ncontainer\n    .register('myDependency', () =\u003e { foo: 'bar' }, [])\n    .register('myDependency', () =\u003e { foo: 'bar' }, []); // Throws an error\n```\n\n### Building Modules ###\n\nBuilding a module can be done simply by calling the build method with the module name.  This will construct all dependencies and the top-level module.  Considering the registration example above, build will result in the following:\n\n```javascript\nconst myModuleInstance = container.build('anotherModule');\n\n// produces the following:\n\n// {\n//     baz: {\n//         foo: 'bar'\n//     }\n// }\n```\n\n### Overriding Modules ###\n\nOverriding a module is necessary for situations where a module has been registered, but you need to inject something different into the dependency tree.  This is most common in testing scenarios.\n\n```javascript\ncontainer\n    .register('myDependency', () =\u003e { foo: 'bar' }, [])\n    .override('myDependency', () =\u003e { foo: 'bar' }, []); // Doesn't throw an error\n```\n\n## Version History ##\n\n**1.0.0**\n\nInitial release","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmstead%2Fdject-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcmstead%2Fdject-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmstead%2Fdject-core/lists"}