Component@module DSL support

I love CBWire! :+1: The Module Awareness added in version 3 is great however I also wanted to be able to use the component@moduleName DSL. It looks like this feature was started but when I tried to use it, I got an error that the getModuleComponent() function didn’t exist. This function does exist in CBWireRequest.cfc but not CBWireServcie.cfc. With the new simplified syntax that function as it is does not work. I was able to get it working with some changes to CBWireRequest.cfc. I am sure there is a better way to implement this functionality. Below are the changes I made to allow this while still retaining the Module Awareness functionality. I am still doing further testing to see if I missed any conflicts but so far so good. If feasible I would love to see something like this integrated into a future release.

These changes allow me to use the following from anywhere if the cbwire components are in a folder names the same as the “wiresLocation” used in the coldbox.cfc config for cbWire in the module folder, I.E. myModule/wires/myWireComponent.

#wire( "myWireComponent@myModule" )#

Changes to CBWireRequest.cfc

getRootComponentPath()

function getRootComponentPath( required componentName ) {
	var appMapping = getAppMapping();
	var wireRoot = ( len( appMapping ) ? appMapping & "." : "" ) & getWiresLocation();
	var componentPath = "";
	var currentModule = "";
	if ( find( "@", arguments.componentName ) ) {
		// if using component@module DSL for component
		var thisComponent = listFirst( arguments.componentName, "@" );
		var thisModule = listLast( arguments.componentName, "@" );
		var modulesConfig = variables.controller.getSetting( "modules" );
		componentPath = reFindNoCase( "#appMapping#\.", arguments.componentName ) ? thisComponent : "#wireRoot#.#thisComponent#";
		if ( !modulesConfig.keyExists( thisModule ) ) {
			throw( message = "Could not find #thisModule# module to render wire #componentName#" );
		}
		componentPath = thisModule & "." & componentPath;
	}else{
		// Original functionality
		componentPath = reFindNoCase( "#appMapping#\.", arguments.componentName ) ? arguments.componentName : "#wireRoot#.#arguments.componentName#";
		currentModule = getCurrentRequestModule();
		if ( currentModule.len() && currentModule != "cbwire" ) {
			componentPath = currentModule & "." & componentPath;
		}
	}
	return componentPath;
}

getRootComponentPath()

function getComponentInstance( componentName ){

	return getRootComponent( arguments.componentName );

}