BREAKING CHANGE: Consumers must use ESM-compatible environments.
All import paths now include .js extensions.
CommonJS (require) is no longer supported.
* refactor: consolidate registration decorators
- Introduced `Register` decorator to handle class and instance registration in the DI container.
- Deprecated `RegisterInstance` in favor of `Register`, which now internally handles instance registration.
- Added support for marking dependencies as deprecated with a warning logged upon first resolution.
- Updated documentation with examples and notes on deprecation.
* tests: add mode parameter to RegisterInstanceDecorator
- Introduced a `mode` parameter to the `test_RegisterInstanceDecorator` function allowing 'instance' or 'standalone' modes.
- Updated test cases to utilize the new `mode` parameter when registering an instance.
- Disabled specific ESLint rule in `Decorators.test.ts` for deprecation warnings.
- Added an additional test call to `test_RegisterInstanceDecorator` with 'instance' mode.
* docs: Reflect changes to changelog
* refactor: add region tags for overloads in Register.ts
* docs: Reflect changes to changelog
* refactor: consolidate registration decorators
- Introduced `Register` decorator to handle class and instance registration in the DI container.
- Deprecated `RegisterInstance` in favor of `Register`, which now internally handles instance registration.
- Added support for marking dependencies as deprecated with a warning logged upon first resolution.
- Updated documentation with examples and notes on deprecation.
* tests: add mode parameter to RegisterInstanceDecorator
- Introduced a `mode` parameter to the `test_RegisterInstanceDecorator` function allowing 'instance' or 'standalone' modes.
- Updated test cases to utilize the new `mode` parameter when registering an instance.
- Disabled specific ESLint rule in `Decorators.test.ts` for deprecation warnings.
- Added an additional test call to `test_RegisterInstanceDecorator` with 'instance' mode.
* docs: Reflect changes to changelog
* refactor: add region tags for overloads in Register.ts
* docs: Reflect changes to changelog
* docs: Reflect changes to changelog und push version
- Import additional exception classes from `src/interfaces/Exceptions`
- Modify `Inject` function to:
- Accept `init` parameter as a function or `true` for instantiation
- Throw specific errors: `DependencyResolutionError`, `InjectorError`, `NoInstantiationMethodError`
- Ensure necessary dependencies are handled properly
- Define property with `Object.defineProperty` for performance
- Add `hasConstructor` helper function to check if an object has a constructor
- Added `InjectorError` class for handling injector errors
- Added `NoInstantiationMethodError` class for missing instantiation methods
- Both classes extend `TSinjexError` and provide detailed error messages
- Import `Identifier` from `src/types/Identifier`
- Change `identifier` parameter type in `DependencyResolutionError` constructor from `string` to `Identifier`
- Update error message to call `identifier.toString()`
Unified the import paths of the 'Identifier' type across multiple files to ensure consistency. The 'Identifier' type is now imported from '../types/Identifier' instead of 'src/types/Identifier'. This change reduces ambiguity and aligns the import pattern throughout the codebase.
Increased coverage thresholds to 90% across all metrics. Added exclusions for `.spec.ts` and `.test.ts` files to the coverage configuration. Introduced new test files for `Decorators` and `Functions`, incorporating detailed unit tests for decorators and DI functionalities. Removed outdated and redundant test files, consolidating their functionality into the updated tests. Also added new npm script for jest watch mode. Marked helper and main index files to be ignored by the coverage.
Updated the lazy initialization logic to ensure the instance is created only once by moving the instance variable outside of the proxy handlers. This addresses potential redundant instance creation and improves efficiency and consistency in DI container operations.
- Moved `TSinjex` class to `classes` directory for better organization.
- Updated imports across the codebase to reflect the new location of `TSinjex`.
- Introduced `Identifier` type to standardize dependency identifiers.
- Enhanced JSDoc comments for improved clarity and consistency.
- Adjusted error messages for `DependencyResolutionError` to provide clearer information.
- Updated and expanded decorator and function types to use `Identifier` type.
Upgraded the package version to 0.0.9. Introduced Typedoc for generating documentation with added script in package.json. Enhanced exception handling by introducing `DependencyResolutionError`. Refined TSinjex comments and README structure for better readability. Updated index file exports for better module organization.
Updated package version to 0.0.7 to reflect new changes. Added export statements for `InitDelegate` and `GenericConstructor` types, enhancing type availability for package users.
Renamed all instances of 'TSInjex' to 'TSinjex' for consistency across the codebase, including interfaces, classes, and test files. Updated the version in `package.json` from 0.0.5 to 0.0.6. Added Jest setup example to the `README.md` to guide developers on initial configuration for testing.
Changed the relative import path in `register.ts` for better module resolution and incremented the package version to 0.0.4 to reflect the updated changes.
Renamed functions files to follow consistent camelCase convention. Added a missing type export for ITSInjex interface in the main index file, enabling better TypeScript type support and ensuring interfaces are available for external modules.
Upgraded package version from 0.0.1 to 0.0.2 to reflect new functionality. Added exports for `resolve` and `register` functions to extend the library capabilities.
- Renamed DIContainer class and related references to TSInjex to better indicate its purpose as a TypeScript-based dependency injection container.
- Extracted IDependency interface to a separate file to improve modularity.
- Split the ITSInjex interface into ITSInjexRegister and ITSInjexResolve, then extended them in a new ITSInjex interface to clarify the separation of concerns.
- Updated tests and decorators to reflect the renaming and interface changes.
- Adjusted helper, functions, and index export to align with the new TSInjex structure.