royale-asjs icon indicating copy to clipboard operation
royale-asjs copied to clipboard

COMPILE::JS - @externs - error stopped working

Open sanjeev-rajput opened this issue 8 months ago • 7 comments

this option is very useful and was working fine till yesterday but now it is stopped working. this also not working on below URL which was working fine earlier.

https://royale.apache.org/blog/using-external-javascript-libraries-in-apache-royale/

win - 11 edge - Version 135.0.3179.73 (Official build) (64-bit)

sanjeev-rajput avatar Apr 18 '25 13:04 sanjeev-rajput

I investigated it little more and turn out that issue is with

/** * @externs */ COMPILE::JS

it works fine if we attach script tag manually in html template and access it with var hljs:Object = window["hljs"]; hljs"highlightBlock";

sanjeev-rajput avatar Apr 19 '25 03:04 sanjeev-rajput

Hi, what's not working for you exactly? I actively use @externs in my projects and it works fine. Is it only happening with Edge?

mjesteve avatar Apr 19 '25 11:04 mjesteve

please visit apache royale online demo and click "HIGHLIGHT BLOCK" button. Here is link for same https://royale.apache.org/blog-examples/BE0012_Using_external_javascript_libraries_in_Apache_Royale/index.html

earlier it was working fine but now it not working on Firefox and edge

sanjeev-rajput avatar Apr 19 '25 12:04 sanjeev-rajput

Ok. I understood it wasn't working for you in "your project." This error is related to the general change in Apache servers (they only allow access to local resources). I'll review it when I can. In any case, this shouldn't affect your projects.

mjesteve avatar Apr 19 '25 12:04 mjesteve

understood apache royale server online link behavior

But it is a very unexpected behavior I am face in my recent project and after lots of investigation this is what i found

// ------------ this works fine------------------------- /* * @externs * */ COMPILE::JS

// ------------ this doesn't work ------------------------- /** * @externs * */ COMPILE::JS

difference is comments start with one (/*) and with two (/**)

please correct me if some guideline is mentioned on this somewhere

sanjeev-rajput avatar Apr 20 '25 03:04 sanjeev-rajput

For me the correct one is:

/**
 * @externs
 */

And in the example you mention it is correct. ([BE0012_Using_external_javascript_libraries_in_Apache_Royale)

mjesteve avatar Apr 22 '25 11:04 mjesteve

this also not working on below URL which was working fine earlier. https://royale.apache.org/blog/using-external-javascript-libraries-in-apache-royale/

please visit apache royale online demo and click "HIGHLIGHT BLOCK" button. Here is link for same https://royale.apache.org/blog-examples/BE0012_Using_external_javascript_libraries_in_Apache_Royale/index.html earlier it was working fine but now it not working on Firefox and edge

The BE0012_Using_external_javascript_libraries_in_Apache_Royale is now fixed on the Apache Royale website. There were some changes necessary to comply with additional security restrictions imposed on all of Apache's web servers. Basically, we were no longer allowed to load .js and .css files from external URLs (in this case, we couldn't load the highlight.min.js and atom-one-dark.min.css files from cdnjs.cloudflare.com). However, that's a restriction specific to our servers, and anyone else's projects are not affected by this restriction, unless someone at your organization coincidentally added similar restrictions at the same time (which seems unlikely).

You'll notice that, after the changes, the hljs.as file still contains the following:

/**
 * @externs
 */
COMPILE::JS

What was removed from the hljs.as file was the <inject_script> section. However, that doesn't mean that everyone needs to stop using<inject_script>. This feature still exists, it should still work the same, and we are not planning to remove it. In this example, we simply switched to using the new -js-include-script and -js-include-css compiler options, which allowed us to use local copies of the .js and .css files instead of loading them from cdnjs.cloudflare.com.

@sanjeev-rajput If you continue to have issues in your own project, and you'd like some help fixing them, then please share some code with us. Ideally, create a simplified project that demonstrates your issue in isolation. Thank you!

joshtynjala avatar May 13 '25 15:05 joshtynjala

Closing because BE0012_Using_external_javascript_libraries_in_Apache_Royale is now working correctly.

joshtynjala avatar Aug 28 '25 16:08 joshtynjala