Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-71882

Grunt babel should replace names of modules

XMLWordPrintable

    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE
    • MDL-71882-master
    • Hide
      1. Run grunt babel:dist
        1. Confirm that there were no changes in built files

          git status
          

      2. Run grunt watch in a window
      3. Unzip the attached 71882.zip into the lib/amd/src directory
        1. Confirm that the new files were built by grunt watch
        2. Confirm that the output included the following lines:

          Replacing module name 'arl-test1' with core/test1
          Replacing module name 'arl-test2' with core/test2
          

        3. Confirm that the output did not include any other warnings about core/test3 or core/test4*
      4. In your browser open the Browser Developer tools -> Console, and run:

        require(['core/test5'])
        

        1. Confirm that the following output was shown:

          arl-test1 loaded
          arl-test2 loaded
          arl-test4 loaded
          arl-test4 loaded
          

      Show
      Run grunt babel:dist Confirm that there were no changes in built files git status Run grunt watch in a window Unzip the attached 71882.zip into the lib/amd/src directory Confirm that the new files were built by grunt watch Confirm that the output included the following lines : Replacing module name 'arl-test1' with core/test1 Replacing module name 'arl-test2' with core/test2 Confirm that the output did not include any other warnings about core/test3 or core/test4* In your browser open the Browser Developer tools -> Console, and run: require(['core/test5']) Confirm that the following output was shown : arl-test1 loaded arl-test2 loaded arl-test4 loaded arl-test4 loaded

      If a third-party JS module is included and it already has a named define, then we should replace that name rather than trying to add to it (which we currently do).

      The signature for the define call is:

           define = function (name, deps, callback) {
      

      https://github.com/requirejs/requirejs/blob/master/require.js#L2061

      We can easily replace any provided name with the calculated one. We know it will always be a String if provided (it's optional). We already perform AST translations so this should be trivial.

        1. 71882.zip
          1 kB
        2. MDL-71882_Step 1.png
          MDL-71882_Step 1.png
          31 kB
        3. MDL-71882_Step 3.png
          MDL-71882_Step 3.png
          173 kB
        4. MDL-71882_Step 4_manual.png
          MDL-71882_Step 4_manual.png
          121 kB
        5. MDL-71882 step 4.png
          MDL-71882 step 4.png
          41 kB

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Simey Lameze Simey Lameze
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Angelia Dela Cruz Angelia Dela Cruz
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 9 minutes
                2h 9m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.