acs-aem-commons icon indicating copy to clipboard operation
acs-aem-commons copied to clipboard

Versioned Client Libs: Async-loaded JS/CSS calls are not getting a hash appended

Open henrykuijpers opened this issue 2 years ago • 1 comments

Required Information

  • [x] AEM Version, including Service Packs, Cumulative Fix Packs, etc: 6.5.12
  • [x] ACS AEM Commons Version: 5.2.0
  • [x] Reproducible on Latest? yes

Expected Behavior

<script>
GraniteClientLibraryManager.write([{"p":"/etc.clientlibs/clientlibs/granite/jquery.min.1234567890.js","c":[]},{"p":"/etc.clientlibs/clientlibs/granite/utils.min.1234567890.js","c":[]},{"p":"/etc.clientlibs/clientlibs/granite/jquery/granite.min.1234567890.js","c":[]},{"p":"/etc.clientlibs/foundation/clientlibs/jquery.min.1234567890.js","c":[]},{"p":"/etc.clientlibs/foundation/clientlibs/shared.min.1234567890.js","c":[]},{"p":"/etc.clientlibs/clientlibs/social/thirdparty/underscore.min.1234567890.js","c":[]},...],false);
</script>

(With hash)

Actual Behavior

<script>
GraniteClientLibraryManager.write([{"p":"/etc.clientlibs/clientlibs/granite/jquery.min.js","c":[]},{"p":"/etc.clientlibs/clientlibs/granite/utils.min.js","c":[]},{"p":"/etc.clientlibs/clientlibs/granite/jquery/granite.min.js","c":[]},{"p":"/etc.clientlibs/foundation/clientlibs/jquery.min.js","c":[]},{"p":"/etc.clientlibs/foundation/clientlibs/shared.min.js","c":[]},{"p":"/etc.clientlibs/clientlibs/social/thirdparty/underscore.min.js","c":[]},...],false);
</script>

(Without hash)

Steps to Reproduce

  1. Install AEM
  2. Install AEM service pack
  3. Install latest ACS AEM Commons
  4. Enable versioned clientlibs transformer factory
  5. Notice that all clientlibs (in view-source:) are being hashed, except for the ones in GraniteClientLibraryManager.write()
  6. Notice that the values that are passed to GraniteClientLibraryManager.write() are translated 1:1 to script/link tags

Links

henrykuijpers avatar Apr 06 '22 14:04 henrykuijpers

@henrykuijpers Versioned Clientlibs uses a Sling Rewriter Transformer Factory to update the URL's w/ the checksums. These URLs are in JavaScript itself, so im not sure this is really feasible (even if we could, it sounds like a bad idea to try to start parsing JS and updating it).

Reminder me what writes out that GraniteClientLibraryManager.write() JS?

davidjgonzalez avatar Apr 08 '22 21:04 davidjgonzalez