Read-only mining codemod that scans AngularJS JavaScript source for dependency-injection
annotation styles and emits a di_pattern metric for migration assessment, including
minification-safety classification. It never modifies files โ every match is reported via codemod:metrics and the transform always returns null.
What it detects
di_style
Example
Minification safe
array
['$http', function ($http) {}]
yes
inject_property
Foo.$inject = ['$http'];
yes
inline
.service('Foo', function ($http) {}) โ anonymous function passed directly to a registration call
no
implicit
function Foo($http) {} referenced by name in a registration call, with no $inject annotation anywhere
no
inline and implicit both rely on parameter names for injection, so they break once a
minifier renames those parameters โ flagged as the primary automation targets before a
production build pipeline is minified.
# Install from registry
codemod run angularjs-di-patterns
# Or run locally
codemod run -w workflow.yaml
Development
bash
# Test the transformation
pnpm test
# Validate the workflow
codemod workflow validate -w workflow.yaml
# Publish to registry
codemod login
codemod publish
License
MIT
Ready to evolve your codebase?
Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.