Aalexbit-codemod

angularjs-route-blast-radius

Mine AngularJS route blast radius (components, services, complexity); read-only metrics

miningmetricsangularjscode-miningmigration-assessmentroute_blast_radius
PRO
0 executions
Use dashboard

Run locally

npx codemod angularjs-route-blast-radius

This is a Pro codemod. Preview changes and insights for free, no login or code sharing required. Applying changes and accessing insights requires a paid plan and sign in.Learn more

angularjs-route-blast-radius

Read-only mining codemod that estimates the migration "blast radius" of every ui-router
$stateProvider.state(...) and ngRoute $routeProvider.when(...) registration in a file — how
many downstream artifacts (component, controller, template, resolves, nested/child states) a
given route touches. No files are written to the target repo.

What it detects

  • $stateProvider.state('name', { ... }) and the single-object state({ name: '...', ... })
    form (ui-router), including chained .state(a).state(b).state(c) registrations.
  • $routeProvider.when('/path', { ... }) (ngRoute).
  • Per registration: component, controller, template/templateUrl (including inside a
    views map), and resolve key count.
  • ui-router nested states, detected by dot-separated state names (dashboard.settings), plus
    how many other states in the same file are children of this one (dashboard.settings.*).

Estimated touch points

text
Touch pointsRisk
≤2low
3–5medium
6+high

automation is partial when the route has no resolves and isn't nested (a fairly mechanical
Angular Router mapping), and manual otherwise (resolves and nested state hierarchies usually
require re-architecting, not a 1:1 route conversion). effort_points and recommended_phase
scale with resolve_count and is_nested.

Metrics

MetricCardinalities
route_blast_radiusroute_id, router_type, has_component, has_controller, has_template_url, resolve_count, is_nested, estimated_touch_points, file, line, snippet, migration_category, risk, automation, effort_points, recommended_phase

Limitations

  • File-local: the "child state" count only considers other .state() calls in the same file.
    A large ui-router app that splits state definitions across multiple files will under-count
    nested-state blast radius; combine with angularjs-routing-inventory for a full cross-file
    picture.
  • line/snippet are anchored to the .state/.when token and its arguments rather than the
    whole call expression, because chained calls ($stateProvider.state(a).state(b)) all share the
    same call-expression start position at $stateProvider.
  • component/controller/template detection inside a views map only looks one level deep.

Run

bash

Testing

bash

Development

bash

License

MIT

Ready to contribute?

Build your own codemod and share it with the community.