Interface JSModule
- All Superinterfaces:
JSBundleAsset,JSBundleObject,JSResolvableBundleAsset
JSBundle.
JSModules belong to a JSPackage and JSPackages belong
to a JSBundle.
You can have several copies of the same JSModule in different
modules of the portal. For example, suppose you have a module named
p@1.0.0/m (the module m residing in package
p with version 1.0.0) containing three OSGi bundles:
b1.jar, b2.jar, and b3.jar. In this
scenario, you would have three JS modules in the NPMRegistry (one per
bundle) and one JS resolved module (depending on the algorithm used, points
to one of the three JS modules). The JS module is served to the browser using
its JS resolved module (i.e., a virtual entity passed to the browser to avoid
using any of the other three JS modules).
The modules would look something like this:
Modules:-
b1.jar:p@1.0.0/mwith URL.../b1.jar/p@1.0.0/m -
b2.jar:p@1.0.0/mwith URL.../b2.jar/p@1.0.0/m -
b3.jar:p@1.0.0/mwith URL.../b3.jar/p@1.0.0/m
-
p@1.0.0/mwith URL.../p@1.0.0/m
The URL of the resolved module does not show any reference to a bundle. Also,
when the resolved module is requested, it's internally resolved to one of the
other three modules. Therefore, the requester would receive something like
.../b2.jar/p@1.0.0/m, but wouldn't notice it since it's
transparent to the requester.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the module dependencies declared by the NPM module.Returns the packages that contain all the NPM module's dependencies.com.liferay.portal.kernel.json.JSONObjectGet the metadata that describe the module.Returns the module's NPM package.Returns the module's source map.Methods inherited from interface com.liferay.frontend.js.loader.modules.extender.npm.JSBundleAsset
getInputStream, getURLMethods inherited from interface com.liferay.frontend.js.loader.modules.extender.npm.JSBundleObject
getId, getNameMethods inherited from interface com.liferay.frontend.js.loader.modules.extender.npm.JSResolvableBundleAsset
getResolvedId, getResolvedURL
-
Method Details
-
getDependencies
Collection<String> getDependencies()Returns the module dependencies declared by the NPM module.- Returns:
- the module names
-
getDependencyPackageNames
Collection<String> getDependencyPackageNames()Returns the packages that contain all the NPM module's dependencies.- Returns:
- the NPM package names
-
getFlagsJSONObject
com.liferay.portal.kernel.json.JSONObject getFlagsJSONObject()Get the metadata that describe the module. -
getJSPackage
JSPackage getJSPackage()Returns the module's NPM package.- Returns:
- the NPM package
-
getSourceMapInputStream
Returns the module's source map.- Returns:
- an
InputStreamthat allows reading the bytes inside the source map - Throws:
IOException- if an IO exception occurred
-