Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function writeCSSExportLoaderModule(webContextPath, moduleName) {
const link = document.createElement('link');
link.setAttribute('rel','stylesheet');
link.setAttribute('type','text/css');
link.setAttribute('href', Liferay.ThemeDisplay.getPathContext() + '/o${webContextPath}/__liferay__/css/${flatModuleName}');
link.setAttribute('href', Liferay.ThemeDisplay.getCDNHost() + Liferay.ThemeDisplay.getPathContext() + '/o${webContextPath}/__liferay__/css/${flatModuleName}');
if (Liferay.CSP) {
link.setAttribute('nonce', Liferay.CSP.nonce);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css');
link.setAttribute(
'href',
Liferay.ThemeDisplay.getPathContext() +
Liferay.ThemeDisplay.getCDNHost() + Liferay.ThemeDisplay.getPathContext() +
'/o${projectWebContextPath}/${cssBaseURI}' +
(document.dir === 'rtl' ? '_rtl' : '') +
'.(${hash}).css'
Expand Down
2 changes: 1 addition & 1 deletion modules/_node-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"node-scripts": "./bin.js"
},
"com.liferay": {
"sha256": "fbebf438625ff2f33ad75492887f910ce2df345f6af33d52a4676028af6a7b0d"
"sha256": "68f9517db28b323afdb49e1d1c42db014e6f99487c1609389bc4155aeaa1cd2a"
},
"dependencies": {
"@babel/preset-env": "7.24.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependencies {
compileOnly project(":apps:list-type:list-type-api")
compileOnly project(":apps:map:map-api")
compileOnly project(":apps:object:object-api")
compileOnly project(":apps:portal-url-builder:portal-url-builder-api")
compileOnly project(":apps:static:osgi:osgi-util")
compileOnly project(":apps:trash:trash-api")
compileOnly project(":core:osgi-service-tracker-collections")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,52 @@

package com.liferay.dynamic.data.mapping.form.field.type.internal.frontend.js.importmaps.extender;

import com.liferay.frontend.js.importmaps.extender.JSImportMapsContributor;
import com.liferay.portal.kernel.json.JSONFactory;
import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.frontend.js.importmaps.extender.DynamicJSImportMapsContributor;
import com.liferay.petra.string.StringPool;
import com.liferay.portal.url.builder.AbsolutePortalURLBuilder;
import com.liferay.portal.url.builder.AbsolutePortalURLBuilderFactory;
import com.liferay.portal.url.builder.ESModuleAbsolutePortalURLBuilder;

import jakarta.servlet.ServletContext;
import jakarta.servlet.http.HttpServletRequest;

import java.io.IOException;
import java.io.Writer;

import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

/**
* @author Álvaro Leal
*/
@Component(service = JSImportMapsContributor.class)
@Component(service = DynamicJSImportMapsContributor.class)
public class DynamicDataMappingFormFieldTypeJSImportMapsContributor
implements JSImportMapsContributor {
implements DynamicJSImportMapsContributor {

@Override
public JSONObject getImportMapsJSONObject() {
return _importMapsJSONObject;
public void writeGlobalImports(
HttpServletRequest httpServletRequest, Writer writer)
throws IOException {

AbsolutePortalURLBuilder absolutePortalURLBuilder =
_absolutePortalURLBuilderFactory.getAbsolutePortalURLBuilder(
httpServletRequest);

ESModuleAbsolutePortalURLBuilder esModuleAbsolutePortalURLBuilder =
absolutePortalURLBuilder.forESModule(
"dynamic-data-mapping-form-field-type", "api.js");

writer.write(
"\"@liferay/dynamic-data-mapping-form-field-type/api\" : \"");
writer.write(esModuleAbsolutePortalURLBuilder.build());
writer.write(StringPool.QUOTE);
}

@Activate
protected void activate() {
_importMapsJSONObject = _jsonFactory.createJSONObject();

_importMapsJSONObject.put(
"@liferay/dynamic-data-mapping-form-field-type/api",
_servletContext.getContextPath() + "/__liferay__/api.js");
@Override
public void writeScopedImports(
HttpServletRequest httpServletRequest, Writer writer) {
}

private JSONObject _importMapsJSONObject;

@Reference
private JSONFactory _jsonFactory;

@Reference(
target = "(osgi.web.symbolicname=com.liferay.dynamic.data.mapping.form.field.type)"
)
private ServletContext _servletContext;
private AbsolutePortalURLBuilderFactory _absolutePortalURLBuilderFactory;

}
1 change: 1 addition & 0 deletions modules/apps/fragment/fragment-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies {
compileOnly project(":apps:layout:layout-taglib")
compileOnly project(":apps:portal-configuration:portal-configuration-module-configuration-api")
compileOnly project(":apps:portal-template:portal-template-react-renderer-api")
compileOnly project(":apps:portal-url-builder:portal-url-builder-api")
compileOnly project(":apps:portal:portal-instance-lifecycle-api")
compileOnly project(":apps:ratings:ratings-taglib")
compileOnly project(":apps:saved-content:saved-content-taglib")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,50 @@

package com.liferay.fragment.internal.js.importmaps.extender;

import com.liferay.frontend.js.importmaps.extender.JSImportMapsContributor;
import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.json.JSONUtil;
import com.liferay.frontend.js.importmaps.extender.DynamicJSImportMapsContributor;
import com.liferay.petra.string.StringPool;
import com.liferay.portal.url.builder.AbsolutePortalURLBuilder;
import com.liferay.portal.url.builder.AbsolutePortalURLBuilderFactory;
import com.liferay.portal.url.builder.ESModuleAbsolutePortalURLBuilder;

import jakarta.servlet.ServletContext;
import jakarta.servlet.http.HttpServletRequest;

import java.io.IOException;
import java.io.Writer;

import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

/**
* @author Víctor Galán
*/
@Component(service = JSImportMapsContributor.class)
@Component(service = DynamicJSImportMapsContributor.class)
public class FragmentImplJSImportMapsContributor
implements JSImportMapsContributor {
implements DynamicJSImportMapsContributor {

@Override
public JSONObject getImportMapsJSONObject() {
return _importMapsJSONObject;
}
public void writeGlobalImports(
HttpServletRequest httpServletRequest, Writer writer)
throws IOException {

AbsolutePortalURLBuilder absolutePortalURLBuilder =
_absolutePortalURLBuilderFactory.getAbsolutePortalURLBuilder(
httpServletRequest);

@Activate
protected void activate() {
_importMapsJSONObject = JSONUtil.put(
"@liferay/fragment-impl/api",
_servletContext.getContextPath() + "/__liferay__/api.js");
ESModuleAbsolutePortalURLBuilder esModuleAbsolutePortalURLBuilder =
absolutePortalURLBuilder.forESModule("fragment-impl", "api.js");

writer.write("\"@liferay/fragment-impl/api\" : \"");
writer.write(esModuleAbsolutePortalURLBuilder.build());
writer.write(StringPool.QUOTE);
}

private JSONObject _importMapsJSONObject;
@Override
public void writeScopedImports(
HttpServletRequest httpServletRequest, Writer writer) {
}

@Reference(
target = "(osgi.web.symbolicname=com.liferay.fragment.impl)",
unbind = "-"
)
private ServletContext _servletContext;
@Reference
private AbsolutePortalURLBuilderFactory _absolutePortalURLBuilderFactory;

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,59 @@

package com.liferay.frontend.js.dependencies.web.internal.js.importmaps.extender;

import com.liferay.frontend.js.importmaps.extender.JSImportMapsContributor;
import com.liferay.portal.kernel.json.JSONFactory;
import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.frontend.js.importmaps.extender.DynamicJSImportMapsContributor;
import com.liferay.petra.string.StringPool;
import com.liferay.portal.url.builder.AbsolutePortalURLBuilder;
import com.liferay.portal.url.builder.AbsolutePortalURLBuilderFactory;
import com.liferay.portal.url.builder.ESModuleAbsolutePortalURLBuilder;

import jakarta.servlet.ServletContext;
import jakarta.servlet.http.HttpServletRequest;

import java.io.IOException;
import java.io.Writer;

import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

/**
* @author Iván Zaera Avellón
*/
@Component(service = JSImportMapsContributor.class)
@Component(service = DynamicJSImportMapsContributor.class)
public class FrontendJSDependenciesWebJSImportMapsContributor
implements JSImportMapsContributor {
implements DynamicJSImportMapsContributor {

@Override
public JSONObject getImportMapsJSONObject() {
return _importMapsJSONObject;
}
public void writeGlobalImports(
HttpServletRequest httpServletRequest, Writer writer)
throws IOException {

AbsolutePortalURLBuilder absolutePortalURLBuilder =
_absolutePortalURLBuilderFactory.getAbsolutePortalURLBuilder(
httpServletRequest);

ESModuleAbsolutePortalURLBuilder esModuleAbsolutePortalURLBuilder =
absolutePortalURLBuilder.forESModule(
"frontend-js-dependencies-web", "exports/@liferay$js-api.js");

writer.write("\"@liferay/frontend-js-api\" : \"");
writer.write(esModuleAbsolutePortalURLBuilder.build());
writer.write("\",");

@Activate
protected void activate() {
_importMapsJSONObject = _jsonFactory.createJSONObject();

_importMapsJSONObject.put(
"@liferay/frontend-js-api",
_servletContext.getContextPath() +
"/__liferay__/exports/@liferay$js-api.js"
).put(
"@liferay/frontend-js-api/data-set",
_servletContext.getContextPath() +
"/__liferay__/exports/@liferay$js-api$data-set.js"
);
esModuleAbsolutePortalURLBuilder = absolutePortalURLBuilder.forESModule(
"frontend-js-dependencies-web",
"exports/@liferay$js-api$data-set.js");

writer.write("\"@liferay/frontend-js-api/data-set\" : \"");
writer.write(esModuleAbsolutePortalURLBuilder.build());
writer.write(StringPool.QUOTE);
}

private JSONObject _importMapsJSONObject;
@Override
public void writeScopedImports(
HttpServletRequest httpServletRequest, Writer writer) {
}

@Reference
private JSONFactory _jsonFactory;

@Reference(
target = "(osgi.web.symbolicname=com.liferay.frontend.js.dependencies.web)",
unbind = "-"
)
private ServletContext _servletContext;
private AbsolutePortalURLBuilderFactory _absolutePortalURLBuilderFactory;

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dependencies {
compileOnly group: "org.osgi", name: "org.osgi.service.cm", version: "1.6.0"
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations", version: "1.4.0"
compileOnly project(":apps:frontend-js:frontend-js-importmaps-extender-api")
compileOnly project(":apps:portal-url-builder:portal-url-builder-api")
compileOnly project(":core:petra:petra-function")
compileOnly project(":core:petra:petra-string")
}
Loading