-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Environment and versions used
Current javascript modules version
Steps to reproduce
Definitions declared in js modules are not part of the Provide-Capability
Definitions used in js modules are not part of the Require-Capability
Current Behavior
When definitions from a JS module (here user-password-authentication-ui ) is used in a java module, the java module fail to start because the nodetype requirement is not fulfilled, here the error at startup:
Unable to resolve dx-jelastic-template [175](R 175.4): missing requirement [dx-jelastic-template [175](R 175.4)] com.jahia.services.content; (nodetypes=upaui:authentication) Unresolved requirements: [[dx-jelastic-template [175](R 175.4)] com.jahia.services.content; (nodetypes=upaui:authentication)]
This comes from user-password-authentication-ui module OSGi transformation generates the following capabilities that does not contain nodetypes
Provide-Capability com.jahia.modules.dependencies;moduleIdentifier="UPA - UI (javascript module)";moduleVersion:Version=0.1.0.SNAPSHOT
com.jahia.modules.dependencies;moduleIdentifier="user-password-authentication-ui";moduleVersion:Version=0.1.0.SNAPSHOT
Require-Capability com.jahia.modules.dependencies;filter:="(moduleIdentifier=default)"
com.jahia.modules.dependencies;filter:="(moduleIdentifier=javascript-modules-engine)"
com.jahia.modules.dependencies;filter:="(moduleIdentifier=user-password-authentication-api)"
com.jahia.server;filter:="(&(version>=8.2)(!(version>=9)))"
Desired Behavior
the nodetypes should be part of the capabilities
Require-Capability com.jahia.modules.dependencies;filter:="(moduleIdentifier=default)"
com.jahia.modules.dependencies;filter:="(moduleIdentifier=javascript-modules-engine)"
com.jahia.modules.dependencies;filter:="(moduleIdentifier=user-password-authentication-api)"
com.jahia.services.content;filter:="(nodetypes=upauimix:component)"
com.jahia.services.content;filter:="(nodetypes=jnt:content)"
com.jahia.services.content;filter:="(nodetypes=jmix:image)"
..
com.jahia.server;filter:="(&(version>=8.2)(!(version>=9)))"
Provide-Capability com.jahia.modules.dependencies;moduleIdentifier="UPA - UI (javascript module)";moduleVersion:Version=0.1.0.SNAPSHOT
com.jahia.modules.dependencies;moduleIdentifier="user-password-authentication-ui";moduleVersion:Version=0.1.0.SNAPSHOT
com.jahia.services.content;nodetypes:List<String>="upaui:authentication"
How it works in javascript modules
At the time the js module in registered into jahia, we build a Manifest then use BND to build the OSGi bundle.
We are using BND generated values of Require-Capability and Provide-Capability
How it works with Jahia java modules
The operation is done by maven, when packaging a module by our maven jahia plugin
Provide-Capability
Capabilities are read from the CND file.
Require-Capability
Capabilities are read from xml files and CND files.
Suggested fix
We should have at least the same behavior:
- Nodetypes in required capabilities from export files (xml) and cnd usages
- Nodetupes in provided capabilities from cnd nodetypes declaration
Vite plugin
We can imagine a vite plugin that parse the definitions files and usages to generate the list of nodetypes used and provided by the module
Jahia Runtime
When generating the OSGi Manifest, we can get the nodetypes used and feed the Manifest entries.
My opinion on this
As we currently have all the parsing tools in java, it would be easier to do it at running time than with a vite plugin.