mirror of
https://github.com/moodle/moodle.git
synced 2025-07-25 00:02:18 +02:00
Unfortunately the babel minify-mangle plugin seems to be abandoned and in certain circumstances can be very buggy. The only safe options are to disable it, or to switch to a different minification library. Not minifying our javascript is not ideal, so this commit updates the javascript tasks to use a rollup, combined with babel, and terser. Babel still converts code from ES/UMD/AMD to AMD modules with the relevant browser support, whilst terser minifies the code. The rollup bundler handles tracking and creation of sourcemaps, and supports better parallelisation of the tasks. Since the upgrade to Node LTS/Gallium requires an upgrade to @babel/core and eslint, which change the built files anyway, this seems like the ideal time to make this change.
11 lines
1.3 KiB
JavaScript
11 lines
1.3 KiB
JavaScript
/**
|
|
* URL utility functions.
|
|
*
|
|
* @module core/url
|
|
* @copyright 2015 Damyon Wiese <damyon@moodle.com>
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
* @since 2.9
|
|
*/
|
|
define("core/url",["jquery","core/config"],(function($,config){return{fileUrl:function(relativeScript,slashArg){var url=config.wwwroot+relativeScript;return"/"!=slashArg.charAt(0)&&(slashArg="/"+slashArg),config.slasharguments?url+=slashArg:url+="?file="+encodeURIComponent(slashArg),url},relativeUrl:function(relativePath,params,includeSessKey){if(0===relativePath.indexOf("http:")||0===relativePath.indexOf("https:")||relativePath.indexOf("://")>=0)throw new Error("relativeUrl function does not accept absolute urls");"/"!=relativePath.charAt(0)&&(relativePath="/"+relativePath),"admin"!==config.admin&&(relativePath=relativePath.replace(/^\/admin\//,"/"+config.admin+"/")),params=params||{},includeSessKey&&(params.sesskey=config.sesskey);var queryString="";return Object.keys(params).length&&(queryString=$.map(params,(function(value,param){return param+"="+value})).join("&")),""!==queryString?config.wwwroot+relativePath+"?"+queryString:config.wwwroot+relativePath},imageUrl:function(imagename,component){return M.util.image_url(imagename,component)}}}));
|
|
|
|
//# sourceMappingURL=url.min.js.map
|