Skip to content

Semver-aware dependency resolution for plugins #1982

@bpamiri

Description

@bpamiri

Summary

The current dependency system ($determineDependency()) only checks whether a named plugin is loaded — it cannot express version constraints. A plugin declaring dependency="authenticateThis" succeeds even if the loaded version is incompatible.

Current Behavior

// Plugins.cfc ~line 198-213
// Checks: does a plugin with this name exist in the loaded plugins struct?
// No version comparison whatsoever

Proposed Behavior

Declaration (in plugin.json)

{
  "dependencies": {
    "authenticateThis": ">=1.0.0 <2.0.0",
    "wheels-utils": "^3.0.0"
  }
}

Resolution

  • Parse semver constraints from plugin.json dependencies
  • Compare against the version reported by each loaded plugin
  • On constraint mismatch:
    • Development: throw an error with clear message ("Plugin X requires authenticateThis >=1.0.0 but 0.9.2 is loaded")
    • Production: log a warning
  • Plugins without plugin.json fall back to existing presence-only check

Semver Support

Standard semver operators: >=, <=, >, <, =, ^ (compatible), ~ (patch-level). Implement a lightweight semver comparison utility (or use existing CFML library if available).

Files

Phase

Phase 2 — DI Integration & Lifecycle (3.x, backward compatible)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions