Skip to content

Inversify v7 migration#1368

Merged
sanex3339 merged 1 commit intojavascript-obfuscator:masterfrom
notaphplover:chore/inversify-v7-migration
Apr 27, 2026
Merged

Inversify v7 migration#1368
sanex3339 merged 1 commit intojavascript-obfuscator:masterfrom
notaphplover:chore/inversify-v7-migration

Conversation

@notaphplover
Copy link
Copy Markdown
Contributor

Migrate the dependency injection framework from Inversify v6 to v7. This is a breaking change in the Inversify API that requires updates throughout the codebase.

Key changes:

  • Update inversify dependency from 6.1.4 to 7.11.0
  • Replace interfaces.Bind with ContainerModuleLoadOptions in all container modules
  • Change bind parameter to options in ContainerModule callbacks
  • Update method calls from bind() to options.bind()
  • Replace whenTargetNamed() with whenNamed()
  • Import ContainerModuleLoadOptions instead of interfaces from inversify
  • Add injectFromBase decorator to all injectable classes that extend from base classes
  • Update factory types to use Factory<T, [Args]> and ResolutionContext instead of interfaces.Context
  • Replace interfaces.ServiceIdentifier<T> with ServiceIdentifier<T>
  • Update context.container.getNamed() to context.get() with options object in factory bindings

All container modules, custom code helpers, custom nodes, generators, node transformers, and storage classes have been updated to be compatible with the new Inversify v7 API.

@sanex3339
Copy link
Copy Markdown
Member

Thank you for your effort. I'll think about what to do with this PR, because though great work has been done, the Pro version on Obfuscator.io, which is a fork of the OSS version, also must be in sync with the OSS version in terms of used library versions. But the Pro version is heavily ahead of the OSS version, so i need to apply the migration to Inversify@7 to all new VM-related classes there as well.

So i'll keep the PR open, and most likely merge it somewhere in February.

@sanex3339
Copy link
Copy Markdown
Member

@notaphplover hi, as i manually migrated the Obfuscator.io Pro version to inversify@7.11.0, the OSS version also can be migrated.

Would you mind please syncing the PR with the latest master to ensure all new possible classes are also migrated, then when CI is green i merge the PR

@notaphplover
Copy link
Copy Markdown
Contributor Author

Hey @sanex3339, sure, I'll do it in a couple of days

Migrate the dependency injection framework from Inversify v6 to v7.
This is a breaking change in the Inversify API that requires updates
throughout the codebase.

Key changes:

- Update inversify dependency from 6.1.4 to 7.11.0
- Replace `interfaces.Bind` with `ContainerModuleLoadOptions` in all
  container modules
- Change `bind` parameter to `options` in ContainerModule callbacks
- Update method calls from `bind()` to `options.bind()`
- Replace `whenTargetNamed()` with `whenNamed()`
- Import `ContainerModuleLoadOptions` instead of `interfaces` from inversify
- Add `injectFromBase` decorator to all injectable classes that extend
  from base classes
- Update factory types to use `Factory<T, [Args]>` and `ResolutionContext`
  instead of `interfaces.Context`
- Replace `interfaces.ServiceIdentifier<T>` with `ServiceIdentifier<T>`
- Update `context.container.getNamed()` to `context.get()` with options
  object in factory bindings

All container modules, custom code helpers, custom nodes, generators,
node transformers, and storage classes have been updated to be
compatible with the new Inversify v7 API.
@notaphplover notaphplover force-pushed the chore/inversify-v7-migration branch from 678b81a to f276cf4 Compare April 24, 2026 12:39
@notaphplover
Copy link
Copy Markdown
Contributor Author

@sanex3339 It should be ready now

Copy link
Copy Markdown
Member

@sanex3339 sanex3339 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, thank you!

@sanex3339 sanex3339 merged commit 4ebced3 into javascript-obfuscator:master Apr 27, 2026
12 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants