Uploaded image for project: 'Alfresco One Platform'
  1. Alfresco One Platform
  2. ACE-2722

Clean, extensible import API for JavaScript resources

    Details

      Description

      Currently, script imports are handled by a preprocessor directive placed at the top of JavaScript files / content. Constituent scripts are merged into one only at runtime. Import resolution only allows for classpath and simple XPath expressions. This is limiting in the fact that

      a) scripts with import directives are syntactically invalid and thus prevent support by JavaScript capable IDEs
      b) no script can be imported dynamically, e.g. as the result of some evaluation
      c) breakpoints for debugging can not be set / specified prior to the merging process, e.g. not before the script has been executed at least once

      I propose the following changes to provide a JavaScript-based import API. This API additionally enables extensibility on the Repository side through a pluggable locator registry.

      Some background information to the motivation for this improvement is available at my blog (http://axel-faust.de/?p=75&lang=en as well as http://axel-faust.de/?p=47&lang=en)

        Attachments

          Activity

          Hide
          p_bodnar Petr Bodnár added a comment -

          @Axel, I'm sorry but what exact problem do you have? Anyway, the appropriate fix should have been committed already, to quote David Webster:

          I've fixed this according to Kev's suggestion (HBF r92569); it's now possible to precede the <import tag with "//" to allow the .js files to be parsed as valid JavaScript.

          BTW My original suggestion (see above) was to better precede the tag with "//+" for example so your argument of inadvertently importing a file which you don't want wouldn't have the right weight

          Show
          p_bodnar Petr Bodnár added a comment - @Axel, I'm sorry but what exact problem do you have? Anyway, the appropriate fix should have been committed already, to quote David Webster: I've fixed this according to Kev's suggestion (HBF r92569 ); it's now possible to precede the <import tag with "//" to allow the .js files to be parsed as valid JavaScript. BTW My original suggestion (see above) was to better precede the tag with "// + " for example so your argument of inadvertently importing a file which you don't want wouldn't have the right weight
          Hide
          twerner Torsten Werner added a comment -

          I cannot access the site the r92569 is linking to. What exactly was committed there? Is it part of Alfresco enterprise 5.0.1?

          Show
          twerner Torsten Werner added a comment - I cannot access the site the r92569 is linking to. What exactly was committed there? Is it part of Alfresco enterprise 5.0.1?
          Hide
          p_bodnar Petr Bodnár added a comment -

          Yeah, good question, only god knows probably...

          Show
          p_bodnar Petr Bodnár added a comment - Yeah, good question, only god knows probably...
          Hide
          mrogers Mark Rogers [X] (Inactive) added a comment -

          No it was not Enterprise, it was to a development branch, HEAD-BUG-FIX.

          It was merged to HEAD last January. revision #94891

          Show
          mrogers Mark Rogers [X] (Inactive) added a comment - No it was not Enterprise, it was to a development branch, HEAD-BUG-FIX. It was merged to HEAD last January. revision #94891
          Hide
          afaust Axel Faust added a comment -

          Ok - the confusion may be due to the fact that there are two distinct implementation of ScriptResourceHelper in Alfresco - one in Surf and one on Repository tier. The Surf one has been fixed and the change is in both 5.0.d and 5.0.1. The Repository tier one has not been changed / adapted.

          Show
          afaust Axel Faust added a comment - Ok - the confusion may be due to the fact that there are two distinct implementation of ScriptResourceHelper in Alfresco - one in Surf and one on Repository tier. The Surf one has been fixed and the change is in both 5.0.d and 5.0.1. The Repository tier one has not been changed / adapted.

            People

            • Assignee:
              uiteam Web Apps
              Reporter:
              mrogers Mark Rogers [X] (Inactive)
            • Votes:
              15 Vote for this issue
              Watchers:
              24 Start watching this issue

              Dates

              • Created:
                Updated: