}
},
{
- files: ["**/amd/src/*.js"],
+ files: ["**/amd/src/*.js", "**/amd/src/**/*.js"],
// We support es6 now. Woot!
env: {
es6: true
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
// 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;
// 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);
$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".
at least a single checkbox item is selected or not.
* Final deprecation (removal) of the core/modal_confirm dialogue.
* Upgrade scssphp to v1.0.2, This involves renaming classes from Leafo => ScssPhp as the repo has changed.
+* 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 ===