This is an automated email from the ASF dual-hosted git repository. thiagohp pushed a commit to branch feature/coffeescript-to-typescript in repository https://gitbox.apache.org/repos/asf/tapestry-5.git
commit 233fac5fc481be99a9cd82e5148f610bcb56e51e Author: Thiago H. de Paula Figueiredo <[email protected]> AuthorDate: Sun Jun 8 18:01:51 2025 -0300 TAP5-2804: renaming Require.js-enabling configuration symbol --- 5_10_RELEASE_NOTES.md | 2 +- .../src/main/java/org/apache/tapestry5/SymbolConstants.java | 10 ++++++---- .../services/javascript/ConfigureHTMLElementFilter.java | 10 +++++----- .../java/org/apache/tapestry5/modules/JavaScriptModule.java | 1 + .../java/org/apache/tapestry5/modules/TapestryModule.java | 1 - .../org/apache/tapestry5/integration/app1/AjaxTests.java | 12 ++++++++++++ .../apache/tapestry5/integration/app1/components/Border.tml | 9 +++++++++ 7 files changed, 34 insertions(+), 11 deletions(-) diff --git a/5_10_RELEASE_NOTES.md b/5_10_RELEASE_NOTES.md index 8bb02a0a8..d62d92163 100644 --- a/5_10_RELEASE_NOTES.md +++ b/5_10_RELEASE_NOTES.md @@ -2,7 +2,7 @@ Scratch pad for changes destined for the 5.10.0 release notes page. # Added configuration symbols -* `tapestry.es-modules-enabled`(`SymbolConstants.ES_MODULES_ENABLED`) +* `tapestry.require-js-enabled`(`SymbolConstants.REQUIRE_JS_ENABLED`) (default value: `code`false). # Added methods diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java b/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java index f9d16f875..9a5c845b0 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java @@ -811,12 +811,14 @@ public class SymbolConstants public static final String COMPONENT_DEPENDENCY_FILE = "tapestry.component-dependency-file"; /** - * Defines whether ES modules will be used, being managed by the browser. - * If not, Require.js will be used to manage AMD modules. Default value: - * {@code false} (i.e. AMD modules and Require.js). + * Defines whether Require.js will be used to manage AMD modules. + * This also causes Tapestry to use the Require.js/AMD versions of + * its own JavaScript files. When disabled, Require.js will not be included + * and the ES6 module version of its own JavaScript files will be used instead. + * Default value: {@code true}). * * @since 5.10.0 */ - public static final String ES_MODULES_ENABLED = "tapestry.es-modules-enabled"; + public static final String REQUIRE_JS_ENABLED = "tapestry.require-js-enabled"; } diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/ConfigureHTMLElementFilter.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/ConfigureHTMLElementFilter.java index c5008d087..53a9b36fe 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/ConfigureHTMLElementFilter.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/javascript/ConfigureHTMLElementFilter.java @@ -35,17 +35,17 @@ public class ConfigureHTMLElementFilter implements MarkupRendererFilter private final boolean debugEnabled; - private final String esModulesEnabled; + private final String requireJsEnabled; public ConfigureHTMLElementFilter(ThreadLocale threadLocale, @Symbol(TapestryHttpSymbolConstants.PRODUCTION_MODE) boolean productionMode, - @Symbol(SymbolConstants.ES_MODULES_ENABLED) - boolean esModulesEnabled) + @Symbol(SymbolConstants.REQUIRE_JS_ENABLED) + boolean requireJsEnabled) { this.threadLocale = threadLocale; this.debugEnabled = !productionMode; - this.esModulesEnabled = String.valueOf(esModulesEnabled); + this.requireJsEnabled = String.valueOf(requireJsEnabled); } public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) @@ -61,7 +61,7 @@ public class ConfigureHTMLElementFilter implements MarkupRendererFilter if (html != null) { html.attributes("data-locale", threadLocale.getLocale().toString(), - "data-es-modules-enabled", esModulesEnabled); + "data-require-js-enabled", requireJsEnabled); if (debugEnabled) { diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/modules/JavaScriptModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/modules/JavaScriptModule.java index d1a20145f..8c2c53401 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/modules/JavaScriptModule.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/modules/JavaScriptModule.java @@ -494,6 +494,7 @@ public class JavaScriptModule { configuration.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, "prototype"); configuration.add(SymbolConstants.MODULE_PATH_PREFIX, "modules"); + configuration.add(SymbolConstants.REQUIRE_JS_ENABLED, "true"); } @Contribute(ModuleManager.class) diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java index a3f42084d..73a69419e 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java @@ -2213,7 +2213,6 @@ public final class TapestryModule configuration.add(SymbolConstants.OPENAPI_DESCRIPTION_PATH, "/openapi.json"); configuration.add(SymbolConstants.OPENAPI_BASE_PATH, "/"); - configuration.add(SymbolConstants.ES_MODULES_ENABLED, "false"); } /** diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java index d26df0e60..ad9e1ae20 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java @@ -12,6 +12,7 @@ package org.apache.tapestry5.integration.app1; +import org.apache.tapestry5.SymbolConstants; import org.testng.annotations.Test; /** @@ -331,6 +332,17 @@ public class AjaxTests extends App1TestCase // // An ugly way of giving time for all the AJAX requests to finish // // without adding more JavaScript for that. // Thread.sleep(3000); + + } + + @Test + public void verify_configuration_symbols() + { + open("/"); + assertEquals(getText("tapestry-javascript-infrastructure-provider-value"), + System.getProperty(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, "(none set)")); + assertEquals(getText("require-js-enabled-value"), + System.getProperty(SymbolConstants.REQUIRE_JS_ENABLED, "(none set)")); } } diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml index 93bb9820a..32210e97f 100644 --- a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml +++ b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml @@ -51,6 +51,15 @@ <hr/> + <h2>Settings</h2> + + <dl> + <dt>JavaScript infrastructure provider</dt> + <dd id="tapestry-javascript-infrastructure-provider-value">${symbol:tapestry.javascript-infrastructure-provider}</dd> + <dt>Require.js enabled</dt> + <dd id="require-js-enabled-value">${symbol:tapestry.require-js-enabled}</dd> + </dl> + <h2>JVM</h2> <p> ${jvm}
