@nexus-ioc/core 0.4.2 → 0.6.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.
- package/README.md +20 -9
- package/dist/cjs/browser.js.map +1 -0
- package/dist/cjs/core/graph/analyze-module.js.map +1 -0
- package/dist/cjs/core/graph/analyze-provider.js.map +1 -0
- package/dist/cjs/core/graph/helpers/index.js.map +1 -0
- package/dist/{core → cjs/core}/graph/module-graph.js +28 -21
- package/dist/cjs/core/graph/module-graph.js.map +1 -0
- package/dist/cjs/core/graph/providers/analyze-class-provider.js.map +1 -0
- package/dist/cjs/core/graph/providers/analyze-factory-provider.js.map +1 -0
- package/dist/cjs/core/graph/providers/analyze-function-provider.js.map +1 -0
- package/dist/cjs/core/graph/providers/analyze-value-provider.js.map +1 -0
- package/dist/cjs/core/graph/providers/provider-factory.js.map +1 -0
- package/dist/cjs/core/modules/container.js +182 -0
- package/dist/cjs/core/modules/container.js.map +1 -0
- package/dist/cjs/core/modules/module-container-factory.js.map +1 -0
- package/dist/{core → cjs/core}/modules/module-container.js +0 -1
- package/dist/cjs/core/modules/module-container.js.map +1 -0
- package/dist/cjs/core/modules/module-token-factory.js.map +1 -0
- package/dist/cjs/core/modules/modules-container.js.map +1 -0
- package/dist/{core → cjs/core}/nexus-applications.browser.js +19 -2
- package/dist/cjs/core/nexus-applications.browser.js.map +1 -0
- package/dist/cjs/core/nexus-applications.js +204 -0
- package/dist/cjs/core/nexus-applications.js.map +1 -0
- package/dist/{core → cjs/core}/nexus-applications.server.js +19 -2
- package/dist/cjs/core/nexus-applications.server.js.map +1 -0
- package/dist/{core → cjs/core}/resolver/providers-container.js +1 -1
- package/dist/cjs/core/resolver/providers-container.js.map +1 -0
- package/dist/{core → cjs/core}/resolver/resolver.js +53 -14
- package/dist/cjs/core/resolver/resolver.js.map +1 -0
- package/dist/{decorators → cjs/decorators}/global.js +1 -1
- package/dist/cjs/decorators/global.js.map +1 -0
- package/dist/{decorators → cjs/decorators}/inject.js +39 -0
- package/dist/cjs/decorators/inject.js.map +1 -0
- package/dist/cjs/decorators/injectable.js +46 -0
- package/dist/cjs/decorators/injectable.js.map +1 -0
- package/dist/cjs/decorators/nsModule.js +57 -0
- package/dist/cjs/decorators/nsModule.js.map +1 -0
- package/dist/cjs/decorators/optional.js +60 -0
- package/dist/cjs/decorators/optional.js.map +1 -0
- package/dist/{index.js → cjs/index.js} +13 -6
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/interfaces/abstract.interface.js.map +1 -0
- package/dist/cjs/interfaces/constants.js.map +1 -0
- package/dist/cjs/interfaces/dynamic-module.interface.js.map +1 -0
- package/dist/{interfaces → cjs/interfaces}/index.js +6 -6
- package/dist/cjs/interfaces/index.js.map +1 -0
- package/dist/cjs/interfaces/injectable.interface.js.map +1 -0
- package/dist/cjs/interfaces/injection-token.interface.js.map +1 -0
- package/dist/cjs/interfaces/module-metadata.interface.js.map +1 -0
- package/dist/cjs/interfaces/module-types.interface.js.map +1 -0
- package/dist/cjs/interfaces/modules/container.interface.js.map +1 -0
- package/dist/{interfaces → cjs/interfaces}/modules/index.js +1 -1
- package/dist/cjs/interfaces/modules/index.js.map +1 -0
- package/dist/cjs/interfaces/modules/module-container-factory.interface.js.map +1 -0
- package/dist/cjs/interfaces/modules/module-container.interface.js.map +1 -0
- package/dist/cjs/interfaces/modules/module-graph.interface.js.map +1 -0
- package/dist/cjs/interfaces/modules/module-token-factory.interface.js.map +1 -0
- package/dist/cjs/interfaces/modules/modules-container.interface.js.map +1 -0
- package/dist/cjs/interfaces/modules/provider-token-factory.interface.js.map +1 -0
- package/dist/cjs/interfaces/nexus-application.interface.js.map +1 -0
- package/dist/cjs/interfaces/on-module-init.interface.js.map +1 -0
- package/dist/{interfaces → cjs/interfaces}/plugins/index.js +1 -1
- package/dist/cjs/interfaces/plugins/index.js.map +1 -0
- package/dist/cjs/interfaces/plugins/module-plugin.interface.js.map +1 -0
- package/dist/cjs/interfaces/plugins/scanner-plugin.interface.js.map +1 -0
- package/dist/cjs/interfaces/scope.interface.js +59 -0
- package/dist/cjs/interfaces/scope.interface.js.map +1 -0
- package/dist/cjs/interfaces/type.interface.js.map +1 -0
- package/dist/cjs/interfaces/utils/hash-utils.interface.js.map +1 -0
- package/dist/cjs/interfaces/utils/index.js.map +1 -0
- package/dist/{interfaces → cjs/interfaces}/validate-module-keys.js +1 -1
- package/dist/cjs/interfaces/validate-module-keys.js.map +1 -0
- package/dist/cjs/server.js.map +1 -0
- package/dist/cjs/utils/hash-utils.browser.js.map +1 -0
- package/dist/cjs/utils/hash-utils.js +25 -0
- package/dist/cjs/utils/hash-utils.js.map +1 -0
- package/dist/cjs/utils/hash-utils.server.js.map +1 -0
- package/dist/{utils → cjs/utils}/helpers.js +2 -1
- package/dist/cjs/utils/helpers.js.map +1 -0
- package/dist/{utils → cjs/utils}/shared.utils.js +15 -16
- package/dist/cjs/utils/shared.utils.js.map +1 -0
- package/dist/esm/browser.js +2 -0
- package/dist/esm/browser.js.map +1 -0
- package/dist/esm/core/graph/analyze-module.js +78 -0
- package/dist/esm/core/graph/analyze-module.js.map +1 -0
- package/dist/esm/core/graph/analyze-provider.js +53 -0
- package/dist/esm/core/graph/analyze-provider.js.map +1 -0
- package/dist/esm/core/graph/helpers/index.js +17 -0
- package/dist/esm/core/graph/helpers/index.js.map +1 -0
- package/dist/esm/core/graph/module-graph.js +402 -0
- package/dist/esm/core/graph/module-graph.js.map +1 -0
- package/dist/esm/core/graph/providers/analyze-class-provider.js +13 -0
- package/dist/esm/core/graph/providers/analyze-class-provider.js.map +1 -0
- package/dist/esm/core/graph/providers/analyze-factory-provider.js +13 -0
- package/dist/esm/core/graph/providers/analyze-factory-provider.js.map +1 -0
- package/dist/esm/core/graph/providers/analyze-function-provider.js +7 -0
- package/dist/esm/core/graph/providers/analyze-function-provider.js.map +1 -0
- package/dist/esm/core/graph/providers/analyze-value-provider.js +13 -0
- package/dist/esm/core/graph/providers/analyze-value-provider.js.map +1 -0
- package/dist/esm/core/graph/providers/provider-factory.js +21 -0
- package/dist/esm/core/graph/providers/provider-factory.js.map +1 -0
- package/dist/esm/core/modules/container.js +178 -0
- package/dist/esm/core/modules/container.js.map +1 -0
- package/dist/esm/core/modules/module-container-factory.js +21 -0
- package/dist/esm/core/modules/module-container-factory.js.map +1 -0
- package/dist/esm/core/modules/module-container.js +58 -0
- package/dist/esm/core/modules/module-container.js.map +1 -0
- package/dist/esm/core/modules/module-token-factory.js +43 -0
- package/dist/esm/core/modules/module-token-factory.js.map +1 -0
- package/dist/esm/core/modules/modules-container.js +39 -0
- package/dist/esm/core/modules/modules-container.js.map +1 -0
- package/dist/esm/core/nexus-applications.browser.js +49 -0
- package/dist/esm/core/nexus-applications.browser.js.map +1 -0
- package/dist/esm/core/nexus-applications.js +200 -0
- package/dist/esm/core/nexus-applications.js.map +1 -0
- package/dist/esm/core/nexus-applications.server.js +49 -0
- package/dist/esm/core/nexus-applications.server.js.map +1 -0
- package/dist/esm/core/resolver/providers-container.js +4 -0
- package/dist/esm/core/resolver/providers-container.js.map +1 -0
- package/dist/esm/core/resolver/resolver.js +161 -0
- package/dist/esm/core/resolver/resolver.js.map +1 -0
- package/dist/esm/decorators/global.js +9 -0
- package/dist/esm/decorators/global.js.map +1 -0
- package/dist/esm/decorators/inject.js +63 -0
- package/dist/esm/decorators/inject.js.map +1 -0
- package/dist/esm/decorators/injectable.js +43 -0
- package/dist/esm/decorators/injectable.js.map +1 -0
- package/dist/esm/decorators/nsModule.js +54 -0
- package/dist/esm/decorators/nsModule.js.map +1 -0
- package/dist/esm/decorators/optional.js +57 -0
- package/dist/esm/decorators/optional.js.map +1 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/interfaces/abstract.interface.js +2 -0
- package/dist/esm/interfaces/abstract.interface.js.map +1 -0
- package/dist/esm/interfaces/constants.js +13 -0
- package/dist/esm/interfaces/constants.js.map +1 -0
- package/dist/esm/interfaces/dynamic-module.interface.js +2 -0
- package/dist/esm/interfaces/dynamic-module.interface.js.map +1 -0
- package/dist/esm/interfaces/index.js +16 -0
- package/dist/esm/interfaces/index.js.map +1 -0
- package/dist/esm/interfaces/injectable.interface.js +2 -0
- package/dist/esm/interfaces/injectable.interface.js.map +1 -0
- package/dist/esm/interfaces/injection-token.interface.js +2 -0
- package/dist/esm/interfaces/injection-token.interface.js.map +1 -0
- package/dist/esm/interfaces/module-metadata.interface.js +2 -0
- package/dist/esm/interfaces/module-metadata.interface.js.map +1 -0
- package/dist/esm/interfaces/module-types.interface.js +2 -0
- package/dist/esm/interfaces/module-types.interface.js.map +1 -0
- package/dist/esm/interfaces/modules/container.interface.js +2 -0
- package/dist/esm/interfaces/modules/container.interface.js.map +1 -0
- package/dist/esm/interfaces/modules/index.js +8 -0
- package/dist/esm/interfaces/modules/index.js.map +1 -0
- package/dist/esm/interfaces/modules/module-container-factory.interface.js +2 -0
- package/dist/esm/interfaces/modules/module-container-factory.interface.js.map +1 -0
- package/dist/esm/interfaces/modules/module-container.interface.js +2 -0
- package/dist/esm/interfaces/modules/module-container.interface.js.map +1 -0
- package/dist/esm/interfaces/modules/module-graph.interface.js +13 -0
- package/dist/esm/interfaces/modules/module-graph.interface.js.map +1 -0
- package/dist/esm/interfaces/modules/module-token-factory.interface.js +2 -0
- package/dist/esm/interfaces/modules/module-token-factory.interface.js.map +1 -0
- package/dist/esm/interfaces/modules/modules-container.interface.js +2 -0
- package/dist/esm/interfaces/modules/modules-container.interface.js.map +1 -0
- package/dist/esm/interfaces/modules/provider-token-factory.interface.js +2 -0
- package/dist/esm/interfaces/modules/provider-token-factory.interface.js.map +1 -0
- package/dist/esm/interfaces/nexus-application.interface.js +2 -0
- package/dist/esm/interfaces/nexus-application.interface.js.map +1 -0
- package/dist/esm/interfaces/on-module-init.interface.js +2 -0
- package/dist/esm/interfaces/on-module-init.interface.js.map +1 -0
- package/dist/esm/interfaces/plugins/index.js +3 -0
- package/dist/esm/interfaces/plugins/index.js.map +1 -0
- package/dist/esm/interfaces/plugins/module-plugin.interface.js +2 -0
- package/dist/esm/interfaces/plugins/module-plugin.interface.js.map +1 -0
- package/dist/esm/interfaces/plugins/scanner-plugin.interface.js +2 -0
- package/dist/esm/interfaces/plugins/scanner-plugin.interface.js.map +1 -0
- package/dist/esm/interfaces/scope.interface.js +56 -0
- package/dist/esm/interfaces/scope.interface.js.map +1 -0
- package/dist/esm/interfaces/type.interface.js +2 -0
- package/dist/esm/interfaces/type.interface.js.map +1 -0
- package/dist/esm/interfaces/utils/hash-utils.interface.js +2 -0
- package/dist/esm/interfaces/utils/hash-utils.interface.js.map +1 -0
- package/dist/esm/interfaces/utils/index.js +2 -0
- package/dist/esm/interfaces/utils/index.js.map +1 -0
- package/dist/esm/interfaces/validate-module-keys.js +21 -0
- package/dist/esm/interfaces/validate-module-keys.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/server.js +2 -0
- package/dist/esm/server.js.map +1 -0
- package/dist/esm/utils/hash-utils.browser.js +20 -0
- package/dist/esm/utils/hash-utils.browser.js.map +1 -0
- package/dist/esm/utils/hash-utils.js +21 -0
- package/dist/esm/utils/hash-utils.js.map +1 -0
- package/dist/esm/utils/hash-utils.server.js +17 -0
- package/dist/esm/utils/hash-utils.server.js.map +1 -0
- package/dist/esm/utils/helpers.js +63 -0
- package/dist/esm/utils/helpers.js.map +1 -0
- package/dist/esm/utils/shared.utils.js +49 -0
- package/dist/esm/utils/shared.utils.js.map +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/{core → types/core}/graph/analyze-module.d.ts +4 -4
- package/dist/{core → types/core}/graph/analyze-provider.d.ts +4 -4
- package/dist/{core → types/core}/graph/module-graph.d.ts +1 -1
- package/dist/{core → types/core}/graph/providers/analyze-class-provider.d.ts +2 -2
- package/dist/{core → types/core}/graph/providers/analyze-factory-provider.d.ts +2 -2
- package/dist/{core → types/core}/graph/providers/analyze-value-provider.d.ts +1 -1
- package/dist/{core → types/core}/graph/providers/provider-factory.d.ts +1 -1
- package/dist/types/core/modules/container.d.ts +154 -0
- package/dist/{core → types/core}/modules/module-container.d.ts +1 -1
- package/dist/{core → types/core}/nexus-applications.browser.d.ts +9 -1
- package/dist/types/core/nexus-applications.d.ts +160 -0
- package/dist/{core → types/core}/nexus-applications.server.d.ts +9 -1
- package/dist/types/decorators/inject.d.ts +42 -0
- package/dist/types/decorators/injectable.d.ts +37 -0
- package/dist/types/decorators/nsModule.d.ts +44 -0
- package/dist/types/decorators/optional.d.ts +42 -0
- package/dist/{index.d.ts → types/index.d.ts} +6 -3
- package/dist/types/interfaces/module-types.interface.d.ts +158 -0
- package/dist/types/interfaces/modules/container.interface.d.ts +8 -0
- package/dist/types/interfaces/modules/module-container.interface.d.ts +1 -0
- package/dist/{interfaces → types/interfaces}/modules/module-graph.interface.d.ts +3 -23
- package/dist/{interfaces → types/interfaces}/nexus-application.interface.d.ts +2 -0
- package/dist/types/interfaces/on-module-init.interface.d.ts +51 -0
- package/dist/types/interfaces/scope.interface.d.ts +54 -0
- package/dist/types/interfaces/utils/hash-utils.interface.d.ts +1 -0
- package/dist/{interfaces → types/interfaces}/validate-module-keys.d.ts +1 -1
- package/dist/types/utils/hash-utils.d.ts +7 -0
- package/package.json +83 -60
- package/dist/browser.js.map +0 -1
- package/dist/core/graph/analyze-module.js.map +0 -1
- package/dist/core/graph/analyze-provider.js.map +0 -1
- package/dist/core/graph/helpers/index.js.map +0 -1
- package/dist/core/graph/module-graph.js.map +0 -1
- package/dist/core/graph/providers/analyze-class-provider.js.map +0 -1
- package/dist/core/graph/providers/analyze-factory-provider.js.map +0 -1
- package/dist/core/graph/providers/analyze-function-provider.js.map +0 -1
- package/dist/core/graph/providers/analyze-value-provider.js.map +0 -1
- package/dist/core/graph/providers/provider-factory.js.map +0 -1
- package/dist/core/modules/container.d.ts +0 -15
- package/dist/core/modules/container.js +0 -40
- package/dist/core/modules/container.js.map +0 -1
- package/dist/core/modules/module-container-factory.js.map +0 -1
- package/dist/core/modules/module-container.js.map +0 -1
- package/dist/core/modules/module-token-factory.js.map +0 -1
- package/dist/core/modules/modules-container.js.map +0 -1
- package/dist/core/nexus-applications.browser.js.map +0 -1
- package/dist/core/nexus-applications.server.js.map +0 -1
- package/dist/core/resolver/providers-container.js.map +0 -1
- package/dist/core/resolver/resolver.js.map +0 -1
- package/dist/decorators/global.js.map +0 -1
- package/dist/decorators/inject.d.ts +0 -3
- package/dist/decorators/inject.js.map +0 -1
- package/dist/decorators/injectable.d.ts +0 -3
- package/dist/decorators/injectable.js +0 -12
- package/dist/decorators/injectable.js.map +0 -1
- package/dist/decorators/nsModule.d.ts +0 -3
- package/dist/decorators/nsModule.js +0 -16
- package/dist/decorators/nsModule.js.map +0 -1
- package/dist/decorators/optional.d.ts +0 -2
- package/dist/decorators/optional.js +0 -20
- package/dist/decorators/optional.js.map +0 -1
- package/dist/errors/container-not-compiled.error.d.ts +0 -3
- package/dist/errors/container-not-compiled.error.js +0 -12
- package/dist/errors/container-not-compiled.error.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/interfaces/abstract.interface.js.map +0 -1
- package/dist/interfaces/constants.js.map +0 -1
- package/dist/interfaces/dynamic-module.interface.js.map +0 -1
- package/dist/interfaces/index.js.map +0 -1
- package/dist/interfaces/injectable.interface.js.map +0 -1
- package/dist/interfaces/injection-token.interface.js.map +0 -1
- package/dist/interfaces/module-metadata.interface.js.map +0 -1
- package/dist/interfaces/module-types.interface.d.ts +0 -20
- package/dist/interfaces/module-types.interface.js.map +0 -1
- package/dist/interfaces/modules/container.interface.d.ts +0 -16
- package/dist/interfaces/modules/container.interface.js.map +0 -1
- package/dist/interfaces/modules/index.js.map +0 -1
- package/dist/interfaces/modules/module-container-factory.interface.js.map +0 -1
- package/dist/interfaces/modules/module-container.interface.d.ts +0 -13
- package/dist/interfaces/modules/module-container.interface.js.map +0 -1
- package/dist/interfaces/modules/module-graph.interface.js.map +0 -1
- package/dist/interfaces/modules/module-token-factory.interface.js.map +0 -1
- package/dist/interfaces/modules/modules-container.interface.js.map +0 -1
- package/dist/interfaces/modules/provider-token-factory.interface.js.map +0 -1
- package/dist/interfaces/nexus-application.interface.js.map +0 -1
- package/dist/interfaces/on-module-init.interface.d.ts +0 -3
- package/dist/interfaces/on-module-init.interface.js.map +0 -1
- package/dist/interfaces/plugins/index.js.map +0 -1
- package/dist/interfaces/plugins/module-plugin.interface.js.map +0 -1
- package/dist/interfaces/plugins/scanner-plugin.interface.js.map +0 -1
- package/dist/interfaces/scope.interface.d.ts +0 -4
- package/dist/interfaces/scope.interface.js +0 -9
- package/dist/interfaces/scope.interface.js.map +0 -1
- package/dist/interfaces/type.interface.js.map +0 -1
- package/dist/interfaces/utils/hash-utils.interface.d.ts +0 -5
- package/dist/interfaces/utils/hash-utils.interface.js.map +0 -1
- package/dist/interfaces/utils/index.js.map +0 -1
- package/dist/interfaces/validate-module-keys.js.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/utils/hash-utils.browser.js.map +0 -1
- package/dist/utils/hash-utils.server.js.map +0 -1
- package/dist/utils/helpers.js.map +0 -1
- package/dist/utils/random-string-generator.util.d.ts +0 -1
- package/dist/utils/random-string-generator.util.js +0 -7
- package/dist/utils/random-string-generator.util.js.map +0 -1
- package/dist/utils/shared.utils.js.map +0 -1
- package/dist/{browser.js → cjs/browser.js} +0 -0
- package/dist/{core → cjs/core}/graph/analyze-module.js +0 -0
- package/dist/{core → cjs/core}/graph/analyze-provider.js +0 -0
- package/dist/{core → cjs/core}/graph/helpers/index.js +0 -0
- package/dist/{core → cjs/core}/graph/providers/analyze-class-provider.js +0 -0
- package/dist/{core → cjs/core}/graph/providers/analyze-factory-provider.js +0 -0
- package/dist/{core → cjs/core}/graph/providers/analyze-function-provider.js +0 -0
- package/dist/{core → cjs/core}/graph/providers/analyze-value-provider.js +0 -0
- package/dist/{core → cjs/core}/graph/providers/provider-factory.js +0 -0
- package/dist/{core → cjs/core}/modules/module-container-factory.js +0 -0
- package/dist/{core → cjs/core}/modules/module-token-factory.js +0 -0
- package/dist/{core → cjs/core}/modules/modules-container.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/abstract.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/constants.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/dynamic-module.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/injectable.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/injection-token.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/module-metadata.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/module-types.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/modules/container.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/modules/module-container-factory.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/modules/module-container.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/modules/module-graph.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/modules/module-token-factory.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/modules/modules-container.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/modules/provider-token-factory.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/nexus-application.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/on-module-init.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/plugins/module-plugin.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/plugins/scanner-plugin.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/type.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/utils/hash-utils.interface.js +0 -0
- package/dist/{interfaces → cjs/interfaces}/utils/index.js +0 -0
- package/dist/{server.js → cjs/server.js} +0 -0
- package/dist/{utils → cjs/utils}/hash-utils.browser.js +0 -0
- package/dist/{utils → cjs/utils}/hash-utils.server.js +0 -0
- package/dist/{browser.d.ts → types/browser.d.ts} +0 -0
- package/dist/{core → types/core}/graph/helpers/index.d.ts +0 -0
- package/dist/{core → types/core}/graph/providers/analyze-function-provider.d.ts +0 -0
- package/dist/{core → types/core}/modules/module-container-factory.d.ts +0 -0
- package/dist/{core → types/core}/modules/module-token-factory.d.ts +0 -0
- package/dist/{core → types/core}/modules/modules-container.d.ts +0 -0
- package/dist/{core → types/core}/resolver/providers-container.d.ts +0 -0
- package/dist/{core → types/core}/resolver/resolver.d.ts +0 -0
- package/dist/{decorators → types/decorators}/global.d.ts +0 -0
- package/dist/{interfaces → types/interfaces}/abstract.interface.d.ts +0 -0
- package/dist/{interfaces → types/interfaces}/constants.d.ts +0 -0
- package/dist/{interfaces → types/interfaces}/dynamic-module.interface.d.ts +0 -0
- package/dist/{interfaces → types/interfaces}/index.d.ts +6 -6
- package/dist/{interfaces → types/interfaces}/injectable.interface.d.ts +0 -0
- package/dist/{interfaces → types/interfaces}/injection-token.interface.d.ts +0 -0
- package/dist/{interfaces → types/interfaces}/module-metadata.interface.d.ts +0 -0
- package/dist/{interfaces → types/interfaces}/modules/index.d.ts +1 -1
- package/dist/{interfaces → types/interfaces}/modules/module-container-factory.interface.d.ts +0 -0
- package/dist/{interfaces → types/interfaces}/modules/module-token-factory.interface.d.ts +0 -0
- package/dist/{interfaces → types/interfaces}/modules/modules-container.interface.d.ts +0 -0
- package/dist/{interfaces → types/interfaces}/modules/provider-token-factory.interface.d.ts +0 -0
- package/dist/{interfaces → types/interfaces}/plugins/index.d.ts +1 -1
- /package/dist/{interfaces → types/interfaces}/plugins/module-plugin.interface.d.ts +0 -0
- /package/dist/{interfaces → types/interfaces}/plugins/scanner-plugin.interface.d.ts +0 -0
- /package/dist/{interfaces → types/interfaces}/type.interface.d.ts +0 -0
- /package/dist/{interfaces → types/interfaces}/utils/index.d.ts +0 -0
- /package/dist/{server.d.ts → types/server.d.ts} +0 -0
- /package/dist/{utils → types/utils}/hash-utils.browser.d.ts +0 -0
- /package/dist/{utils → types/utils}/hash-utils.server.d.ts +0 -0
- /package/dist/{utils → types/utils}/helpers.d.ts +0 -0
- /package/dist/{utils → types/utils}/shared.utils.d.ts +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import type { InjectableOptions } from "../interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Marks a class as injectable, making it available for dependency injection.
|
|
5
|
+
*
|
|
6
|
+
* This decorator must be applied to any class that you want to use as a provider
|
|
7
|
+
* in the IoC container. It configures the scope and other options for the provider.
|
|
8
|
+
*
|
|
9
|
+
* @param options - Configuration options for the injectable
|
|
10
|
+
* @param options.scope - The lifecycle scope of the provider:
|
|
11
|
+
* - `Scope.Singleton` (default): One instance shared across the entire application
|
|
12
|
+
* - `Scope.Request`: New instance for each container.get() call
|
|
13
|
+
* - `Scope.Transient`: New instance every time, even within the same dependency tree
|
|
14
|
+
* @returns A class decorator
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Singleton scope (default)
|
|
19
|
+
* @Injectable()
|
|
20
|
+
* class UserService {
|
|
21
|
+
* constructor(private db: Database) {}
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* // Request scope
|
|
25
|
+
* @Injectable({ scope: Scope.Request })
|
|
26
|
+
* class RequestContext {
|
|
27
|
+
* requestId = Math.random();
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
30
|
+
* // Transient scope
|
|
31
|
+
* @Injectable({ scope: Scope.Transient })
|
|
32
|
+
* class Logger {
|
|
33
|
+
* timestamp = Date.now();
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function Injectable(options?: InjectableOptions): ClassDecorator;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import type { ModuleMetadata } from "../interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Defines a module in the application.
|
|
5
|
+
*
|
|
6
|
+
* A module is a class annotated with @NsModule() decorator that organizes
|
|
7
|
+
* the application structure. Modules can:
|
|
8
|
+
* - Declare providers that will be instantiated by the container
|
|
9
|
+
* - Import other modules to use their exported providers
|
|
10
|
+
* - Export providers to make them available to other modules
|
|
11
|
+
*
|
|
12
|
+
* @param metadata - Module configuration
|
|
13
|
+
* @param metadata.imports - Modules whose exported providers should be available in this module
|
|
14
|
+
* @param metadata.providers - Providers that belong to this module
|
|
15
|
+
* @param metadata.exports - Providers or modules to export (make available to importing modules)
|
|
16
|
+
* @returns A class decorator
|
|
17
|
+
* @throws {Error} If invalid metadata keys are provided
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Basic module
|
|
22
|
+
* @NsModule({
|
|
23
|
+
* providers: [UserService, UserRepository],
|
|
24
|
+
* exports: [UserService]
|
|
25
|
+
* })
|
|
26
|
+
* class UserModule {}
|
|
27
|
+
*
|
|
28
|
+
* // Module with imports
|
|
29
|
+
* @NsModule({
|
|
30
|
+
* imports: [DatabaseModule, LoggerModule],
|
|
31
|
+
* providers: [ProductService],
|
|
32
|
+
* exports: [ProductService]
|
|
33
|
+
* })
|
|
34
|
+
* class ProductModule {}
|
|
35
|
+
*
|
|
36
|
+
* // Root module
|
|
37
|
+
* @NsModule({
|
|
38
|
+
* imports: [UserModule, ProductModule],
|
|
39
|
+
* providers: [AppService]
|
|
40
|
+
* })
|
|
41
|
+
* class AppModule {}
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function NsModule(metadata: ModuleMetadata): ClassDecorator;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
/**
|
|
3
|
+
* Marks a dependency as optional.
|
|
4
|
+
*
|
|
5
|
+
* When a dependency is marked as optional, the container will not throw an error
|
|
6
|
+
* if the provider is not found. Instead, it will inject `undefined`.
|
|
7
|
+
*
|
|
8
|
+
* This is useful for:
|
|
9
|
+
* - Optional features that may not be available in all configurations
|
|
10
|
+
* - Graceful degradation when certain services are not registered
|
|
11
|
+
* - Testing scenarios where you want to omit certain dependencies
|
|
12
|
+
*
|
|
13
|
+
* @returns A decorator that can be applied to constructor parameters or properties
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Optional constructor parameter
|
|
18
|
+
* @Injectable()
|
|
19
|
+
* class UserService {
|
|
20
|
+
* constructor(
|
|
21
|
+
* private db: Database,
|
|
22
|
+
* @Optional() private cache?: CacheService
|
|
23
|
+
* ) {
|
|
24
|
+
* // cache will be undefined if CacheService is not registered
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* // Optional property injection
|
|
29
|
+
* @Injectable()
|
|
30
|
+
* class ProductService {
|
|
31
|
+
* @Optional()
|
|
32
|
+
* @Inject('ANALYTICS')
|
|
33
|
+
* private analytics?: AnalyticsService;
|
|
34
|
+
*
|
|
35
|
+
* trackEvent(event: string) {
|
|
36
|
+
* // Only track if analytics service is available
|
|
37
|
+
* this.analytics?.track(event);
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function Optional(): PropertyDecorator & ParameterDecorator;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
1
|
+
export { ContainerNotCompiledError } from "@nexus-ioc/shared";
|
|
2
|
+
export { Container } from "./core/modules/container";
|
|
3
|
+
export { NexusApplications } from "./core/nexus-applications";
|
|
4
|
+
export { Global } from "./decorators/global";
|
|
3
5
|
export { Inject } from "./decorators/inject";
|
|
4
6
|
export { Injectable } from "./decorators/injectable";
|
|
5
|
-
export {
|
|
7
|
+
export { NsModule } from "./decorators/nsModule";
|
|
6
8
|
export { Optional } from "./decorators/optional";
|
|
9
|
+
export * from "./interfaces";
|
|
7
10
|
export * from "./utils/helpers";
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { InjectionToken } from "./injection-token.interface";
|
|
2
|
+
import type { Scope } from "./scope.interface";
|
|
3
|
+
import type { Type } from "./type.interface";
|
|
4
|
+
/**
|
|
5
|
+
* Represents a module class.
|
|
6
|
+
*/
|
|
7
|
+
export type Module = Type;
|
|
8
|
+
/**
|
|
9
|
+
* Represents a provider that can be registered in a module.
|
|
10
|
+
*
|
|
11
|
+
* A provider can be:
|
|
12
|
+
* - A class decorated with @Injectable()
|
|
13
|
+
* - A ClassProvider (provides a different class than the token)
|
|
14
|
+
* - A ValueProvider (provides a static value)
|
|
15
|
+
* - A FactoryProvider (provides a value from a factory function)
|
|
16
|
+
*
|
|
17
|
+
* @template T - The type of value the provider creates
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Class provider (shorthand)
|
|
22
|
+
* @NsModule({
|
|
23
|
+
* providers: [UserService]
|
|
24
|
+
* })
|
|
25
|
+
*
|
|
26
|
+
* // ClassProvider (explicit)
|
|
27
|
+
* @NsModule({
|
|
28
|
+
* providers: [
|
|
29
|
+
* { provide: UserService, useClass: MockUserService }
|
|
30
|
+
* ]
|
|
31
|
+
* })
|
|
32
|
+
*
|
|
33
|
+
* // ValueProvider
|
|
34
|
+
* @NsModule({
|
|
35
|
+
* providers: [
|
|
36
|
+
* { provide: 'CONFIG', useValue: { apiUrl: 'https://api.example.com' } }
|
|
37
|
+
* ]
|
|
38
|
+
* })
|
|
39
|
+
*
|
|
40
|
+
* // FactoryProvider
|
|
41
|
+
* @NsModule({
|
|
42
|
+
* providers: [
|
|
43
|
+
* {
|
|
44
|
+
* provide: 'DATABASE',
|
|
45
|
+
* useFactory: (config: Config) => createDatabase(config),
|
|
46
|
+
* inject: ['CONFIG']
|
|
47
|
+
* }
|
|
48
|
+
* ]
|
|
49
|
+
* })
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export type Provider<T = any> = ClassProvider<T> | ValueProvider<T> | FactoryProvider<T> | Type<T>;
|
|
53
|
+
/**
|
|
54
|
+
* Provides a class instance, potentially different from the injection token.
|
|
55
|
+
*
|
|
56
|
+
* Use this when you want to:
|
|
57
|
+
* - Provide a mock or alternative implementation
|
|
58
|
+
* - Use a different class than the token
|
|
59
|
+
* - Override a provider in a specific module
|
|
60
|
+
*
|
|
61
|
+
* @template T - The type of instance to create
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* @NsModule({
|
|
66
|
+
* providers: [
|
|
67
|
+
* // Provide MockUserService when UserService is requested
|
|
68
|
+
* {
|
|
69
|
+
* provide: UserService,
|
|
70
|
+
* useClass: MockUserService,
|
|
71
|
+
* scope: Scope.Singleton
|
|
72
|
+
* }
|
|
73
|
+
* ]
|
|
74
|
+
* })
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export interface ClassProvider<T = any> {
|
|
78
|
+
/** The injection token to register this provider under */
|
|
79
|
+
provide: InjectionToken;
|
|
80
|
+
/** The class to instantiate */
|
|
81
|
+
useClass: Type<T>;
|
|
82
|
+
/** The lifecycle scope (default: Singleton) */
|
|
83
|
+
scope?: Scope;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Provides a static value.
|
|
87
|
+
*
|
|
88
|
+
* Use this for:
|
|
89
|
+
* - Configuration objects
|
|
90
|
+
* - Constants
|
|
91
|
+
* - Pre-created instances
|
|
92
|
+
* - Primitive values (including null and undefined)
|
|
93
|
+
*
|
|
94
|
+
* Value providers are always singleton scope.
|
|
95
|
+
*
|
|
96
|
+
* @template T - The type of value to provide
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* @NsModule({
|
|
101
|
+
* providers: [
|
|
102
|
+
* { provide: 'API_URL', useValue: 'https://api.example.com' },
|
|
103
|
+
* { provide: 'MAX_RETRIES', useValue: 3 },
|
|
104
|
+
* { provide: 'CONFIG', useValue: { debug: true } },
|
|
105
|
+
* { provide: 'OPTIONAL_VALUE', useValue: null }
|
|
106
|
+
* ]
|
|
107
|
+
* })
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
export interface ValueProvider<T = any> {
|
|
111
|
+
/** The injection token to register this provider under */
|
|
112
|
+
provide: InjectionToken;
|
|
113
|
+
/** The value to provide */
|
|
114
|
+
useValue: T;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Provides a value created by a factory function.
|
|
118
|
+
*
|
|
119
|
+
* Use this when:
|
|
120
|
+
* - The value requires complex initialization logic
|
|
121
|
+
* - The value depends on other providers
|
|
122
|
+
* - You need to create the value dynamically
|
|
123
|
+
* - You want to return a Promise for async initialization
|
|
124
|
+
*
|
|
125
|
+
* @template T - The type of value the factory creates
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* @NsModule({
|
|
130
|
+
* providers: [
|
|
131
|
+
* {
|
|
132
|
+
* provide: 'DATABASE',
|
|
133
|
+
* useFactory: async (config: Config) => {
|
|
134
|
+
* const db = await createConnection(config.dbUrl);
|
|
135
|
+
* await db.migrate();
|
|
136
|
+
* return db;
|
|
137
|
+
* },
|
|
138
|
+
* inject: ['CONFIG'],
|
|
139
|
+
* scope: Scope.Singleton
|
|
140
|
+
* },
|
|
141
|
+
* {
|
|
142
|
+
* provide: 'LOGGER',
|
|
143
|
+
* useFactory: () => createLogger({ level: 'info' })
|
|
144
|
+
* }
|
|
145
|
+
* ]
|
|
146
|
+
* })
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
export interface FactoryProvider<T = any> {
|
|
150
|
+
/** The injection token to register this provider under */
|
|
151
|
+
provide: InjectionToken;
|
|
152
|
+
/** The factory function that creates the value */
|
|
153
|
+
useFactory: (...args: any[]) => T | Promise<T>;
|
|
154
|
+
/** Tokens of dependencies to inject into the factory function */
|
|
155
|
+
inject?: InjectionToken[];
|
|
156
|
+
/** The lifecycle scope (default: Singleton) */
|
|
157
|
+
scope?: Scope;
|
|
158
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ContainerBaseInterface } from "@nexus-ioc/shared";
|
|
2
|
+
import type { Module } from "../module-types.interface";
|
|
3
|
+
import type { ModuleGraphInterface } from "./module-graph.interface";
|
|
4
|
+
export type { ContainerBaseInterface } from "@nexus-ioc/shared";
|
|
5
|
+
export interface ContainerInterface extends ContainerBaseInterface {
|
|
6
|
+
run(rootModule: Module): Promise<void>;
|
|
7
|
+
graph: ModuleGraphInterface;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ModuleContainerInterface } from "@nexus-ioc/shared";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { GraphError } from "@nexus-ioc/shared";
|
|
1
2
|
import type { AnalyzeModule } from "../../core/graph/analyze-module";
|
|
2
3
|
import type { AnalyzeProvider } from "../../core/graph/analyze-provider";
|
|
3
4
|
import type { InjectionToken } from "../injection-token.interface";
|
|
5
|
+
export type { GraphError } from "@nexus-ioc/shared";
|
|
4
6
|
export declare enum NodeTypeEnum {
|
|
5
7
|
MODULE = "module",
|
|
6
8
|
PROVIDER = "provider"
|
|
@@ -25,31 +27,9 @@ export type Edge = {
|
|
|
25
27
|
unreached?: boolean;
|
|
26
28
|
};
|
|
27
29
|
};
|
|
28
|
-
export type GraphError = {
|
|
29
|
-
type: "CD_IMPORTS";
|
|
30
|
-
path: string[];
|
|
31
|
-
} | {
|
|
32
|
-
type: "CD_PROVIDERS";
|
|
33
|
-
path: [InjectionToken, InjectionToken][];
|
|
34
|
-
} | {
|
|
35
|
-
type: "UNREACHED_DEP_CONSTRUCTOR";
|
|
36
|
-
token: string;
|
|
37
|
-
dependency: string;
|
|
38
|
-
position: number;
|
|
39
|
-
} | {
|
|
40
|
-
type: "UNREACHED_DEP_PROPERTY";
|
|
41
|
-
token: string;
|
|
42
|
-
dependency: string;
|
|
43
|
-
key: string;
|
|
44
|
-
} | {
|
|
45
|
-
type: "UNREACHED_DEP_FACTORY";
|
|
46
|
-
token: string;
|
|
47
|
-
dependency: string;
|
|
48
|
-
key: number;
|
|
49
|
-
};
|
|
50
30
|
export interface ModuleGraphInterface {
|
|
51
31
|
compile(): Promise<void>;
|
|
52
|
-
getNode(token: InjectionToken): Node;
|
|
32
|
+
getNode(token: InjectionToken): Node | undefined;
|
|
53
33
|
getEdge(token: InjectionToken): Edge[];
|
|
54
34
|
getAllNodes(): Node[];
|
|
55
35
|
getAllEdges(): Edge[][];
|
|
@@ -4,5 +4,7 @@ import type { ModulePluginInterface } from "./plugins";
|
|
|
4
4
|
export interface NexusApplicationInterface extends ModulePluginInterface {
|
|
5
5
|
bootstrap(): Promise<this>;
|
|
6
6
|
get<T>(token: InjectionToken): Promise<T | undefined>;
|
|
7
|
+
setParent(parentContainer: NexusApplicationInterface): this;
|
|
8
|
+
async(): this;
|
|
7
9
|
errors: GraphError[];
|
|
8
10
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lifecycle hook interface for module initialization.
|
|
3
|
+
*
|
|
4
|
+
* Implement this interface to execute custom logic when a provider is initialized.
|
|
5
|
+
* The `onModuleInit()` method is called after the provider instance is created
|
|
6
|
+
* and all its dependencies are injected.
|
|
7
|
+
*
|
|
8
|
+
* This is useful for:
|
|
9
|
+
* - Establishing database connections
|
|
10
|
+
* - Loading configuration
|
|
11
|
+
* - Initializing caches
|
|
12
|
+
* - Setting up event listeners
|
|
13
|
+
* - Any other initialization logic
|
|
14
|
+
*
|
|
15
|
+
* The method can be synchronous or asynchronous. If it returns a Promise,
|
|
16
|
+
* the container will wait for it to resolve before considering the provider
|
|
17
|
+
* fully initialized.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* @Injectable()
|
|
22
|
+
* class DatabaseService implements OnModuleInit {
|
|
23
|
+
* private connection: Connection;
|
|
24
|
+
*
|
|
25
|
+
* async onModuleInit() {
|
|
26
|
+
* // Called after DatabaseService is instantiated
|
|
27
|
+
* this.connection = await createConnection({
|
|
28
|
+
* host: 'localhost',
|
|
29
|
+
* database: 'myapp'
|
|
30
|
+
* });
|
|
31
|
+
* console.log('Database connected');
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* @Injectable()
|
|
36
|
+
* class CacheService implements OnModuleInit {
|
|
37
|
+
* onModuleInit() {
|
|
38
|
+
* // Synchronous initialization
|
|
39
|
+
* this.warmUpCache();
|
|
40
|
+
* }
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export interface OnModuleInit {
|
|
45
|
+
/**
|
|
46
|
+
* Called after the provider is instantiated and dependencies are injected.
|
|
47
|
+
*
|
|
48
|
+
* @returns void or a Promise that resolves when initialization is complete
|
|
49
|
+
*/
|
|
50
|
+
onModuleInit(): void | Promise<void>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the lifecycle scope of a provider.
|
|
3
|
+
*
|
|
4
|
+
* The scope determines how instances are created and cached:
|
|
5
|
+
*
|
|
6
|
+
* - **Singleton**: One instance is created and shared across the entire application.
|
|
7
|
+
* The instance is cached globally and reused for all requests.
|
|
8
|
+
*
|
|
9
|
+
* - **Request**: A new instance is created for each `container.get()` call, but
|
|
10
|
+
* the same instance is reused within that call's dependency tree. This is useful
|
|
11
|
+
* for request-scoped data in web applications.
|
|
12
|
+
*
|
|
13
|
+
* - **Transient**: A new instance is created every time the provider is injected,
|
|
14
|
+
* even within the same dependency tree. No caching is performed.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Singleton - shared across the application
|
|
19
|
+
* @Injectable({ scope: Scope.Singleton })
|
|
20
|
+
* class DatabaseConnection {
|
|
21
|
+
* // Only one instance exists
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* // Request - new instance per request
|
|
25
|
+
* @Injectable({ scope: Scope.Request })
|
|
26
|
+
* class RequestContext {
|
|
27
|
+
* requestId = Math.random();
|
|
28
|
+
* // Different requestId for each container.get() call
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* // Transient - new instance every time
|
|
32
|
+
* @Injectable({ scope: Scope.Transient })
|
|
33
|
+
* class Logger {
|
|
34
|
+
* timestamp = Date.now();
|
|
35
|
+
* // Different timestamp for each injection
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare enum Scope {
|
|
40
|
+
/**
|
|
41
|
+
* Singleton scope - one instance shared across the entire application.
|
|
42
|
+
* This is the default scope.
|
|
43
|
+
*/
|
|
44
|
+
Singleton = 0,
|
|
45
|
+
/**
|
|
46
|
+
* Request scope - new instance for each container.get() call,
|
|
47
|
+
* but shared within that call's dependency tree.
|
|
48
|
+
*/
|
|
49
|
+
Request = 1,
|
|
50
|
+
/**
|
|
51
|
+
* Transient scope - new instance every time, no caching.
|
|
52
|
+
*/
|
|
53
|
+
Transient = 2
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { HashUtilInterface } from "@nexus-ioc/shared";
|
|
@@ -3,5 +3,5 @@ export declare const MODULE_METADATA: {
|
|
|
3
3
|
PROVIDERS: string;
|
|
4
4
|
EXPORTS: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const INVALID_MODULE_CONFIG_MESSAGE: (
|
|
6
|
+
export declare const INVALID_MODULE_CONFIG_MESSAGE: (_text: TemplateStringsArray, property: string) => string;
|
|
7
7
|
export declare function validateModuleKeys(keys: string[]): void;
|
package/package.json
CHANGED
|
@@ -1,62 +1,85 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
2
|
+
"name": "@nexus-ioc/core",
|
|
3
|
+
"version": "0.6.1",
|
|
4
|
+
"description": "A powerful IoC container for TypeScript applications",
|
|
5
|
+
"author": "Isqanderm <aleksandr.melnik.personal@gmail.com> (https://www.linkedin.com/in/isqander-melnik)",
|
|
6
|
+
"homepage": "https://github.com/Isqanderm/ioc#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Isqanderm/ioc.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/Isqanderm/ioc/issues"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"IoC",
|
|
16
|
+
"dependency injection",
|
|
17
|
+
"inversion control",
|
|
18
|
+
"typescript",
|
|
19
|
+
"DI",
|
|
20
|
+
"framework",
|
|
21
|
+
"container"
|
|
22
|
+
],
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public",
|
|
25
|
+
"provenance": true
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"package.json",
|
|
30
|
+
"LICENSE",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
33
|
+
"main": "./dist/cjs/index.js",
|
|
34
|
+
"module": "./dist/esm/index.js",
|
|
35
|
+
"types": "./dist/types/index.d.ts",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"import": {
|
|
39
|
+
"types": "./dist/types/index.d.ts",
|
|
40
|
+
"default": "./dist/esm/index.js"
|
|
41
|
+
},
|
|
42
|
+
"require": {
|
|
43
|
+
"types": "./dist/types/index.d.ts",
|
|
44
|
+
"default": "./dist/cjs/index.js"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"sideEffects": false,
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"reflect-metadata": "^0.1.12 || ^0.2.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@nexus-ioc/testing": "^0.6.1",
|
|
55
|
+
"@types/node": "^24.8.1",
|
|
56
|
+
"@vitest/coverage-v8": "^3.0.0",
|
|
57
|
+
"reflect-metadata": "^0.1.12 || ^0.2.0",
|
|
58
|
+
"sinon": "^21.0.0",
|
|
59
|
+
"typescript": "^5.9.3",
|
|
60
|
+
"vite": "^7.0.0",
|
|
61
|
+
"vitest": "^3.0.0"
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"@nexus-ioc/shared": "^0.6.1",
|
|
65
|
+
"tslib": "^2.6.3"
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "npm run build:cjs && npm run build:esm",
|
|
69
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
70
|
+
"build:esm": "tsc -p tsconfig.esm.json && node ../../scripts/fix-esm-imports.js dist/esm && echo '{\"type\":\"module\"}' > dist/esm/package.json",
|
|
71
|
+
"test": "vitest run",
|
|
72
|
+
"clean": "rm -rf ./dist && rm -f tsconfig*.tsbuildinfo",
|
|
73
|
+
"test:watch": "vitest",
|
|
74
|
+
"test:ui": "vitest --ui",
|
|
75
|
+
"test:coverage": "vitest run --coverage",
|
|
76
|
+
"test:memory": "vitest run --config vitest.memory.config.mts",
|
|
77
|
+
"code:format": "npx @biomejs/biome format --write",
|
|
78
|
+
"code:lint": "npx @biomejs/biome lint --write",
|
|
79
|
+
"code:check": "npx @biomejs/biome check",
|
|
80
|
+
"code:check:ci": "npx @biomejs/biome ci",
|
|
81
|
+
"code:check:apply": "npx @biomejs/biome check --write",
|
|
82
|
+
"test:ready": "echo 0"
|
|
83
|
+
},
|
|
84
|
+
"gitHead": "26c6fd169d8a091ed4f362ba789c58d10f03c6d8"
|
|
62
85
|
}
|
package/dist/browser.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":";;;AAAA,gFAA6E;AAApE,sIAAA,wBAAwB,OAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyze-module.js","sourceRoot":"","sources":["../../../src/core/graph/analyze-module.ts"],"names":[],"mappings":";;;AAAA,iDAI0B;AAC1B,iDAAsE;AAEtE,MAAa,aAAa;IAQzB,YAA6B,OAAiC;QAAjC,YAAO,GAAP,OAAO,CAA0B;QAP7C,eAAU,GAAG,IAAA,yBAAe,EAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACpD,cAAS,GAAG,IAAA,yBAAe,EAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;YAClE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM;YAC9B,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;QACR,WAAM,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QAC5B,WAAM,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAEmB,CAAC;IAElE,IAAW,IAAI;QACd,OAAO,yBAAY,CA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AAY,6CAAoB,CAAC;AAC/C,CAAC;AAED,SAAgB,wBAAwB,CACvC,MAAuB;IAEvB,OAAO,MAAM,YAAY,iDAAsB,CAAC;AACjD,CAAC;AAED,SAAgB,yBAAyB,CACxC,MAAuB;IAEvB,OAAO,MAAM,YAAY,mDAAuB,CAAC;AAClD,CAAC;AAED,SAAgB,sBAAsB,CACrC,MAAuB;IAEvB,OAAO,MAAM,YAAY,6CAAoB,CAAC;AAC/C,CAAC"}
|