Merge branch 'MDL-66192-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Eloy Lafuente (stronk7)
2019-08-01 00:22:14 +02:00
6 changed files with 25 additions and 14 deletions
+1 -1
View File
@@ -204,7 +204,7 @@
}
},
{
files: ["**/amd/src/*.js"],
files: ["**/amd/src/*.js", "**/amd/src/**/*.js"],
// We support es6 now. Woot!
env: {
es6: true
+8 -1
View File
@@ -64,7 +64,14 @@ module.exports = function(grunt) {
var inAMD = path.basename(cwd) == 'amd';
// Globbing pattern for matching all AMD JS source files.
var amdSrc = [inAMD ? cwd + '/src/*.js' : '**/amd/src/*.js'];
var amdSrc = [];
if (inAMD) {
amdSrc.push(cwd + "/src/*.js");
amdSrc.push(cwd + "/src/**/*.js");
} else {
amdSrc.push("**/amd/src/*.js");
amdSrc.push("**/amd/src/**/*.js");
}
/**
* Function to generate the destination for the uglify task
+5 -2
View File
@@ -114,11 +114,14 @@ class core_requirejs {
// Skip it - RecursiveDirectoryIterator fatals if the directory is not readable as an iterator.
continue;
}
$items = new RecursiveDirectoryIterator($srcdir);
$srcdir = realpath($srcdir);
$directory = new RecursiveDirectoryIterator($srcdir);
$items = new RecursiveIteratorIterator($directory);
foreach ($items as $item) {
$extension = $item->getExtension();
if ($extension === 'js') {
$filename = str_replace('.min', '', $item->getBaseName('.js'));
$filename = substr($item->getRealpath(), strlen($srcdir) + 1);
$filename = str_replace('.min', '', $filename);
// We skip lazy loaded modules unless specifically requested.
if ($includelazy || strpos($filename, '-lazy') === false) {
$modulename = $component . '/' . $filename;
-5
View File
@@ -44,11 +44,6 @@ $file = '/' . min_clean_param($file, 'SAFEPATH');
// Only load js files from the js modules folder from the components.
[$unused, $component, $module] = explode('/', $file, 3);
// No subdirs allowed - only flat module structure please.
if (strpos('/', $module) !== false) {
die('Invalid module');
}
// When running a lazy load, we only deal with one file so we can just return the working sourcemap.
$jsfiles = core_requirejs::find_one_amd_module($component, $module, false);
$jsfile = reset($jsfiles);
-5
View File
@@ -52,11 +52,6 @@ $file = '/' . min_clean_param($file, 'SAFEPATH');
$jsfiles = array();
list($unused, $component, $module) = explode('/', $file, 3);
// No subdirs allowed - only flat module structure please.
if (strpos('/', $module) !== false) {
die('Invalid module');
}
// Use the caching only for meaningful revision numbers which prevents future cache poisoning.
if ($rev > 0 and $rev < (time() + 60 * 60)) {
// This is "production mode".
+11
View File
@@ -26,6 +26,17 @@ information provided here is intended especially for developers.
are now public. If you are overriding these then you will need to change your methods to public in your class.
* $CFG->httpswwwroot has been removed. It is no longer necessary as loginhttps has already been removed and it's no longer being
used anywhere in core.
* It is now possible to use sub-directories for AMD modules.
The standard rules for Level 2 namespaces also apply to AMD modules.
The sub-directory used must be either an valid component, or placed inside a 'local' directory to ensure that it does not conflict with other components.
The following are all valid module names and locations in your plugin:
mod_forum/view: mod/forum/amd/src/view.js
mod_forum/local/views/post: mod/forum/amd/src/local/views/post
mod_forum/form/checkbox-toggle: mod/forum/amd/src/form/checkbox-toggle.js
The following are all invalid module names and locations in your plugin:
mod_forum/views/post: mod/forum/amd/src/views/post
=== 3.7 ===